You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mr...@apache.org on 2008/06/13 22:27:17 UTC

svn commit: r667640 [2/2] - in /ofbiz/trunk/applications/product: webapp/facility/WEB-INF/actions/shipment/ widget/facility/

Copied: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy (from r667620, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy?p2=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy&p1=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.bsh&r1=667620&r2=667640&rev=667640&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy Fri Jun 13 13:27:17 2008
@@ -17,55 +17,53 @@
  * under the License.
  */
 
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.order.order.*;
-import org.ofbiz.entity.util.EntityUtil;
-
-facilityId = parameters.get("facilityId");
-if (UtilValidate.isNotEmpty(facilityId)) {
-    facility = delegator.findByPrimaryKey("Facility", UtilMisc.toMap("facilityId", facilityId));
-    context.put("facilityId", facilityId);
-    context.put("facility", facility);
+import org.ofbiz.base.util.*
+import org.ofbiz.order.order.*
+import org.ofbiz.entity.util.EntityUtil
+
+facilityId = parameters.facilityId;
+if (facilityId) {
+    facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+    context.facilityId = facilityId;
+    context.facility = facility;
 }
 
 // order based packing
-orderId = parameters.get("orderId");
-shipGroupSeqId = parameters.get("shipGroupSeqId");
-shipmentId = parameters.get("shipmentId");
-if (shipmentId == null) {
+orderId = parameters.orderId;
+shipGroupSeqId = parameters.shipGroupSeqId;
+shipmentId = parameters.shipmentId;
+if (!shipmentId) {
     shipmentId = request.getAttribute("shipmentId");
 }
-context.put("shipmentId", shipmentId);
+context.shipmentId = shipmentId;
 
 // If a shipment exists, provide the IDs of any related invoices
-if (UtilValidate.isNotEmpty(shipmentId)) {
-
+if (shipmentId) {
     // Get the primaryOrderId from the shipment
-    shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
-    if (shipment != null && shipment.getString("primaryOrderId") != null) {
-        orderItemBillingList = delegator.findByAnd("OrderItemBilling", UtilMisc.toMap("orderId", shipment.getString("primaryOrderId")), UtilMisc.toList("invoiceId"));
+    shipment = delegator.findOne("Shipment",  [shipmentId : shipmentId], false);
+    if (shipment && shipment.primaryOrderId) {
+        orderItemBillingList = delegator.findList("OrderItemBilling", EntityCondition.makeCondition([orderId : shipment.primaryOrderId]), null, ['invoiceId'], null, false);
         invoiceIds = EntityUtil.getFieldListFromEntityList(orderItemBillingList, "invoiceId", true);
-        if (invoiceIds != null) {
-            context.put("invoiceIds", invoiceIds);
+        if (invoiceIds) {
+            context.invoiceIds = invoiceIds;
         }
     }
 }
 
 // validate order information
-if (UtilValidate.isNotEmpty(orderId) && UtilValidate.isEmpty(shipGroupSeqId) && orderId.indexOf("/") > -1) {
+if (orderId && !shipGroupSeqId && orderId.indexOf("/") > -1) {
     // split the orderID/shipGroupSeqID
     idSplit = orderId.split("\\/");
     orderId = idSplit[0];
     shipGroupSeqId = idSplit[1];
-} else if (orderId != null && UtilValidate.isEmpty(shipGroupSeqId)) {
+} else if (orderId && !shipGroupSeqId) {
     shipGroupSeqId = "00001";
 }
 
 // setup the packing session
 packSession = session.getAttribute("packingSession");
-clear = parameters.get("clear");
-if (packSession == null) {
+clear = parameters.clear;
+if (!packSession) {
     packSession = new org.ofbiz.shipment.packing.PackingSession(dispatcher, userLogin);
     session.setAttribute("packingSession", packSession);
     Debug.log("Created NEW packing session!!");
@@ -73,31 +71,31 @@
     if (packSession.getStatus() == 0) {
         OrderReadHelper orh = new OrderReadHelper(delegator, orderId);
         shipGrp = orh.getOrderItemShipGroup(shipGroupSeqId);
-        context.put("shippedShipGroupSeqId", shipGroupSeqId);
-        context.put("shippedOrderId", orderId);
-        context.put("shippedCarrier", shipGrp.get("carrierPartyId"));
+        context.shippedShipGroupSeqId = shipGroupSeqId;
+        context.shippedOrderId = orderId;
+        context.shippedCarrier = shipGrp.carrierPartyId;
 
         packSession.clear();
         shipGroupSeqId = null;
         orderId = null;
-    } else if (clear != null) {
+    } else if (clear) {
         packSession.clear();
     }
 }
 packSession.clearItemInfos();
 
 // picklist based packing information
-picklistBinId = parameters.get("picklistBinId");
+picklistBinId = parameters.picklistBinId;
 // see if the bin ID is already set
-if (UtilValidate.isEmpty(picklistBinId)) {
+if (!picklistBinId) {
     picklistBinId = packSession.getPicklistBinId();
 }
-if (UtilValidate.isNotEmpty(picklistBinId)) {
-    bin = delegator.findByPrimaryKey("PicklistBin", UtilMisc.toMap("picklistBinId", picklistBinId));
-    if (bin != null) {
-        orderId = bin.getString("primaryOrderId");
-        shipGroupSeqId = bin.getString("primaryShipGroupSeqId");
-        packSession.addItemInfo(bin.getRelatedByAnd("PicklistItem", UtilMisc.toMap("itemStatusId", "PICKITEM_PENDING")));
+if (picklistBinId) {
+    bin = delegator.findOne("PicklistBin", [picklistBinId : picklistBinId], false);
+    if (bin) {
+        orderId = bin.primaryOrderId;
+        shipGroupSeqId = bin.primaryShipGroupSeqId;
+        packSession.addItemInfo(bin.getRelatedByAnd("PicklistItem", [itemStatusId : 'PICKITEM_PENDING']));
         //context.put("picklistItemInfos", bin.getRelatedByAnd("PicklistItem", UtilMisc.toMap("itemStatusId", "PICKITEM_PENDING")));
     }
 } else {
@@ -110,57 +108,57 @@
 packSession.setPicklistBinId(picklistBinId);
 packSession.setFacilityId(facilityId);
 
-context.put("packingSession", packSession);
-context.put("orderId", orderId);
-context.put("shipGroupSeqId", shipGroupSeqId);
-context.put("picklistBinId", picklistBinId);
+context.packingSession = packSession;
+context.orderId = orderId;
+context.shipGroupSeqId = shipGroupSeqId;
+context.picklistBinId = picklistBinId;
 
 // grab the order information
-if (UtilValidate.isNotEmpty(orderId)) {
-    orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
-    if (orderHeader != null) {
+if (orderId) {
+    orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+    if (orderHeader) {
         OrderReadHelper orh = new OrderReadHelper(orderHeader);
-        context.put("orderId", orderId);
-        context.put("orderHeader", orderHeader);
-        context.put("orderReadHelper", orh);
+        context.orderId = orderId;
+        context.orderHeader = orderHeader;
+        context.orderReadHelper = orh;
         orderItemShipGroup = orh.getOrderItemShipGroup(shipGroupSeqId);
-        context.put("orderItemShipGroup", orderItemShipGroup);
+        context.orderItemShipGroup = orderItemShipGroup;
 
-        if ("ORDER_APPROVED".equals(orderHeader.getString("statusId"))) {
-            if (UtilValidate.isNotEmpty(shipGroupSeqId)) {
+        if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
+            if (shipGroupSeqId) {
 
                 // Generate the shipment cost estimate for the ship group
                 productStoreId = orh.getProductStoreId();
                 shippableItemInfo = orh.getOrderItemAndShipGroupAssoc(shipGroupSeqId);
-                shippableItems = delegator.findByAnd("OrderItemAndShipGrpInvResAndItemSum", UtilMisc.toMap("orderId", orderId, "shipGroupSeqId", shipGroupSeqId));
+                shippableItems = delegator.findList("OrderItemAndShipGrpInvResAndItemSum", EntityCondition.makeCondition([orderId : orderId, shipGroupSeqId : shipGroupSeqId]), null, null, null, false);
                 shippableTotal = new Double(orh.getShippableTotal(shipGroupSeqId).doubleValue());
                 shippableWeight = new Double(orh.getShippableWeight(shipGroupSeqId).doubleValue());
                 shippableQuantity = new Double(orh.getShippableQuantity(shipGroupSeqId).doubleValue());
                 shipmentCostEstimate = packSession.getShipmentCostEstimate(orderItemShipGroup, productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity);
-                context.put("shipmentCostEstimateForShipGroup", shipmentCostEstimate);
-                context.put("productStoreId", productStoreId);
+                context.shipmentCostEstimateForShipGroup = shipmentCostEstimate;
+                context.productStoreId = productStoreId;
 
-                if (picklistBinId == null) {
+                if (!picklistBinId) {
                     packSession.addItemInfo(shippableItems);
                     //context.put("itemInfos", shippableItemInfo);
                 }
             } else {
-                request.setAttribute("errorMessageList", UtilMisc.toList("No ship group sequence ID. Cannot process."));
+                request.setAttribute("errorMessageList", ['No ship group sequence ID. Cannot process.']);
             }
         } else {
-            request.setAttribute("errorMessageList", UtilMisc.toList("Order #" + orderId + " is not approved for packing."));
+            request.setAttribute("errorMessageList", ["Order #" + orderId + " is not approved for packing."]);
         }
     } else {
-        request.setAttribute("errorMessageList", UtilMisc.toList("Order #" + orderId + " cannot be found."));
+        request.setAttribute("errorMessageList", ["Order #" + orderId + " cannot be found."]);
     }
 }
 
 // Try to get the defaultWeightUomId first from the facility, then from the shipment properties, and finally defaulting to kilos
 defaultWeightUomId = null; 
-if (! UtilValidate.isEmpty(facility)) {
-    defaultWeightUomId = facility.getString("defaultWeightUomId");
+if (facility) {
+    defaultWeightUomId = facility.defaultWeightUomId;
 }
-if (UtilValidate.isEmpty(defaultWeightUomId)) {
+if (!defaultWeightUomId) {
     defaultWeightUomId = UtilProperties.getPropertyValue("shipment.properties", "shipment.default.weight.uom", "WT_kg");
 }
-context.put("defaultWeightUomId", defaultWeightUomId);
+context.defaultWeightUomId = defaultWeightUomId;
\ No newline at end of file

Copied: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.groovy (from r667620, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.groovy?p2=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.groovy&p1=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.bsh&r1=667620&r2=667640&rev=667640&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.groovy Fri Jun 13 13:27:17 2008
@@ -19,30 +19,27 @@
 
 // This script gets shipment items grouped by package for use in the packing slip PDF or any screens that require by-package layout
 
-import javolution.util.FastList;
-import javolution.util.FastMap;
-import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.*;
 import org.ofbiz.entity.condition.*;
 
 // Since this script is run after ViewShipment, we will re-use the shipment in the context
-shipment = context.get("shipment");
-if (shipment == null) return;
+shipment = context.shipment;
+if (!shipment) {
+    return;
+}
 
 // get the packages related to this shipment in order of packages
-orderBy = UtilMisc.toList("shipmentPackageSeqId");
-shipmentPackages = shipment.getRelated("ShipmentPackage", orderBy);
+shipmentPackages = shipment.getRelated("ShipmentPackage", ['shipmentPackageSeqId']);
 
 // first we scan the shipment items and count the quantity of each product that is being shipped
-quantityShippedByProduct = FastMap.newInstance();
-quantityInShipmentByProduct = FastMap.newInstance();
+quantityShippedByProduct = [:];
+quantityInShipmentByProduct = [:];
 shipmentItems = shipment.getRelated("ShipmentItem");
-for (iter = shipmentItems.iterator(); iter.hasNext(); ) {
-    shipmentItem = iter.next();
-    productId = shipmentItem.get("productId");
-
+shipmentItems.each { shipmentItem ->
+    productId = shipmentItem.productId;
     shipped = quantityShippedByProduct.get(productId);
-    if (shipped == null) shipped = new Double(0);
+    if (!shipped) {
+        shipped = 0 as Double;
+    }
     shipped += shipmentItem.getDouble("quantity").doubleValue();
     quantityShippedByProduct.put(productId, shipped);
     quantityInShipmentByProduct.put(productId, shipped);
@@ -56,18 +53,16 @@
                 EntityCondition.makeCondition("shipmentTypeId", EntityOperator.EQUALS, "SALES_SHIPMENT"),
                 EntityCondition.makeCondition("createdDate", EntityOperator.LESS_THAN_EQUAL_TO, shipment.getString("createdDate"))
             ),
-        EntityOperator.AND),
-    null, null, null, null);
-
-while ((previousShipmentItem = previousShipmentIter.next()) != null) {
-    if (previousShipmentItem.getString("shipmentId").equals(shipment.getString("shipmentId")) == false) {
+        EntityOperator.AND), null, null, null, null);
+previousShipmentIter.each { previousShipmentItem ->
+    if (previousShipmentItem.shipmentId.equals(shipment.shipmentId) == false) {
         previousShipmentItems = previousShipmentItem.getRelated("ShipmentItem");
-        for (iter = previousShipmentItems.iterator(); iter.hasNext(); ) {
-            shipmentItem = iter.next();
-            productId = shipmentItem.get("productId");
-
+        previousShipmentItems.each { shipmentItem ->
+            productId = shipmentItem.productId;
             shipped = quantityShippedByProduct.get(productId);
-            if (shipped == null) shipped = new Double(0);
+            if (!shipped) {
+                shipped = new Double(0);
+            }
             shipped += shipmentItem.getDouble("quantity").doubleValue();
             quantityShippedByProduct.put(productId, shipped);
         }
@@ -76,46 +71,45 @@
 previousShipmentIter.close();
 
 // next scan the order items (via issuances) to count the quantity of each product requested
-quantityRequestedByProduct = FastMap.newInstance();
-countedOrderItems = FastMap.newInstance(); // this map is only used to keep track of the order items already counted
+quantityRequestedByProduct = [:];
+countedOrderItems = [:]; // this map is only used to keep track of the order items already counted
 order = shipment.getRelatedOne("PrimaryOrderHeader");
 issuances = order.getRelated("ItemIssuance");
-for (iter = issuances.iterator(); iter.hasNext(); ) {
-    issuance = iter.next();
+issuances.each { issuance ->
     orderItem = issuance.getRelatedOne("OrderItem");
-    productId = orderItem.get("productId");
-    if (!countedOrderItems.containsKey(orderItem.getString("orderId") + orderItem.getString("orderItemSeqId"))) {
-        countedOrderItems.put(orderItem.getString("orderId") + orderItem.getString("orderItemSeqId"), null);
+    productId = orderItem.productId;
+    if (!countedOrderItems.containsKey(orderItem.orderId + orderItem.orderItemSeqId)) {
+        countedOrderItems.put(orderItem.orderId + orderItem.orderItemSeqId, null);
         requested = quantityRequestedByProduct.get(productId);
-        if (requested == null) requested = new Double(0);
+        if (!requested) {
+            requested = new Double(0);
+        }
         cancelQuantity = orderItem.getDouble("cancelQuantity");
         quantity = orderItem.getDouble("quantity");
-        requested += quantity.doubleValue() - (cancelQuantity != null ? cancelQuantity.doubleValue() : 0);
+        requested += quantity.doubleValue() - (cancelQuantity ? cancelQuantity.doubleValue() : 0);
         quantityRequestedByProduct.put(productId, requested);
     }
 }
 
 // for each package, we want to list the quantities and details of each product
-packages = FastList.newInstance(); // note we assume that the package number is simply the index + 1 of this list
-for (iter = shipmentPackages.iterator(); iter.hasNext(); ) {
-    shipmentPackage = iter.next();
-    contents = shipmentPackage.getRelated("ShipmentPackageContent", UtilMisc.toList("shipmentItemSeqId"));
+packages = [:]; // note we assume that the package number is simply the index + 1 of this list
+shipmentPackages.each { shipmentPackage ->
+    contents = shipmentPackage.getRelated("ShipmentPackageContent", ['shipmentItemSeqId']);
 
     // each line is one logical Product and the quantities associated with it
-    lines = FastList.newInstance();
-    for (citer = contents.iterator(); citer.hasNext(); ) {
-        content = citer.next();
+    lines = [:];
+    contents.each { content ->
         shipmentItem = content.getRelatedOne("ShipmentItem");
         product = shipmentItem.getRelatedOne("Product");
 
-        line = FastMap.newInstance();
-        line.put("product", product);
-        line.put("quantityInPackage", content.get("quantity"));
-        line.put("quantityInShipment", quantityInShipmentByProduct.get(product.get("productId")));
-        line.put("quantityShipped", quantityShippedByProduct.get(product.get("productId")));
-        line.put("quantityRequested", quantityRequestedByProduct.get(product.get("productId")));
+        line = [:];
+        line.product = product;
+        line.quantityInPackage = content.quantity;
+        line.quantityInShipment = quantityInShipmentByProduct.get(product.productId);
+        line.quantityShipped = quantityShippedByProduct.get(product.productId);
+        line.quantityRequested = quantityRequestedByProduct.get(product.productId);
         lines.add(line);
     }
     packages.add(lines);
 }
-context.put("packages", packages);
+context.packages = packages;
\ No newline at end of file

Copied: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy (from r667620, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy?p2=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy&p1=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.bsh&r1=667620&r2=667640&rev=667640&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy Fri Jun 13 13:27:17 2008
@@ -17,62 +17,61 @@
  * under the License.
  */
 
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.order.order.*;
+import org.ofbiz.base.util.*
+import org.ofbiz.order.order.*
 
-facilityId = parameters.get("facilityId");
-if (UtilValidate.isNotEmpty(facilityId)) {
-    facility = delegator.findByPrimaryKey("Facility", UtilMisc.toMap("facilityId", facilityId));
-    context.put("facilityId", facilityId);
-    context.put("facility", facility);
+facilityId = parameters.facilityId;
+if (facilityId) {
+    facility = delegator.findOne("Facility", [facilityId : facilityId], false);
+    context.facilityId = facilityId;
+    context.facility = facility;
 }
 
-orderId = parameters.get("orderId");
-if (UtilValidate.isNotEmpty(orderId)) {
-    orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
-    if (orderHeader != null) {
+orderId = parameters.orderId
+if (orderId) {
+    orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+    if (orderHeader) {
         OrderReadHelper orh = new OrderReadHelper(orderHeader);
-        context.put("orderId", orderId);
-        context.put("orderHeader", orderHeader);
-        context.put("orderReadHelper", orh);
+        context.orderId = orderId;
+        context.orderHeader = orderHeader;
+        context.orderReadHelper = orh;
     } else {
         request.setAttribute("_ERROR_MESSAGE_", "<li>Order #" + orderId + " cannot be found.");
     }
 }
 
-shipmentId = parameters.get("shipmentId");
-if (UtilValidate.isNotEmpty(shipmentId)) {
-    shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
-    if (shipment != null) {
+shipmentId = parameters.shipmentId;
+if (shipmentId) {
+    shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+    if (shipment) {
         // nuke event message - throws off the flow
         request.setAttribute("_EVENT_MESSAGE_", null);
         
         // set the shipment context info
-        context.put("shipmentType", shipment.getRelatedOneCache("ShipmentType"));
-        context.put("statusItem", shipment.getRelatedOne("StatusItem"));
-        context.put("primaryOrderHeader", shipment.getRelatedOne("PrimaryOrderHeader"));
-        context.put("toPerson", shipment.getRelatedOne("ToPerson"));
-        context.put("toPartyGroup", shipment.getRelatedOne("ToPartyGroup"));
-        context.put("fromPerson", shipment.getRelatedOne("FromPerson"));
-        context.put("fromPartyGroup", shipment.getRelatedOne("FromPartyGroup"));
-        context.put("originFacility", shipment.getRelatedOne("OriginFacility"));
-        context.put("destinationFacility", shipment.getRelatedOne("DestinationFacility"));
-        context.put("originPostalAddress", shipment.getRelatedOne("OriginPostalAddress"));
-        context.put("destinationPostalAddress", shipment.getRelatedOne("DestinationPostalAddress"));
-        context.put("shipmentPackages", shipment.getRelated("ShipmentPackage", null, UtilMisc.toList("shipmentPackageSeqId")));
-        context.put("shipmentRoutes", shipment.getRelated("ShipmentRouteSegment", null, UtilMisc.toList("shipmentRouteSegmentId")));
-        context.put("shipment", shipment);
-        context.put("shipmentId", shipmentId);
+        context.shipmentType = shipment.getRelatedOneCache("ShipmentType");
+        context.statusItem = shipment.getRelatedOne("StatusItem");
+        context.primaryOrderHeader = shipment.getRelatedOne("PrimaryOrderHeader");
+        context.toPerson = shipment.getRelatedOne("ToPerson");
+        context.toPartyGroup = shipment.getRelatedOne("ToPartyGroup");
+        context.fromPerson = shipment.getRelatedOne("FromPerson");
+        context.fromPartyGroup = shipment.getRelatedOne("FromPartyGroup");
+        context.originFacility = shipment.getRelatedOne("OriginFacility");
+        context.destinationFacility = shipment.getRelatedOne("DestinationFacility");
+        context.originPostalAddress = shipment.getRelatedOne("OriginPostalAddress");
+        context.destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress");
+        context.shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId']);
+        context.shipmentRoutes = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId']);
+        context.shipment = shipment;
+        context.shipmentId = shipmentId;
         
-        weightUoms = delegator.findByAnd("Uom", UtilMisc.toMap("uomTypeId", "WEIGHT_MEASURE"), UtilMisc.toList("description"));
-        defaultWeightUom = UtilProperties.getPropertyValue("shipment.properties", "shipment.default.weight.uom");        
-        if (UtilValidate.isNotEmpty(defaultWeightUom)) {
-            defaultWeight = delegator.findByPrimaryKey("Uom", UtilMisc.toMap("uomId", defaultWeightUom));
-            if (defaultWeight != null) {
+        weightUoms = delegator.findList("Uom", EntityCondition.makeCondition(['uomTypeId' : 'WEIGHT_MEASURE']), null, ['description'], null, false);
+        defaultWeightUom = UtilProperties.getPropertyValue("shipment.properties", "shipment.default.weight.uom");
+        if (defaultWeightUom) {
+            defaultWeight = delegator.findOne("Uom", [uomId : defaultWeightUom], false);
+            if (defaultWeight) {
                 weightUoms.add(0, defaultWeight);
             }
         }
-        context.put("weightUomList", weightUoms);
+        context.weightUomList = weightUoms;
     }    
-}
+}
\ No newline at end of file

Copied: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy (from r667620, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy?p2=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy&p1=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.bsh&r1=667620&r2=667640&rev=667640&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy Fri Jun 13 13:27:17 2008
@@ -17,27 +17,25 @@
  * under the License.
  */
 
-import org.ofbiz.entity.condition.*;
-import org.ofbiz.entity.util.*;
-import org.ofbiz.service.ServiceUtil;
-import org.ofbiz.base.util.*;
-
-delegator = request.getAttribute("delegator");
+import org.ofbiz.entity.condition.*
+import org.ofbiz.entity.util.*
+import org.ofbiz.service.ServiceUtil
+import org.ofbiz.base.util.*
 
 shipmentId = request.getParameter("shipmentId");
 orderId = request.getParameter("purchaseOrderId");
 shipGroupSeqId = request.getParameter("shipGroupSeqId");
-context.put("shipmentId", shipmentId);
-context.put("shipGroupSeqId", shipGroupSeqId);
+context.shipmentId = shipmentId;
+context.shipGroupSeqId = shipGroupSeqId;
 
 // Retrieve the map resident in session which stores order item quantities to receive
 itemQuantitiesToReceive = session.getAttribute("purchaseOrderItemQuantitiesToReceive");
-if (! UtilValidate.isEmpty(itemQuantitiesToReceive)) {
-    sessionShipmentId = itemQuantitiesToReceive.get("_shipmentId");
-    sessionOrderId = itemQuantitiesToReceive.get("_orderId");
-    if ( (UtilValidate.isNotEmpty(sessionShipmentId) && ! sessionShipmentId.equals(shipmentId)) || 
-         ((UtilValidate.isNotEmpty(sessionOrderId) && ! sessionOrderId.equals(orderId)))        ||
-         "Y".equals(request.getParameter("clearAll")) ) {
+if (itemQuantitiesToReceive) {
+    sessionShipmentId = itemQuantitiesToReceive._shipmentId;
+    sessionOrderId = itemQuantitiesToReceive._orderId;
+    if ((sessionShipmentId && !sessionShipmentId.equals(shipmentId)) || 
+        ((sessionOrderId && !sessionOrderId.equals(orderId)))        ||
+         "Y".equals(request.getParameter("clearAll"))) {
 
              // Clear the map if the shipmentId or orderId are different than the current ones, or
              // if the clearAll parameter is present
@@ -45,185 +43,181 @@
     }
 }
 
-shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
-context.put("shipment", shipment);
-if (UtilValidate.isEmpty(shipment)) {
+shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
+context.shipment = shipment;
+if (!shipment) {
     return;
 }
 
-isPurchaseShipment = "PURCHASE_SHIPMENT".equals(shipment.getString("shipmentTypeId"));
-context.put("isPurchaseShipment", isPurchaseShipment);
-if (! isPurchaseShipment) {
+isPurchaseShipment = "PURCHASE_SHIPMENT".equals(shipment.shipmentTypeId);
+context.isPurchaseShipment = isPurchaseShipment;
+if (!isPurchaseShipment) {
     return;
 }
 
 facility = shipment.getRelatedOne("DestinationFacility");
-context.put("facility", facility);
-context.put("facilityId", shipment.get("destinationFacilityId"));
-context.put("now", UtilDateTime.nowTimestamp());
+context.facility = facility;
+context.facilityId = shipment.destinationFacilityId;
+context.now = UtilDateTime.nowTimestamp();
 
-if (UtilValidate.isEmpty(orderId)) {
-    orderId = shipment.get("primaryOrderId");
+if (!orderId) {
+    orderId = shipment.primaryOrderId;
 }
-if (UtilValidate.isEmpty(shipGroupSeqId)) {
-    shipGroupSeqId = shipment.get("primaryShipGroupSeqId");
+if (!shipGroupSeqId) {
+    shipGroupSeqId = shipment.primaryShipGroupSeqId;
 }
-context.put("orderId", orderId);
+context.orderId = orderId;
 
-if (UtilValidate.isEmpty(orderId)) {
+if (!orderId) {
     return;
 }
 
-orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
-context.put("orderHeader", orderHeader);
-if (UtilValidate.isEmpty(orderHeader)) {
+orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+context.orderHeader = orderHeader;
+if (!orderHeader) {
     return;
 }
 
-isPurchaseOrder = "PURCHASE_ORDER".equals(orderHeader.getString("orderTypeId"));
-context.put("isPurchaseOrder", isPurchaseOrder);
-if (! isPurchaseOrder) {
+isPurchaseOrder = "PURCHASE_ORDER".equals(orderHeader.orderTypeId);
+context.isPurchaseOrder = isPurchaseOrder;
+if (!isPurchaseOrder) {
     return;
 }
 
 // Get the base currency from the facility owner, for currency conversions
 baseCurrencyUomId = null;
-if (! UtilValidate.isEmpty(facility)) {
+if (facility) {
     owner = facility.getRelatedOne("OwnerParty");
-    if (! UtilValidate.isEmpty(owner)) {
-        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;
         }
     }
-    if (! UtilValidate.isEmpty(ownerAcctgPref)) {
-        baseCurrencyUomId = ownerAcctgPref.get("baseCurrencyUomId");
+    if (ownerAcctgPref) {
+        baseCurrencyUomId = ownerAcctgPref.baseCurrencyUomId;
     }
 }
 
 inventoryItemTypes = delegator.findList("InventoryItemType", null, null, null, null, false);
-context.put("inventoryItemTypes", inventoryItemTypes);
+context.inventoryItemTypes = inventoryItemTypes;
 
 // Populate the tracking map with shipment and order IDs
-if (UtilValidate.isEmpty(itemQuantitiesToReceive)) {
-    itemQuantitiesToReceive = UtilMisc.toMap("_shipmentId", shipmentId, "_orderId", orderId);
+if (!itemQuantitiesToReceive) {
+    itemQuantitiesToReceive = [_shipmentId : shipmentId, _orderId : orderId];
 }
 
 oiasgaLimitMap = null;
-if (! UtilValidate.isEmpty(shipGroupSeqId)) {
-    oiasgaLimitMap = UtilMisc.toMap("shipGroupSeqId", shipGroupSeqId);
+if (shipGroupSeqId) {
+    oiasgaLimitMap = [shipGroupSeqId : shipGroupSeqId];
 }
 
-orderItemDatas = new TreeMap();
+orderItemDatas = [:] as TreeMap;
 totalAvailableToReceive = 0;
 
 // Populate the order item data for the FTL
-orderItems = orderHeader.getRelated("OrderItemAndShipGroupAssoc", oiasgaLimitMap, UtilMisc.toList("shipGroupSeqId", "orderItemSeqId"));
-orderItemIter = orderItems.iterator();
-while (orderItemIter.hasNext()) {
-    orderItemAndShipGroupAssoc = orderItemIter.next();
+orderItems = orderHeader.getRelated("OrderItemAndShipGroupAssoc", oiasgaLimitMap, ['shipGroupSeqId', 'orderItemSeqId']);
+orderItems.each { orderItemAndShipGroupAssoc ->   
     product = orderItemAndShipGroupAssoc.getRelatedOne("Product");
     
     // Get the order item, since the orderItemAndShipGroupAssoc's quantity field is manipulated in some cases
-    orderItem = delegator.findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemAndShipGroupAssoc.get("orderItemSeqId")));
-    orderItemData = new HashMap();
+    orderItem = delegator.findOne("OrderItem", [orderId : orderId, orderItemSeqId : orderItemAndShipGroupAssoc.orderItemSeqId], false);
+    orderItemData = [:];
 
     // Get the item's ordered quantity
     totalOrdered = 0;
     ordered = orderItem.getDouble("quantity");
-    if (ordered != null)
+    if (ordered) {
         totalOrdered += ordered.doubleValue();
+    }
     cancelled = orderItem.getDouble("cancelQuantity");
-    if (cancelled != null)
+    if (cancelled) {
         totalOrdered -= cancelled.doubleValue();
+    }
 
     // Get the item quantity received from all shipments via the ShipmentReceipt entity
     totalReceived = 0.0;
-    receipts = delegator.findByAnd("ShipmentReceipt", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItem.get("orderItemSeqId")));
-    fulfilledReservations = new ArrayList();
-    if (receipts != null && receipts.size() > 0) {
-        recIter = receipts.iterator();
-        while (recIter.hasNext()) {
-            rec = recIter.next();
+    receipts = delegator.findList("ShipmentReceipt", EntityCondition.makeCondition([orderId : orderId, orderItemSeqId : orderItem.orderItemSeqId]), null, null, null, false);
+    fulfilledReservations = [] as ArrayList;
+    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();
+            }
             // Get the reservations related to this receipt
-            oisgirs = delegator.findByAnd("OrderItemShipGrpInvRes", UtilMisc.toMap("inventoryItemId", rec.get("inventoryItemId")));
-            if (! UtilValidate.isEmpty(oisgirs)) {
+            oisgirs = delegator.findList("OrderItemShipGrpInvRes", EntityCondition.makeCondition([inventoryItemId : rec.inventoryItemId]), null, null, null, false);
+            if (oisgirs) {
                 fulfilledReservations.addAll(oisgirs);
             }
-        }            
+        }
     }
-    orderItemData.put("fulfilledReservations", fulfilledReservations);
+    orderItemData.fulfilledReservations = fulfilledReservations;
 
     // Update the unit cost with the converted value, if any
-    if (UtilValidate.isNotEmpty(baseCurrencyUomId) && UtilValidate.isNotEmpty(orderHeader.getString("currencyUom"))) {
-        if (! UtilValidate.isEmpty(product)) {
-            result = dispatcher.runSync("convertUom", UtilMisc.toMap("uomId", orderHeader.getString("currencyUom"), "uomIdTo", baseCurrencyUomId, "originalValue", orderItem.get("unitPrice")));
+    if (baseCurrencyUomId && orderHeader.currencyUom) {
+        if (product) {
+            result = dispatcher.runSync("convertUom", [uomId : orderHeader.currencyUom, uomIdTo : baseCurrencyUomId, originalValue : orderItem.unitPrice]);
             if (!ServiceUtil.isError(result)) {
-                orderItem.put("unitPrice", result.get("convertedValue"));
+                orderItem.unitPrice = result.convertedValue;
             }
         }
     }
 
     // Retrieve the backordered quantity
     // TODO: limit to a facility? The shipment destination facility is not necessarily the same facility as the inventory
-    conditions = UtilMisc.toList(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, product.get("productId")), EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.LESS_THAN, new Double(0)));
+    conditions = [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, product.productId), 
+                  EntityCondition.makeCondition("availableToPromiseTotal", EntityOperator.LESS_THAN, new Double(0))];
     negativeInventoryItems = delegator.findList("InventoryItem",  EntityCondition.makeCondition(conditions, EntityOperator.AND), null, null, null, false);
     backOrderedQuantity = 0;
-    niit = negativeInventoryItems.iterator();
-    while (niit.hasNext()) {
-        negativeInventoryItem = niit.next();
+    negativeInventoryItems.each { negativeInventoryItem -> 
         backOrderedQuantity += negativeInventoryItem.getDouble("availableToPromiseTotal").doubleValue();
     }
-    orderItemData.put("backOrderedQuantity", Math.abs(backOrderedQuantity));
+    orderItemData.backOrderedQuantity = Math.abs(backOrderedQuantity);
 
     // Calculate how many units it should be possible to recieve for this purchase order
     availableToReceive = totalOrdered - totalReceived;
     totalAvailableToReceive += availableToReceive;
-    orderItemData.put("availableToReceive", availableToReceive);
-    orderItemData.put("totalQuantityReceived", totalReceived);
-    orderItemData.put("shipGroupSeqId", orderItemAndShipGroupAssoc.get("shipGroupSeqId"));
-    orderItemData.put("orderItem", orderItem);
-    orderItemData.put("product", product);
-    orderItemDatas.put(orderItem.getString("orderItemSeqId"), orderItemData);
+    orderItemData.availableToReceive = availableToReceive;
+    orderItemData.totalQuantityReceived = totalReceived;
+    orderItemData.shipGroupSeqId = orderItemAndShipGroupAssoc.shipGroupSeqId;
+    orderItemData.orderItem = orderItem;
+    orderItemData.product = product;
+    orderItemDatas.put(orderItem.orderItemSeqId, orderItemData);
 }
-context.put("orderItemDatas", orderItemDatas.values());
+context.orderItemDatas = orderItemDatas.values();
 
 // Handle any item product quantities to receive by adding to the map in session
 productIdToReceive = request.getParameter("productId");
 productQtyToReceive = request.getParameter("quantity");
-context.put("newQuantity", productQtyToReceive);
+context.newQuantity = productQtyToReceive;
 
-if (UtilValidate.isNotEmpty(productIdToReceive)) {
-
-    List candidateOrderItems = EntityUtil.filterByAnd(orderItems, UtilMisc.toMap("productId", productIdToReceive));
+if (productIdToReceive) {
+    List candidateOrderItems = EntityUtil.filterByAnd(orderItems, [productId : productIdToReceive]);
 
     // If the productId as given isn't found in the order, try any goodIdentifications and use the first match
-    if (UtilValidate.isEmpty(candidateOrderItems)) {
-        goodIdentifications = delegator.findByAnd("GoodIdentification", UtilMisc.toMap("idValue", productIdToReceive));
-        if (! UtilValidate.isEmpty(goodIdentifications)) {
+    if (!candidateOrderItems) {
+        goodIdentifications = delegator.findList("GoodIdentification", EntityCondition.makeCondition([idValue : productIdToReceive]), null, null, null, false);
+        if (goodIdentifications) {
             giit = goodIdentifications.iterator();
             while (giit.hasNext()) {
                 goodIdentification = giit.next();
-                candidateOrderItems = EntityUtil.filterByAnd(orderItems, UtilMisc.toMap("productId", goodIdentification.get("productId")));
-                if (! UtilValidate.isEmpty(candidateOrderItems)) {
-                    productIdToReceive = goodIdentification.get("productId");
+                candidateOrderItems = EntityUtil.filterByAnd(orderItems, [productId : goodIdentification.productId]);
+                if (candidateOrderItems) {
+                    productIdToReceive = goodIdentification.productId;
                     break;
                 }
             }
         }
     }
     
-    if (! UtilValidate.isEmpty(candidateOrderItems)) {
-
+    if (candidateOrderItems) {
         quantity = 0;
-        if (! UtilValidate.isEmpty(productQtyToReceive)) {
+        if (productQtyToReceive) {
             try {
                 quantity = Double.parseDouble(productQtyToReceive);
             } catch (Exception e) {
@@ -236,10 +230,10 @@
         pqit = candidateOrderItems.iterator();
         while (pqit.hasNext() && totalQuantityUsed < quantity) {
             candidateOrderItem = pqit.next();
-            orderItemSeqId = candidateOrderItem.getString("orderItemSeqId");
+            orderItemSeqId = candidateOrderItem.orderItemSeqId;
             qtyBefore = itemQuantitiesToReceive.containsKey(orderItemSeqId) ? itemQuantitiesToReceive.get(orderItemSeqId) : 0;
             totalQuantityToReceiveBefore += qtyBefore;
-            qtyMaxAvailable = orderItemDatas.get(orderItemSeqId).get("availableToReceive") - qtyBefore;
+            qtyMaxAvailable = orderItemDatas.get(orderItemSeqId).availableToReceive - qtyBefore;
             
             if (qtyMaxAvailable <= 0) {
                 continue;
@@ -252,28 +246,28 @@
         
         // If there's any quantity to receive left after using as much as possible for every relevant order item, add an error message to the context
         if (quantity > totalQuantityUsed) {
-            context.put("ProductReceiveInventoryAgainstPurchaseOrderQuantityExceedsAvailableToReceive", true);
+            context.ProductReceiveInventoryAgainstPurchaseOrderQuantityExceedsAvailableToReceive = true;
         }
         
         // Notify if some or all of the quantity just entered for the product will go to a backorder
-        backOrderedQuantity = orderItemDatas.get(EntityUtil.getFirst(candidateOrderItems).get("orderItemSeqId")).get("backOrderedQuantity") - totalQuantityToReceiveBefore;
+        backOrderedQuantity = orderItemDatas.get(EntityUtil.getFirst(candidateOrderItems).orderItemSeqId).backOrderedQuantity - totalQuantityToReceiveBefore;
         
         if (backOrderedQuantity > 0) {
             totalQtyUsedForBackorders = backOrderedQuantity >= totalQuantityUsed ? totalQuantityUsed : backOrderedQuantity;
             if (totalQtyUsedForBackorders > 0) {
-                context.put("quantityToReceive", totalQuantityUsed);
-                context.put("quantityToBackOrder", totalQtyUsedForBackorders);
-                context.put("ProductReceiveInventoryAgainstPurchaseOrderQuantityGoesToBackOrder", true);
+                context.quantityToReceive = totalQuantityUsed;
+                context.quantityToBackOrder = totalQtyUsedForBackorders;
+                context.ProductReceiveInventoryAgainstPurchaseOrderQuantityGoesToBackOrder = true;
             }
         }
     } else {
 
         // Add an error message to the context if the productId doesn't exist in this purchase order
-        context.put("ProductReceiveInventoryAgainstPurchaseOrderProductNotFound", true);
+        context.ProductReceiveInventoryAgainstPurchaseOrderProductNotFound = true;
     }
 }
 
 // Put the tracking map back into the session, in case it has been reconstructed
 session.setAttribute("purchaseOrderItemQuantitiesToReceive", itemQuantitiesToReceive);
-context.put("itemQuantitiesToReceive", itemQuantitiesToReceive);
-context.put("totalAvailableToReceive", totalAvailableToReceive);
+context.itemQuantitiesToReceive = itemQuantitiesToReceive;
+context.totalAvailableToReceive = totalAvailableToReceive;
\ No newline at end of file

Copied: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.groovy (from r667620, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.groovy?p2=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.groovy&p1=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.bsh&r1=667620&r2=667640&rev=667640&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.groovy Fri Jun 13 13:27:17 2008
@@ -17,56 +17,48 @@
  * under the License.
  */
 
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
-import org.ofbiz.content.report.*;
+import org.ofbiz.entity.*
+import org.ofbiz.base.util.*
+import org.ofbiz.content.report.*
 
 shipmentId = request.getParameter("shipmentId");
-shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
+shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
 
-if (shipment != null) {   
-    shipmentPackageRouteSegs = shipment.getRelated("ShipmentPackageRouteSeg", null, UtilMisc.toList("shipmentRouteSegmentId", "shipmentPackageSeqId"));
-    shipmentPackageDatas = new LinkedList();
-    if (shipmentPackageRouteSegs != null && shipmentPackageRouteSegs.size() > 0) {
-        shipmentPackageRouteSegsIter = shipmentPackageRouteSegs.iterator();
-        while (shipmentPackageRouteSegsIter.hasNext()) {
-            shipmentPackageRouteSeg = shipmentPackageRouteSegsIter.next();
-            shipmentPackages = shipmentPackageRouteSeg.getRelated("ShipmentPackage", null, UtilMisc.toList("shipmentPackageSeqId"));
-            print("shipmentPackages"+shipmentPackages);
+if (shipment) {   
+    shipmentPackageRouteSegs = shipment.getRelated("ShipmentPackageRouteSeg", null, ['shipmentRouteSegmentId', 'shipmentPackageSeqId']);
+    shipmentPackageDatas = [] as LinkedList;
+    if (shipmentPackageRouteSegs) {
+        shipmentPackageRouteSegs.each { shipmentPackageRouteSeg ->
+            shipmentPackages = shipmentPackageRouteSeg.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId']);
             shipmentRouteSegment = shipmentPackageRouteSeg.getRelatedOne("ShipmentRouteSegment");
-            if (shipmentPackages != null && shipmentPackages.size() > 0) {
-                shipmentPackagesIter = shipmentPackages.iterator();
-                while (shipmentPackagesIter.hasNext()) {
-                    shipmentPackage = shipmentPackagesIter.next();
-                    shipmentItemsDatas = new LinkedList();
-                    shipmentPackageContents = shipmentPackage.getRelated("ShipmentPackageContent", null, UtilMisc.toList("shipmentItemSeqId"));                    
-                    if (shipmentPackageContents != null && shipmentPackageContents.size() > 0) {
-                        shipmentPackageContentsIter = shipmentPackageContents.iterator();
-                        while (shipmentPackageContentsIter.hasNext()) {
-                            shipmentItemsData = new HashMap();   
-                            shipmentPackageContent = shipmentPackageContentsIter.next();
+            if (shipmentPackages) {
+                shipmentPackages.each { shipmentPackage ->
+                    shipmentItemsDatas = [] as LinkedList;
+                    shipmentPackageContents = shipmentPackage.getRelated("ShipmentPackageContent", null, ['shipmentItemSeqId']);
+                    if (shipmentPackageContents) {
+                        shipmentPackageContents.each { shipmentPackageContent ->
+                            shipmentItemsData = [:];
                             packageQuantity = shipmentPackageContent.getDouble("quantity");
                             shipmentItem = shipmentPackageContent.getRelatedOne("ShipmentItem");  
-                            if (shipmentItem != null) {
+                            if (shipmentItem) {
                                 shippedQuantity = shipmentItem.getDouble("quantity");
-                                shipmentItemsData.put("shipmentItem", shipmentItem);
-                                shipmentItemsData.put("shippedQuantity", shippedQuantity);
-                                shipmentItemsData.put("packageQuantity", packageQuantity);
+                                shipmentItemsData.shipmentItem = shipmentItem;
+                                shipmentItemsData.shippedQuantity = shippedQuantity;
+                                shipmentItemsData.packageQuantity = packageQuantity;
                                 shipmentItemsDatas.add(shipmentItemsData);
                             }
                         }
                     }
-                    shipmentPackageData = new HashMap();
-                    shipmentPackageData.put("shipmentPackage", shipmentPackage);
-                    shipmentPackageData.put("shipmentRouteSegment", shipmentRouteSegment);
-                    shipmentPackageData.put("shipmentItemsDatas", shipmentItemsDatas);
+                    shipmentPackageData = [:];
+                    shipmentPackageData.shipmentPackage = shipmentPackage;
+                    shipmentPackageData.shipmentRouteSegment = shipmentRouteSegment;
+                    shipmentPackageData.shipmentItemsDatas = shipmentItemsDatas;
                     shipmentPackageDatas.add(shipmentPackageData);
                 }
             }
         }
     }
-    context.put("shipmentPackageDatas", shipmentPackageDatas);
+    context.shipmentPackageDatas = shipmentPackageDatas;
 }
-
-context.put("shipmentId", shipmentId);
-context.put("shipment", shipment);
+context.shipmentId = shipmentId;
+context.shipment = shipment;
\ No newline at end of file

Copied: ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.groovy (from r667620, ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.groovy?p2=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.groovy&p1=ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.bsh&r1=667620&r2=667640&rev=667640&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.bsh (original)
+++ ofbiz/trunk/applications/product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.groovy Fri Jun 13 13:27:17 2008
@@ -17,35 +17,29 @@
  * under the License.
  */
 
-import java.util.*;
-import org.ofbiz.entity.*;
-import org.ofbiz.base.util.*;
+import org.ofbiz.entity.condition.*
 
-//delegator = request.getAttribute("delegator");
-//security = request.getAttribute("security");
-//userLogin = session.getAttribute("userLogin");
-
-shipmentId = parameters.get("shipmentId");
-if (shipmentId == null) {
+shipmentId = parameters.shipmentId;
+if (!shipmentId) {
     shipmentId = request.getAttribute("shipmentId");
 }
-shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId));
+shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false);
 
-context.put("shipmentId", shipmentId);
-context.put("shipment", shipment);
+context.shipmentId = shipmentId;
+context.shipment = shipment;
 
-if (shipment != null) {
-    context.put("shipmentType", shipment.getRelatedOne("ShipmentType"));
-    context.put("statusItem", shipment.getRelatedOne("StatusItem"));
-    context.put("primaryOrderHeader", shipment.getRelatedOne("PrimaryOrderHeader"));
-    context.put("toPerson", shipment.getRelatedOne("ToPerson"));
-    context.put("toPartyGroup", shipment.getRelatedOne("ToPartyGroup"));
-    context.put("fromPerson", shipment.getRelatedOne("FromPerson"));
-    context.put("fromPartyGroup", shipment.getRelatedOne("FromPartyGroup"));
-    context.put("originFacility", shipment.getRelatedOne("OriginFacility"));
-    context.put("destinationFacility", shipment.getRelatedOne("DestinationFacility"));
-    context.put("originPostalAddress", shipment.getRelatedOne("OriginPostalAddress"));
-    context.put("destinationPostalAddress", shipment.getRelatedOne("DestinationPostalAddress"));
+if (shipment) {
+    context.shipmentType = shipment.getRelatedOne("ShipmentType");
+    context.statusItem = shipment.getRelatedOne("StatusItem");
+    context.primaryOrderHeader = shipment.getRelatedOne("PrimaryOrderHeader");
+    context.toPerson = shipment.getRelatedOne("ToPerson");
+    context.toPartyGroup = shipment.getRelatedOne("ToPartyGroup");
+    context.fromPerson = shipment.getRelatedOne("FromPerson");
+    context.fromPartyGroup = shipment.getRelatedOne("FromPartyGroup");
+    context.originFacility = shipment.getRelatedOne("OriginFacility");
+    context.destinationFacility = shipment.getRelatedOne("DestinationFacility");
+    context.originPostalAddress = shipment.getRelatedOne("OriginPostalAddress");
+    context.destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress");
 }
 
 // check permission
@@ -53,15 +47,15 @@
 if (security.hasEntityPermission("FACILITY", "_VIEW", userLogin)) {
     hasPermission = true;
 } else {
-    if (shipment != null) {
-        if (UtilValidate.isNotEmpty(shipment.get("primaryOrderId"))) {
+    if (shipment) {
+        if (shipment.primaryOrderId) {
             // allow if userLogin is associated with the primaryOrderId with the SUPPLIER_AGENT roleTypeId
-            orderRoleCheckMap = UtilMisc.toMap("orderId", shipment.get("primaryOrderId"), "partyId", userLogin.get("partyId"), "roleTypeId", "SUPPLIER_AGENT");
-            orderRole = delegator.findByPrimaryKey("OrderRole", orderRoleCheckMap);
-            if (orderRole != null) {
+            orderRoleCheckMap = [orderId : shipment.primaryOrderId, partyId : userLogin.partyId, roleTypeId : 'SUPPLIER_AGENT'];
+            orderRole = delegator.findOne("OrderRole", orderRoleCheckMap, false);
+            if (orderRole) {
                 hasPermission = true;
             }
         }
     }
 }
-context.put("hasPermission", hasPermission);
+context.hasPermission = hasPermission;
\ No newline at end of file

Modified: ofbiz/trunk/applications/product/widget/facility/ShipmentScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/facility/ShipmentScreens.xml?rev=667640&r1=667639&r2=667640&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/facility/ShipmentScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/facility/ShipmentScreens.xml Fri Jun 13 13:27:17 2008
@@ -25,7 +25,7 @@
             <actions>
                 <set field="titleProperty" value="ProductFindShipment"/>
                 <set field="headerItem" value="shipment"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/FindShipment.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/FindShipment.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
@@ -75,10 +75,10 @@
                 <set field="headerItem" value="shipment"/>
                 <set field="tabButtonItem" value="ViewShipment"/>
 
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.bsh"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentItems.bsh"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPackages.bsh"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentRouteSegments.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.groovy"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentItems.groovy"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPackages.groovy"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentRouteSegments.groovy"/>
             </actions>
             <widgets>
                 <section>
@@ -122,7 +122,7 @@
                 <set field="headerItem" value="shipment"/>
                 <set field="tabButtonItem" value="EditShipment"/>
 
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipment.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipment.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonShipmentDecorator">
@@ -142,7 +142,7 @@
                 <set field="headerItem" value="shipment"/>
                 <set field="tabButtonItem" value="EditShipmentItems"/>
 
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentItems.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentItems.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonShipmentDecorator">
@@ -162,7 +162,7 @@
                 <set field="headerItem" value="shipment"/>
                 <set field="tabButtonItem" value="EditShipmentPlan"/>
 
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPlan.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPlan.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonShipmentDecorator">
@@ -182,7 +182,7 @@
                 <set field="headerItem" value="shipment"/>
                 <set field="tabButtonItem" value="EditShipmentPackages"/>
 
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPackages.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPackages.grovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonShipmentDecorator">
@@ -202,7 +202,7 @@
                 <set field="headerItem" value="shipment"/>
                 <set field="tabButtonItem" value="EditShipmentRouteSegments"/>
 
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentRouteSegments.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentRouteSegments.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonShipmentDecorator">
@@ -222,7 +222,7 @@
                 <set field="headerItem" value="shipment"/>
                 <set field="tabButtonItem" value="AddItemsFromOrder"/>
 
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromOrder.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/AddItemsFromOrder.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonShipmentDecorator">
@@ -241,10 +241,10 @@
             <actions>
                 <set field="titleProperty" value="ProductQuickShipOrder"/>
                 <set field="headerItem" value="shipment"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.bsh"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentItems.bsh"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPackages.bsh"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentRouteSegments.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/QuickShipOrder.groovy"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentItems.groovy"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentPackages.groovy"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/EditShipmentRouteSegments.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
@@ -263,7 +263,7 @@
             <actions>
                 <set field="titleProperty" value="ProductPackOrder"/>
                 <set field="headerItem" value="shipment"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/PackOrder.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/PackOrder.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
@@ -286,8 +286,8 @@
                 <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
 
                 <set field="shipmentId" from-field="parameters.shipmentId"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.bsh"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.groovy"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/PackingSlip.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">
@@ -347,8 +347,8 @@
                 <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/>
 
                 <set field="shipmentId" from-field="parameters.shipmentId"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.bsh"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/ViewShipment.groovy"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/ShipmentManifest.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml">
@@ -392,7 +392,7 @@
                 <set field="headerItem" value="shipment"/>
                 <set field="tabButtonItem" value="ProductReceiveInventoryAgainstPO"/>
                 <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/>
-                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.bsh"/>
+                <script location="component://product/webapp/facility/WEB-INF/actions/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="CommonShipmentDecorator">