svn commit: r1767764 [20/33] - in /ofbiz/trunk: applications/accounting/groovyScripts/admin/ applications/accounting/groovyScripts/ap/invoices/ applications/accounting/groovyScripts/ar/ applications/accounting/groovyScripts/chartofaccounts/ application...

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

svn commit: r1767764 [20/33] - in /ofbiz/trunk: applications/accounting/groovyScripts/admin/ applications/accounting/groovyScripts/ap/invoices/ applications/accounting/groovyScripts/ar/ applications/accounting/groovyScripts/chartofaccounts/ application...

Arun Patidar-4
Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipment.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipment.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipment.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipment.groovy Wed Nov  2 19:09:13 2016
@@ -19,42 +19,42 @@
 
 import org.apache.ofbiz.entity.condition.*
 
-shipmentId = parameters.shipmentId;
-shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+shipmentId = parameters.shipmentId
+shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
 
 // orderHeader is needed here to determine type of order and hence types of shipment status
 if (!shipment) {
-    primaryOrderId = request.getParameter("primaryOrderId");
+    primaryOrderId = request.getParameter("primaryOrderId")
 } else {
-    primaryOrderId = shipment.primaryOrderId;
+    primaryOrderId = shipment.primaryOrderId
 }
-orderHeader = from("OrderHeader").where(orderId : primaryOrderId).queryOne();
+orderHeader = from("OrderHeader").where(orderId : primaryOrderId).queryOne()
 
 // the kind of StatusItem to use is based on the type of order
-statusItemTypeId = "SHIPMENT_STATUS";
+statusItemTypeId = "SHIPMENT_STATUS"
 if (orderHeader && "PURCHASE_ORDER".equals(orderHeader.orderTypeId)) {
-    statusItemTypeId = "PURCH_SHIP_STATUS";
+    statusItemTypeId = "PURCH_SHIP_STATUS"
 }
-context.statusItemTypeId = statusItemTypeId;
+context.statusItemTypeId = statusItemTypeId
 
-context.shipmentId = shipmentId;
-context.shipment = shipment;
+context.shipmentId = shipmentId
+context.shipment = shipment
 
 if (shipment) {
-    currentStatus = shipment.getRelatedOne("StatusItem", false);
-    originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false);
-    destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false);
-    originTelecomNumber = shipment.getRelatedOne("OriginTelecomNumber", false);
-    destinationTelecomNumber = shipment.getRelatedOne("DestinationTelecomNumber", false);
+    currentStatus = shipment.getRelatedOne("StatusItem", false)
+    originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false)
+    destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false)
+    originTelecomNumber = shipment.getRelatedOne("OriginTelecomNumber", false)
+    destinationTelecomNumber = shipment.getRelatedOne("DestinationTelecomNumber", false)
 
     if (orderHeader) {
-        context.productStoreId = orderHeader.productStoreId;
+        context.productStoreId = orderHeader.productStoreId
     }
 
-    context.currentStatus = currentStatus;
-    context.originPostalAddress = originPostalAddress;
-    context.destinationPostalAddress = destinationPostalAddress;
-    context.originTelecomNumber = originTelecomNumber;
-    context.destinationTelecomNumber = destinationTelecomNumber;
+    context.currentStatus = currentStatus
+    context.originPostalAddress = originPostalAddress
+    context.destinationPostalAddress = destinationPostalAddress
+    context.originTelecomNumber = originTelecomNumber
+    context.destinationTelecomNumber = destinationTelecomNumber
 
 }

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentItems.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentItems.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentItems.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentItems.groovy Wed Nov  2 19:09:13 2016
@@ -20,49 +20,49 @@
 import org.apache.ofbiz.entity.*
 import org.apache.ofbiz.base.util.*
 
-shipmentId = request.getParameter("shipmentId");
+shipmentId = request.getParameter("shipmentId")
 if (!shipmentId) {
-    shipmentId = context.shipmentId;
+    shipmentId = context.shipmentId
 }
 
-shipment = null;
+shipment = null
 if (shipmentId) {
-    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
 }
 
 if (shipment) {
-    shipmentItems = shipment.getRelated("ShipmentItem", null, ['shipmentItemSeqId'], false);
-    shipmentItemDatas = [] as LinkedList;
+    shipmentItems = shipment.getRelated("ShipmentItem", null, ['shipmentItemSeqId'], false)
+    shipmentItemDatas = [] as LinkedList
     if (shipmentItems) {
         shipmentItems.each { shipmentItem ->
-            shipmentPackageContents = shipmentItem.getRelated("ShipmentPackageContent", null, null, false);
-            totalQuantityPackaged = 0;
+            shipmentPackageContents = shipmentItem.getRelated("ShipmentPackageContent", null, null, false)
+            totalQuantityPackaged = 0
             shipmentPackageContents.each { shipmentPackageContent ->
                 if (shipmentPackageContent.quantity) {
-                    totalQuantityPackaged += shipmentPackageContent.getDouble("quantity");
+                    totalQuantityPackaged += shipmentPackageContent.getDouble("quantity")
                 }
             }
 
-            totalQuantityToPackage = 0;
+            totalQuantityToPackage = 0
             if (shipmentItem.quantity) {
-                totalQuantityToPackage = shipmentItem.getDouble("quantity") - totalQuantityPackaged;
+                totalQuantityToPackage = shipmentItem.getDouble("quantity") - totalQuantityPackaged
             }
 
-            shipmentItemData = [:];
-            shipmentItemData.shipmentItem = shipmentItem;
-            shipmentItemData.shipmentPackageContents = shipmentPackageContents;
-            shipmentItemData.itemIssuances = shipmentItem.getRelated("ItemIssuance", null, null, false);
-            shipmentItemData.orderShipments = shipmentItem.getRelated("OrderShipment", null, null, false);
-            shipmentItemData.product = shipmentItem.getRelatedOne("Product", false);
-            shipmentItemData.totalQuantityPackaged = totalQuantityPackaged;
-            shipmentItemData.totalQuantityToPackage = totalQuantityToPackage;
-            shipmentItemDatas.add(shipmentItemData);
+            shipmentItemData = [:]
+            shipmentItemData.shipmentItem = shipmentItem
+            shipmentItemData.shipmentPackageContents = shipmentPackageContents
+            shipmentItemData.itemIssuances = shipmentItem.getRelated("ItemIssuance", null, null, false)
+            shipmentItemData.orderShipments = shipmentItem.getRelated("OrderShipment", null, null, false)
+            shipmentItemData.product = shipmentItem.getRelatedOne("Product", false)
+            shipmentItemData.totalQuantityPackaged = totalQuantityPackaged
+            shipmentItemData.totalQuantityToPackage = totalQuantityToPackage
+            shipmentItemDatas.add(shipmentItemData)
         }
     }
-    shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false);
+    shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false)
 
-    context.shipment = shipment;
-    context.shipmentItemDatas = shipmentItemDatas;
-    context.shipmentPackages = shipmentPackages;
+    context.shipment = shipment
+    context.shipmentItemDatas = shipmentItemDatas
+    context.shipmentPackages = shipmentPackages
 }
-context.shipmentId = shipmentId;
+context.shipmentId = shipmentId

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentPackages.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentPackages.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentPackages.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentPackages.groovy Wed Nov  2 19:09:13 2016
@@ -19,40 +19,40 @@
 
 import org.apache.ofbiz.entity.condition.*
 
-shipmentId = request.getParameter("shipmentId");
+shipmentId = request.getParameter("shipmentId")
 if (!shipmentId) {
-    shipmentId = context.shipmentId;
+    shipmentId = context.shipmentId
 }
 
-shipment = null;
+shipment = null
 if (shipmentId) {
-    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
 }
 
 if (shipment) {
-    shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false);
-    shipmentPackageDatas = [] as LinkedList;
+    shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false)
+    shipmentPackageDatas = [] as LinkedList
     if (shipmentPackages) {
         shipmentPackages.each { shipmentPackage ->
-            shipmentPackageData = [:];
-            shipmentPackageData.shipmentPackage = shipmentPackage;
-            shipmentPackageData.shipmentPackageContents = shipmentPackage.getRelated("ShipmentPackageContent", null, null, false);
-            shipmentPackageData.shipmentPackageRouteSegs = shipmentPackage.getRelated("ShipmentPackageRouteSeg", null, null, false);
-            shipmentPackageData.weightUom = shipmentPackage.getRelatedOne("WeightUom", false);
-            shipmentPackageDatas.add(shipmentPackageData);
+            shipmentPackageData = [:]
+            shipmentPackageData.shipmentPackage = shipmentPackage
+            shipmentPackageData.shipmentPackageContents = shipmentPackage.getRelated("ShipmentPackageContent", null, null, false)
+            shipmentPackageData.shipmentPackageRouteSegs = shipmentPackage.getRelated("ShipmentPackageRouteSeg", null, null, false)
+            shipmentPackageData.weightUom = shipmentPackage.getRelatedOne("WeightUom", false)
+            shipmentPackageDatas.add(shipmentPackageData)
         }
     }
 
