You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2008/07/01 11:25:09 UTC

svn commit: r673033 - /ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy

Author: jacopoc
Date: Tue Jul  1 02:25:08 2008
New Revision: 673033

URL: http://svn.apache.org/viewvc?rev=673033&view=rev
Log:
Misc fixes for script broken after migration to Groovy.

Modified:
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy

Modified: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy?rev=673033&r1=673032&r2=673033&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy Tue Jul  1 02:25:08 2008
@@ -134,25 +134,24 @@
         totalReceived = 0.0;
         receipts = thisItem.getRelated("ShipmentReceipt");
         if (receipts) {
-            while (rec = receipts.next()) {
-                if (shipment) {
-                    if (!rec.shipmentId || !rec.shipmentId.equals(shipment.shipmentId)) {
-                        continue;
+            receipts.each { rec ->
+                if (!shipment || (rec.shipmentId && rec.shipmentId.equals(shipment.shipmentId))) {
+                    accepted = rec.getDouble("quantityAccepted");
+                    rejected = rec.getDouble("quantityRejected");
+                    if (accepted) {
+                        totalReceived += accepted.doubleValue();
                     }
+                    if (rejected) {
+                        totalReceived += rejected.doubleValue();
+                    }                                            
                 }
-                accepted = rec.getDouble("quantityAccepted");
-                rejected = rec.getDouble("quantityRejected");
-                if (accepted)
-                    totalReceived += accepted.doubleValue();
-                if (rejected)
-                    totalReceived += rejected.doubleValue();                                            
             }            
         }
         receivedQuantities.put(thisItem.orderItemSeqId, new Double(totalReceived));
         //----------------------
-        salesOrderItemAssocs = delegator.findList("OrderItemAssoc", [orderItemAssocTypeId : 'PURCHASE_ORDER',
+        salesOrderItemAssocs = delegator.findList("OrderItemAssoc", EntityCondition.makeCondition([orderItemAssocTypeId : 'PURCHASE_ORDER',
                                                                      toOrderId : thisItem.orderId,
-                                                                     toOrderItemSeqId : thisItem.orderItemSeqId], 
+                                                                     toOrderItemSeqId : thisItem.orderItemSeqId]), 
                                                                      null, null, null, false);
         if (salesOrderItemAssocs) {
             salesOrderItem = EntityUtil.getFirst(salesOrderItemAssocs);
@@ -163,7 +162,7 @@
 
 receivedItems = null;
 if (purchaseOrder) {
-    receivedItems = delegator.findList("ShipmentReceiptAndItem", [orderId : purchaseOrderId, facilityId : facilityId], null, null, null, false);
+    receivedItems = delegator.findList("ShipmentReceiptAndItem", EntityCondition.makeCondition([orderId : purchaseOrderId, facilityId : facilityId]), null, null, null, false);
     context.receivedItems = receivedItems;
 }
 
@@ -188,16 +187,14 @@
 
     // get the unit cost of the products in a shipment
     if (purchaseOrderItems) {
-        while (orderItem = purchaseOrderItems.next()) {        
+        purchaseOrderItems.each { orderItem ->
             productId = orderItem.productId;
-            if (!productId) {
-                continue;
-            }
-
-            result = dispatcher.runSync("getProductCost", [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId, 
-                                                           costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")]);
-            if (!ServiceUtil.isError(result)) {
-                standardCosts.put(productId, result.productCost);
+            if (productId) {
+                result = dispatcher.runSync("getProductCost", [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId, 
+                                                               costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")]);
+                if (!ServiceUtil.isError(result)) {
+                    standardCosts.put(productId, result.productCost);
+                }
             }
         }
     }