You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2013/11/20 12:02:43 UTC

svn commit: r1543766 - in /ofbiz/trunk/applications/product: servicedef/ src/org/ofbiz/product/inventory/ webapp/facility/WEB-INF/actions/facility/

Author: jleroux
Date: Wed Nov 20 11:02:42 2013
New Revision: 1543766

URL: http://svn.apache.org/r1543766
Log:
A completed patch from Pierre Smits for "Using type=accounting-number in form in facility generates wrong output for inventory overview" https://issues.apache.org/jira/browse/OFBIZ-5335

When using locale DE or NL several quantities (ATP, QOH and others) get transformed wrong.
E.g. a ATP of 250 for a product is 250.00 in locale EN or FR, but for DE and NL the output is 250.000.000,00

jleroux: I completed Pierre's patch in 2 ways:
* used also BigDecimal for minimumStock in getProductInventoryAndFacilitySummary service and groovy script
* Fixed the same kind of issue in  CountFacilityInventoryByProduct.groovy

In by and large i18n contexts, this fixes number of Inventory views and reports, also in Asset Maint and Birt components where those 2 service/groovy scripts are used

Modified:
    ofbiz/trunk/applications/product/servicedef/services_facility.xml
    ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy

Modified: ofbiz/trunk/applications/product/servicedef/services_facility.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_facility.xml?rev=1543766&r1=1543765&r2=1543766&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_facility.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_facility.xml Wed Nov 20 11:02:42 2013
@@ -257,10 +257,10 @@ under the License.
         <attribute name="checkTime" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="facilityId" type="String" mode="IN" optional="false"/>
         <attribute name="productId" type="String" mode="IN" optional="false"/>
-        <attribute name="minimumStock" mode="IN" type="String" optional="true"/>
+        <attribute name="minimumStock" mode="IN" type="BigDecimal" optional="true"/>
         <attribute name="statusId" type="String" mode="IN" optional="true"/>
-        <attribute name="totalQuantityOnHand" mode="OUT" type="String" optional="true"/>
-        <attribute name="totalAvailableToPromise" mode="OUT" type="String" optional="true"/>
+        <attribute name="totalQuantityOnHand" mode="OUT" type="BigDecimal" optional="true"/>
+        <attribute name="totalAvailableToPromise" mode="OUT" type="BigDecimal" optional="true"/>
         <attribute name="quantityOnOrder" mode="OUT" type="BigDecimal" optional="true"/>
         <attribute name="offsetQOHQtyAvailable" mode="OUT" type="BigDecimal" optional="true"/>
         <attribute name="offsetATPQtyAvailable" mode="OUT" type="BigDecimal" optional="true"/>
@@ -818,7 +818,7 @@ under the License.
         <attribute name="partyId" type="String" mode="IN" optional="false"/>
         <attribute name="roleTypeId" type="String" mode="IN" optional="false"/>
     </service>
-    
+
     <service name="createFacilityContent" engine="simple" default-entity-name="FacilityContent"
         location="component://product/script/org/ofbiz/product/storage/StorageServices.xml" invoke="createFacilityContent" auth="true">
         <description>Create a Facility Content</description>
@@ -826,7 +826,7 @@ under the License.
         <auto-attributes include="nonpk" mode="IN" optional="true"/>
         <override name="fromDate" optional="true"/>
     </service>
-    
+
     <service name="deleteFacilityContent" engine="simple" default-entity-name="FacilityContent"
                 location="component://product/script/org/ofbiz/product/storage/StorageServices.xml" invoke="deleteFacilityContent" auth="true">
         <description>Delete Content From Facility</description>

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=1543766&r1=1543765&r2=1543766&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 Wed Nov 20 11:02:42 2013
@@ -21,7 +21,6 @@ package org.ofbiz.product.inventory;
 import java.math.BigDecimal;
 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;
@@ -52,6 +51,8 @@ import org.ofbiz.service.GenericServiceE
 import org.ofbiz.service.LocalDispatcher;
 import org.ofbiz.service.ServiceUtil;
 
+import com.ibm.icu.util.Calendar;
+
 /**
  * Inventory Services
  */
@@ -73,12 +74,12 @@ public class InventoryServices {
         try {
             inventoryItem = delegator.findOne("InventoryItem", UtilMisc.toMap("inventoryItemId", inventoryItemId), false);
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                     "ProductNotFindInventoryItemWithId", locale) + inventoryItemId);
         }
 
         if (inventoryItem == null) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                     "ProductNotFindInventoryItemWithId", locale) + inventoryItemId);
         }
 
@@ -91,7 +92,7 @@ public class InventoryServices {
                 BigDecimal qoh = inventoryItem.getBigDecimal("quantityOnHandTotal");
 
                 if (atp == null) {
-                    return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
+                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                             "ProductInventoryItemATPNotAvailable",
                             UtilMisc.toMap("inventoryItemId", inventoryItem.getString("inventoryItemId")), locale));
                 }