-    shipmentItems = shipment.getRelated("ShipmentItem", null, ['shipmentItemSeqId'], false);
-    shipmentRouteSegments = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId'], false);
-    weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").orderBy("description").queryList();
-    boxTypes = from("ShipmentBoxType").queryList();
-
-    context.shipment = shipment;
-    context.shipmentPackageDatas = shipmentPackageDatas;
-    context.shipmentItems = shipmentItems;
-    context.shipmentRouteSegments = shipmentRouteSegments;
-    context.weightUoms = weightUoms;
-    context.boxTypes = boxTypes;
+    shipmentItems = shipment.getRelated("ShipmentItem", null, ['shipmentItemSeqId'], false)
+    shipmentRouteSegments = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId'], false)
+    weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").orderBy("description").queryList()
+    boxTypes = from("ShipmentBoxType").queryList()
+
+    context.shipment = shipment
+    context.shipmentPackageDatas = shipmentPackageDatas
+    context.shipmentItems = shipmentItems
+    context.shipmentRouteSegments = shipmentRouteSegments
+    context.weightUoms = weightUoms
+    context.boxTypes = boxTypes
 }
-context.shipmentId = shipmentId;
+context.shipmentId = shipmentId

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentPlan.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentPlan.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentPlan.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentPlan.groovy Wed Nov  2 19:09:13 2016
@@ -17,149 +17,149 @@
  * under the License.
  */
 
-import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.entity.condition.EntityCondition
 
-shipmentId = request.getParameter("shipmentId");
-orderId = request.getParameter("orderId");
-shipGroupSeqId = request.getParameter("shipGroupSeqId");
+shipmentId = request.getParameter("shipmentId")
+orderId = request.getParameter("orderId")
+shipGroupSeqId = request.getParameter("shipGroupSeqId")
 
 if (!shipmentId) {
-    shipmentId = context.shipmentId;
+    shipmentId = context.shipmentId
 }
-action = request.getParameter("action");
+action = request.getParameter("action")
 
-shipment = null;
+shipment = null
 if (shipmentId) {
-    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
 }
 
 
 // **************************************
 // Order Items are searched also by shipGroupSeqId and put in orderItemShipGroupAssocs
 // **************************************
-orderItemShipGroupAssocs = null;
+orderItemShipGroupAssocs = null
 // **************************************
 // Search method: search by productId
 // **************************************
 if (action && orderId) {
     if (shipGroupSeqId) {
-        orderItemShipGroupAssocs = from("OrderItemShipGroupAssoc").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryList();
+        orderItemShipGroupAssocs = from("OrderItemShipGroupAssoc").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryList()
     } else {
-        orderItemShipGroupAssocs = from("OrderItemShipGroupAssoc").where("orderId", orderId).queryList();
+        orderItemShipGroupAssocs = from("OrderItemShipGroupAssoc").where("orderId", orderId).queryList()
     }
 }
 
 // **************************************
 // ShipmentPlan list form
 // **************************************
-totWeight = 0;
-totVolume = 0;
-shipmentPlans = null;
-shipmentPlansIt = null;
-rows = [] as ArrayList;
+totWeight = 0
+totVolume = 0
+shipmentPlans = null
+shipmentPlansIt = null
+rows = [] as ArrayList
 if (shipment) {
-    shipmentPlans = from("OrderShipment").where("shipmentId", shipment.shipmentId).queryList();
+    shipmentPlans = from("OrderShipment").where("shipmentId", shipment.shipmentId).queryList()
 }
 if (shipmentPlans) {
     shipmentPlans.each { shipmentPlan ->
-        oneRow = new HashMap(shipmentPlan);
-        orderItem = shipmentPlan.getRelatedOne("OrderItem", false);
-        oneRow.productId = orderItem.productId;
-        orderedQuantity = orderItem.getDouble("quantity");
-        canceledQuantity = orderItem.getDouble("cancelQuantity");
+        oneRow = new HashMap(shipmentPlan)
+        orderItem = shipmentPlan.getRelatedOne("OrderItem", false)
+        oneRow.productId = orderItem.productId
+        orderedQuantity = orderItem.getDouble("quantity")
+        canceledQuantity = orderItem.getDouble("cancelQuantity")
         if (canceledQuantity) {
-            orderedQuantity = Double.valueOf(orderedQuantity.doubleValue() - canceledQuantity.doubleValue());
+            orderedQuantity = Double.valueOf(orderedQuantity.doubleValue() - canceledQuantity.doubleValue())
         }
-        oneRow.totOrderedQuantity = orderedQuantity.intValue();
+        oneRow.totOrderedQuantity = orderedQuantity.intValue()
 
         // Total quantity issued
-        issuedQuantity = 0.0;
-        qtyIssuedInShipment = [:];
-        issuances = orderItem.getRelated("ItemIssuance", null, null, false);
+        issuedQuantity = 0.0
+        qtyIssuedInShipment = [:]
+        issuances = orderItem.getRelated("ItemIssuance", null, null, false)
         issuances.each { issuance ->
             if (issuance.quantity) {
-                issuedQuantity += issuance.getDouble("quantity");
+                issuedQuantity += issuance.getDouble("quantity")
                 if (issuance.cancelQuantity) {
-                    issuedQuantity -= issuance.getDouble("cancelQuantity");
+                    issuedQuantity -= issuance.getDouble("cancelQuantity")
                 }
                 if (qtyIssuedInShipment.containsKey(issuance.shipmentId)) {
-                    qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.shipmentId)).doubleValue();
-                    qtyInShipment += issuance.getDouble("quantity");
+                    qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.shipmentId)).doubleValue()
+                    qtyInShipment += issuance.getDouble("quantity")
                     if (issuance.cancelQuantity) {
-                        qtyInShipment -= issuance.getDouble("cancelQuantity");
+                        qtyInShipment -= issuance.getDouble("cancelQuantity")
                     }
-                    qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment);
+                    qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment)
                 } else {
-                    qtyInShipment = issuance.getDouble("quantity");
+                    qtyInShipment = issuance.getDouble("quantity")
                     if (issuance.cancelQuantity) {
-                        qtyInShipment -= issuance.getDouble("cancelQuantity");
+                        qtyInShipment -= issuance.getDouble("cancelQuantity")
                     }
-                    qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment);
+                    qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment)
                 }
             }
         }
-        oneRow.totIssuedQuantity = issuedQuantity;
+        oneRow.totIssuedQuantity = issuedQuantity
         // Total quantity planned not issued
-        plannedQuantity = 0.0;
-        qtyPlannedInShipment = [:];
-        plans = from("OrderShipment").where("orderId", orderItem.orderId, "orderItemSeqId", orderItem.orderItemSeqId).queryList();
+        plannedQuantity = 0.0
+        qtyPlannedInShipment = [:]
+        plans = from("OrderShipment").where("orderId", orderItem.orderId, "orderItemSeqId", orderItem.orderItemSeqId).queryList()
         plans.each { plan ->
             if (plan.quantity) {
-                netPlanQty = plan.getDouble("quantity");
+                netPlanQty = plan.getDouble("quantity")
                 if (qtyIssuedInShipment.containsKey(plan.shipmentId)) {
-                    qtyInShipment = ((Double)qtyIssuedInShipment.get(plan.shipmentId)).doubleValue();
+                    qtyInShipment = ((Double)qtyIssuedInShipment.get(plan.shipmentId)).doubleValue()
                     if (netPlanQty > qtyInShipment) {
-                        netPlanQty -= qtyInShipment;
+                        netPlanQty -= qtyInShipment
                     } else {
-                        netPlanQty = 0;
+                        netPlanQty = 0
                     }
                 }
-                plannedQuantity += netPlanQty;
+                plannedQuantity += netPlanQty
                 if (qtyPlannedInShipment.containsKey(plan.shipmentId)) {
-                    qtyInShipment = ((Double)qtyPlannedInShipment.get(plan.shipmentId)).doubleValue();
-                    qtyInShipment += netPlanQty;
-                    qtyPlannedInShipment.put(plan.shipmentId, qtyInShipment);
+                    qtyInShipment = ((Double)qtyPlannedInShipment.get(plan.shipmentId)).doubleValue()
+                    qtyInShipment += netPlanQty
+                    qtyPlannedInShipment.put(plan.shipmentId, qtyInShipment)
                 } else {
-                    qtyPlannedInShipment.put(plan.shipmentId, netPlanQty);
+                    qtyPlannedInShipment.put(plan.shipmentId, netPlanQty)
                 }
             }
         }
-        oneRow.totPlannedQuantity = plannedQuantity;
+        oneRow.totPlannedQuantity = plannedQuantity
         if (qtyIssuedInShipment.containsKey(shipmentId)) {
-            oneRow.issuedQuantity = qtyIssuedInShipment.get(shipmentId);
+            oneRow.issuedQuantity = qtyIssuedInShipment.get(shipmentId)
         } else {
-            oneRow.issuedQuantity = "";
+            oneRow.issuedQuantity = ""
         }
         // Reserved and Not Available quantity
