Author: mrisaliti
Date: Sat Jan 8 21:43:59 2011
New Revision: 1056812
URL: http://svn.apache.org/viewvc?rev=1056812&view=rev
Log:
Internationalization of ServiceUtil.returnSuccess, ServiceUtil.returnFailure,
ServiceUtil.returnError (OFBIZ-4091)
Modified:
ofbiz/trunk/applications/product/config/ProductUiLabels.xml
ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.xml?rev=1056812&r1=1056811&r2=1056812&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.xml Sat Jan 8
21:43:59 2011
@@ -12337,16 +12337,16 @@
<value xml:lang="zh_TW">é¯èª¤ï¼å ´æ</value>
</property>
<property key="ProductErrorFacilityIdNotFound">
- <value xml:lang="de">FEHLER: Einricht mit der ID [${facilityId}] nicht
gefunden</value>
- <value xml:lang="en">ERROR: Facility with ID [${facilityId}] not
found</value>
- <value xml:lang="es">ERROR: Almacén con Código [${facilityId}] no
encontrado</value>
- <value xml:lang="fr">ERREUR: lieu de stockage non trouvé avec la
référence [${facilityId}]</value>
- <value xml:lang="it">ERRORE: Stabilimento con Codice [${facilityId}]
non trovato</value>
- <value xml:lang="ro">EROARE: Compartiment cu Cod [${facilityId}]
negasit</value>
- <value xml:lang="ru">ÐШÐÐÐÐ: ÐбÑÐµÐºÑ Ñ ÐºÐ¾Ð´Ð¾Ð¼
[${facilityId}] не найден</value>
- <value xml:lang="th">ERROR: à¸à¸´à¸à¸à¸¥à¸²à¸ !
à¹à¸¡à¹à¸à¸à¸à¸¥à¸±à¸à¸ªà¸´à¸à¸à¹à¸²à¸à¹à¸§à¸¢à¸£à¸«à¸±à¸ª
[${facilityId}] </value>
- <value xml:lang="zh">éè¯¯ï¼æ²¡ææ¾å°æ è¯ä¸º
[${facilityId}]åºæ</value>
- <value xml:lang="zh_TW">é¯èª¤ï¼æ²ææ¾å°IDçº
[${facilityId}]å ´æ</value>
+ <value xml:lang="de">FEHLER: Einricht mit der ID ${facilityId} nicht
gefunden</value>
+ <value xml:lang="en">ERROR: Facility with ID ${facilityId} not
found</value>
+ <value xml:lang="es">ERROR: Almacén con Código ${facilityId} no
encontrado</value>
+ <value xml:lang="fr">ERREUR: lieu de stockage non trouvé avec la
référence ${facilityId}</value>
+ <value xml:lang="it">ERRORE: Stabilimento con Codice ${facilityId} non
trovato</value>
+ <value xml:lang="ro">EROARE: Compartiment cu Cod ${facilityId}
negasit</value>
+ <value xml:lang="ru">ÐШÐÐÐÐ: ÐбÑÐµÐºÑ Ñ ÐºÐ¾Ð´Ð¾Ð¼
${facilityId} не найден</value>
+ <value xml:lang="th">ERROR: à¸à¸´à¸à¸à¸¥à¸²à¸ !
à¹à¸¡à¹à¸à¸à¸à¸¥à¸±à¸à¸ªà¸´à¸à¸à¹à¸²à¸à¹à¸§à¸¢à¸£à¸«à¸±à¸ª
${facilityId}</value>
+ <value xml:lang="zh">éè¯¯ï¼æ²¡ææ¾å°æ è¯ä¸º ${facilityId}
åºæ</value>
+ <value xml:lang="zh_TW">é¯èª¤ï¼æ²ææ¾å°IDçº ${facilityId}
å ´æ</value>
</property>
<property key="ProductErrorNoFacilityAvailable">
<value xml:lang="de">Fehler: Keine Einrichtung verfügbar</value>
@@ -14529,6 +14529,34 @@
<value xml:lang="zh">åºåæç»</value>
<value xml:lang="zh_TW">庫åæç´°</value>
</property>
+ <property key="ProductInventoryItemATPNotAvailable">
+ <value xml:lang="en">The request transfer amount is not available,
there is no available to promise on the Inventory Item with ID
${inventoryItemId}</value>
+ <value xml:lang="it">La richiesta di trasferimento non è disponibile,
non c'è disponibilità promessa sulla riga inventario
${inventoryItemId}</value>
+ </property>
+ <property key="ProductInventoryItemATPIsNotSufficient">
+ <value xml:lang="en">The request transfer amount is not available, the
available to promise ${atp} is not sufficient for the desired transfer quantity
${xferQty} on the Inventory Item with ID ${inventoryItemId}</value>
+ <value xml:lang="it">La richiesta di trasferimento non è disponibile,
la disponibilità promessa ${atp} non è sufficiente per la quantitÃ
desiderata di trasferimento ${xferQty} sulla riga inventario
${inventoryItemId}</value>
+ </property>
+ <property key="ProductInventoryItemLookupProblem">
+ <value xml:lang="en">Inventory Item/Transfer lookup problem:
${errorString}</value>
+ <value xml:lang="it">Problema nella ricerca della riga di
inventario/trasferimento: ${errorString}</value>
+ </property>
+ <property key="ProductInventoryItemRefreshProblem">
+ <value xml:lang="en">Inventory refresh problem: ${errorString}</value>
+ <value xml:lang="it">Problema durante l'aggiornamento dell'inventario:
${errorString}</value>
+ </property>
+ <property key="ProductInventoryItemStoreProblem">
+ <value xml:lang="en">Inventory item store problem:
${errorString}</value>
+ <value xml:lang="it">Problema registrazione riga di inventario:
${errorString}</value>
+ </property>
+ <property key="ProductInventoryItemTransferNotFound">
+ <value xml:lang="en">Inventory transfer ${inventoryTransferId} not
found</value>
+ <value xml:lang="it">Inventaraio trasferimento ${inventoryTransferId}
non trovato</value>
+ </property>
+ <property key="ProductInventoryItemDetailCreateProblem">
+ <value xml:lang="en">Inventory Item Detail create problem in prepare
inventory transfer: ${errorString}</value>
+ <value xml:lang="it">Problema nella creazione riga inventario
dettaglio in preparazione per il trasferimento di inventario:
${errorString}</value>
+ </property>
<property key="ProductInventoryItemGrandTotals">
<value xml:lang="de">Bestandsposition Haupttotal</value>
<value xml:lang="en">Inventory Item Grand Totals</value>
@@ -14725,6 +14753,10 @@
<value xml:lang="zh">ä¸å¯ç¨</value>
<value xml:lang="zh_TW">ä¸å¯ç¨</value>
</property>
+ <property key="ProductInventoryNotAvailableForFacility">
+ <value xml:lang="en">Could not find inventory for facility
${facilityId}</value>
+ <value xml:lang="it">Non è possibile trovare lo stabilimento
${facilityId}</value>
+ </property>
<property key="ProductInventoryReceive">
<value xml:lang="de">Bestandseingang</value>
<value xml:lang="en">Receive Inventory</value>
@@ -18649,13 +18681,25 @@
<value xml:lang="en">Error calculating VAT tax (with calcTaxForDisplay
service)</value>
<value xml:lang="it">Errore di calcolo delle tasse</value>
</property>
+ <property key="ProductPriceCannotRetrieveInventoryItem">
+ <value xml:lang="en">Problem getting InventoryItem records</value>
+ <value xml:lang="it">Problema nel ricavare InventoryItem
records</value>
+ </property>
<property key="ProductPriceCannotRetrievePriceRules">
<value xml:lang="en">Error getting rules from the database while
calculating price: ${errorString}</value>
<value xml:lang="it">Errore nel ricavare le regole prezzo dal database
durante il calcolo del prezzo: ${errorString}</value>
</property>
<property key="ProductPriceCannotRetrieveProductStore">
<value xml:lang="en">Error getting product store info from the
database while calculating price: ${errorString}</value>
- <value xml:lang="it">Error getting product store info from the
database while calculating price: ${errorString}</value>
+ <value xml:lang="it">Errore nel ricavare il negozio dal database
durant il calcolo del prezzo: ${errorString}</value>
+ </property>
+ <property key="ProductPriceCannotRetrieveRelativeReservation">
+ <value xml:lang="en">Problem getting related reservations</value>
+ <value xml:lang="it">Problema nel ricavare le relative riserve</value>
+ </property>
+ <property key="ProductPriceCannotRetrieveShipmentAndItem">
+ <value xml:lang="en">Problem getting ShipmentAndItem records</value>
+ <value xml:lang="it">Problema nel ricavare ShipmentAndItem
records</value>
</property>
<property key="ProductPriceCannotRetrieveVirtualProductId">
<value xml:lang="en">Error getting virtual product id from the
database while calculating price: ${errorString}</value>
@@ -21760,6 +21804,10 @@
<value xml:lang="zh">æ¾å°äºåºååçåºå</value>
<value xml:lang="zh_TW">æ¾å°äºåºååç庫å</value>
</property>
+ <property key="ProductSerializedInventoryNotAvailable">
+ <value xml:lang="en">Serialized inventory is not available for
transfer.</value>
+ <value xml:lang="it">Inventario serializzato non è disponibile per il
trasferimento.</value>
+ </property>
<property key="ProductSerializedInventorySummary">
<value xml:lang="de">Bestand mit Seriennummern Zusammenfassung</value>
<value xml:lang="en">Serialized Inventory Summary</value>
Modified:
ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java?rev=1056812&r1=1056811&r2=1056812&view=diff
==============================================================================
---
ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
(original)
+++
ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
Sat Jan 8 21:43:59 2011
@@ -23,6 +23,7 @@ import java.math.MathContext;
import java.sql.Timestamp;
import com.ibm.icu.util.Calendar;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
@@ -33,6 +34,7 @@ import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilDateTime;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.GenericEntityException;
@@ -56,7 +58,7 @@ import org.ofbiz.service.ServiceUtil;
public class InventoryServices {
public final static String module = InventoryServices.class.getName();
-
+ public static final String resource = "ProductUiLabels";
public static final MathContext generalRounding = new MathContext(10);
public static Map<String, Object> prepareInventoryTransfer(DispatchContext
dctx, Map<String, ? extends Object> context) {
@@ -66,15 +68,18 @@ public class InventoryServices {
GenericValue inventoryItem = null;
GenericValue newItem = null;
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
try {
inventoryItem = delegator.findByPrimaryKey("InventoryItem",
UtilMisc.toMap("inventoryItemId", inventoryItemId));
} catch (GenericEntityException e) {
- return ServiceUtil.returnError("Inventory item lookup problem [" +
e.getMessage() + "]");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductNotFindInventoryItemWithId", locale) +
inventoryItemId);
}
if (inventoryItem == null) {
- return ServiceUtil.returnError("Cannot locate inventory item.");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductNotFindInventoryItemWithId", locale) +
inventoryItemId);
}
try {
@@ -86,7 +91,9 @@ public class InventoryServices {
BigDecimal qoh =
inventoryItem.getBigDecimal("quantityOnHandTotal");
if (atp == null) {
- return ServiceUtil.returnError("The request transfer
amount is not available, there is no available to promise on the Inventory Item
with ID " + inventoryItem.getString("inventoryItemId"));
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemATPNotAvailable",
+ UtilMisc.toMap("inventoryItemId",
inventoryItem.getString("inventoryItemId")), locale));
}
if (qoh == null) {
qoh = atp;
@@ -94,7 +101,10 @@ public class InventoryServices {
// first make sure we have enough to cover the request
transfer amount
if (xferQty.compareTo(atp) > 0) {
- return ServiceUtil.returnError("The request transfer
amount is not available, the available to promise [" + atp + "] is not
sufficient for the desired transfer quantity [" + xferQty + "] on the Inventory
Item with ID " + inventoryItem.getString("inventoryItemId"));
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemATPIsNotSufficient",
+ UtilMisc.toMap("inventoryItemId",
inventoryItem.getString("inventoryItemId"),
+ "atp", atp, "xferQty", xferQty), locale));
}
/*
@@ -130,21 +140,28 @@ public class InventoryServices {
try {
Map<String, Object> resultNew =
dctx.getDispatcher().runSync("createInventoryItemDetail", createNewDetailMap);
if (ServiceUtil.isError(resultNew)) {
- return ServiceUtil.returnError("Inventory Item
Detail create problem in prepare inventory transfer", null, null, resultNew);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemDetailCreateProblem",
+ UtilMisc.toMap("errorString", ""),
locale), null, null, resultNew);
}
Map<String, Object> resultUpdate =
dctx.getDispatcher().runSync("createInventoryItemDetail",
createUpdateDetailMap);
if (ServiceUtil.isError(resultNew)) {
- return ServiceUtil.returnError("Inventory Item
Detail create problem in prepare inventory transfer", null, null, resultUpdate);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemDetailCreateProblem",
+ UtilMisc.toMap("errorString", ""),
locale), null, null, resultUpdate);
}
} catch (GenericServiceException e1) {
- return ServiceUtil.returnError("Inventory Item Detail
create problem in prepare inventory transfer: [" + e1.getMessage() + "]");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemDetailCreateProblem",
+ UtilMisc.toMap("errorString",
e1.getMessage()), locale));
}
} else {
results.put("inventoryItemId",
inventoryItem.get("inventoryItemId"));
}
} else if (inventoryType.equals("SERIALIZED_INV_ITEM")) {
if
(!"INV_AVAILABLE".equals(inventoryItem.getString("statusId"))) {
- return ServiceUtil.returnError("Serialized inventory is
not available for transfer.");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductSerializedInventoryNotAvailable", locale));
}
}
@@ -162,10 +179,14 @@ public class InventoryServices {
try {
Map<String, Object> result =
dctx.getDispatcher().runSync("createInventoryItemDetail", createDetailMap);
if (ServiceUtil.isError(result)) {
- return ServiceUtil.returnError("Inventory Item
Detail create problem in complete inventory transfer", null, null, result);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemDetailCreateProblem",
+ UtilMisc.toMap("errorString", ""),
locale), null, null, result);
}
} catch (GenericServiceException e1) {
- return ServiceUtil.returnError("Inventory Item Detail
create problem in complete inventory transfer: [" + e1.getMessage() + "]");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemDetailCreateProblem",
+ UtilMisc.toMap("errorString",
e1.getMessage()), locale));
}
}
} else if (inventoryType.equals("SERIALIZED_INV_ITEM")) {
@@ -185,7 +206,9 @@ public class InventoryServices {
return results;
} catch (GenericEntityException e) {
- return ServiceUtil.returnError("Inventory store/create problem ["
+ e.getMessage() + "]");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemStoreProblem",
+ UtilMisc.toMap("errorString", e.getMessage()), locale));
}
}
@@ -197,6 +220,7 @@ public class InventoryServices {
GenericValue inventoryItem = null;
GenericValue destinationFacility = null;
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
try {
inventoryTransfer = delegator.findByPrimaryKey("InventoryTransfer",
@@ -204,11 +228,15 @@ public class InventoryServices {
inventoryItem = inventoryTransfer.getRelatedOne("InventoryItem");
destinationFacility =
inventoryTransfer.getRelatedOne("ToFacility");
} catch (GenericEntityException e) {
- return ServiceUtil.returnError("Inventory Item/Transfer lookup
problem [" + e.getMessage() + "]");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemLookupProblem",
+ UtilMisc.toMap("errorString", e.getMessage()), locale));
}
if (inventoryTransfer == null || inventoryItem == null) {
- return ServiceUtil.returnError("ERROR: Lookup of InventoryTransfer
and/or InventoryItem failed!");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemLookupProblem",
+ UtilMisc.toMap("errorString", ""), locale));
}
String inventoryType = inventoryItem.getString("inventoryItemTypeId");
@@ -231,15 +259,21 @@ public class InventoryServices {
try {
Map<String, Object> result =
dctx.getDispatcher().runSync("createInventoryItemDetail", createDetailMap);
if (ServiceUtil.isError(result)) {
- return ServiceUtil.returnError("Inventory Item Detail
create problem in complete inventory transfer", null, null, result);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemDetailCreateProblem",
+ UtilMisc.toMap("errorString", ""), locale), null,
null, result);
}
} catch (GenericServiceException e1) {
- return ServiceUtil.returnError("Inventory Item Detail create
problem in complete inventory transfer: [" + e1.getMessage() + "]");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemDetailCreateProblem",
+ UtilMisc.toMap("errorString", e1.getMessage()),
locale));
}
try {
inventoryItem.refresh();
} catch (GenericEntityException e) {
- return ServiceUtil.returnError("Inventory refresh problem [" +
e.getMessage() + "]");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemRefreshProblem",
+ UtilMisc.toMap("errorString", e.getMessage()),
locale));
}
}
@@ -268,10 +302,14 @@ public class InventoryServices {
try {
Map<String, Object> result =
dctx.getDispatcher().runSync("updateInventoryItem", updateInventoryItemMap);
if (ServiceUtil.isError(result)) {
- return ServiceUtil.returnError("Inventory item store problem",
null, null, result);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemStoreProblem",
+ UtilMisc.toMap("errorString", ""), locale), null,
null, result);
}
} catch (GenericServiceException exc) {
- return ServiceUtil.returnError("Inventory item store problem [" +
exc.getMessage() + "]");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemStoreProblem",
+ UtilMisc.toMap("errorString", exc.getMessage()), locale));
}
// set the inventory transfer record to complete
@@ -281,7 +319,9 @@ public class InventoryServices {
try {
inventoryTransfer.store();
} catch (GenericEntityException e) {
- return ServiceUtil.returnError("Inventory store problem [" +
e.getMessage() + "]");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemStoreProblem",
+ UtilMisc.toMap("errorString", e.getMessage()), locale));
}
return ServiceUtil.returnSuccess();
@@ -293,20 +333,27 @@ public class InventoryServices {
GenericValue inventoryTransfer = null;
GenericValue inventoryItem = null;
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
try {
inventoryTransfer = delegator.findByPrimaryKey("InventoryTransfer",
UtilMisc.toMap("inventoryTransferId",
inventoryTransferId));
if (UtilValidate.isEmpty(inventoryTransfer)) {
- return ServiceUtil.returnError("Inventory transfer [" +
inventoryTransferId + "] not found");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemTransferNotFound",
+ UtilMisc.toMap("inventoryTransferId",
inventoryTransferId), locale));
}
inventoryItem = inventoryTransfer.getRelatedOne("InventoryItem");
} catch (GenericEntityException e) {
- return ServiceUtil.returnError("Inventory Item/Transfer lookup
problem [" + e.getMessage() + "]");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemLookupProblem",
+ UtilMisc.toMap("errorString", e.getMessage()), locale));
}
if (inventoryTransfer == null || inventoryItem == null) {
- return ServiceUtil.returnError("ERROR: Lookup of InventoryTransfer
and/or InventoryItem failed!");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemLookupProblem",
+ UtilMisc.toMap("errorString", ""), locale));
}
String inventoryType = inventoryItem.getString("inventoryItemTypeId");
@@ -322,10 +369,14 @@ public class InventoryServices {
try {
Map<String, Object> result =
dctx.getDispatcher().runSync("createInventoryItemDetail", createDetailMap);
if (ServiceUtil.isError(result)) {
- return ServiceUtil.returnError("Inventory Item Detail
create problem in cancel inventory transfer", null, null, result);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemDetailCreateProblem",
+ UtilMisc.toMap("errorString", ""), locale), null,
null, result);
}
} catch (GenericServiceException e1) {
- return ServiceUtil.returnError("Inventory Item Detail create
problem in cancel inventory transfer: [" + e1.getMessage() + "]");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemDetailCreateProblem",
+ UtilMisc.toMap("errorString", e1.getMessage()),
locale));
}
} else if (inventoryType.equals("SERIALIZED_INV_ITEM")) {
inventoryItem.set("statusId", "INV_AVAILABLE");
@@ -333,7 +384,9 @@ public class InventoryServices {
try {
inventoryItem.store();
} catch (GenericEntityException e) {
- return ServiceUtil.returnError("Inventory item store problem
in cancel inventory transfer: [" + e.getMessage() + "]");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemStoreProblem",
+ UtilMisc.toMap("errorString", e.getMessage()),
locale));
}
}
@@ -344,7 +397,9 @@ public class InventoryServices {
try {
inventoryTransfer.store();
} catch (GenericEntityException e) {
- return ServiceUtil.returnError("Inventory store problem [" +
e.getMessage() + "]");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryItemStoreProblem",
+ UtilMisc.toMap("errorString", e.getMessage()), locale));
}
return ServiceUtil.returnSuccess();
@@ -355,6 +410,7 @@ public class InventoryServices {
Delegator delegator = dctx.getDelegator();
LocalDispatcher dispatcher = dctx.getDispatcher();
GenericValue userLogin = (GenericValue) context.get("userLogin");
+ Locale locale = (Locale) context.get("locale");
/* TODO: NOTE: This method has been updated, but testing requires many
eyes. See http://jira.undersunconsulting.com/browse/OFBIZ-662
boolean skipThisNeedsUpdating = true;
@@ -374,7 +430,8 @@ public class InventoryServices {
inventoryItems = delegator.findList("InventoryItem", ee, null,
null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Trouble getting inventory items", module);
- return ServiceUtil.returnError("Problem getting InventoryItem
records");
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductPriceCannotRetrieveInventoryItem", locale));
}
if (inventoryItems == null) {
@@ -398,7 +455,8 @@ public class InventoryServices {
shipmentAndItems = delegator.findList("ShipmentAndItem", ecl,
null, UtilMisc.toList("estimatedArrivalDate"), null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Problem getting ShipmentAndItem records",
module);
- return ServiceUtil.returnError("Problem getting
ShipmentAndItem records");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductPriceCannotRetrieveShipmentAndItem", locale));
}
// get the reservations in order of newest first
@@ -407,7 +465,8 @@ public class InventoryServices {
reservations =
inventoryItem.getRelated("OrderItemShipGrpInvRes", null,
UtilMisc.toList("-reservedDatetime"));
} catch (GenericEntityException e) {
Debug.logError(e, "Problem getting related reservations",
module);
- return ServiceUtil.returnError("Problem getting related
reservations");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductPriceCannotRetrieveRelativeReservation",
locale));
}
if (reservations == null) {
@@ -711,6 +770,7 @@ public class InventoryServices {
LocalDispatcher dispatcher = dctx.getDispatcher();
List<GenericValue> orderItems =
UtilGenerics.checkList(context.get("orderItems"));
String facilityId = (String) context.get("facilityId");
+ Locale locale = (Locale) context.get("");
Map<String, BigDecimal> atpMap = FastMap.newInstance();
Map<String, BigDecimal> qohMap = FastMap.newInstance();
Map<String, BigDecimal> mktgPkgAtpMap = FastMap.newInstance();
@@ -726,7 +786,9 @@ public class InventoryServices {
facilities = delegator.findList("Facility", null, null, null,
null, false);
}
} catch (GenericEntityException e) {
- return ServiceUtil.returnError("Unable to locate facilities." +
e.getMessage());
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductErrorFacilityIdNotFound",
+ UtilMisc.toMap("facilityId", facilityId), locale));
}
// loop through all the order items
@@ -740,7 +802,8 @@ public class InventoryServices {
product = orderItem.getRelatedOneCache("Product");
} catch (GenericEntityException e) {
Debug.logError(e, "Couldn't get product.", module);
- return ServiceUtil.returnError("Unable to retrive product with
id [" + productId + "]");
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductProductNotFound", locale) + productId);
}
BigDecimal atp = BigDecimal.ZERO;
@@ -760,9 +823,10 @@ public class InventoryServices {
}
invResult =
dispatcher.runSync("getInventoryAvailableByFacility",
UtilMisc.toMap("productId", productId, "facilityId",
facility.getString("facilityId")));
} catch (GenericServiceException e) {
- String msg = "Could not find inventory for facility [" +
facility.getString("facilityId") + "]";
- Debug.logError(e, msg, module);
- return ServiceUtil.returnError(msg);
+ Debug.logError(e, "Could not find inventory for facility "
+ facility.getString("facilityId"), module);
+ return
ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "ProductInventoryNotAvailableForFacility",
+ UtilMisc.toMap("facilityId",
facility.getString("facilityId")), locale));
}
// add the results for this facility to the ATP/QOH counter
for all facilities