Author: jaz
Date: Fri Jan 21 17:36:32 2011
New Revision: 1061925

URL: http://svn.apache.org/viewvc?rev=1061925&view=rev
Log:
view minor adjustments to support order items without a product id

Modified:
    
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
    
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy

Modified: 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1061925&r1=1061924&r2=1061925&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java 
(original)
+++ 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java 
Fri Jan 21 17:36:32 2011
@@ -1708,9 +1708,11 @@ public class OrderReadHelper {
     /** Get a set of productIds in the order. */
     public Collection<String> getOrderProductIds() {
         Set<String> productIds = FastSet.newInstance();
-        for (Iterator<GenericValue> iter = getOrderItems().iterator(); 
iter.hasNext();) {
-            productIds.add(iter.next().getString("productId"));
-        }
+        for (GenericValue orderItem : getOrderItems()) {
+            if (orderItem.get("productId") != null) {
+                productIds.add(orderItem.getString("productId"));
+            }
+        }        
         return productIds;
     }
 

Modified: 
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1061925&r1=1061924&r2=1061925&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
 (original)
+++ 
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
 Fri Jan 21 17:36:32 2011
@@ -345,13 +345,18 @@ if (orderHeader) {
     }
     context.productionProductQuantityMap = productionMap;
 
-    // INVENTORY: find the number of products in outstanding sales orders for 
the same product store
-    requiredMap = 
InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, 
delegator);
-    context.requiredProductQuantityMap = requiredMap;
-
-    // INVENTORY: find the quantity of each product in outstanding purchase 
orders
-    onOrderMap = 
InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, 
delegator);
-    context.onOrderProductQuantityMap = onOrderMap;
+    if (productIds.size() > 0) {
+        // INVENTORY: find the number of products in outstanding sales orders 
for the same product store    
+        requiredMap = 
InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, 
delegator);
+        context.requiredProductQuantityMap = requiredMap;
+    
+        // INVENTORY: find the quantity of each product in outstanding 
purchase orders
+        onOrderMap = 
InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, 
delegator);
+        context.onOrderProductQuantityMap = onOrderMap;
+    } else {
+        context.requiredProductQuantityMap = FastMap.newInstance();
+        context.onOrderProductQuantityMap = FastMap.newInstance();
+    }
 }
 
 paramString = "";


Reply via email to