-        reservedQuantity = 0.0;
-        reservedNotAvailable = 0.0;
-        reservations = orderItem.getRelated("OrderItemShipGrpInvRes", null, null, false);
+        reservedQuantity = 0.0
+        reservedNotAvailable = 0.0
+        reservations = orderItem.getRelated("OrderItemShipGrpInvRes", null, null, false)
         reservations.each { reservation ->
             if (reservation.quantity) {
-                reservedQuantity += reservation.getDouble("quantity");
+                reservedQuantity += reservation.getDouble("quantity")
             }
             if (reservation.quantityNotAvailable) {
-                reservedNotAvailable += reservation.getDouble("quantityNotAvailable");
+                reservedNotAvailable += reservation.getDouble("quantityNotAvailable")
             }
         }
-        oneRow.notAvailableQuantity = reservedNotAvailable;
+        oneRow.notAvailableQuantity = reservedNotAvailable
 
         // Planned Weight and Volume
-        product = orderItem.getRelatedOne("Product", false);
-        weight = 0.0;
-        quantity = 0.0;
+        product = orderItem.getRelatedOne("Product", false)
+        weight = 0.0
+        quantity = 0.0
         if (shipmentPlan.getDouble("quantity")) {
-            quantity = shipmentPlan.getDouble("quantity");
+            quantity = shipmentPlan.getDouble("quantity")
         }
         if (product.getDouble("productWeight")) {
-            weight = product.getDouble("productWeight") * quantity;
+            weight = product.getDouble("productWeight") * quantity
         }
-        oneRow.weight = weight;
+        oneRow.weight = weight
         if (product.weightUomId) {
-            weightUom = from("Uom").where("uomId", product.weightUomId).queryOne();
-            oneRow.weightUom = weightUom.abbreviation;
+            weightUom = from("Uom").where("uomId", product.weightUomId).queryOne()
+            oneRow.weightUom = weightUom.abbreviation
         }
-        volume = 0.0;
+        volume = 0.0
         if (product.getDouble("productHeight") &&
             product.getDouble("productWidth") &&
             product.getDouble("productDepth")) {
@@ -167,120 +167,120 @@ if (shipmentPlans) {
                 volume = product.getDouble("productHeight") *
                          product.getDouble("productWidth") *
                          product.getDouble("productDepth") *
-                         quantity;
+                         quantity
         }
-        oneRow.volume = volume;
+        oneRow.volume = volume
         if (product.heightUomId && product.widthUomId && product.depthUomId) {
-            heightUom = from("Uom").where("uomId", product.heightUomId).cache(true).queryOne();
-            widthUom = from("Uom").where("uomId", product.widthUomId).cache(true).queryOne();
-            depthUom = from("Uom").where("uomId", product.depthUomId).cache(true).queryOne();
-            oneRow.volumeUom = heightUom.abbreviation + "x" + widthUom.abbreviation + "x" + depthUom.abbreviation;
-        }
-        totWeight += weight;
-        totVolume += volume;
-        rows.add(oneRow);
+            heightUom = from("Uom").where("uomId", product.heightUomId).cache(true).queryOne()
+            widthUom = from("Uom").where("uomId", product.widthUomId).cache(true).queryOne()
+            depthUom = from("Uom").where("uomId", product.depthUomId).cache(true).queryOne()
+            oneRow.volumeUom = heightUom.abbreviation + "x" + widthUom.abbreviation + "x" + depthUom.abbreviation
+        }
+        totWeight += weight
+        totVolume += volume
+        rows.add(oneRow)
     }
 }
 
 // **************************************
 // ShipmentPlan add form
 // **************************************
-addRows = [] as ArrayList;
+addRows = [] as ArrayList
 if (orderItemShipGroupAssocs) {
     orderItemShipGroupAssocs.each { orderItemShipGroupAssoc ->
-        orderItem = orderItemShipGroupAssoc.getRelatedOne("OrderItem", false);
-        oneRow = [:];
-        oneRow.shipmentId = shipmentId;
-        oneRow.orderId = orderItemShipGroupAssoc.orderId;
-        oneRow.orderItemSeqId = orderItemShipGroupAssoc.orderItemSeqId;
-        oneRow.shipGroupSeqId = orderItemShipGroupAssoc.shipGroupSeqId;
-        oneRow.productId = orderItem.productId;
-        orderedQuantity = orderItemShipGroupAssoc.getDouble("quantity");
-        canceledQuantity = orderItemShipGroupAssoc.getDouble("cancelQuantity");
+        orderItem = orderItemShipGroupAssoc.getRelatedOne("OrderItem", false)
+        oneRow = [:]
+        oneRow.shipmentId = shipmentId
+        oneRow.orderId = orderItemShipGroupAssoc.orderId
+        oneRow.orderItemSeqId = orderItemShipGroupAssoc.orderItemSeqId
+        oneRow.shipGroupSeqId = orderItemShipGroupAssoc.shipGroupSeqId
+        oneRow.productId = orderItem.productId
+        orderedQuantity = orderItemShipGroupAssoc.getDouble("quantity")
+        canceledQuantity = orderItemShipGroupAssoc.getDouble("cancelQuantity")
         if (canceledQuantity) {
-            orderedQuantity = Double.valueOf(orderedQuantity.doubleValue() - canceledQuantity.doubleValue());
+            orderedQuantity = Double.valueOf(orderedQuantity.doubleValue() - canceledQuantity.doubleValue())
         }
-        oneRow.orderedQuantity = orderedQuantity;
+        oneRow.orderedQuantity = orderedQuantity
         // Total quantity issued
-        issuedQuantity = 0.0;
-        qtyIssuedInShipment = [:];
-        issuances = orderItem.getRelated("ItemIssuance", null, null, false);
+        issuedQuantity = 0.0
+        qtyIssuedInShipment = [:]
+        issuances = orderItem.getRelated("ItemIssuance", null, null, false)
         issuances.each { issuance ->
             if (issuance.quantity) {
-                issuedQuantity += issuance.getDouble("quantity");
+                issuedQuantity += issuance.getDouble("quantity")
                 if (issuance.cancelQuantity) {
-                    issuedQuantity -= issuance.getDouble("cancelQuantity");
+                    issuedQuantity -= issuance.getDouble("cancelQuantity")
                 }
                 if (qtyIssuedInShipment.containsKey(issuance.shipmentId)) {
-                    qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.shipmentId)).doubleValue();
-                    qtyInShipment += issuance.getDouble("quantity");
-                    qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment);
+                    qtyInShipment = ((Double)qtyIssuedInShipment.get(issuance.shipmentId)).doubleValue()
+                    qtyInShipment += issuance.getDouble("quantity")
+                    qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment)
                 } else {
-                    qtyInShipment = issuance.getDouble("quantity");
+                    qtyInShipment = issuance.getDouble("quantity")
                     if (issuance.cancelQuantity) {
-                        qtyInShipment -= issuance.getDouble("cancelQuantity");
+                        qtyInShipment -= issuance.getDouble("cancelQuantity")
                     }
-                    qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment);
+                    qtyIssuedInShipment.put(issuance.shipmentId, qtyInShipment)
                 }
             }
         }
-        oneRow.issuedQuantity = issuedQuantity;
+        oneRow.issuedQuantity = issuedQuantity
         // Total quantity planned not issued
-        plannedQuantity = 0.0;
-        EntityCondition orderShipmentCondition = null;
+        plannedQuantity = 0.0
+        EntityCondition orderShipmentCondition = null
         if (shipGroupSeqId) {
-            orderShipmentCondition = EntityCondition.makeCondition([orderId : orderItemShipGroupAssoc.orderId, orderItemSeqId : orderItemShipGroupAssoc.orderItemSeqId, shipGroupSeqId : orderItemShipGroupAssoc.shipGroupSeqId]);
+            orderShipmentCondition = EntityCondition.makeCondition([orderId : orderItemShipGroupAssoc.orderId, orderItemSeqId : orderItemShipGroupAssoc.orderItemSeqId, shipGroupSeqId : orderItemShipGroupAssoc.shipGroupSeqId])
         } else {
-            orderShipmentCondition = EntityCondition.makeCondition([orderId : orderItemShipGroupAssoc.orderId, orderItemSeqId : orderItemShipGroupAssoc.orderItemSeqId]);
+            orderShipmentCondition = EntityCondition.makeCondition([orderId : orderItemShipGroupAssoc.orderId, orderItemSeqId : orderItemShipGroupAssoc.orderItemSeqId])
         }
-        plans = from("OrderShipment").where(orderShipmentCondition).queryList();
+        plans = from("OrderShipment").where(orderShipmentCondition).queryList()
         plans.each { plan ->
             if (plan.quantity) {
-                netPlanQty = plan.getDouble("quantity");
-                plannedQuantity += netPlanQty;
+                netPlanQty = plan.getDouble("quantity")
+                plannedQuantity += netPlanQty
             }
         }
-        oneRow.plannedQuantity = plannedQuantity;
+        oneRow.plannedQuantity = plannedQuantity
 
         // (default) quantity for plan
-        planQuantity = (orderedQuantity - plannedQuantity - issuedQuantity > 0? orderedQuantity - plannedQuantity - issuedQuantity: 0);
-        oneRow.quantity = planQuantity;
+        planQuantity = (orderedQuantity - plannedQuantity - issuedQuantity > 0? orderedQuantity - plannedQuantity - issuedQuantity: 0)
+        oneRow.quantity = planQuantity
 
         // Planned (unitary) Weight and Volume
