svn commit: r667229 - in /ofbiz/trunk/applications/product: webapp/facility/WEB-INF/actions/inventory/ webapp/facility/WEB-INF/actions/returns/ widget/facility/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r667229 - in /ofbiz/trunk/applications/product: webapp/facility/WEB-INF/actions/inventory/ webapp/facility/WEB-INF/actions/returns/ widget/facility/

mrisaliti
Author: mrisaliti
Date: Thu Jun 12 14:17:46 2008
New Revision: 667229

URL: http://svn.apache.org/viewvc?rev=667229&view=rev
Log:
Converted some facility bsh scripts to groovy (Part of issue OFBIZ-1801)

Added:
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy
      - copied, changed from r667195, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy
      - copied, changed from r667195, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.bsh
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.groovy
      - copied, changed from r667195, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.bsh
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy
      - copied, changed from r667195, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/receiveInventory.bsh
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.groovy
      - copied, changed from r667195, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.bsh
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/ReceiveReturn.groovy
      - copied, changed from r667195, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/receiveReturn.bsh
Removed:
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.bsh
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.bsh
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.bsh
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/receiveInventory.bsh
    ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/receiveReturn.bsh
Modified:
    ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml

Copied: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy (from r667195, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy?p2=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy&p1=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh&r1=667195&r2=667229&rev=667229&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy Thu Jun 12 14:17:46 2008
@@ -17,63 +17,56 @@
  * under the License.
  */
 
-import java.util.HashSet;
-import javolution.util.FastList;
-import javolution.util.FastMap;
-
-import org.ofbiz.base.util.*;
-import org.ofbiz.service.ServiceUtil;
-import org.ofbiz.entity.condition.*;
+import org.ofbiz.service.ServiceUtil
+import org.ofbiz.entity.condition.*
 
-facilityId = parameters.get("facilityId");
+facilityId = parameters.facilityId;
 
 // fields to search by
-productId = parameters.get("productId");
-internalName = parameters.get("internalName");
+productId = parameters.productId ? parameters.productId.trim() : null;
+internalName = parameters.internalName ? parameters.internalName.trim() : null;
 
 // build conditions
-conditions = UtilMisc.toList(
-        EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId),
-        EntityCondition.makeCondition("inventoryItemTypeId", EntityOperator.EQUALS, "NON_SERIAL_INV_ITEM")
-        );
-if (productId != null && productId.trim().length() != 0) {
-    conditions.add( EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId.trim() + "%") );
+conditions = [EntityCondition.makeCondition("facilityId", EntityOperator.EQUALS, facilityId),
+              EntityCondition.makeCondition("inventoryItemTypeId", EntityOperator.EQUALS, "NON_SERIAL_INV_ITEM")
+             ];
+if (productId) {
+    conditions.add(EntityCondition.makeCondition("productId", EntityOperator.LIKE, productId + "%"));
 }