@@ -101,7 +102,7 @@ public class InventoryServices {
 
                 // first make sure we have enough to cover the request transfer amount
                 if (xferQty.compareTo(atp) > 0) {
-                    return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
+                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                             "ProductInventoryItemATPIsNotSufficient",
                             UtilMisc.toMap("inventoryItemId", inventoryItem.getString("inventoryItemId"),
                                     "atp", atp, "xferQty", xferQty), locale));
@@ -140,19 +141,19 @@ public class InventoryServices {
                     try {
                         Map<String, Object> resultNew = dctx.getDispatcher().runSync("createInventoryItemDetail", createNewDetailMap);
                         if (ServiceUtil.isError(resultNew)) {
-                            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                                    "ProductInventoryItemDetailCreateProblem", 
+                            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(resultUpdate)) {
-                            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                                    "ProductInventoryItemDetailCreateProblem", 
+                            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                                    "ProductInventoryItemDetailCreateProblem",
                                     UtilMisc.toMap("errorString", ""), locale), null, null, resultUpdate);
                         }
                     } catch (GenericServiceException e1) {
-                        return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                                "ProductInventoryItemDetailCreateProblem", 
+                        return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                                "ProductInventoryItemDetailCreateProblem",
                                 UtilMisc.toMap("errorString", e1.getMessage()), locale));
                     }
                 } else {
@@ -160,7 +161,7 @@ public class InventoryServices {
                 }
             } else if (inventoryType.equals("SERIALIZED_INV_ITEM")) {
                 if (!"INV_AVAILABLE".equals(inventoryItem.getString("statusId"))) {
-                    return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
+                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                             "ProductSerializedInventoryNotAvailable", locale));
                 }
             }
@@ -179,13 +180,13 @@ public class InventoryServices {
                     try {
                         Map<String, Object> result = dctx.getDispatcher().runSync("createInventoryItemDetail", createDetailMap);
                         if (ServiceUtil.isError(result)) {
-                            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                                    "ProductInventoryItemDetailCreateProblem", 
+                            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                                    "ProductInventoryItemDetailCreateProblem",
                                     UtilMisc.toMap("errorString", ""), locale), null, null, result);
                         }
                     } catch (GenericServiceException e1) {
-                        return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                                "ProductInventoryItemDetailCreateProblem", 
+                        return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                                "ProductInventoryItemDetailCreateProblem",
                                 UtilMisc.toMap("errorString", e1.getMessage()), locale));
                     }
                 }
@@ -206,8 +207,8 @@ public class InventoryServices {
 
             return results;
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                    "ProductInventoryItemStoreProblem", 
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                    "ProductInventoryItemStoreProblem",
                     UtilMisc.toMap("errorString", e.getMessage()), locale));
         }
     }
@@ -228,14 +229,14 @@ public class InventoryServices {
             inventoryItem = inventoryTransfer.getRelatedOne("InventoryItem", false);
             destinationFacility = inventoryTransfer.getRelatedOne("ToFacility", false);
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                    "ProductInventoryItemLookupProblem", 
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                    "ProductInventoryItemLookupProblem",
                     UtilMisc.toMap("errorString", e.getMessage()), locale));
         }
 
         if (inventoryTransfer == null || inventoryItem == null) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                    "ProductInventoryItemLookupProblem", 
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                    "ProductInventoryItemLookupProblem",
                     UtilMisc.toMap("errorString", ""), locale));
         }
 
@@ -259,20 +260,20 @@ public class InventoryServices {
             try {
                 Map<String, Object> result = dctx.getDispatcher().runSync("createInventoryItemDetail", createDetailMap);
                 if (ServiceUtil.isError(result)) {
-                    return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                            "ProductInventoryItemDetailCreateProblem", 
+                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                            "ProductInventoryItemDetailCreateProblem",
                             UtilMisc.toMap("errorString", ""), locale), null, null, result);
                 }
             } catch (GenericServiceException e1) {
-                return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                        "ProductInventoryItemDetailCreateProblem", 
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                        "ProductInventoryItemDetailCreateProblem",
                         UtilMisc.toMap("errorString", e1.getMessage()), locale));
             }
             try {
                 inventoryItem.refresh();
             } catch (GenericEntityException e) {
-                return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                        "ProductInventoryItemRefreshProblem", 
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                        "ProductInventoryItemRefreshProblem",
                         UtilMisc.toMap("errorString", e.getMessage()), locale));
             }
         }
@@ -302,13 +303,13 @@ public class InventoryServices {
         try {
             Map<String, Object> result = dctx.getDispatcher().runSync("updateInventoryItem", updateInventoryItemMap);
             if (ServiceUtil.isError(result)) {
-                return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                        "ProductInventoryItemStoreProblem", 
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                        "ProductInventoryItemStoreProblem",
                         UtilMisc.toMap("errorString", ""), locale), null, null, result);
             }
         } catch (GenericServiceException exc) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                    "ProductInventoryItemStoreProblem", 
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                    "ProductInventoryItemStoreProblem",
                     UtilMisc.toMap("errorString", exc.getMessage()), locale));
         }
 