-        weight = new Double(0);
-        product = orderItem.getRelatedOne("Product", false);
+        weight = new Double(0)
+        product = orderItem.getRelatedOne("Product", false)
         if (product.getDouble("productWeight")) {
-            weight = product.getDouble("productWeight");
+            weight = product.getDouble("productWeight")
         }
-        oneRow.weight = weight;
+        oneRow.weight = weight
 
         if (product.weightUomId) {
-            weightUom = from("Uom").where("uomId", product.weightUomId).cache(true).queryOne();
-            oneRow.weightUom = weightUom.abbreviation;
+            weightUom = from("Uom").where("uomId", product.weightUomId).cache(true).queryOne()
+            oneRow.weightUom = weightUom.abbreviation
         }
-        volume = 0.0;
+        volume = 0.0
         if (product.getDouble("productHeight") && product.getDouble("productWidth") && product.getDouble("productDepth")) {
                 // TODO: check if uom conversion is needed
                 volume = product.getDouble("productHeight") *
                          product.getDouble("productWidth") *
-                         product.getDouble("productDepth");
+                         product.getDouble("productDepth")
         }
 
-        oneRow.volume = volume;
+        oneRow.volume = volume
         if (product.heightUomId && product.widthUomId && product.depthUomId) {
-            heightUom = from("Uom").where("uomId", product.heightUomId).cache(true).queryOne();
-            widthUom = from("Uom").where("uomId", product.widthUomId).cache(true).queryOne();
-            depthUom = from("Uom").where("uomId", product.depthUomId).cache(true).queryOne();
-            oneRow.volumeUom = heightUom.abbreviation + "x" + widthUom.abbreviation + "x" + depthUom.abbreviation;
+            heightUom = from("Uom").where("uomId", product.heightUomId).cache(true).queryOne()
+            widthUom = from("Uom").where("uomId", product.widthUomId).cache(true).queryOne()
+            depthUom = from("Uom").where("uomId", product.depthUomId).cache(true).queryOne()
+            oneRow.volumeUom = heightUom.abbreviation + "x" + widthUom.abbreviation + "x" + depthUom.abbreviation
         }
-        addRows.add(oneRow);
+        addRows.add(oneRow)
     }
 }
 
-context.listShipmentPlanRows = rows;
-context.addToShipmentPlanRows = addRows;
-context.rowCount = addRows.size();
-context.shipmentId = shipmentId;
-context.shipment = shipment;
-context.totWeight = totWeight;
-context.totVolume = totVolume;
+context.listShipmentPlanRows = rows
+context.addToShipmentPlanRows = addRows
+context.rowCount = addRows.size()
+context.shipmentId = shipmentId
+context.shipment = shipment
+context.totWeight = totWeight
+context.totVolume = totVolume

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentRouteSegments.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentRouteSegments.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentRouteSegments.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/EditShipmentRouteSegments.groovy Wed Nov  2 19:09:13 2016
@@ -18,72 +18,72 @@
  */
 
 import org.apache.ofbiz.base.util.*
-import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.entity.condition.EntityCondition
 
-shipmentId = request.getParameter("shipmentId");
+shipmentId = request.getParameter("shipmentId")
 if (!shipmentId) {
-    shipmentId = context.shipmentId;
+    shipmentId = context.shipmentId
 }
 
-shipment = null;
+shipment = null
 if (shipmentId) {
-    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
 }
 
 if (shipment) {
-    shipmentRouteSegments = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId'], false);
-    shipmentRouteSegmentDatas = [] as LinkedList;
+    shipmentRouteSegments = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId'], false)
+    shipmentRouteSegmentDatas = [] as LinkedList
     if (shipmentRouteSegments) {
         shipmentRouteSegments.each { shipmentRouteSegment ->
-            shipmentRouteSegmentData = [:];
-            shipmentRouteSegmentData.shipmentRouteSegment = shipmentRouteSegment;
-            shipmentRouteSegmentData.originFacility = shipmentRouteSegment.getRelatedOne("OriginFacility", false);
-            shipmentRouteSegmentData.destFacility = shipmentRouteSegment.getRelatedOne("DestFacility", false);
-            shipmentRouteSegmentData.originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress", false);
-            shipmentRouteSegmentData.originTelecomNumber = shipmentRouteSegment.getRelatedOne("OriginTelecomNumber", false);
-            shipmentRouteSegmentData.destPostalAddress = shipmentRouteSegment.getRelatedOne("DestPostalAddress", false);
-            shipmentRouteSegmentData.destTelecomNumber = shipmentRouteSegment.getRelatedOne("DestTelecomNumber", false);
-            shipmentRouteSegmentData.shipmentMethodType = shipmentRouteSegment.getRelatedOne("ShipmentMethodType", false);
-            shipmentRouteSegmentData.carrierPerson = shipmentRouteSegment.getRelatedOne("CarrierPerson", false);
-            shipmentRouteSegmentData.carrierPartyGroup = shipmentRouteSegment.getRelatedOne("CarrierPartyGroup", false);
-            shipmentRouteSegmentData.shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, null, false);
-            shipmentRouteSegmentData.carrierServiceStatusItem = shipmentRouteSegment.getRelatedOne("CarrierServiceStatusItem", false);
-            shipmentRouteSegmentData.currencyUom = shipmentRouteSegment.getRelatedOne("CurrencyUom", false);
-            shipmentRouteSegmentData.billingWeightUom = shipmentRouteSegment.getRelatedOne("BillingWeightUom", false);
+            shipmentRouteSegmentData = [:]
+            shipmentRouteSegmentData.shipmentRouteSegment = shipmentRouteSegment
+            shipmentRouteSegmentData.originFacility = shipmentRouteSegment.getRelatedOne("OriginFacility", false)
+            shipmentRouteSegmentData.destFacility = shipmentRouteSegment.getRelatedOne("DestFacility", false)
+            shipmentRouteSegmentData.originPostalAddress = shipmentRouteSegment.getRelatedOne("OriginPostalAddress", false)
+            shipmentRouteSegmentData.originTelecomNumber = shipmentRouteSegment.getRelatedOne("OriginTelecomNumber", false)
+            shipmentRouteSegmentData.destPostalAddress = shipmentRouteSegment.getRelatedOne("DestPostalAddress", false)
+            shipmentRouteSegmentData.destTelecomNumber = shipmentRouteSegment.getRelatedOne("DestTelecomNumber", false)
+            shipmentRouteSegmentData.shipmentMethodType = shipmentRouteSegment.getRelatedOne("ShipmentMethodType", false)
+            shipmentRouteSegmentData.carrierPerson = shipmentRouteSegment.getRelatedOne("CarrierPerson", false)
+            shipmentRouteSegmentData.carrierPartyGroup = shipmentRouteSegment.getRelatedOne("CarrierPartyGroup", false)
+            shipmentRouteSegmentData.shipmentPackageRouteSegs = shipmentRouteSegment.getRelated("ShipmentPackageRouteSeg", null, null, false)
+            shipmentRouteSegmentData.carrierServiceStatusItem = shipmentRouteSegment.getRelatedOne("CarrierServiceStatusItem", false)
+            shipmentRouteSegmentData.currencyUom = shipmentRouteSegment.getRelatedOne("CurrencyUom", false)
+            shipmentRouteSegmentData.billingWeightUom = shipmentRouteSegment.getRelatedOne("BillingWeightUom", false)
             if (shipmentRouteSegment.carrierServiceStatusId) {
-                shipmentRouteSegmentData.carrierServiceStatusValidChangeToDetails = from("StatusValidChangeToDetail").where("statusId", shipmentRouteSegment.carrierServiceStatusId).orderBy("sequenceId").queryList();
+                shipmentRouteSegmentData.carrierServiceStatusValidChangeToDetails = from("StatusValidChangeToDetail").where("statusId", shipmentRouteSegment.carrierServiceStatusId).orderBy("sequenceId").queryList()
             } else {
-                shipmentRouteSegmentData.carrierServiceStatusValidChangeToDetails = from("StatusValidChangeToDetail").where("statusId", "SHRSCS_NOT_STARTED").orderBy("sequenceId").queryList();
+                shipmentRouteSegmentData.carrierServiceStatusValidChangeToDetails = from("StatusValidChangeToDetail").where("statusId", "SHRSCS_NOT_STARTED").orderBy("sequenceId").queryList()
             }
-            shipmentRouteSegmentDatas.add(shipmentRouteSegmentData);
+            shipmentRouteSegmentDatas.add(shipmentRouteSegmentData)
         }
     }
 
-    shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false);
-    facilities = from("Facility").orderBy("facilityName").queryList();
-    shipmentMethodTypes = from("ShipmentMethodType").orderBy("description").queryList();
-    weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").queryList();
-    currencyUoms = from("Uom").where("uomTypeId", "CURRENCY_MEASURE").queryList();
+    shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false)
+    facilities = from("Facility").orderBy("facilityName").queryList()
+    shipmentMethodTypes = from("ShipmentMethodType").orderBy("description").queryList()
+    weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").queryList()
+    currencyUoms = from("Uom").where("uomTypeId", "CURRENCY_MEASURE").queryList()
 