-if (internalName != null && internalName.trim().length() != 0) {
-    conditions.add( EntityCondition.makeCondition("internalName", true, EntityOperator.LIKE, internalName.trim() + "%", true) );
+if (internalName) {
+    conditions.add(EntityCondition.makeCondition("internalName", true, EntityOperator.LIKE, internalName + "%", true));
 }
 
 if (conditions.size() > 2) {
-    EntityConditionList ecl = EntityCondition.makeCondition(conditions, EntityOperator.AND);
-    physicalInventory = delegator.findList("ProductInventoryItem", ecl, null, UtilMisc.toList("productId"), null, false);
+    ecl = EntityCondition.makeCondition(conditions, EntityOperator.AND);
+    physicalInventory = delegator.findList("ProductInventoryItem", ecl, null, ['productId'], null, false);
 
     // also need the overal product QOH and ATP for each product
-    atpMap = FastMap.newInstance();
-    qohMap = FastMap.newInstance();
+    atpMap = [:];
+    qohMap = [:];
     
     // build a list of productIds
-    productIds = new HashSet();
-    for (iter = physicalInventory.iterator(); iter.hasNext(); ) {
-        productIds.add(iter.next().get("productId"));
+    productIds = [] as Set;
+    physicalInventory.each { iter ->
+        productIds.add(iter.productId);
     }
 
     // for each product, call the inventory counting service
-    for (iter = productIds.iterator(); iter.hasNext(); ) {
-        productId = iter.next();
-        result = dispatcher.runSync("getInventoryAvailableByFacility", UtilMisc.toMap("facilityId", facilityId, "productId", productId));
+    productIds.each { productId ->
+        result = dispatcher.runSync("getInventoryAvailableByFacility", [facilityId : facilityId, productId : productId]);
         if (!ServiceUtil.isError(result)) {
-            atpMap.put(productId, result.get("availableToPromiseTotal"));
-            qohMap.put(productId, result.get("quantityOnHandTotal"));
+            atpMap.put(productId, result.availableToPromiseTotal);
+            qohMap.put(productId, result.quantityOnHandTotal);
         }
     }
 
     // associate the quantities to each row and store the combined data as our list
-    physicalInventoryCombined = FastList.newInstance();
-    for (iter = physicalInventory.iterator(); iter.hasNext(); ) {
-        row = iter.next().getAllFields();
-        row.put("productATP", atpMap.get(row.get("productId")));
-        row.put("productQOH", qohMap.get(row.get("productId")));
+    physicalInventoryCombined = [];
+    physicalInventory.each { iter ->
+        row = iter.getAllFields();
+        row.productATP = atpMap.get(row.productId);
+        row.productQOH = qohMap.get(row.productId);
         physicalInventoryCombined.add(row);
     }
-    context.put("physicalInventory", physicalInventoryCombined);
-}
+    context.physicalInventory = physicalInventoryCombined;
+}
\ No newline at end of file

Copied: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy (from r667195, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy?p2=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy&p1=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.bsh&r1=667195&r2=667229&rev=667229&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy Thu Jun 12 14:17:46 2008
@@ -17,19 +17,13 @@
  * under the License.
  */
 
-import java.util.*;
-import javolution.util.FastList;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.entity.*;
-import org.ofbiz.entity.condition.*;
-import org.ofbiz.entity.transaction.*;
-
-delegator = request.getAttribute("delegator");
-dispatcher = request.getAttribute("dispatcher");
+import org.ofbiz.entity.*
+import org.ofbiz.entity.condition.*
+import org.ofbiz.entity.transaction.*
 
 action = request.getParameter("action");
 
-inventoryItemTotals = FastList.newInstance();
+inventoryItemTotals = [];
 qohGrandTotal = 0.0;
 atpGrandTotal = 0.0;
 costPriceGrandTotal = 0.0;
@@ -37,65 +31,63 @@
 totalCostPriceGrandTotal = 0.0;
 totalRetailPriceGrandTotal = 0.0;
 boolean beganTransaction = false;
-if (action != null) {
-    conditions = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "INV_DELIVERED"));
+if (action) {
+    conditions = [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "INV_DELIVERED")];
     conditions.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, null));
     conditionList = EntityCondition.makeCondition(conditions, EntityOperator.OR);
     try {
         // create resultMap to stop issue with the first puts in the while loop
-        resultMap = new HashMap();
+        resultMap = [:];
         beganTransaction = TransactionUtil.begin();
-        invItemListItr = delegator.find("InventoryItem", conditionList, null, null, UtilMisc.toList("productId"), null);
-        while ((inventoryItem = invItemListItr.next()) != null) {
-            productId = inventoryItem.getString("productId");
-            product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId));
-            productFacility = delegator.findByPrimaryKey("ProductFacility", UtilMisc.toMap("productId", productId, "facilityId", facilityId));
-            if (productFacility != null) {
+        invItemListItr = delegator.find("InventoryItem", conditionList, null, null, ['productId'], null);
+        invItemListItr.each { inventoryItem ->
+            productId = inventoryItem.productId;
+            product = delegator.findOne("Product", [productId : productId], false);
+            productFacility = delegator.findOne("ProductFacility", [productId : productId, facilityId : facilityId], false);
+            if (productFacility) {
                 quantityOnHandTotal = inventoryItem.getDouble("quantityOnHandTotal");
                 availableToPromiseTotal = inventoryItem.getDouble("availableToPromiseTotal");
                 costPrice = inventoryItem.getDouble("unitCost");
                 retailPrice = 0.0;
                 productPrices = product.getRelated("ProductPrice");
-                if (productPrices != null) {
-                    productPriceItr = productPrices.iterator();
-                    while (productPriceItr.hasNext()) {
-                        productPrice = productPriceItr.next();
-                        if (("DEFAULT_PRICE").equals(productPrice.getString("productPriceTypeId"))) {
+                if (productPrices) {
+                    productPrices.each { productPrice ->                  
+                        if (("DEFAULT_PRICE").equals(productPrice.productPriceTypeId)) {
                             retailPrice = productPrice.getDouble("price");
                         }
                     }
                 }
-                if(costPrice != null && quantityOnHandTotal != null){
+                if (costPrice && quantityOnHandTotal) {
                     totalCostPrice = costPrice * quantityOnHandTotal;
-                    resultMap.put("totalCostPrice", totalCostPrice);
+                    resultMap.totalCostPrice = totalCostPrice;
                     totalCostPriceGrandTotal += totalCostPrice;
                 }
-                if(retailPrice != null && quantityOnHandTotal != null){
+                if (retailPrice && quantityOnHandTotal) {
                     totalRetailPrice = retailPrice * quantityOnHandTotal;
-                    resultMap.put("totalRetailPrice", totalRetailPrice);
+                    resultMap.totalRetailPrice = totalRetailPrice;
                     totalRetailPriceGrandTotal += totalRetailPrice;
                 }
-                if(quantityOnHandTotal != null){
+                if (quantityOnHandTotal) {
                     qohGrandTotal += quantityOnHandTotal;
                 }
-                if(availableToPromiseTotal != null){
+                if (availableToPromiseTotal) {
                     atpGrandTotal += availableToPromiseTotal;
                 }
-                if(costPrice != null){
+                if (costPrice) {
                     costPriceGrandTotal += costPrice;
                 }
-                if(retailPrice != null){
+                if (retailPrice) {
                     retailPriceGrandTotal += retailPrice;
                 }
                 
-                resultMap = UtilMisc.toMap("productId", product.getString("productId"), "quantityOnHand", quantityOnHandTotal, "availableToPromise", availableToPromiseTotal,
-                        "costPrice", costPrice, "retailPrice", retailPrice);
+                resultMap = [productId : product.productId, quantityOnHand : quantityOnHandTotal, availableToPromise : availableToPromiseTotal,
+                             costPrice : costPrice, retailPrice : retailPrice];
                 inventoryItemTotals.add(resultMap);
             }
         }
         invItemListItr.close();
     } catch (GenericEntityException e) {
-        String errMsg = "Failure in operation, rolling back transaction";
+        errMsg = "Failure in operation, rolling back transaction";
         Debug.logError(e, errMsg, "findInventoryItemsByLabels");
         try {
             // only rollback the transaction if we started one...
@@ -112,9 +104,9 @@
     
 }
 
-inventoryItemGrandTotals = FastList.newInstance();
-inventoryItemGrandTotals.add(UtilMisc.toMap("qohGrandTotal", qohGrandTotal, "atpGrandTotal", atpGrandTotal,
-        "totalCostPriceGrandTotal", totalCostPriceGrandTotal, "totalRetailPriceGrandTotal", totalRetailPriceGrandTotal));
+inventoryItemGrandTotals = [];
+inventoryItemGrandTotals.add([qohGrandTotal : qohGrandTotal, atpGrandTotal : atpGrandTotal,
+                              totalCostPriceGrandTotal : totalCostPriceGrandTotal, totalRetailPriceGrandTotal : totalRetailPriceGrandTotal]);
 
-context.put("inventoryItemTotals", inventoryItemTotals);
-context.put("inventoryItemGrandTotals", inventoryItemGrandTotals);
+context.inventoryItemTotals = inventoryItemTotals;
+context.inventoryItemGrandTotals = inventoryItemGrandTotals;
\ No newline at end of file

Copied: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.groovy (from r667195, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.groovy?p2=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.groovy&p1=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.bsh&r1=667195&r2=667229&rev=667229&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.groovy Thu Jun 12 14:17:46 2008
@@ -17,25 +17,18 @@
  * under the License.
  */
 
-import java.util.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-
 // get physicalInventoryAndVarianceDatas if this is a NON_SERIAL_INV_ITEM
-if (inventoryItem != null && "NON_SERIAL_INV_ITEM".equals(inventoryItem.getString("inventoryItemTypeId"))) {
-    physicalInventoryAndVariances = delegator.findByAnd("PhysicalInventoryAndVariance", UtilMisc.toMap("inventoryItemId", inventoryItemId), UtilMisc.toList("-physicalInventoryDate", "-physicalInventoryId"));
+if (inventoryItem && "NON_SERIAL_INV_ITEM".equals(inventoryItem.inventoryItemTypeId)) {
+    physicalInventoryAndVariances = delegator.findList("PhysicalInventoryAndVariance", EntityCondition.makeCondition([inventoryItemId : inventoryItemId]), null, ['-physicalInventoryDate', '-physicalInventoryId'], null, false);
     physicalInventoryAndVarianceDatas = new ArrayList(physicalInventoryAndVariances.size());
-    physicalInventoryAndVarianceIter = physicalInventoryAndVariances.iterator();
-    while (physicalInventoryAndVarianceIter.hasNext()) {
-        physicalInventoryAndVariance = physicalInventoryAndVarianceIter.next();
-        physicalInventoryAndVarianceData = new HashMap();
+    physicalInventoryAndVariances.each { physicalInventoryAndVariance ->
+        physicalInventoryAndVarianceData = [:];
         physicalInventoryAndVarianceDatas.add(physicalInventoryAndVarianceData);
 
-        physicalInventoryAndVarianceData.put("physicalInventoryAndVariance", physicalInventoryAndVariance);
-        physicalInventoryAndVarianceData.put("varianceReason", physicalInventoryAndVariance.getRelatedOneCache("VarianceReason"));
-        physicalInventoryAndVarianceData.put("person", physicalInventoryAndVariance.getRelatedOne("Person"));
-        physicalInventoryAndVarianceData.put("partyGroup", physicalInventoryAndVariance.getRelatedOne("PartyGroup"));
+        physicalInventoryAndVarianceData.physicalInventoryAndVariance = physicalInventoryAndVariance;
+        physicalInventoryAndVarianceData.varianceReason = physicalInventoryAndVariance.getRelatedOneCache("VarianceReason");
+        physicalInventoryAndVarianceData.person = physicalInventoryAndVariance.getRelatedOne("Person");
+        physicalInventoryAndVarianceData.partyGroup = physicalInventoryAndVariance.getRelatedOne("PartyGroup");
     }
-
-    context.put("physicalInventoryAndVarianceDatas", physicalInventoryAndVarianceDatas);
-}
+    context.physicalInventoryAndVarianceDatas = physicalInventoryAndVarianceDatas;
+}
\ No newline at end of file

Copied: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy (from r667195, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/receiveInventory.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy?p2=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy&p1=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/receiveInventory.bsh&r1=667195&r2=667229&rev=667229&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/receiveInventory.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy Thu Jun 12 14:17:46 2008
@@ -17,60 +17,54 @@
  * under the License.
  */
 
-import org.ofbiz.entity.*;
-import org.ofbiz.entity.util.*;
-import org.ofbiz.entity.condition.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.service.ServiceUtil;
+import org.ofbiz.entity.util.*
+import org.ofbiz.entity.condition.*
+import org.ofbiz.service.ServiceUtil
 
-delegator = request.getAttribute("delegator");
-dispatcher = request.getAttribute("dispatcher");
 facilityId = request.getParameter("facilityId");
 purchaseOrderId = request.getParameter("purchaseOrderId");
 productId = request.getParameter("productId");
 shipmentId = request.getParameter("shipmentId");
 
 facility = null;
-if (facilityId != null) {
-    facility = delegator.findByPrimaryKey("Facility", UtilMisc.toMap("facilityId", facilityId));
+if (facilityId) {
+    facility = delegator.findOne("Facility", [facilityId : facilityId], false);
 }
 
 ownerAcctgPref = null;
-if (facility != null) {
+if (facility) {
     owner = facility.getRelatedOne("OwnerParty");
-    if (owner != null) {
-        result = dispatcher.runSync("getPartyAccountingPreferences", UtilMisc.toMap("organizationPartyId", owner.getString("partyId"), "userLogin", request.getAttribute("userLogin")));
-        if (!ServiceUtil.isError(result) && result.get("partyAccountingPreference") != null) {
-            ownerAcctgPref = result.get("partyAccountingPreference");
+    if (owner) {
+        result = dispatcher.runSync("getPartyAccountingPreferences", [organizationPartyId : owner.partyId, userLogin : request.getAttribute("userLogin")]);
+        if (!ServiceUtil.isError(result) && result.partyAccountingPreference) {
+            ownerAcctgPref = result.partyAccountingPreference;
         }
     }
 }
 
 purchaseOrder = null;
-if (purchaseOrderId != null && purchaseOrderId.length() > 0) {
-    purchaseOrder = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", purchaseOrderId));
-    if (purchaseOrder != null && !"PURCHASE_ORDER".equals(purchaseOrder.getString("orderTypeId"))) {
+if (purchaseOrderId) {
+    purchaseOrder = delegator.findOne("OrderHeader", [orderId : purchaseOrderId], false);
+    if (purchaseOrder && !"PURCHASE_ORDER".equals(purchaseOrder.orderTypeId)) {
         purchaseOrder = null;
     }
 }
 
 product = null;
-if (productId != null) {  
-    product = delegator.findByPrimaryKey("Product", UtilMisc.toMap("productId", productId));      
+if (productId) {  
+    product = delegator.findOne("Product", [productId : productId], false);      
 }
 
 shipments = null;
-if (purchaseOrder != null && shipmentId == null) {
-    issuances = delegator.findByAnd("ItemIssuance", UtilMisc.toMap("orderId", purchaseOrderId));
-    if (issuances != null) {
-        shipments = new TreeSet();
-        issueIter = issuances.iterator();
-        while (issueIter.hasNext()) {
-            issuance = issueIter.next();
+if (purchaseOrder && !shipmentId) {
+    issuances = delegator.findList("ItemIssuance", EntityCondition.makeCondition([orderId : purchaseOrderId]), null, null, null, false);
+    if (issuances) {
+        shipments = [] as TreeSet;
+        issuances.each { issuance ->
             shipment = issuance.getRelatedOne("Shipment");
-            if (!"PURCH_SHIP_RECEIVED".equals(shipment.getString("statusId")) &&
-                !"SHIPMENT_CANCELLED".equals(shipment.getString("statusId")) &&
-                (shipment.getString("destinationFacilityId") == null || facilityId.equals(shipment.getString("destinationFacilityId")))) {
+            if (!"PURCH_SHIP_RECEIVED".equals(shipment.statusId) &&
+                !"SHIPMENT_CANCELLED".equals(shipment.statusId) &&
+                (!shipment.destinationFacilityId || facilityId.equals(shipment.destinationFacilityId))) {
                 shipments.add(shipment);
             }
         }        
@@ -78,28 +72,26 @@
 }
 
 shipment = null;
-if (shipmentId != null && !shipmentId.equals("_NA_")) {
-    shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
+if (shipmentId && !shipmentId.equals("_NA_")) {
+    shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
 }
 
-shippedQuantities = new HashMap();
+shippedQuantities = [:];
 purchaseOrderItems = null;
-if (purchaseOrder != null) {
-    if (product != null) {
-        purchaseOrderItems = purchaseOrder.getRelated("OrderItem", UtilMisc.toMap("productId", productId), null);
-    } else if (shipment != null) {
+if (purchaseOrder) {
+    if (product) {
+        purchaseOrderItems = purchaseOrder.getRelated("OrderItem", [productId : productId], null);
+    } else if (shipment) {
         orderItems = purchaseOrder.getRelated("OrderItem");
-        issuances = shipment.getRelated("ItemIssuance", UtilMisc.toMap("orderId", purchaseOrderId), null);
-        issueIter = issuances.iterator();
-        exprs = new ArrayList();
-        while (issueIter.hasNext()) {
-            issuance = issueIter.next();
-            exprs.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, issuance.getString("orderItemSeqId")));
+        issuances = shipment.getRelated("ItemIssuance", [orderId : purchaseOrderId], null);
+        exprs = [] as ArrayList;
+        issuances.each { issuance ->
+            exprs.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, issuance.orderItemSeqId));
             double issuanceQty = issuance.getDouble("quantity").doubleValue();
-            if (shippedQuantities.containsKey(issuance.getString("orderItemSeqId"))) {
-                issuanceQty += ((Double)shippedQuantities.get(issuance.getString("orderItemSeqId"))).doubleValue();
+            if (shippedQuantities.containsKey(issuance.orderItemSeqId)) {
+                issuanceQty += ((Double)shippedQuantities.get(issuance.orderItemSeqId)).doubleValue();
             }
-            shippedQuantities.put(issuance.getString("orderItemSeqId"), issuanceQty);
+            shippedQuantities.put(issuance.orderItemSeqId, issuanceQty);
         }              
         purchaseOrderItems = EntityUtil.filterByOr(orderItems, exprs);
     } else {    
@@ -107,83 +99,78 @@
     }
 }
 // convert the unit prices to that of the facility owner's currency
-if (purchaseOrder != null && facility != null) {
-    if (ownerAcctgPref != null) {
-        ownerCurrencyUomId = ownerAcctgPref.get("baseCurrencyUomId");
-        orderCurrencyUomId = purchaseOrder.get("currencyUom");
+if (purchaseOrder && facility) {
+    if (ownerAcctgPref) {
+        ownerCurrencyUomId = ownerAcctgPref.baseCurrencyUomId;
+        orderCurrencyUomId = purchaseOrder.currencyUom;
         if (!orderCurrencyUomId.equals(ownerCurrencyUomId)) {
-            for (iter = purchaseOrderItems.iterator(); iter.hasNext(); ) {
-                item = iter.next();
+            purchaseOrderItems.each { item ->
                 serviceResults = dispatcher.runSync("convertUom",
-                        UtilMisc.toMap("uomId", orderCurrencyUomId, "uomIdTo", ownerCurrencyUomId, "originalValue", item.get("unitPrice")));
+                        [uomId : orderCurrencyUomId, uomIdTo : ownerCurrencyUomId, originalValue : item.unitPrice]);
                 if (ServiceUtil.isError(serviceResults)) {
                     request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(serviceResults));
                     return;
                 } else {
-                    convertedValue = serviceResults.get("convertedValue");
-                    if (convertedValue != null) {
-                        item.put("unitPrice", convertedValue);
+                    convertedValue = serviceResults.convertedValue;
+                    if (convertedValue) {
+                        item.unitPrice = convertedValue;
                     }
                 }
             }
         }
 
         // put the pref currency in the map for display and form use
-        context.put("currencyUomId", ownerCurrencyUomId);
+        context.currencyUomId = ownerCurrencyUomId;
     } else {
         request.setAttribute("_ERROR_MESSAGE_", "Either no owner party was set for this facility, or no accounting preferences were set for this owner party.");
     }
 }
-receivedQuantities = new HashMap();
-salesOrderItems = new HashMap();
-if (purchaseOrderItems != null && purchaseOrderItems.size() > 0) {
-    context.put("firstOrderItem", EntityUtil.getFirst(purchaseOrderItems));
-    context.put("purchaseOrderItemsSize", purchaseOrderItems.size());
-    itemsIter = purchaseOrderItems.iterator();
-    while (itemsIter.hasNext()) {
+receivedQuantities = [:];
+salesOrderItems = [:];
+if (purchaseOrderItems) {
+    context.firstOrderItem = EntityUtil.getFirst(purchaseOrderItems);
+    context.purchaseOrderItemsSize = purchaseOrderItems.size();
+    purchaseOrderItems.each { thisItem ->
         totalReceived = 0.0;
-        thisItem = itemsIter.next();
         receipts = thisItem.getRelated("ShipmentReceipt");
-        if (receipts != null && receipts.size() > 0) {
-            recIter = receipts.iterator();
-            while (recIter.hasNext()) {
-                rec = recIter.next();
-                if (shipment != null) {
-                    if (rec.getString("shipmentId") == null ||
-                        !rec.getString("shipmentId").equals(shipment.getString("shipmentId"))) {
+        if (receipts) {
+            while (rec = receipts.next()) {
+                if (shipment) {
+                    if (!rec.shipmentId || !rec.shipmentId.equals(shipment.shipmentId)) {
                         continue;
                     }
                 }
                 accepted = rec.getDouble("quantityAccepted");
                 rejected = rec.getDouble("quantityRejected");
-                if (accepted != null)
+                if (accepted)
                     totalReceived += accepted.doubleValue();
-                if (rejected != null)
+                if (rejected)
                     totalReceived += rejected.doubleValue();                                            
             }            
         }
-        receivedQuantities.put(thisItem.getString("orderItemSeqId"), new Double(totalReceived));
+        receivedQuantities.put(thisItem.orderItemSeqId, new Double(totalReceived));
         //----------------------
-        salesOrderItemAssocs = delegator.findByAnd("OrderItemAssoc", UtilMisc.toMap("orderItemAssocTypeId", "PURCHASE_ORDER",
-                                                                                    "toOrderId", thisItem.getString("orderId"),
-                                                                                    "toOrderItemSeqId", thisItem.getString("orderItemSeqId")));
-        if (salesOrderItemAssocs != null && salesOrderItemAssocs.size() > 0) {
+        salesOrderItemAssocs = delegator.findList("OrderItemAssoc", [orderItemAssocTypeId : 'PURCHASE_ORDER',
+                                                                     toOrderId : thisItem.orderId,
+                                                                     toOrderItemSeqId : thisItem.orderItemSeqId],
+                                                                     null, null, null, false);
+        if (salesOrderItemAssocs) {
             salesOrderItem = EntityUtil.getFirst(salesOrderItemAssocs);
-            salesOrderItems.put(thisItem.getString("orderItemSeqId"), salesOrderItem);        
+            salesOrderItems.put(thisItem.orderItemSeqId, salesOrderItem);        
         }
     }
 }
 
 receivedItems = null;
-if (purchaseOrder != null) {
-    receivedItems = delegator.findByAnd("ShipmentReceiptAndItem", UtilMisc.toMap("orderId", purchaseOrderId, "facilityId", facilityId));
-    context.put("receivedItems", receivedItems);
+if (purchaseOrder) {
+    receivedItems = delegator.findList("ShipmentReceiptAndItem", [orderId : purchaseOrderId, facilityId : facilityId], null, null, null, false);
+    context.receivedItems = receivedItems;
 }
 
-String invalidProductId = null;
-if (productId != null && productId.length() > 0 && product == null) {
+invalidProductId = null;
+if (productId && !product) {
     invalidProductId = "No product found with product ID: [" + productId + "]";
-    context.put("invalidProductId", invalidProductId);
+    context.invalidProductId = invalidProductId;
 }
 
 // reject reasons
@@ -196,45 +183,46 @@
 facilities = delegator.findList("Facility", null, null, null, null, false);
 
 // default per unit cost for both shipment or individual product
-standardCosts = new HashMap();
-if (ownerAcctgPref != null) {
+standardCosts = [:];
+if (ownerAcctgPref) {
 
     // get the unit cost of the products in a shipment
-    if (purchaseOrderItems != null) {
-        for (iter = purchaseOrderItems.iterator(); iter.hasNext(); ) {
-            orderItem = iter.next();
-            productId = orderItem.get("productId");
-            if (productId == null) continue;
+    if (purchaseOrderItems) {
+        while (orderItem = purchaseOrderItems.next()) {        
+            productId = orderItem.productId;
+            if (!productId) {
+                continue;
+            }
 
-            result = dispatcher.runSync("getProductCost", UtilMisc.toMap("productId", productId, "currencyUomId", ownerAcctgPref.get("baseCurrencyUomId"),
-                        "costComponentTypePrefix", "EST_STD", "userLogin", request.getAttribute("userLogin")));
+            result = dispatcher.runSync("getProductCost", [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId,
+                                                           costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")]);
             if (!ServiceUtil.isError(result)) {
-                standardCosts.put(productId, result.get("productCost"));
+                standardCosts.put(productId, result.productCost);
             }
         }
     }
 
     // get the unit cost of a single product
-    if (productId != null) {
-        result = dispatcher.runSync("getProductCost", UtilMisc.toMap("productId", productId, "currencyUomId", ownerAcctgPref.get("baseCurrencyUomId"),
-                    "costComponentTypePrefix", "EST_STD", "userLogin", request.getAttribute("userLogin")));
+    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.get("productCost"));
+            standardCosts.put(productId, result.productCost);
         }
     }
 }
 
-context.put("facilityId", facilityId);
-context.put("facility", facility);
-context.put("purchaseOrder", purchaseOrder);
-context.put("product", product);
-context.put("shipments", shipments);
-context.put("shipment", shipment);
-context.put("shippedQuantities", shippedQuantities);
-context.put("purchaseOrderItems", purchaseOrderItems);
-context.put("receivedQuantities", receivedQuantities);
-context.put("salesOrderItems", salesOrderItems);
-context.put("rejectReasons", rejectReasons);
-context.put("inventoryItemTypes", inventoryItemTypes);
-context.put("facilities", facilities);
-context.put("standardCosts", standardCosts);
+context.facilityId = facilityId;
+context.facility = facility;
+context.purchaseOrder = purchaseOrder;
+context.product = product;
+context.shipments = shipments;
+context.shipment = shipment;
+context.shippedQuantities = shippedQuantities;
+context.purchaseOrderItems = purchaseOrderItems;
+context.receivedQuantities = receivedQuantities;
+context.salesOrderItems = salesOrderItems;
+context.rejectReasons = rejectReasons;
+context.inventoryItemTypes = inventoryItemTypes;
+context.facilities = facilities;
+context.standardCosts = standardCosts;
\ No newline at end of file

Copied: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.groovy (from r667195, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.groovy?p2=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.groovy&p1=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.bsh&r1=667195&r2=667229&rev=667229&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.groovy Thu Jun 12 14:17:46 2008
@@ -16,89 +16,84 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
-import java.util.*;
-import java.io.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.entity.util.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.widget.html.*;
-
-delegator = request.getAttribute("delegator");
-
-String facilityId = request.getParameter("facilityId");
-
-String inventoryTransferId = request.getParameter("inventoryTransferId");
-context.put("inventoryTransferId", inventoryTransferId);
-
-String inventoryItemId = request.getParameter("inventoryItemId");
-
-GenericValue inventoryTransfer = null;
-GenericValue inventoryItem = null;
-GenericValue inventoryItemType = null;
-GenericValue inventoryStatus = null;
-
-if (inventoryTransferId != null) {
-    inventoryTransfer = delegator.findByPrimaryKey("InventoryTransfer", UtilMisc.toMap("inventoryTransferId", inventoryTransferId));
-    if (inventoryTransfer != null) {
-        context.put("inventoryTransfer", inventoryTransfer);
-        if (facilityId == null) {
-            facilityId = inventoryTransfer.getString("facilityId");
-            parameters.put("facilityId", facilityId);
+
+import org.ofbiz.entity.condition.*
+import org.ofbiz.entity.util.*
+
+facilityId = request.getParameter("facilityId");
+
+inventoryTransferId = request.getParameter("inventoryTransferId");
+context.inventoryTransferId = inventoryTransferId;
+
+inventoryItemId = request.getParameter("inventoryItemId");
+inventoryTransfer = null;
+
+if (inventoryTransferId) {
+    inventoryTransfer = delegator.findOne("InventoryTransfer", [inventoryTransferId : inventoryTransferId], false);
+    if (inventoryTransfer) {
+        context.inventoryTransfer = inventoryTransfer;
+        if (!facilityId) {
+            facilityId = inventoryTransfer.facilityId;
+            parameters.facilityId = facilityId;
         }
-        if (inventoryItemId == null) {
-            inventoryItemId = inventoryTransfer.getString("inventoryItemId");
+        if (!inventoryItemId) {
+            inventoryItemId = inventoryTransfer.inventoryItemId;
         }
     }
 }
-GenericValue facility = null;
-facility = delegator.findByPrimaryKey("Facility", UtilMisc.toMap("facilityId", facilityId));
-context.put("facilityId", facilityId);
-context.put("facility", facility);
-context.put("inventoryItemId", inventoryItemId);
 
-if (facilityId != null) {
-    facility = delegator.findByPrimaryKey("Facility", UtilMisc.toMap("facilityId", facilityId));
+facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+context.facilityId = facilityId;
+context.facility = facility;
+context.inventoryItemId = inventoryItemId;
+
+if (facilityId) {
+    facility = delegator.findOne("Facility", [facilityId : facilityId], false);
 }
 
 String illegalInventoryItem = null;
-if (inventoryItemId != null) {
-    inventoryItem = delegator.findByPrimaryKey("InventoryItem", UtilMisc.toMap("inventoryItemId", inventoryItemId));
-    if (facilityId != null && inventoryItem != null && inventoryItem.get("facilityId") != null && !inventoryItem.getString("facilityId").equals(facilityId)) {
+if (inventoryItemId) {
+    inventoryItem = delegator.findOne("InventoryItem", [inventoryItemId : inventoryItemId], false);
+    if (facilityId && inventoryItem && inventoryItem.facilityId && !inventoryItem.facilityId.equals(facilityId)) {
         illegalInventoryItem = "Inventory item not found for this facility.";
         inventoryItem = null;
     }
-    if (inventoryItem != null) {
-        context.put("inventoryItem", inventoryItem);
+    if (inventoryItem) {
+        context.inventoryItem = inventoryItem;
         inventoryItemType = inventoryItem.getRelatedOne("InventoryItemType");
     
-        if (inventoryItemType != null) context.put("inventoryItemType", inventoryItemType);
-        if (inventoryItem.getString("statusId") != null) {
+        if (inventoryItemType) {
+            context.inventoryItemType = inventoryItemType;
+        }      
+        if (inventoryItem.statusId) {
             inventoryStatus = inventoryItem.getRelatedOne("StatusItem");
-            if (inventoryStatus != null) context.put("inventoryStatus", inventoryStatus);
+            if (inventoryStatus) {
+                context.inventoryStatus = inventoryStatus;
+            }
         }
     }
 }
 
 // facilities
-List facilities = delegator.findList("Facility", null, null, null, null, false);
-context.put("facilities", facilities);
+context.facilities = delegator.findList("Facility", null, null, null, null, false);
 
 // status items
-if (inventoryTransfer != null && UtilValidate.isNotEmpty(inventoryTransfer.getString("statusId"))) {
-    List statusChange = delegator.findByAnd("StatusValidChange", UtilMisc.toMap("statusId", inventoryTransfer.getString("statusId")));
-    if (statusChange != null) {
-        List statusItems = new ArrayList();
-        Iterator statusChangeIter = statusChange.iterator();
-        while (statusChangeIter.hasNext()) {
-            GenericValue curStatusChange = (GenericValue) statusChangeIter.next();
-            GenericValue curStatusItem = delegator.findByPrimaryKey("StatusItem", UtilMisc.toMap("statusId", curStatusChange.get("statusIdTo")));
-            if (curStatusItem != null) statusItems.add(curStatusItem);
+if (inventoryTransfer && inventoryTransfer.statusId) {
+    statusChange = delegator.findList("StatusValidChange", EntityCondition.makeCondition([statusId : inventoryTransfer.statusId]), null, null, null, false);
+    if (statusChange) {
+        statusItems = [] as ArrayList;
+        statusChange.each { curStatusChange ->
+            curStatusItem = delegator.findOne("StatusItem", [statusId : curStatusChange.statusIdTo], false);
+            if (curStatusItem) {
+                statusItems.add(curStatusItem);
+            }
         }
-        List statusItem = EntityUtil.orderBy(statusItems, UtilMisc.toList("sequenceId"));
-        context.put("statusItems", statusItems);
+        statusItem = EntityUtil.orderBy(statusItems, ['sequenceId']);
+        context.statusItems = statusItems;
     }
 } else {
-    List statusItems = delegator.findByAnd("StatusItem", UtilMisc.toMap("statusTypeId", "INVENTORY_XFER_STTS"), UtilMisc.toList("sequenceId"));
-    if (statusItems != null) context.put("statusItems", statusItems);
-}
+    statusItems = delegator.findList("StatusItem", EntityCondition.makeCondition([statusTypeId : 'INVENTORY_XFER_STTS']), null, ['sequenceId'], null, false);
+    if (statusItems) {
+        context.statusItems = statusItems;
+    }
+}
\ No newline at end of file

Copied: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/ReceiveReturn.groovy (from r667195, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/receiveReturn.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/ReceiveReturn.groovy?p2=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/ReceiveReturn.groovy&p1=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/receiveReturn.bsh&r1=667195&r2=667229&rev=667229&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/receiveReturn.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/returns/ReceiveReturn.groovy Thu Jun 12 14:17:46 2008
@@ -19,77 +19,69 @@
 
 import org.ofbiz.entity.*;
 import org.ofbiz.entity.util.*;
-import org.ofbiz.base.util.*;
 
-delegator = request.getAttribute("delegator");
 facilityId = request.getParameter("facilityId");
 returnId = request.getParameter("returnId");
 
 facility = null;
-if (facilityId != null) {
-    facility = delegator.findByPrimaryKey("Facility", UtilMisc.toMap("facilityId", facilityId));
+if (facilityId) {
+    facility = delegator.findOne("Facility", [facilityId : facilityId], false);
 }
 
 returnHeader = null;
 returnItems = null;
-if (returnId != null) {
-    returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId));    
-    if (returnHeader != null) {
-        if (returnHeader.getString("statusId").equals("RETURN_ACCEPTED")) {
+if (returnId) {
+    returnHeader = delegator.findOne("ReturnHeader", [returnId : returnId], false);
+    if (returnHeader) {
+        if ("RETURN_ACCEPTED".equals(returnHeader.statusId)) {
             returnItems = returnHeader.getRelated("ReturnItem");
-        } else if (returnHeader.getString("statusId").equals("RETURN_REQUESTED")) {
+        } else if ("RETURN_REQUESTED".equals(returnHeader.statusId)) {
             uiLabelMap = UtilProperties.getResourceBundleMap("ProductErrorUiLabels", locale);
-            ProductReturnRequestedOK = uiLabelMap.get("ProductReturnRequestedOK");
+            ProductReturnRequestedOK = uiLabelMap.ProductReturnRequestedOK;
             request.setAttribute("_EVENT_MESSAGE_", ProductReturnRequestedOK + " (#" + returnId.toString() + ")" );
-        }  else if (!returnHeader.getString("statusId").equals("RETURN_RECEIVED")) {
+        }  else if ("RETURN_RECEIVED".equals(!returnHeader.statusId)) {
             uiLabelMap = UtilProperties.getResourceBundleMap("ProductErrorUiLabels", locale);
-            ProductReturnNotYetAcceptedOrAlreadyReceived = uiLabelMap.get("ProductReturnNotYetAcceptedOrAlreadyReceived");
+            ProductReturnNotYetAcceptedOrAlreadyReceived = uiLabelMap.ProductReturnNotYetAcceptedOrAlreadyReceived;
             request.setAttribute("_ERROR_MESSAGE_", ProductReturnNotYetAcceptedOrAlreadyReceived + " (#" + returnId.toString() + ")" );
         }
     }
 }
 
-receivedQuantities = new HashMap();
-if (returnItems != null && returnItems.size() > 0) {
-    context.put("firstOrderItem", EntityUtil.getFirst(returnItems));
-    context.put("returnItemsSize", returnItems.size());
-    itemsIter = returnItems.iterator();
-    while (itemsIter.hasNext()) {
+receivedQuantities = [:];
+if (returnItems) {
+    context.firstOrderItem = EntityUtil.getFirst(returnItems);
+    context.returnItemsSize = returnItems.size();
+    returnItems.each { thisItem ->
         totalReceived = 0.0;
-        thisItem = itemsIter.next();
         receipts = thisItem.getRelated("ShipmentReceipt");
-        if (receipts != null && receipts.size() > 0) {
-            recIter = receipts.iterator();
-            while (recIter.hasNext()) {
-                rec = recIter.next();
+        if (receipts) {
+            receipts.each { rec ->
                 accepted = rec.getDouble("quantityAccepted");
                 rejected = rec.getDouble("quantityRejected");
-                if (accepted != null)
+                if (accepted)
                     totalReceived += accepted.doubleValue();
-                if (rejected != null)
-                    totalReceived += rejected.doubleValue();                                            
-            }            
+                if (rejected)
+                    totalReceived += rejected.doubleValue();
+            }
         }
-        receivedQuantities.put(thisItem.getString("returnItemSeqId"), new Double(totalReceived));        
+        receivedQuantities.put(thisItem.returnItemSeqId = new Double(totalReceived));
     }
 }
 
-receivedItems = null;
-if (returnHeader != null) {
-    receivedItems = delegator.findByAnd("ShipmentReceipt", UtilMisc.toMap("returnId", returnId));
-    context.put("receivedItems", receivedItems);
+if (returnHeader) {
+    context.receivedItems = delegator.findList("ShipmentReceipt", [returnId : returnId], null, null, null, false);
 }
 
 // facilities
 facilities = delegator.findList("Facility", null, null, null, null, false);
 
 //all possible inventory item types
-inventoryItemTypes = delegator.findList("InventoryItemType", null, null, UtilMisc.toList("description"), null, true);
+inventoryItemTypes = delegator.findList("InventoryItemType", null, null, ['description'], null, true);
 
-context.put("facilityId", facilityId);
-context.put("facility", facility);
-context.put("returnHeader", returnHeader);
-context.put("returnItems", returnItems);
-context.put("receivedQuantities", receivedQuantities);
-context.put("facilities", facilities);
-context.put("inventoryItemTypes", inventoryItemTypes);
+context.facilityId = facilityId;
+context.facility = facility;
+context.returnHeader = returnHeader;
+context.returnItems = returnItems;
+context.receivedQuantities = receivedQuantities;
+context.facilities = facilities;
+context.inventoryItemTypes = inventoryItemTypes;
\ No newline at end of file

Modified: ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml?rev=667229&r1=667228&r2=667229&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/facility/FacilityScreens.xml Thu Jun 12 14:17:46 2008
@@ -558,7 +558,7 @@
                 <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="50"/>
                 
                 <entity-one entity-name="Facility" value-name="facility" use-cache="true"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonFacilityDecorator" location="${parameters.commonFacilityDecoratorLocation}">
@@ -590,7 +590,7 @@
                 <set field="tabButtonItem" value="ViewFacilityInventoryByProduct"/>
                 <set field="facilityId" from-field="parameters.facilityId"/>
                 <entity-one entity-name="Facility" value-name="facility" use-cache="true"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy"/>
                 <property-map resource="ProductUiLabels" map-name="uiLabelMap"/>
                 <set field="title" value="${uiLabelMap.PageTitleInventoryItemGrandTotals}"/>
             </actions>
@@ -618,7 +618,7 @@
                 <set field="viewSize" from-field="parameters.VIEW_SIZE" type="Integer" default-value="10000"/>
                 
                 <entity-one entity-name="Facility" value-name="facility" use-cache="true"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/InventoryItemTotals.groovy"/>
             </actions>
             <widgets>
                 <container>
@@ -823,7 +823,7 @@
                                 <if-compare field-name="inventoryItem.inventoryItemTypeId" operator="equals" value="NON_SERIAL_INV_ITEM"/>
                             </condition>
                             <actions>
-                                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.bsh"/>
+                                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/PhysicalInventoryVariance.groovy"/>
                             </actions>
                             <widgets>
                                 <screenlet id="physical-inventory-variances" title="${uiLabelMap.ProductPhysicalInventoryVariances}" collapsible="true">
@@ -929,7 +929,7 @@
                 <set field="titleProperty" value="PageTitleFindFacilityPhysicalInventory"/>
                 <set field="headerItem" value="facility"/>
                 <set field="tabButtonItem" value="PhysicalInventory"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/FindFacilityPhysicalInventory.groovy"/>
 
             </actions>
             <widgets>
@@ -973,7 +973,7 @@
         <section>
             <actions>
                 <set field="tabButtonItem" value="FindFacilityTransfers"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/TransferInventoryItem.groovy"/>
                 <set field="facilityId" from-field="parameters.facilityId"/>
                 <entity-one entity-name="Facility" value-name="facility"/>
                 <property-map resource="ProductUiLabels" map-name="uiLabelMap"/>
@@ -995,7 +995,7 @@
         <section>
             <actions>
                 <set field="tabButtonItem" value="ReceiveInventory"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/receiveInventory.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/inventory/ReceiveInventory.groovy"/>
                 <set field="facilityId" from-field="parameters.facilityId"/>
                 <entity-one entity-name="Facility" value-name="facility"/>
                 <property-map resource="ProductUiLabels" map-name="uiLabelMap"/>
@@ -1019,7 +1019,7 @@
                 <set field="headerItem" value="facility"/>
                 <set field="tabButtonItem" value="ReceiveReturn"/>
 
-                <script location="component://product/webapp/facility/WEB-INF/actions/returns/receiveReturn.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/returns/ReceiveReturn.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonFacilityDecorator" location="${parameters.commonFacilityDecoratorLocation}">
@@ -1310,4 +1310,4 @@
         </section>
     </screen>    
 
-</screens>
+</screens>
\ No newline at end of file