@@ -319,8 +320,8 @@ public class InventoryServices {
         try {
             inventoryTransfer.store();
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                    "ProductInventoryItemStoreProblem", 
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                    "ProductInventoryItemStoreProblem",
                     UtilMisc.toMap("errorString", e.getMessage()), locale));
         }
 
@@ -339,20 +340,20 @@ public class InventoryServices {
             inventoryTransfer = delegator.findOne("InventoryTransfer",
                     UtilMisc.toMap("inventoryTransferId", inventoryTransferId), false);
             if (UtilValidate.isEmpty(inventoryTransfer)) {
-                return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                        "ProductInventoryItemTransferNotFound", 
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                        "ProductInventoryItemTransferNotFound",
                         UtilMisc.toMap("inventoryTransferId", inventoryTransferId), locale));
             }
             inventoryItem = inventoryTransfer.getRelatedOne("InventoryItem", false);
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                    "ProductInventoryItemLookupProblem", 
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                    "ProductInventoryItemLookupProblem",
                     UtilMisc.toMap("errorString", e.getMessage()), locale));
         }
 
         if (inventoryTransfer == null || inventoryItem == null) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                    "ProductInventoryItemLookupProblem", 
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                    "ProductInventoryItemLookupProblem",
                     UtilMisc.toMap("errorString", ""), locale));
         }
 
@@ -369,13 +370,13 @@ public class InventoryServices {
             try {
                 Map<String, Object> result = dctx.getDispatcher().runSync("createInventoryItemDetail", createDetailMap);
                 if (ServiceUtil.isError(result)) {
-                    return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                            "ProductInventoryItemDetailCreateProblem", 
+                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                            "ProductInventoryItemDetailCreateProblem",
                             UtilMisc.toMap("errorString", ""), locale), null, null, result);
                 }
             } catch (GenericServiceException e1) {
-                return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                        "ProductInventoryItemDetailCreateProblem", 
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                        "ProductInventoryItemDetailCreateProblem",
                         UtilMisc.toMap("errorString", e1.getMessage()), locale));
             }
         } else if (inventoryType.equals("SERIALIZED_INV_ITEM")) {
@@ -384,8 +385,8 @@ public class InventoryServices {
             try {
                 inventoryItem.store();
             } catch (GenericEntityException e) {
-                return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                        "ProductInventoryItemStoreProblem", 
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                        "ProductInventoryItemStoreProblem",
                         UtilMisc.toMap("errorString", e.getMessage()), locale));
             }
         }
@@ -397,8 +398,8 @@ public class InventoryServices {
         try {
             inventoryTransfer.store();
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                    "ProductInventoryItemStoreProblem", 
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                    "ProductInventoryItemStoreProblem",
                     UtilMisc.toMap("errorString", e.getMessage()), locale));
         }
 
@@ -430,7 +431,7 @@ 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(UtilProperties.getMessage(resource, 
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                     "ProductPriceCannotRetrieveInventoryItem", locale));
         }
 
@@ -455,7 +456,7 @@ 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(UtilProperties.getMessage(resource, 
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                         "ProductPriceCannotRetrieveShipmentAndItem", locale));
             }
 
@@ -465,7 +466,7 @@ public class InventoryServices {
                 reservations = inventoryItem.getRelated("OrderItemShipGrpInvRes", null, UtilMisc.toList("-reservedDatetime"), false);
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Problem getting related reservations", module);
-                return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                         "ProductPriceCannotRetrieveRelativeReservation", locale));
             }
 
@@ -786,8 +787,8 @@ public class InventoryServices {
                 facilities = delegator.findList("Facility", null, null, null, null, false);
             }
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                    "ProductErrorFacilityIdNotFound", 
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                    "ProductErrorFacilityIdNotFound",
                     UtilMisc.toMap("facilityId", facilityId), locale));
         }
 
@@ -802,7 +803,7 @@ public class InventoryServices {
                 product = orderItem.getRelatedOne("Product", true);
             } catch (GenericEntityException e) {
                 Debug.logError(e, "Couldn't get product.", module);
-                return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
+                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
                         "ProductProductNotFound", locale) + productId);
             }
 
@@ -824,8 +825,8 @@ public class InventoryServices {
                     invResult = dispatcher.runSync("getInventoryAvailableByFacility", UtilMisc.toMap("productId", productId, "facilityId", facility.getString("facilityId")));
                 } catch (GenericServiceException e) {
                     Debug.logError(e, "Could not find inventory for facility " + facility.getString("facilityId"), module);
-                    return ServiceUtil.returnError(UtilProperties.getMessage(resource, 
-                            "ProductInventoryNotAvailableForFacility", 
+                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+                            "ProductInventoryNotAvailableForFacility",
                             UtilMisc.toMap("facilityId", facility.getString("facilityId")), locale));
                 }
 