-    carrierPartyRoles = from("PartyRole").where("roleTypeId", "CARRIER").queryList();
-    carrierPartyDatas = [] as LinkedList;
+    carrierPartyRoles = from("PartyRole").where("roleTypeId", "CARRIER").queryList()
+    carrierPartyDatas = [] as LinkedList
     carrierPartyRoles.each { carrierPartyRole ->
-        party = carrierPartyRole.getRelatedOne("Party", false);
-        carrierPartyData = [:];
-        carrierPartyData.party = party;
-        carrierPartyData.person = party.getRelatedOne("Person", false);
-        carrierPartyData.partyGroup = party.getRelatedOne("PartyGroup", false);
-        carrierPartyDatas.add(carrierPartyData);
+        party = carrierPartyRole.getRelatedOne("Party", false)
+        carrierPartyData = [:]
+        carrierPartyData.party = party
+        carrierPartyData.person = party.getRelatedOne("Person", false)
+        carrierPartyData.partyGroup = party.getRelatedOne("PartyGroup", false)
+        carrierPartyDatas.add(carrierPartyData)
     }
 
-    context.shipment = shipment;
-    context.shipmentRouteSegmentDatas = shipmentRouteSegmentDatas;
-    context.shipmentPackages = shipmentPackages;
-    context.facilities = facilities;
-    context.shipmentMethodTypes = shipmentMethodTypes;
-    context.weightUoms = weightUoms;
-    context.currencyUoms = currencyUoms;
-    context.carrierPartyDatas = carrierPartyDatas;
+    context.shipment = shipment
+    context.shipmentRouteSegmentDatas = shipmentRouteSegmentDatas
+    context.shipmentPackages = shipmentPackages
+    context.facilities = facilities
+    context.shipmentMethodTypes = shipmentMethodTypes
+    context.weightUoms = weightUoms
+    context.currencyUoms = currencyUoms
+    context.carrierPartyDatas = carrierPartyDatas
 }
-context.shipmentId = shipmentId;
-context.nowTimestampString = UtilDateTime.nowTimestamp().toString();
+context.shipmentId = shipmentId
+context.nowTimestampString = UtilDateTime.nowTimestamp().toString()

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/PackOrder.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/PackOrder.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/PackOrder.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/PackOrder.groovy Wed Nov  2 19:09:13 2016
@@ -17,39 +17,39 @@
  * under the License.
  */
 
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.order.*;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
-import org.apache.ofbiz.entity.condition.EntityCondition;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.order.*
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.util.EntityUtilProperties
+import org.apache.ofbiz.entity.condition.EntityCondition
 
 
-facilityId = parameters.facilityId;
+facilityId = parameters.facilityId
 if (facilityId) {
-    facility = from("Facility").where("facilityId", facilityId).queryOne();
-    context.facilityId = facilityId;
-    context.facility = facility;
+    facility = from("Facility").where("facilityId", facilityId).queryOne()
+    context.facilityId = facilityId
+    context.facility = facility
 }
 
 // order based packing
-orderId = parameters.orderId;
-shipGroupSeqId = parameters.shipGroupSeqId;
-shipmentId = parameters.shipmentId;
+orderId = parameters.orderId
+shipGroupSeqId = parameters.shipGroupSeqId
+shipmentId = parameters.shipmentId
 if (!shipmentId) {
-    shipmentId = request.getAttribute("shipmentId");
+    shipmentId = request.getAttribute("shipmentId")
 }
-context.shipmentId = shipmentId;
+context.shipmentId = shipmentId
 
 // If a shipment exists, provide the IDs of any related invoices
-invoiceIds = null;
+invoiceIds = null
 if (shipmentId) {
     // Get the primaryOrderId from the shipment
-    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
     if (shipment && shipment.primaryOrderId) {
-        orderItemBillingList = from("OrderItemBilling").where("orderId", shipment.primaryOrderId).orderBy("invoiceId").queryList();
-        invoiceIds = EntityUtil.getFieldListFromEntityList(orderItemBillingList, "invoiceId", true);
+        orderItemBillingList = from("OrderItemBilling").where("orderId", shipment.primaryOrderId).orderBy("invoiceId").queryList()
+        invoiceIds = EntityUtil.getFieldListFromEntityList(orderItemBillingList, "invoiceId", true)
         if (invoiceIds) {
-            context.invoiceIds = invoiceIds;
+            context.invoiceIds = invoiceIds
         }
     }
 }
@@ -57,85 +57,85 @@ if (shipmentId) {
 // validate order information
 if (orderId && !shipGroupSeqId && orderId.indexOf("/") > -1) {
     // split the orderID/shipGroupSeqID
-    idSplit = orderId.split("\\/");
-    orderId = idSplit[0];
-    shipGroupSeqId = idSplit[1];
+    idSplit = orderId.split("\\/")
+    orderId = idSplit[0]
+    shipGroupSeqId = idSplit[1]
 } else if (orderId && !shipGroupSeqId) {
-    shipGroupSeqId = "00001";
+    shipGroupSeqId = "00001"
 }
 
 // setup the packing session
-packSession = session.getAttribute("packingSession");
-clear = parameters.clear;
+packSession = session.getAttribute("packingSession")
+clear = parameters.clear
 if (!packSession) {
-    packSession = new org.apache.ofbiz.shipment.packing.PackingSession(dispatcher, userLogin);
-    session.setAttribute("packingSession", packSession);
-    Debug.log("Created NEW packing session!!");
+    packSession = new org.apache.ofbiz.shipment.packing.PackingSession(dispatcher, userLogin)
+    session.setAttribute("packingSession", packSession)
+    Debug.log("Created NEW packing session!!")
 } else {
     if (packSession.getStatus() == 0) {
-        OrderReadHelper orh = new OrderReadHelper(delegator, orderId);
-        shipGrp = orh.getOrderItemShipGroup(shipGroupSeqId);
-        context.shippedShipGroupSeqId = shipGroupSeqId;
-        context.shippedOrderId = orderId;
-        context.shippedCarrier = shipGrp.carrierPartyId;
-
-        packSession.clear();
-        shipGroupSeqId = null;
-        orderId = null;
+        OrderReadHelper orh = new OrderReadHelper(delegator, orderId)
+        shipGrp = orh.getOrderItemShipGroup(shipGroupSeqId)
+        context.shippedShipGroupSeqId = shipGroupSeqId
+        context.shippedOrderId = orderId
+        context.shippedCarrier = shipGrp.carrierPartyId
+
+        packSession.clear()
+        shipGroupSeqId = null
+        orderId = null
     } else if (clear) {
-        packSession.clear();
+        packSession.clear()
     }
 }
-packSession.clearItemInfos();
+packSession.clearItemInfos()
 
 // picklist based packing information
-picklistBinId = parameters.picklistBinId;
+picklistBinId = parameters.picklistBinId
 // see if the bin ID is already set
 if (!picklistBinId) {
-    picklistBinId = packSession.getPicklistBinId();
+    picklistBinId = packSession.getPicklistBinId()
 }
 if (picklistBinId) {
-    bin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne();
+    bin = from("PicklistBin").where("picklistBinId", picklistBinId).queryOne()
     if (bin) {
-        orderId = bin.primaryOrderId;
-        shipGroupSeqId = bin.primaryShipGroupSeqId;
-        packSession.addItemInfo(bin.getRelated("PicklistItem", [itemStatusId : 'PICKITEM_PENDING'], null, false));
+        orderId = bin.primaryOrderId
+        shipGroupSeqId = bin.primaryShipGroupSeqId
+        packSession.addItemInfo(bin.getRelated("PicklistItem", [itemStatusId : 'PICKITEM_PENDING'], null, false))
     }
 } else {
-    picklistBinId = null;
+    picklistBinId = null
 }
 
 // make sure we always re-set the infos
-packSession.setPrimaryShipGroupSeqId(shipGroupSeqId);
-packSession.setPrimaryOrderId(orderId);
-packSession.setPicklistBinId(picklistBinId);
-packSession.setFacilityId(facilityId);
+packSession.setPrimaryShipGroupSeqId(shipGroupSeqId)
+packSession.setPrimaryOrderId(orderId)
+packSession.setPicklistBinId(picklistBinId)
+packSession.setFacilityId(facilityId)
 
 if (invoiceIds) {
-    orderId = null;
+    orderId = null
 }
-shipment = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryFirst();
-context.shipment = shipment;
+shipment = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryFirst()
+context.shipment = shipment
 
-context.packingSession = packSession;
-context.orderId = orderId;
-context.shipGroupSeqId = shipGroupSeqId;
-context.picklistBinId = picklistBinId;
+context.packingSession = packSession
+context.orderId = orderId
+context.shipGroupSeqId = shipGroupSeqId
+context.picklistBinId = picklistBinId
 
 // grab the order information
 if (orderId) {
-    orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
+    orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
     if (orderHeader) {
-        OrderReadHelper orh = new OrderReadHelper(orderHeader);
-        context.orderId = orderId;
-        context.orderHeader = orderHeader;
-        context.orderReadHelper = orh;
-        orderItemShipGroup = orh.getOrderItemShipGroup(shipGroupSeqId);
-        context.orderItemShipGroup = orderItemShipGroup;
-        carrierPartyId = orderItemShipGroup.carrierPartyId;
-            carrierShipmentBoxTypes = from("CarrierShipmentBoxType").where("partyId", carrierPartyId).queryList();
+        OrderReadHelper orh = new OrderReadHelper(orderHeader)
+        context.orderId = orderId
+        context.orderHeader = orderHeader
+        context.orderReadHelper = orh
+        orderItemShipGroup = orh.getOrderItemShipGroup(shipGroupSeqId)
+        context.orderItemShipGroup = orderItemShipGroup
+        carrierPartyId = orderItemShipGroup.carrierPartyId
+            carrierShipmentBoxTypes = from("CarrierShipmentBoxType").where("partyId", carrierPartyId).queryList()
             if (carrierShipmentBoxTypes) {
-            context.carrierShipmentBoxTypes = carrierShipmentBoxTypes;
+            context.carrierShipmentBoxTypes = carrierShipmentBoxTypes
             }
 
         if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
@@ -143,41 +143,41 @@ if (orderId) {
                 if (!shipment) {
     
                     // Generate the shipment cost estimate for the ship group
-                    productStoreId = orh.getProductStoreId();
-                    shippableItemInfo = orh.getOrderItemAndShipGroupAssoc(shipGroupSeqId);
-                    shippableItems = from("OrderItemAndShipGrpInvResAndItemSum").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryList();
-                    shippableTotal = new Double(orh.getShippableTotal(shipGroupSeqId).doubleValue());
-                    shippableWeight = new Double(orh.getShippableWeight(shipGroupSeqId).doubleValue());
-                    shippableQuantity = new Double(orh.getShippableQuantity(shipGroupSeqId).doubleValue());
+                    productStoreId = orh.getProductStoreId()
+                    shippableItemInfo = orh.getOrderItemAndShipGroupAssoc(shipGroupSeqId)
+                    shippableItems = from("OrderItemAndShipGrpInvResAndItemSum").where("orderId", orderId, "shipGroupSeqId", shipGroupSeqId).queryList()
+                    shippableTotal = new Double(orh.getShippableTotal(shipGroupSeqId).doubleValue())
+                    shippableWeight = new Double(orh.getShippableWeight(shipGroupSeqId).doubleValue())
+                    shippableQuantity = new Double(orh.getShippableQuantity(shipGroupSeqId).doubleValue())
                     if (orderItemShipGroup.contactMechId && orderItemShipGroup.shipmentMethodTypeId && orderItemShipGroup.carrierPartyId && orderItemShipGroup.carrierRoleTypeId) {
-                        shipmentCostEstimate = packSession.getShipmentCostEstimate(orderItemShipGroup, productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity);
-                        context.shipmentCostEstimateForShipGroup = shipmentCostEstimate;
+                        shipmentCostEstimate = packSession.getShipmentCostEstimate(orderItemShipGroup, productStoreId, shippableItemInfo, shippableTotal, shippableWeight, shippableQuantity)
+                        context.shipmentCostEstimateForShipGroup = shipmentCostEstimate
                     }
-                    context.productStoreId = productStoreId;
+                    context.productStoreId = productStoreId
     
                     if (!picklistBinId) {
-                        packSession.addItemInfo(shippableItems);
+                        packSession.addItemInfo(shippableItems)
                     }
                 } else {
-                    request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderHasBeenAlreadyVerified", [orderId : orderId], locale));
+                    request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage("OrderErrorUiLabels", "OrderErrorOrderHasBeenAlreadyVerified", [orderId : orderId], locale))
                 }
             } else {
-                request.setAttribute("errorMessageList", ['No ship group sequence ID. Cannot process.']);
+                request.setAttribute("errorMessageList", ['No ship group sequence ID. Cannot process.'])
             }
         } else {
-            request.setAttribute("errorMessageList", ["Order #" + orderId + " is not approved for packing."]);
+            request.setAttribute("errorMessageList", ["Order #" + orderId + " is not approved for packing."])
         }
     } else {
-        request.setAttribute("errorMessageList", ["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;
+defaultWeightUomId = null
 if (facility) {
-    defaultWeightUomId = facility.defaultWeightUomId;
+    defaultWeightUomId = facility.defaultWeightUomId
 }
 if (!defaultWeightUomId) {
-    defaultWeightUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", "WT_kg", delegator);
+    defaultWeightUomId = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", "WT_kg", delegator)
 }
-context.defaultWeightUomId = defaultWeightUomId;
+context.defaultWeightUomId = defaultWeightUomId

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/PackingSlip.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/PackingSlip.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/PackingSlip.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/PackingSlip.groovy Wed Nov  2 19:09:13 2016
@@ -19,32 +19,32 @@
 
 // This script gets shipment items grouped by package for use in the packing slip PDF or any screens that require by-package layout
 
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.entity.condition.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.entity.condition.*
 import org.apache.ofbiz.entity.util.EntityTypeUtil
 
 // Since this script is run after ViewShipment, we will re-use the shipment in the context
-shipment = context.shipment;
+shipment = context.shipment
 if (!shipment) {
-    return;
+    return
 }
 
 // get the packages related to this shipment in order of packages
-shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false);
+shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false)
 
 // first we scan the shipment items and count the quantity of each product that is being shipped
-quantityShippedByProduct = [:];
-quantityInShipmentByProduct = [:];
-shipmentItems = shipment.getRelated("ShipmentItem", null, null, false);
+quantityShippedByProduct = [:]
+quantityInShipmentByProduct = [:]
+shipmentItems = shipment.getRelated("ShipmentItem", null, null, false)
 shipmentItems.each { shipmentItem ->
-    productId = shipmentItem.productId;
-    shipped = quantityShippedByProduct.get(productId);
+    productId = shipmentItem.productId
+    shipped = quantityShippedByProduct.get(productId)
     if (!shipped) {
-        shipped = 0 as Double;
+        shipped = 0 as Double
     }
-    shipped += shipmentItem.getDouble("quantity").doubleValue();
-    quantityShippedByProduct.put(productId, shipped);
-    quantityInShipmentByProduct.put(productId, shipped);
+    shipped += shipmentItem.getDouble("quantity").doubleValue()
+    quantityShippedByProduct.put(productId, shipped)
+    quantityInShipmentByProduct.put(productId, shipped)
 }
 
 // Add in the total of all previously shipped items
@@ -57,74 +57,74 @@ previousShipmentIter = from("Shipment")
                                                     ObjectType.simpleTypeConvert(shipment.getString("createdDate"), "Timestamp", null, null))
                                             ),
                                         EntityOperator.AND))
-                            .queryIterator();
+                            .queryIterator()
 
 while (previousShipmentItem = previousShipmentIter.next()) {
     if (!previousShipmentItem.shipmentId.equals(shipment.shipmentId)) {
-        previousShipmentItems = previousShipmentItem.getRelated("ShipmentItem", null, null, false);
+        previousShipmentItems = previousShipmentItem.getRelated("ShipmentItem", null, null, false)
         previousShipmentItems.each { shipmentItem ->
-            productId = shipmentItem.productId;
-            shipped = quantityShippedByProduct.get(productId);
+            productId = shipmentItem.productId
+            shipped = quantityShippedByProduct.get(productId)
             if (!shipped) {
-                shipped = new Double(0);
+                shipped = new Double(0)
             }
-            shipped += shipmentItem.getDouble("quantity").doubleValue();
-            quantityShippedByProduct.put(productId, shipped);
+            shipped += shipmentItem.getDouble("quantity").doubleValue()
+            quantityShippedByProduct.put(productId, shipped)
         }
     }
 }
-previousShipmentIter.close();
+previousShipmentIter.close()
 
 // next scan the order items (via issuances) to count the quantity of each product requested