@@ -864,7 +865,7 @@ public class InventoryServices {
         Timestamp checkTime = (Timestamp)context.get("checkTime");
         String facilityId = (String)context.get("facilityId");
         String productId = (String)context.get("productId");
-        String minimumStockStr = (String)context.get("minimumStock");
+        BigDecimal minimumStock = (BigDecimal)context.get("minimumStock");
         String statusId = (String)context.get("statusId");
 
         Map<String, Object> result = FastMap.newInstance();
@@ -894,10 +895,7 @@ public class InventoryServices {
             }
         }
         // filter for quantities
-        BigDecimal minimumStock = BigDecimal.ZERO;
-        if (minimumStockStr != null) {
-            minimumStock = new BigDecimal(minimumStockStr);
-        }
+        minimumStock = minimumStock != null ? minimumStock : BigDecimal.ZERO;
 
         BigDecimal quantityOnHandTotal = BigDecimal.ZERO;
         if (resultOutput.get("quantityOnHandTotal") != null) {
@@ -912,8 +910,8 @@ public class InventoryServices {
         BigDecimal offsetATPQtyAvailable = availableToPromiseTotal.subtract(minimumStock);
 
         BigDecimal quantityOnOrder = InventoryWorker.getOutstandingPurchasedQuantity(productId, delegator);
-        result.put("totalQuantityOnHand", resultOutput.get("quantityOnHandTotal").toString());
-        result.put("totalAvailableToPromise", resultOutput.get("availableToPromiseTotal").toString());
+        result.put("totalQuantityOnHand", resultOutput.get("quantityOnHandTotal"));
+        result.put("totalAvailableToPromise", resultOutput.get("availableToPromiseTotal"));
         result.put("quantityOnOrder", quantityOnOrder);
 
         result.put("offsetQOHQtyAvailable", offsetQOHQtyAvailable);

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy?rev=1543766&r1=1543765&r2=1543766&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy Wed Nov 20 11:02:42 2013
@@ -234,8 +234,8 @@ if (action) {
         prodsIt = prods.iterator();
         while (prodsIt) {
             oneProd = prodsIt.next();
-            offsetQOHQtyAvailable = oneProd.getDouble("offsetQOHQtyAvailable");
-            offsetATPQtyAvailable = oneProd.getDouble("offsetATPQtyAvailable");
+            offsetQOHQtyAvailable = oneProd.getBigDecimal("offsetQOHQtyAvailable");
+            offsetATPQtyAvailable = oneProd.getBigDecimal("offsetATPQtyAvailable");
             if (hasOffsetATP) {
                 if (offsetATPQtyAvailable && offsetATPQtyAvailable.doubleValue() > offsetATP) {
                     break;
@@ -249,8 +249,8 @@ if (action) {
 
             oneInventory = [:];
             oneInventory.productId = oneProd.productId;
-            oneInventory.minimumStock = oneProd.getString("minimumStock");
-            oneInventory.reorderQuantity = oneProd.getString("reorderQuantity");
+            oneInventory.minimumStock = oneProd.getBigDecimal("minimumStock");
+            oneInventory.reorderQuantity = oneProd.getBigDecimal("reorderQuantity");
             oneInventory.daysToShip = oneProd.getString("daysToShip");
             oneInventory.totalQuantityOnHand = oneProd.totalQuantityOnHandTotal;
             oneInventory.totalAvailableToPromise = oneProd.totalAvailableToPromiseTotal;

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy?rev=1543766&r1=1543765&r2=1543766&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy Wed Nov 20 11:02:42 2013
@@ -168,7 +168,7 @@ if (action) {
         oneInventory.checkTime = checkTime;
         oneInventory.facilityId = facilityId;
         oneInventory.productId = oneProd.productId;
-        minimumStock = oneProd.minimumStock as String;
+        minimumStock = oneProd.minimumStock;
         oneInventory.minimumStock = minimumStock;
         oneInventory.reorderQuantity = oneProd.reorderQuantity;
         oneInventory.daysToShip = oneProd.daysToShip;



Re: svn commit: r1543766 - in /ofbiz/trunk/applications/product: servicedef/ src/org/ofbiz/product/inventory/ webapp/facility/WEB-INF/actions/facility/

Posted by Jacques Le Roux <ja...@les7arts.com>.
Ho Sorry, I see that I have changed things I did not want to. They are all only formatting, not functional, changes in InventoryServices.java
This is because I have set a formatting option in Eclipse (remove trailing whitespaces, in AnyEdit preferences, it's not smart enough) . I have reverted this change in Eclipse for future

I have reverted these changes in commits also

Jacques


On Wednesday, November 20, 2013 12:02 PM jleroux@apache.org <jl...@apache.org> wrote:
> Author: jleroux
> Date: Wed Nov 20 11:02:42 2013
> New Revision: 1543766
> 
> URL: http://svn.apache.org/r1543766
> Log:
> A completed patch from Pierre Smits for "Using type=accounting-number in form in facility generates wrong output for inventory
> overview" https://issues.apache.org/jira/browse/OFBIZ-5335 
> 
> When using locale DE or NL several quantities (ATP, QOH and others) get transformed wrong.
> E.g. a ATP of 250 for a product is 250.00 in locale EN or FR, but for DE and NL the output is 250.000.000,00
> 
> jleroux: I completed Pierre's patch in 2 ways:
> * used also BigDecimal for minimumStock in getProductInventoryAndFacilitySummary service and groovy script
> * Fixed the same kind of issue in  CountFacilityInventoryByProduct.groovy
> 
> In by and large i18n contexts, this fixes number of Inventory views and reports, also in Asset Maint and Birt components where
> those 2 service/groovy scripts are used 
> 
> Modified:
>    ofbiz/trunk/applications/product/servicedef/services_facility.xml
>    ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
>    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy
>    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy
> 
> Modified: ofbiz/trunk/applications/product/servicedef/services_facility.xml
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_facility.xml?rev=1543766&r1=1543765&r2=1543766&view=diff
> ============================================================================== ---
> ofbiz/trunk/applications/product/servicedef/services_facility.xml (original) +++
> ofbiz/trunk/applications/product/servicedef/services_facility.xml Wed Nov 20 11:02:42 2013 @@ -257,10 +257,10 @@ under the
>         License. <attribute name="checkTime" type="Timestamp" mode="IN" optional="true"/>
>         <attribute name="facilityId" type="String" mode="IN" optional="false"/>
>         <attribute name="productId" type="String" mode="IN" optional="false"/>
> -        <attribute name="minimumStock" mode="IN" type="String" optional="true"/>
> +        <attribute name="minimumStock" mode="IN" type="BigDecimal" optional="true"/>
>         <attribute name="statusId" type="String" mode="IN" optional="true"/>
> -        <attribute name="totalQuantityOnHand" mode="OUT" type="String" optional="true"/>
> -        <attribute name="totalAvailableToPromise" mode="OUT" type="String" optional="true"/>
> +        <attribute name="totalQuantityOnHand" mode="OUT" type="BigDecimal" optional="true"/>
> +        <attribute name="totalAvailableToPromise" mode="OUT" type="BigDecimal" optional="true"/>
>         <attribute name="quantityOnOrder" mode="OUT" type="BigDecimal" optional="true"/>
>         <attribute name="offsetQOHQtyAvailable" mode="OUT" type="BigDecimal" optional="true"/>
>         <attribute name="offsetATPQtyAvailable" mode="OUT" type="BigDecimal" optional="true"/>
> @@ -818,7 +818,7 @@ under the License.
>         <attribute name="partyId" type="String" mode="IN" optional="false"/>
>         <attribute name="roleTypeId" type="String" mode="IN" optional="false"/>
>     </service>
> -
> +
>     <service name="createFacilityContent" engine="simple" default-entity-name="FacilityContent"
>         location="component://product/script/org/ofbiz/product/storage/StorageServices.xml" invoke="createFacilityContent"
>         auth="true"> <description>Create a Facility Content</description>
> @@ -826,7 +826,7 @@ under the License.
>         <auto-attributes include="nonpk" mode="IN" optional="true"/>
>         <override name="fromDate" optional="true"/>
>     </service>
> -
> +
>     <service name="deleteFacilityContent" engine="simple" default-entity-name="FacilityContent"
>                 location="component://product/script/org/ofbiz/product/storage/StorageServices.xml"
>         invoke="deleteFacilityContent" auth="true"> <description>Delete Content From Facility</description>
> 
> 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=1543766&r1=1543765&r2=1543766&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 Wed Nov 20 11:02:42 2013 @@ -21,7 +21,6
> @@ package org.ofbiz.product.inventory; 
> import java.math.BigDecimal;
> 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;
> @@ -52,6 +51,8 @@ import org.ofbiz.service.GenericServiceE
> import org.ofbiz.service.LocalDispatcher;
> import org.ofbiz.service.ServiceUtil;
> 
> +import com.ibm.icu.util.Calendar;
> +
> /**
>  * Inventory Services
>  */
> @@ -73,12 +74,12 @@ public class InventoryServices {
>         try {
>             inventoryItem = delegator.findOne("InventoryItem", UtilMisc.toMap("inventoryItemId", inventoryItemId), false);
>         } catch (GenericEntityException e) {
> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>                     "ProductNotFindInventoryItemWithId", locale) + inventoryItemId);
>         }
> 
>         if (inventoryItem == null) {
> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>                     "ProductNotFindInventoryItemWithId", locale) + inventoryItemId);
>         }
> 
> @@ -91,7 +92,7 @@ public class InventoryServices {
>                 BigDecimal qoh = inventoryItem.getBigDecimal("quantityOnHandTotal");
> 
>                 if (atp == null) {
> -                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>                             "ProductInventoryItemATPNotAvailable",
>                             UtilMisc.toMap("inventoryItemId", inventoryItem.getString("inventoryItemId")), locale));
>                 }
> @@ -101,7 +102,7 @@ public class InventoryServices {
> 
>                 // first make sure we have enough to cover the request transfer amount
>                 if (xferQty.compareTo(atp) > 0) {
> -                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>                             "ProductInventoryItemATPIsNotSufficient",
>                             UtilMisc.toMap("inventoryItemId", inventoryItem.getString("inventoryItemId"),
>                                     "atp", atp, "xferQty", xferQty), locale));
> @@ -140,19 +141,19 @@ public class InventoryServices {
>                     try {
>                         Map<String, Object> resultNew = dctx.getDispatcher().runSync("createInventoryItemDetail",
>                         createNewDetailMap); if (ServiceUtil.isError(resultNew)) {
> -                            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                                    "ProductInventoryItemDetailCreateProblem",
> +                            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(resultUpdate)) {
> -                            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                                    "ProductInventoryItemDetailCreateProblem",
> +                            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                                    "ProductInventoryItemDetailCreateProblem",
>                                     UtilMisc.toMap("errorString", ""), locale), null, null, resultUpdate);
>                         }
>                     } catch (GenericServiceException e1) {
> -                        return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                                "ProductInventoryItemDetailCreateProblem",
> +                        return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                                "ProductInventoryItemDetailCreateProblem",
>                                 UtilMisc.toMap("errorString", e1.getMessage()), locale));
>                     }
>                 } else {
> @@ -160,7 +161,7 @@ public class InventoryServices {
>                 }
>             } else if (inventoryType.equals("SERIALIZED_INV_ITEM")) {
>                 if (!"INV_AVAILABLE".equals(inventoryItem.getString("statusId"))) {
> -                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>                             "ProductSerializedInventoryNotAvailable", locale));
>                 }
>             }
> @@ -179,13 +180,13 @@ public class InventoryServices {
>                     try {
>                         Map<String, Object> result = dctx.getDispatcher().runSync("createInventoryItemDetail", createDetailMap);
>                         if (ServiceUtil.isError(result)) {
> -                            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                                    "ProductInventoryItemDetailCreateProblem",
> +                            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                                    "ProductInventoryItemDetailCreateProblem",
>                                     UtilMisc.toMap("errorString", ""), locale), null, null, result);
>                         }
>                     } catch (GenericServiceException e1) {
> -                        return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                                "ProductInventoryItemDetailCreateProblem",
> +                        return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                                "ProductInventoryItemDetailCreateProblem",
>                                 UtilMisc.toMap("errorString", e1.getMessage()), locale));
>                     }
>                 }
> @@ -206,8 +207,8 @@ public class InventoryServices {
> 
>             return results;
>         } catch (GenericEntityException e) {
> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                    "ProductInventoryItemStoreProblem",
> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                    "ProductInventoryItemStoreProblem",
>                     UtilMisc.toMap("errorString", e.getMessage()), locale));
>         }
>     }
> @@ -228,14 +229,14 @@ public class InventoryServices {
>             inventoryItem = inventoryTransfer.getRelatedOne("InventoryItem", false);
>             destinationFacility = inventoryTransfer.getRelatedOne("ToFacility", false);
>         } catch (GenericEntityException e) {
> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                    "ProductInventoryItemLookupProblem",
> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                    "ProductInventoryItemLookupProblem",
>                     UtilMisc.toMap("errorString", e.getMessage()), locale));
>         }
> 
>         if (inventoryTransfer == null || inventoryItem == null) {
> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                    "ProductInventoryItemLookupProblem",
> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                    "ProductInventoryItemLookupProblem",
>                     UtilMisc.toMap("errorString", ""), locale));
>         }
> 
> @@ -259,20 +260,20 @@ public class InventoryServices {
>             try {
>                 Map<String, Object> result = dctx.getDispatcher().runSync("createInventoryItemDetail", createDetailMap);
>                 if (ServiceUtil.isError(result)) {
> -                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                            "ProductInventoryItemDetailCreateProblem",
> +                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                            "ProductInventoryItemDetailCreateProblem",
>                             UtilMisc.toMap("errorString", ""), locale), null, null, result);
>                 }
>             } catch (GenericServiceException e1) {
> -                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                        "ProductInventoryItemDetailCreateProblem",
> +                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                        "ProductInventoryItemDetailCreateProblem",
>                         UtilMisc.toMap("errorString", e1.getMessage()), locale));
>             }
>             try {
>                 inventoryItem.refresh();
>             } catch (GenericEntityException e) {
> -                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                        "ProductInventoryItemRefreshProblem",
> +                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                        "ProductInventoryItemRefreshProblem",
>                         UtilMisc.toMap("errorString", e.getMessage()), locale));
>             }
>         }
> @@ -302,13 +303,13 @@ public class InventoryServices {
>         try {
>             Map<String, Object> result = dctx.getDispatcher().runSync("updateInventoryItem", updateInventoryItemMap);
>             if (ServiceUtil.isError(result)) {
> -                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                        "ProductInventoryItemStoreProblem",
> +                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                        "ProductInventoryItemStoreProblem",
>                         UtilMisc.toMap("errorString", ""), locale), null, null, result);
>             }
>         } catch (GenericServiceException exc) {
> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                    "ProductInventoryItemStoreProblem",
> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                    "ProductInventoryItemStoreProblem",
>                     UtilMisc.toMap("errorString", exc.getMessage()), locale));
>         }
> 
> @@ -319,8 +320,8 @@ public class InventoryServices {
>         try {
>             inventoryTransfer.store();
>         } catch (GenericEntityException e) {
> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                    "ProductInventoryItemStoreProblem",
> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                    "ProductInventoryItemStoreProblem",
>                     UtilMisc.toMap("errorString", e.getMessage()), locale));
>         }
> 
> @@ -339,20 +340,20 @@ public class InventoryServices {
>             inventoryTransfer = delegator.findOne("InventoryTransfer",
>                     UtilMisc.toMap("inventoryTransferId", inventoryTransferId), false);
>             if (UtilValidate.isEmpty(inventoryTransfer)) {
> -                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                        "ProductInventoryItemTransferNotFound",
> +                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                        "ProductInventoryItemTransferNotFound",
>                         UtilMisc.toMap("inventoryTransferId", inventoryTransferId), locale));
>             }
>             inventoryItem = inventoryTransfer.getRelatedOne("InventoryItem", false);
>         } catch (GenericEntityException e) {
> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                    "ProductInventoryItemLookupProblem",
> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                    "ProductInventoryItemLookupProblem",
>                     UtilMisc.toMap("errorString", e.getMessage()), locale));
>         }
> 
>         if (inventoryTransfer == null || inventoryItem == null) {
> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                    "ProductInventoryItemLookupProblem",
> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                    "ProductInventoryItemLookupProblem",
>                     UtilMisc.toMap("errorString", ""), locale));
>         }
> 
> @@ -369,13 +370,13 @@ public class InventoryServices {
>             try {
>                 Map<String, Object> result = dctx.getDispatcher().runSync("createInventoryItemDetail", createDetailMap);
>                 if (ServiceUtil.isError(result)) {
> -                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                            "ProductInventoryItemDetailCreateProblem",
> +                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                            "ProductInventoryItemDetailCreateProblem",
>                             UtilMisc.toMap("errorString", ""), locale), null, null, result);
>                 }
>             } catch (GenericServiceException e1) {
> -                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                        "ProductInventoryItemDetailCreateProblem",
> +                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                        "ProductInventoryItemDetailCreateProblem",
>                         UtilMisc.toMap("errorString", e1.getMessage()), locale));
>             }
>         } else if (inventoryType.equals("SERIALIZED_INV_ITEM")) {
> @@ -384,8 +385,8 @@ public class InventoryServices {
>             try {
>                 inventoryItem.store();
>             } catch (GenericEntityException e) {
> -                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                        "ProductInventoryItemStoreProblem",
> +                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                        "ProductInventoryItemStoreProblem",
>                         UtilMisc.toMap("errorString", e.getMessage()), locale));
>             }
>         }
> @@ -397,8 +398,8 @@ public class InventoryServices {
>         try {
>             inventoryTransfer.store();
>         } catch (GenericEntityException e) {
> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                    "ProductInventoryItemStoreProblem",
> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                    "ProductInventoryItemStoreProblem",
>                     UtilMisc.toMap("errorString", e.getMessage()), locale));
>         }
> 
> @@ -430,7 +431,7 @@ 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(UtilProperties.getMessage(resource,
> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>                     "ProductPriceCannotRetrieveInventoryItem", locale));
>         }
> 
> @@ -455,7 +456,7 @@ 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(UtilProperties.getMessage(resource,
> +                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>                         "ProductPriceCannotRetrieveShipmentAndItem", locale));
>             }
> 
> @@ -465,7 +466,7 @@ public class InventoryServices {
>                 reservations = inventoryItem.getRelated("OrderItemShipGrpInvRes", null, UtilMisc.toList("-reservedDatetime"),
>             false); } catch (GenericEntityException e) {
>                 Debug.logError(e, "Problem getting related reservations", module);
> -                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>                         "ProductPriceCannotRetrieveRelativeReservation", locale));
>             }
> 
> @@ -786,8 +787,8 @@ public class InventoryServices {
>                 facilities = delegator.findList("Facility", null, null, null, null, false);
>             }
>         } catch (GenericEntityException e) {
> -            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                    "ProductErrorFacilityIdNotFound",
> +            return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                    "ProductErrorFacilityIdNotFound",
>                     UtilMisc.toMap("facilityId", facilityId), locale));
>         }
> 
> @@ -802,7 +803,7 @@ public class InventoryServices {
>                 product = orderItem.getRelatedOne("Product", true);
>             } catch (GenericEntityException e) {
>                 Debug.logError(e, "Couldn't get product.", module);
> -                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                return ServiceUtil.returnError(UtilProperties.getMessage(resource,
>                         "ProductProductNotFound", locale) + productId);
>             }
> 
> @@ -824,8 +825,8 @@ public class InventoryServices {
>                     invResult = dispatcher.runSync("getInventoryAvailableByFacility", UtilMisc.toMap("productId", productId,
>                 "facilityId", facility.getString("facilityId"))); } catch (GenericServiceException e) {
>                     Debug.logError(e, "Could not find inventory for facility " + facility.getString("facilityId"), module);
> -                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> -                            "ProductInventoryNotAvailableForFacility",
> +                    return ServiceUtil.returnError(UtilProperties.getMessage(resource,
> +                            "ProductInventoryNotAvailableForFacility",
>                             UtilMisc.toMap("facilityId", facility.getString("facilityId")), locale));
>                 }
> 
> @@ -864,7 +865,7 @@ public class InventoryServices {
>         Timestamp checkTime = (Timestamp)context.get("checkTime");
>         String facilityId = (String)context.get("facilityId");
>         String productId = (String)context.get("productId");
> -        String minimumStockStr = (String)context.get("minimumStock");
> +        BigDecimal minimumStock = (BigDecimal)context.get("minimumStock");
>         String statusId = (String)context.get("statusId");
> 
>         Map<String, Object> result = FastMap.newInstance();
> @@ -894,10 +895,7 @@ public class InventoryServices {
>             }
>         }
>         // filter for quantities
> -        BigDecimal minimumStock = BigDecimal.ZERO;
> -        if (minimumStockStr != null) {
> -            minimumStock = new BigDecimal(minimumStockStr);
> -        }
> +        minimumStock = minimumStock != null ? minimumStock : BigDecimal.ZERO;
> 
>         BigDecimal quantityOnHandTotal = BigDecimal.ZERO;
>         if (resultOutput.get("quantityOnHandTotal") != null) {
> @@ -912,8 +910,8 @@ public class InventoryServices {
>         BigDecimal offsetATPQtyAvailable = availableToPromiseTotal.subtract(minimumStock);
> 
>         BigDecimal quantityOnOrder = InventoryWorker.getOutstandingPurchasedQuantity(productId, delegator);
> -        result.put("totalQuantityOnHand", resultOutput.get("quantityOnHandTotal").toString());
> -        result.put("totalAvailableToPromise", resultOutput.get("availableToPromiseTotal").toString());
> +        result.put("totalQuantityOnHand", resultOutput.get("quantityOnHandTotal"));
> +        result.put("totalAvailableToPromise", resultOutput.get("availableToPromiseTotal"));
>         result.put("quantityOnOrder", quantityOnOrder);
> 
>         result.put("offsetQOHQtyAvailable", offsetQOHQtyAvailable);
> 
> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy?rev=1543766&r1=1543765&r2=1543766&view=diff
> ============================================================================== ---
> ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy (original) +++
> ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/CountFacilityInventoryByProduct.groovy Wed Nov 20
>         11:02:42 2013 @@ -234,8 +234,8 @@ if (action) { prodsIt = prods.iterator();
>         while (prodsIt) {
>             oneProd = prodsIt.next();
> -            offsetQOHQtyAvailable = oneProd.getDouble("offsetQOHQtyAvailable");
> -            offsetATPQtyAvailable = oneProd.getDouble("offsetATPQtyAvailable");
> +            offsetQOHQtyAvailable = oneProd.getBigDecimal("offsetQOHQtyAvailable");
> +            offsetATPQtyAvailable = oneProd.getBigDecimal("offsetATPQtyAvailable");
>             if (hasOffsetATP) {
>                 if (offsetATPQtyAvailable && offsetATPQtyAvailable.doubleValue() > offsetATP) {
>                     break;
> @@ -249,8 +249,8 @@ if (action) {
> 
>             oneInventory = [:];
>             oneInventory.productId = oneProd.productId;
> -            oneInventory.minimumStock = oneProd.getString("minimumStock");
> -            oneInventory.reorderQuantity = oneProd.getString("reorderQuantity");
> +            oneInventory.minimumStock = oneProd.getBigDecimal("minimumStock");
> +            oneInventory.reorderQuantity = oneProd.getBigDecimal("reorderQuantity");
>             oneInventory.daysToShip = oneProd.getString("daysToShip");
>             oneInventory.totalQuantityOnHand = oneProd.totalQuantityOnHandTotal;
>             oneInventory.totalAvailableToPromise = oneProd.totalAvailableToPromiseTotal;
> 
> Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy?rev=1543766&r1=1543765&r2=1543766&view=diff
> ============================================================================== ---
> ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy (original) +++
> ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/facility/ViewFacilityInventoryByProduct.groovy Wed Nov 20
>         11:02:42 2013 @@ -168,7 +168,7 @@ if (action) { oneInventory.checkTime = checkTime;
>         oneInventory.facilityId = facilityId;
>         oneInventory.productId = oneProd.productId;
> -        minimumStock = oneProd.minimumStock as String;
> +        minimumStock = oneProd.minimumStock;
>         oneInventory.minimumStock = minimumStock;
>         oneInventory.reorderQuantity = oneProd.reorderQuantity;
>         oneInventory.daysToShip = oneProd.daysToShip;