-quantityRequestedByProduct = [:];
-countedOrderItems = [:]; // this map is only used to keep track of the order items already counted
-order = shipment.getRelatedOne("PrimaryOrderHeader", false);
-issuances = order.getRelated("ItemIssuance", null, null, false);
+quantityRequestedByProduct = [:]
+countedOrderItems = [:] // this map is only used to keep track of the order items already counted
+order = shipment.getRelatedOne("PrimaryOrderHeader", false)
+issuances = order.getRelated("ItemIssuance", null, null, false)
 issuances.each { issuance ->
-    orderItem = issuance.getRelatedOne("OrderItem", false);
-    productId = orderItem.productId;
+    orderItem = issuance.getRelatedOne("OrderItem", false)
+    productId = orderItem.productId
     if (!countedOrderItems.containsKey(orderItem.orderId + orderItem.orderItemSeqId)) {
-        countedOrderItems.put(orderItem.orderId + orderItem.orderItemSeqId, null);
-        requested = quantityRequestedByProduct.get(productId);
+        countedOrderItems.put(orderItem.orderId + orderItem.orderItemSeqId, null)
+        requested = quantityRequestedByProduct.get(productId)
         if (!requested) {
-            requested = new Double(0);
+            requested = new Double(0)
         }
-        cancelQuantity = orderItem.getDouble("cancelQuantity");
-        quantity = orderItem.getDouble("quantity");
-        requested += quantity.doubleValue() - (cancelQuantity ? cancelQuantity.doubleValue() : 0);
-        quantityRequestedByProduct.put(productId, requested);
+        cancelQuantity = orderItem.getDouble("cancelQuantity")
+        quantity = orderItem.getDouble("quantity")
+        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 = []; // note we assume that the package number is simply the index + 1 of this list
+packages = [] // note we assume that the package number is simply the index + 1 of this list
 shipmentPackages.each { shipmentPackage ->
-    contents = shipmentPackage.getRelated("ShipmentPackageContent", null, ['shipmentItemSeqId'], false);
+    contents = shipmentPackage.getRelated("ShipmentPackageContent", null, ['shipmentItemSeqId'], false)
 
     // each line is one logical Product and the quantities associated with it
-    lines = [];
+    lines = []
     contents.each { content ->
-        shipmentItem = content.getRelatedOne("ShipmentItem", false);
-        product = shipmentItem.getRelatedOne("Product", false);
-        productTypeId = product.get("productTypeId");
-
-        line = [:];
-        line.product = product;
-        line.quantityRequested = quantityRequestedByProduct.get(product.productId);
-        line.quantityInPackage = content.quantity;
+        shipmentItem = content.getRelatedOne("ShipmentItem", false)
+        product = shipmentItem.getRelatedOne("Product", false)
+        productTypeId = product.get("productTypeId")
+
+        line = [:]
+        line.product = product
+        line.quantityRequested = quantityRequestedByProduct.get(product.productId)
+        line.quantityInPackage = content.quantity
         if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", productTypeId, "parentTypeId", "MARKETING_PKG_PICK") && line.quantityInPackage > line.quantityRequested) {
-            line.quantityInPackage = line.quantityRequested;
+            line.quantityInPackage = line.quantityRequested
         }
-        line.quantityInShipment = quantityInShipmentByProduct.get(product.productId);
+        line.quantityInShipment = quantityInShipmentByProduct.get(product.productId)
         if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", productTypeId, "parentTypeId", "MARKETING_PKG_PICK") && line.quantityInShipment > line.quantityRequested) {
-            line.quantityInShipment = line.quantityRequested;
+            line.quantityInShipment = line.quantityRequested
         }
-        line.quantityShipped = quantityShippedByProduct.get(product.productId);
+        line.quantityShipped = quantityShippedByProduct.get(product.productId)
         if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", productTypeId, "parentTypeId", "MARKETING_PKG_PICK") && line.quantityShipped > line.quantityRequested) {
-            line.quantityShipped = line.quantityRequested;
+            line.quantityShipped = line.quantityRequested
         }
-        lines.add(line);
+        lines.add(line)
     }
-    packages.add(lines);
+    packages.add(lines)
 }
-context.packages = packages;
+context.packages = packages

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/PrintPickSheets.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/PrintPickSheets.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/PrintPickSheets.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/PrintPickSheets.groovy Wed Nov  2 19:09:13 2016
@@ -17,115 +17,115 @@
  * under the License.
  */
 
-import org.apache.ofbiz.order.order.OrderReadHelper;
-import org.apache.ofbiz.entity.condition.EntityCondition;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.base.util.UtilHttp;
+import org.apache.ofbiz.order.order.OrderReadHelper
+import org.apache.ofbiz.entity.condition.EntityCondition
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.base.util.UtilHttp
 
-toPrintOrders = [];
-maxNumberOfOrders = parameters.maxNumberOfOrdersToPrint;
-int maxNumberOfOrders = maxNumberOfOrders.toInteger();
-int printListCounter = 0;
-printGroupName = parameters.printGroupName;
+toPrintOrders = []
+maxNumberOfOrders = parameters.maxNumberOfOrdersToPrint
+int maxNumberOfOrders = maxNumberOfOrders.toInteger()
+int printListCounter = 0
+printGroupName = parameters.printGroupName
 if (printGroupName != null) {
     pickMoveInfoList.each { pickMoveInfo ->
-        groupName = pickMoveInfo.groupName ;
+        groupName = pickMoveInfo.groupName
         if (groupName == printGroupName) {
-            toPrintOrders.add(pickMoveInfo.orderReadyToPickInfoList);
+            toPrintOrders.add(pickMoveInfo.orderReadyToPickInfoList)
         }
     }
 }
 else {
     pickMoveInfoList.each { pickMoveInfo ->
-        toPrintOrders.add(pickMoveInfo.orderReadyToPickInfoList);
+        toPrintOrders.add(pickMoveInfo.orderReadyToPickInfoList)
     }
 }
 if (toPrintOrders) {
-    orderList = [];
-    orderInfoList = [];
-    itemInfoList = [];
-    orderHeaderList = [];
-    orderChargeList =[];
+    orderList = []
+    orderInfoList = []
+    itemInfoList = []
+    orderHeaderList = []
+    orderChargeList =[]
     toPrintOrders.each { toPrintOrder ->
         if(toPrintOrder) {
-            orderHeaders = toPrintOrder.orderHeader;
-            orderItemShipGroups = toPrintOrder.orderItemShipGroup;
-            orderItemShipGrpInvResList = toPrintOrder.orderItemShipGrpInvResList;
-            orderItemShipGrpInvResInfoList = toPrintOrder.orderItemShipGrpInvResInfoList;
+            orderHeaders = toPrintOrder.orderHeader
+            orderItemShipGroups = toPrintOrder.orderItemShipGroup
+            orderItemShipGrpInvResList = toPrintOrder.orderItemShipGrpInvResList
+            orderItemShipGrpInvResInfoList = toPrintOrder.orderItemShipGrpInvResInfoList
             orderHeaders.each { orderHeader ->
-                printListCounter = ++printListCounter;
+                printListCounter = ++printListCounter
                 if (printListCounter <= maxNumberOfOrders) {
-                    orderMap = [:];
-                    orderId = orderHeader.orderId;
-                    orderMap.orderId = orderId;
-                    orderMap.orderDate = orderHeader.orderDate;
-                    billingOrderContactMechs = [];
-                    billingOrderContactMechs = from("OrderContactMech").where("orderId", orderId, "contactMechPurposeTypeId", "BILLING_LOCATION").queryList();
+                    orderMap = [:]
+                    orderId = orderHeader.orderId
+                    orderMap.orderId = orderId
+                    orderMap.orderDate = orderHeader.orderDate
+                    billingOrderContactMechs = []
+                    billingOrderContactMechs = from("OrderContactMech").where("orderId", orderId, "contactMechPurposeTypeId", "BILLING_LOCATION").queryList()
                     if (billingOrderContactMechs.size() > 0) {
-                        billingContactMechId = EntityUtil.getFirst(billingOrderContactMechs).contactMechId;
-                        billingAddress = from("PostalAddress").where("contactMechId", billingContactMechId).queryOne();
+                        billingContactMechId = EntityUtil.getFirst(billingOrderContactMechs).contactMechId
+                        billingAddress = from("PostalAddress").where("contactMechId", billingContactMechId).queryOne()
                     }
-                    shippingContactMechId = from("OrderContactMech").where("orderId", orderId, "contactMechPurposeTypeId", "SHIPPING_LOCATION").queryFirst().contactMechId;
-                    shippingAddress = from("PostalAddress").where("contactMechId", shippingContactMechId).queryOne();
+                    shippingContactMechId = from("OrderContactMech").where("orderId", orderId, "contactMechPurposeTypeId", "SHIPPING_LOCATION").queryFirst().contactMechId
+                    shippingAddress = from("PostalAddress").where("contactMechId", shippingContactMechId).queryOne()
                     orderItemShipGroups.each { orderItemShipGroup ->
                         if (orderItemShipGroup.orderId == orderId) {
-                            orderMap.shipmentMethodType = EntityUtil.getFirst(orderItemShipGroup.getRelated("ShipmentMethodType", null, null, false)).description;
-                            orderMap.carrierPartyId = orderItemShipGroup.carrierPartyId;
-                            orderMap.shipGroupSeqId = orderItemShipGroup.shipGroupSeqId;
-                            orderMap.carrierPartyId = orderItemShipGroup.carrierPartyId;
-                            orderMap.isGift = orderItemShipGroup.isGift;
-                            orderMap.giftMessage = orderItemShipGroup.giftMessage;
+                            orderMap.shipmentMethodType = EntityUtil.getFirst(orderItemShipGroup.getRelated("ShipmentMethodType", null, null, false)).description
+                            orderMap.carrierPartyId = orderItemShipGroup.carrierPartyId
+                            orderMap.shipGroupSeqId = orderItemShipGroup.shipGroupSeqId
+                            orderMap.carrierPartyId = orderItemShipGroup.carrierPartyId
+                            orderMap.isGift = orderItemShipGroup.isGift
+                            orderMap.giftMessage = orderItemShipGroup.giftMessage
                         }
-                        orderMap.shippingAddress = shippingAddress;
+                        orderMap.shippingAddress = shippingAddress
                         if (billingOrderContactMechs.size() > 0) {
-                            orderMap.billingAddress = billingAddress;
+                            orderMap.billingAddress = billingAddress
                         }
-                        orderInfoMap = [:];
-                        orderInfoMap.(orderHeader.orderId) = orderMap;
+                        orderInfoMap = [:]
+                        orderInfoMap.(orderHeader.orderId) = orderMap
                     }
-                    addInMap = "true";
-                    orderItemMap = [:];
+                    addInMap = "true"
+                    orderItemMap = [:]
                     orderItemShipGrpInvResInfoList.each { orderItemShipGrpInvResInfos ->
                         orderItemShipGrpInvResInfos.each { orderItemShipGrpInvResInfo ->
                             if (orderItemShipGrpInvResInfo.orderItemShipGrpInvRes.orderId == orderId && addInMap == "true") {
-                                orderItemMap.(orderHeader.orderId) = orderItemShipGrpInvResInfos;
-                                addInMap = "false";
+                                orderItemMap.(orderHeader.orderId) = orderItemShipGrpInvResInfos
+                                addInMap = "false"
                             }
                         }
                     }
-                    orderChargeMap = [:];
-                    orderReadHelper = new OrderReadHelper(orderHeader);
-                    orderItems = orderReadHelper.getOrderItems();
-                    orderAdjustments = orderReadHelper.getAdjustments();
-                    orderHeaderAdjustments = orderReadHelper.getOrderHeaderAdjustments();
-                    context.orderHeaderAdjustments = orderHeaderAdjustments;
-                    orderSubTotal = orderReadHelper.getOrderItemsSubTotal();
-                    context.orderSubTotal = orderSubTotal;
-                    otherAdjAmount = orderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, true, false, false);
-                    shippingAmount = orderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true);
-                    shippingAmount = shippingAmount.add(orderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true));
-                    taxAmount = orderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, true, false);
-                    taxAmount = taxAmount.add(orderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, true, false));
-                    grandTotal = orderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments);
-                    orderChargeMap.orderSubTotal = orderSubTotal;
-                    orderChargeMap.taxAmount = taxAmount;
-                    orderChargeMap.shippingAmount = shippingAmount;
-                    orderChargeMap.otherAdjAmount = otherAdjAmount;
-                    orderChargeMap.grandTotal = grandTotal;
-                    orderChargeMap.totalItem = orderItems.size();
-                    orderCharges = [:];
-                    orderCharges.(orderHeader.orderId) = orderChargeMap;
-                    orderChargeList.add(orderCharges);
-                    itemInfoList.add(orderItemMap);
-                    orderInfoList.add(orderInfoMap);
-                    orderList.add(orderHeader);
-                    context.orderHeaderList = orderList;
-                    context.orderInfoList = orderInfoList;
-                    context.itemInfoList = itemInfoList;
-                    context.orderChargeList = orderChargeList;
+                    orderChargeMap = [:]
+                    orderReadHelper = new OrderReadHelper(orderHeader)
+                    orderItems = orderReadHelper.getOrderItems()
+                    orderAdjustments = orderReadHelper.getAdjustments()
+                    orderHeaderAdjustments = orderReadHelper.getOrderHeaderAdjustments()
+                    context.orderHeaderAdjustments = orderHeaderAdjustments
+                    orderSubTotal = orderReadHelper.getOrderItemsSubTotal()
+                    context.orderSubTotal = orderSubTotal
+                    otherAdjAmount = orderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, true, false, false)
+                    shippingAmount = orderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true)
+                    shippingAmount = shippingAmount.add(orderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true))
+                    taxAmount = orderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, true, false)
+                    taxAmount = taxAmount.add(orderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, true, false))
+                    grandTotal = orderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments)
+                    orderChargeMap.orderSubTotal = orderSubTotal
+                    orderChargeMap.taxAmount = taxAmount
+                    orderChargeMap.shippingAmount = shippingAmount
+                    orderChargeMap.otherAdjAmount = otherAdjAmount
+                    orderChargeMap.grandTotal = grandTotal
+                    orderChargeMap.totalItem = orderItems.size()
+                    orderCharges = [:]
+                    orderCharges.(orderHeader.orderId) = orderChargeMap
+                    orderChargeList.add(orderCharges)
+                    itemInfoList.add(orderItemMap)
+                    orderInfoList.add(orderInfoMap)
+                    orderList.add(orderHeader)
+                    context.orderHeaderList = orderList
+                    context.orderInfoList = orderInfoList
+                    context.itemInfoList = itemInfoList
+                    context.orderChargeList = orderChargeList
                 }
             }
         }
     }
-    UtilHttp.setContentDisposition(response, "orderPickSheet.pdf");
+    UtilHttp.setContentDisposition(response, "orderPickSheet.pdf")
 }

Modified: ofbiz/trunk/applications/product/groovyScripts/facility/shipment/QuickShipOrder.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/groovyScripts/facility/shipment/QuickShipOrder.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/groovyScripts/facility/shipment/QuickShipOrder.groovy (original)
+++ ofbiz/trunk/applications/product/groovyScripts/facility/shipment/QuickShipOrder.groovy Wed Nov  2 19:09:13 2016
@@ -19,60 +19,60 @@
 
 import org.apache.ofbiz.base.util.*
 import org.apache.ofbiz.order.order.*
-import org.apache.ofbiz.entity.util.EntityUtilProperties;
+import org.apache.ofbiz.entity.util.EntityUtilProperties
 
-facilityId = parameters.facilityId;
+facilityId = parameters.facilityId
 if (facilityId) {
-    facility = from("Facility").where("facilityId", facilityId).queryOne();
-    context.facilityId = facilityId;
-    context.facility = facility;
+    facility = from("Facility").where("facilityId", facilityId).queryOne()
+    context.facilityId = facilityId
+    context.facility = facility
 }
 
 orderId = parameters.orderId
 if (orderId) {
-    orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
+    orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
     if (orderHeader) {
-        OrderReadHelper orh = new OrderReadHelper(orderHeader);
-        context.orderId = orderId;
-        context.orderHeader = orderHeader;
-        context.orderReadHelper = orh;
+        OrderReadHelper orh = new OrderReadHelper(orderHeader)
+        context.orderId = orderId
+        context.orderHeader = orderHeader
+        context.orderReadHelper = orh
     } else {
-        request.setAttribute("_ERROR_MESSAGE_", "<li>Order #" + orderId + " cannot be found.");
+        request.setAttribute("_ERROR_MESSAGE_", "<li>Order #" + orderId + " cannot be found.")
     }
 }
 
-shipmentId = parameters.shipmentId;
+shipmentId = parameters.shipmentId
 if (shipmentId) {
-    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
+    shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
     if (shipment) {
         // nuke event message - throws off the flow
-        request.setAttribute("_EVENT_MESSAGE_", null);
+        request.setAttribute("_EVENT_MESSAGE_", null)
 
         // set the shipment context info
-        context.shipmentType = shipment.getRelatedOne("ShipmentType", true);
-        context.statusItem = shipment.getRelatedOne("StatusItem", false);
-        context.primaryOrderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false);
-        context.toPerson = shipment.getRelatedOne("ToPerson", false);
-        context.toPartyGroup = shipment.getRelatedOne("ToPartyGroup", false);
-        context.fromPerson = shipment.getRelatedOne("FromPerson", false);
-        context.fromPartyGroup = shipment.getRelatedOne("FromPartyGroup", false);
-        context.originFacility = shipment.getRelatedOne("OriginFacility", false);
-        context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false);
-        context.originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false);
-        context.destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false);
-        context.shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false);
-        context.shipmentRoutes = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId'], false);
-        context.shipment = shipment;
-        context.shipmentId = shipmentId;
+        context.shipmentType = shipment.getRelatedOne("ShipmentType", true)
+        context.statusItem = shipment.getRelatedOne("StatusItem", false)
+        context.primaryOrderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false)
+        context.toPerson = shipment.getRelatedOne("ToPerson", false)
+        context.toPartyGroup = shipment.getRelatedOne("ToPartyGroup", false)
+        context.fromPerson = shipment.getRelatedOne("FromPerson", false)
+        context.fromPartyGroup = shipment.getRelatedOne("FromPartyGroup", false)
+        context.originFacility = shipment.getRelatedOne("OriginFacility", false)
+        context.destinationFacility = shipment.getRelatedOne("DestinationFacility", false)
+        context.originPostalAddress = shipment.getRelatedOne("OriginPostalAddress", false)
+        context.destinationPostalAddress = shipment.getRelatedOne("DestinationPostalAddress", false)
+        context.shipmentPackages = shipment.getRelated("ShipmentPackage", null, ['shipmentPackageSeqId'], false)
+        context.shipmentRoutes = shipment.getRelated("ShipmentRouteSegment", null, ['shipmentRouteSegmentId'], false)
+        context.shipment = shipment
+        context.shipmentId = shipmentId
 
-        weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").orderBy("description").queryList();
-        defaultWeightUom = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", delegator);
+        weightUoms = from("Uom").where("uomTypeId", "WEIGHT_MEASURE").orderBy("description").queryList()
+        defaultWeightUom = EntityUtilProperties.getPropertyValue("shipment", "shipment.default.weight.uom", delegator)
         if (defaultWeightUom) {
-            defaultWeight = from("Uom").where("uomId", defaultWeightUom).queryOne();
+            defaultWeight = from("Uom").where("uomId", defaultWeightUom).queryOne()
             if (defaultWeight) {
-                weightUoms.add(0, defaultWeight);
+                weightUoms.add(0, defaultWeight)
             }
         }
-        context.weightUomList = weightUoms;
+        context.weightUomList = weightUoms
     }
 }