svn commit: r1767764 [13/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 [13/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/order/groovyScripts/order/OrderView.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/OrderView.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/order/OrderView.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/order/OrderView.groovy Wed Nov  2 19:09:13 2016
@@ -17,229 +17,229 @@
  * under the License.
  */
 
-import java.math.BigDecimal;
-import java.util.*;
-import java.sql.Timestamp;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.collections.*;
-import org.apache.ofbiz.order.order.*;
-import org.apache.ofbiz.party.contact.*;
-import org.apache.ofbiz.product.inventory.InventoryWorker;
-import org.apache.ofbiz.product.catalog.CatalogWorker;
-import org.apache.ofbiz.product.store.ProductStoreWorker;
-import org.apache.ofbiz.accounting.payment.*;
-
-orderId = parameters.orderId;
-context.orderId = orderId;
-
-workEffortId = parameters.workEffortId;
-assignPartyId = parameters.partyId;
-assignRoleTypeId = parameters.roleTypeId;
-fromDate = parameters.fromDate;
-delegate = parameters.delegate;
+import java.math.BigDecimal
+import java.util.*
+import java.sql.Timestamp
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.collections.*
+import org.apache.ofbiz.order.order.*
+import org.apache.ofbiz.party.contact.*
+import org.apache.ofbiz.product.inventory.InventoryWorker
+import org.apache.ofbiz.product.catalog.CatalogWorker
+import org.apache.ofbiz.product.store.ProductStoreWorker
+import org.apache.ofbiz.accounting.payment.*
+
+orderId = parameters.orderId
+context.orderId = orderId
+
+workEffortId = parameters.workEffortId
+assignPartyId = parameters.partyId
+assignRoleTypeId = parameters.roleTypeId
+fromDate = parameters.fromDate
+delegate = parameters.delegate
 if (delegate && fromDate) {
-    fromDate = parameters.toFromDate;
+    fromDate = parameters.toFromDate
 }
-context.workEffortId = workEffortId;
-context.assignPartyId = assignPartyId;
-context.assignRoleTypeId = assignRoleTypeId;
-context.fromDate = fromDate;
-context.delegate = delegate;
-context.todayDate = new java.sql.Date(System.currentTimeMillis()).toString();
-def partyId = null;
-
-orderHeader = null;
-orderItems = null;
-orderAdjustments = null;
-comments = null;
+context.workEffortId = workEffortId
+context.assignPartyId = assignPartyId
+context.assignRoleTypeId = assignRoleTypeId
+context.fromDate = fromDate
+context.delegate = delegate
+context.todayDate = new java.sql.Date(System.currentTimeMillis()).toString()
+def partyId = null
+
+orderHeader = null
+orderItems = null
+orderAdjustments = null
+comments = null
 
 if (orderId) {
-    orderHeader = from('OrderHeader').where('orderId', orderId).cache(false).queryFirst();
-    comments = select("orderItemSeqId", "changeComments", "changeDatetime", "changeUserLogin").from("OrderItemChange").where(UtilMisc.toList(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId))).orderBy("-changeDatetime").queryList();
+    orderHeader = from('OrderHeader').where('orderId', orderId).cache(false).queryFirst()
+    comments = select("orderItemSeqId", "changeComments", "changeDatetime", "changeUserLogin").from("OrderItemChange").where(UtilMisc.toList(EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId))).orderBy("-changeDatetime").queryList()
 }
 
 if (orderHeader) {
     // note these are overridden in the OrderViewWebSecure.groovy script if run
-    context.hasPermission = true;
-    context.canViewInternalDetails = true;
+    context.hasPermission = true
+    context.canViewInternalDetails = true
 
-    orderReadHelper = new OrderReadHelper(orderHeader);
-    orderItems = orderReadHelper.getOrderItems();
-    orderAdjustments = orderReadHelper.getAdjustments();
-    orderHeaderAdjustments = orderReadHelper.getOrderHeaderAdjustments();
-    orderSubTotal = orderReadHelper.getOrderItemsSubTotal();
-    orderTerms = orderHeader.getRelated("OrderTerm", null, null, false);
-
-    context.orderHeader = orderHeader;
-    context.comments = comments;
-    context.orderReadHelper = orderReadHelper;
-    context.orderItems = orderItems;
-    context.orderAdjustments = orderAdjustments;
-    context.orderHeaderAdjustments = orderHeaderAdjustments;
-    context.orderSubTotal = orderSubTotal;
-    context.currencyUomId = orderReadHelper.getCurrency();
-    context.orderTerms = orderTerms;
+    orderReadHelper = new OrderReadHelper(orderHeader)
+    orderItems = orderReadHelper.getOrderItems()
+    orderAdjustments = orderReadHelper.getAdjustments()
+    orderHeaderAdjustments = orderReadHelper.getOrderHeaderAdjustments()
+    orderSubTotal = orderReadHelper.getOrderItemsSubTotal()
+    orderTerms = orderHeader.getRelated("OrderTerm", null, null, false)
+
+    context.orderHeader = orderHeader
+    context.comments = comments
+    context.orderReadHelper = orderReadHelper
+    context.orderItems = orderItems
+    context.orderAdjustments = orderAdjustments
+    context.orderHeaderAdjustments = orderHeaderAdjustments
+    context.orderSubTotal = orderSubTotal
+    context.currencyUomId = orderReadHelper.getCurrency()
+    context.orderTerms = orderTerms
 
     // get sales reps
-    context.salesReps = orderHeader.getRelated("OrderRole", [orderId : orderHeader.orderId, roleTypeId : "SALES_REP"], null, false);
+    context.salesReps = orderHeader.getRelated("OrderRole", [orderId : orderHeader.orderId, roleTypeId : "SALES_REP"], null, false)
     
     // get the order type
-    orderType = orderHeader.orderTypeId;
-    context.orderType = orderType;
+    orderType = orderHeader.orderTypeId
+    context.orderType = orderType
 
     // get the display party
-    displayParty = null;
+    displayParty = null
     if ("PURCHASE_ORDER".equals(orderType)) {
-        displayParty = orderReadHelper.getSupplierAgent();
+        displayParty = orderReadHelper.getSupplierAgent()
     } else {
-        displayParty = orderReadHelper.getPlacingParty();
+        displayParty = orderReadHelper.getPlacingParty()
     }
     if (displayParty) {
-        partyId = displayParty.partyId;
-        context.displayParty = displayParty;
-        context.partyId = partyId;
+        partyId = displayParty.partyId
+        context.displayParty = displayParty
+        context.partyId = partyId
 
-        paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, displayParty.partyId, false);
-        context.paymentMethodValueMaps = paymentMethodValueMaps;
+        paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, displayParty.partyId, false)
+        context.paymentMethodValueMaps = paymentMethodValueMaps
     }
 
-    otherAdjAmount = OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, true, false, false);
-    context.otherAdjAmount = otherAdjAmount;
+    otherAdjAmount = OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, true, false, false)
+    context.otherAdjAmount = otherAdjAmount
 
-    shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true);
-    shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true));
-    context.shippingAmount = shippingAmount;
+    shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true)
+    shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true))
+    context.shippingAmount = shippingAmount
 
-    taxAmount = OrderReadHelper.getOrderTaxByTaxAuthGeoAndParty(orderAdjustments).taxGrandTotal;
-    context.taxAmount = taxAmount;
+    taxAmount = OrderReadHelper.getOrderTaxByTaxAuthGeoAndParty(orderAdjustments).taxGrandTotal
+    context.taxAmount = taxAmount
 
-    grandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments);
-    context.grandTotal = grandTotal;
+    grandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments)
+    context.grandTotal = grandTotal
 
-    orderItemList = orderReadHelper.getOrderItems();
+    orderItemList = orderReadHelper.getOrderItems()
     // Retrieve all non-promo items that aren't cancelled
     context.orderItemList = orderReadHelper.getOrderItems().findAll { item ->
         (item.isPromo == null || item.isPromo == 'N')  || !item.statusId.equals('ITEM_CANCELLED')
     }
 
-    shippingAddress = orderReadHelper.getShippingAddress();
-    context.shippingAddress = shippingAddress;
+    shippingAddress = orderReadHelper.getShippingAddress()
+    context.shippingAddress = shippingAddress
 
-    billingAddress = orderReadHelper.getBillingAddress();
-    context.billingAddress = billingAddress;
+    billingAddress = orderReadHelper.getBillingAddress()
+    context.billingAddress = billingAddress
 
-    distributorId = orderReadHelper.getDistributorId();
-    context.distributorId = distributorId;
+    distributorId = orderReadHelper.getDistributorId()
+    context.distributorId = distributorId
 
-    affiliateId = orderReadHelper.getAffiliateId();
-    context.affiliateId = affiliateId;
+    affiliateId = orderReadHelper.getAffiliateId()
+    context.affiliateId = affiliateId
 
-    billingAccount = orderHeader.getRelatedOne("BillingAccount", false);
-    context.billingAccount = billingAccount;
-    context.billingAccountMaxAmount = orderReadHelper.getBillingAccountMaxAmount();
+    billingAccount = orderHeader.getRelatedOne("BillingAccount", false)
+    context.billingAccount = billingAccount
+    context.billingAccountMaxAmount = orderReadHelper.getBillingAccountMaxAmount()
 
     // get a list of all shipments, and a list of ItemIssuances per order item
-    allShipmentsMap = [:];
-    primaryShipments = orderHeader.getRelated("PrimaryShipment", null, null, false);
+    allShipmentsMap = [:]
+    primaryShipments = orderHeader.getRelated("PrimaryShipment", null, null, false)
     primaryShipments.each { primaryShipment ->
-        allShipmentsMap[primaryShipment.shipmentId] = primaryShipment;
+        allShipmentsMap[primaryShipment.shipmentId] = primaryShipment
     }
-    itemIssuancesPerItem = [:];
-    itemIssuances = orderHeader.getRelated("ItemIssuance", null, ["shipmentId", "shipmentItemSeqId"], false);
+    itemIssuancesPerItem = [:]
+    itemIssuances = orderHeader.getRelated("ItemIssuance", null, ["shipmentId", "shipmentItemSeqId"], false)
     itemIssuances.each { itemIssuance ->
         if (!allShipmentsMap.containsKey(itemIssuance.shipmentId)) {
-            iiShipment = itemIssuance.getRelatedOne("Shipment", false);
+            iiShipment = itemIssuance.getRelatedOne("Shipment", false)
             if (iiShipment) {
-                allShipmentsMap[iiShipment.shipmentId] = iiShipment;
+                allShipmentsMap[iiShipment.shipmentId] = iiShipment
             }
         }
 
-        perItemList = itemIssuancesPerItem[itemIssuance.orderItemSeqId];
+        perItemList = itemIssuancesPerItem[itemIssuance.orderItemSeqId]
         if (!perItemList) {
-            perItemList = [];
-            itemIssuancesPerItem[itemIssuance.orderItemSeqId] = perItemList;
+            perItemList = []
+            itemIssuancesPerItem[itemIssuance.orderItemSeqId] = perItemList
         }
-        perItemList.add(itemIssuance);
+        perItemList.add(itemIssuance)
     }
-    context.allShipments = allShipmentsMap.values();
-    context.itemIssuancesPerItem = itemIssuancesPerItem;
+    context.allShipments = allShipmentsMap.values()
+    context.itemIssuancesPerItem = itemIssuancesPerItem
 
     // get a list of all invoices
-    orderBilling = from("OrderItemBilling").where("orderId", orderId).orderBy("invoiceId").queryList();
-    context.invoices = orderBilling*.invoiceId.unique();
+    orderBilling = from("OrderItemBilling").where("orderId", orderId).orderBy("invoiceId").queryList()
+    context.invoices = orderBilling*.invoiceId.unique()
 
     ecl = EntityCondition.makeCondition([
                                     EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId),
                                     EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")],
-                                EntityOperator.AND);
-    orderPaymentPreferences = from("OrderPaymentPreference").where(ecl).queryList();
-    context.orderPaymentPreferences = orderPaymentPreferences;
+                                EntityOperator.AND)
+    orderPaymentPreferences = from("OrderPaymentPreference").where(ecl).queryList()
+    context.orderPaymentPreferences = orderPaymentPreferences
 
     // ship groups
-    shipGroups = from("OrderItemShipGroup").where("orderId", orderId).orderBy("shipGroupSeqId").queryList();
-    context.shipGroups = shipGroups;
+    shipGroups = from("OrderItemShipGroup").where("orderId", orderId).orderBy("shipGroupSeqId").queryList()
+    context.shipGroups = shipGroups
 
 
-    orderItemDatas = [];
+    orderItemDatas = []
     orderItemList.each { orderItem ->
-        BigDecimal cancelQuantity = orderItem.get("cancelQuantity");
-        BigDecimal quantity = orderItem.get("quantity");
+        BigDecimal cancelQuantity = orderItem.get("cancelQuantity")
+        BigDecimal quantity = orderItem.get("quantity")
         if ( cancelQuantity != null ) {
-            quantityOrdered = quantity.subtract(cancelQuantity);
+            quantityOrdered = quantity.subtract(cancelQuantity)
         } else {
-            quantityOrdered = quantity;
+            quantityOrdered = quantity
         }
-        OISGAssContents = [];
+        OISGAssContents = []
         shipGroups.each { shipGroup ->
-            OISGAssContents.addAll(EntityUtil.filterByAnd(shipGroup.getRelated("OrderItemShipGroupAssoc", null, null, false), UtilMisc.toMap("orderItemSeqId", orderItem.getString("orderItemSeqId"))));
+            OISGAssContents.addAll(EntityUtil.filterByAnd(shipGroup.getRelated("OrderItemShipGroupAssoc", null, null, false), UtilMisc.toMap("orderItemSeqId", orderItem.getString("orderItemSeqId"))))
         }
-        BigDecimal totalQuantityPlanned = 0;
+        BigDecimal totalQuantityPlanned = 0
         OISGAssContents.each { OISGAssContent ->
-           BigDecimal cancelQty = OISGAssContent.get("cancelQuantity");
-           BigDecimal qty = OISGAssContent.get("quantity");
+           BigDecimal cancelQty = OISGAssContent.get("cancelQuantity")
+           BigDecimal qty = OISGAssContent.get("quantity")
            if (qty != null) {
-               totalQuantityPlanned = totalQuantityPlanned.add(qty);
+               totalQuantityPlanned = totalQuantityPlanned.add(qty)
            }
            if (cancelQty != null){
-               OISGAssContent.set("quantity", qty.subtract(cancelQty));
+               OISGAssContent.set("quantity", qty.subtract(cancelQty))
            } else {
-               OISGAssContent.set("quantity", qty);
+               OISGAssContent.set("quantity", qty)
            }
         }
-        totalQuantityToPlan = totalQuantityPlanned - quantityOrdered;
-        BigDecimal quantityNotAvailable = 0;
-        List<GenericValue> oisgirs = orderItem.getRelated("OrderItemShipGrpInvRes", null, null, false);
+        totalQuantityToPlan = totalQuantityPlanned - quantityOrdered
+        BigDecimal quantityNotAvailable = 0
+        List<GenericValue> oisgirs = orderItem.getRelated("OrderItemShipGrpInvRes", null, null, false)
         for (GenericValue oisgir : oisgirs) {
             if (UtilValidate.isNotEmpty(oisgir.get("quantityNotAvailable"))) {
-                quantityNotAvailable = quantityNotAvailable.add(oisgir.getBigDecimal("quantityNotAvailable"));
+                quantityNotAvailable = quantityNotAvailable.add(oisgir.getBigDecimal("quantityNotAvailable"))
             }
         }
-        orderItemData = [:];
-        orderItemData.put("orderItem", orderItem);
-        orderItemData.put("OISGAssContents", OISGAssContents);
-        orderItemData.put("product", orderItem.getRelatedOne("Product", false));
-        orderItemData.put("quantityOrdered", quantityOrdered);
-        orderItemData.put("totalQuantityPlanned", totalQuantityPlanned);
-        orderItemData.put("totalQuantityToPlan", totalQuantityToPlan);
-        orderItemData.put("quantityNotAvailable", quantityNotAvailable);
-        orderItemDatas.add(orderItemData);
+        orderItemData = [:]
+        orderItemData.put("orderItem", orderItem)
+        orderItemData.put("OISGAssContents", OISGAssContents)
+        orderItemData.put("product", orderItem.getRelatedOne("Product", false))
+        orderItemData.put("quantityOrdered", quantityOrdered)
+        orderItemData.put("totalQuantityPlanned", totalQuantityPlanned)
+        orderItemData.put("totalQuantityToPlan", totalQuantityToPlan)
+        orderItemData.put("quantityNotAvailable", quantityNotAvailable)
+        orderItemDatas.add(orderItemData)
     }
-    context.put("orderItemDatas", orderItemDatas);
+    context.put("orderItemDatas", orderItemDatas)
     
     // create the actualDate for calendar
-    actualDateCal = Calendar.getInstance();
-    actualDateCal.setTime(new java.util.Date());
-    actualDateCal.set(Calendar.HOUR_OF_DAY, actualDateCal.getActualMinimum(Calendar.HOUR_OF_DAY));
-    actualDateCal.set(Calendar.MINUTE, actualDateCal.getActualMinimum(Calendar.MINUTE));
-    actualDateCal.set(Calendar.SECOND, actualDateCal.getActualMinimum(Calendar.SECOND));
-    actualDateCal.set(Calendar.MILLISECOND, actualDateCal.getActualMinimum(Calendar.MILLISECOND));
-    actualDateTs = new Timestamp(actualDateCal.getTimeInMillis());
-    actualDateStr = actualDateTs.toString();
-    actualDateStr = actualDateStr.substring(0, actualDateStr.indexOf('.'));
-    context.put("actualDateStr", actualDateStr);
+    actualDateCal = Calendar.getInstance()
+    actualDateCal.setTime(new java.util.Date())
+    actualDateCal.set(Calendar.HOUR_OF_DAY, actualDateCal.getActualMinimum(Calendar.HOUR_OF_DAY))
+    actualDateCal.set(Calendar.MINUTE, actualDateCal.getActualMinimum(Calendar.MINUTE))
+    actualDateCal.set(Calendar.SECOND, actualDateCal.getActualMinimum(Calendar.SECOND))
+    actualDateCal.set(Calendar.MILLISECOND, actualDateCal.getActualMinimum(Calendar.MILLISECOND))
+    actualDateTs = new Timestamp(actualDateCal.getTimeInMillis())
+    actualDateStr = actualDateTs.toString()
+    actualDateStr = actualDateStr.substring(0, actualDateStr.indexOf('.'))
+    context.put("actualDateStr", actualDateStr)
 
     // get Shipment tracking info
     orderShipmentInfoSummaryList = select("shipGroupSeqId", "shipmentId", "shipmentRouteSegmentId", "carrierPartyId", "shipmentMethodTypeId", "shipmentPackageSeqId", "trackingCode", "boxNumber")
@@ -247,95 +247,95 @@ if (orderHeader) {
                                     .where("orderId", orderId)
                                     .orderBy("shipmentId", "shipmentRouteSegmentId", "shipmentPackageSeqId")
                                     .distinct()
-                                    .queryList();
-    context.orderShipmentInfoSummaryList = orderShipmentInfoSummaryList;
+                                    .queryList()
+    context.orderShipmentInfoSummaryList = orderShipmentInfoSummaryList
 
-    customerPoNumber = null;
+    customerPoNumber = null
     orderItemList.each { orderItem ->
-        customerPoNumber = orderItem.correspondingPoId;
+        customerPoNumber = orderItem.correspondingPoId
     }
-    context.customerPoNumber = customerPoNumber;
+    context.customerPoNumber = customerPoNumber
 
-    statusChange = from("StatusValidChange").where("statusId", orderHeader.statusId).queryList();
-    context.statusChange = statusChange;
+    statusChange = from("StatusValidChange").where("statusId", orderHeader.statusId).queryList()
+    context.statusChange = statusChange
 
-    currentStatus = orderHeader.getRelatedOne("StatusItem", false);
-    context.currentStatus = currentStatus;
+    currentStatus = orderHeader.getRelatedOne("StatusItem", false)
+    context.currentStatus = currentStatus
 
-    orderHeaderStatuses = orderReadHelper.getOrderHeaderStatuses();
-    context.orderHeaderStatuses = orderHeaderStatuses;
+    orderHeaderStatuses = orderReadHelper.getOrderHeaderStatuses()
+    context.orderHeaderStatuses = orderHeaderStatuses
 
-    adjustmentTypes = from("OrderAdjustmentType").orderBy("description").queryList();
-    context.orderAdjustmentTypes = adjustmentTypes;
+    adjustmentTypes = from("OrderAdjustmentType").orderBy("description").queryList()
+    context.orderAdjustmentTypes = adjustmentTypes
 
-    notes = from("OrderHeaderNoteView").where("orderId", orderId).orderBy("-noteDateTime").queryList();
-    context.orderNotes = notes;
+    notes = from("OrderHeaderNoteView").where("orderId", orderId).orderBy("-noteDateTime").queryList()
+    context.orderNotes = notes
 
-    showNoteHeadingOnPDF = false;
+    showNoteHeadingOnPDF = false
     if (notes && EntityUtil.filterByCondition(notes, EntityCondition.makeCondition("internalNote", EntityOperator.EQUALS, "N")).size() > 0) {
-        showNoteHeadingOnPDF = true;
+        showNoteHeadingOnPDF = true
     }
-    context.showNoteHeadingOnPDF = showNoteHeadingOnPDF;
+    context.showNoteHeadingOnPDF = showNoteHeadingOnPDF
 
-    cmvm = ContactMechWorker.getOrderContactMechValueMaps(delegator, orderId);
-    context.orderContactMechValueMaps = cmvm;
+    cmvm = ContactMechWorker.getOrderContactMechValueMaps(delegator, orderId)
+    context.orderContactMechValueMaps = cmvm
 
-    orderItemChangeReasons = from("Enumeration").where("enumTypeId", "ODR_ITM_CH_REASON").orderBy("sequenceId").queryList();
-    context.orderItemChangeReasons = orderItemChangeReasons;
+    orderItemChangeReasons = from("Enumeration").where("enumTypeId", "ODR_ITM_CH_REASON").orderBy("sequenceId").queryList()
+    context.orderItemChangeReasons = orderItemChangeReasons
 
     if ("PURCHASE_ORDER".equals(orderType)) {
         // for purchase orders, we need also the supplier's postal address
-        supplier = orderReadHelper.getBillFromParty();
+        supplier = orderReadHelper.getBillFromParty()
         if (supplier) {
-            supplierContactMechValueMaps = ContactMechWorker.getPartyContactMechValueMaps(delegator, supplier.partyId, false, "POSTAL_ADDRESS");
-            context.supplierContactMechValueMaps = supplierContactMechValueMaps;
+            supplierContactMechValueMaps = ContactMechWorker.getPartyContactMechValueMaps(delegator, supplier.partyId, false, "POSTAL_ADDRESS")
+            context.supplierContactMechValueMaps = supplierContactMechValueMaps
             supplierContactMechValueMaps.each { supplierContactMechValueMap ->
-                contactMechPurposes = supplierContactMechValueMap.partyContactMechPurposes;
+                contactMechPurposes = supplierContactMechValueMap.partyContactMechPurposes
                 contactMechPurposes.each { contactMechPurpose ->
                     if (contactMechPurpose.contactMechPurposeTypeId.equals("GENERAL_LOCATION")) {
-                        context.supplierGeneralContactMechValueMap = supplierContactMechValueMap;
+                        context.supplierGeneralContactMechValueMap = supplierContactMechValueMap
                     } else if (contactMechPurpose.contactMechPurposeTypeId.equals("SHIPPING_LOCATION")) {
-                        context.supplierShippingContactMechValueMap = supplierContactMechValueMap;
+                        context.supplierShippingContactMechValueMap = supplierContactMechValueMap
                     } else if (contactMechPurpose.contactMechPurposeTypeId.equals("BILLING_LOCATION")) {
-                        context.supplierBillingContactMechValueMap = supplierContactMechValueMap;
+                        context.supplierBillingContactMechValueMap = supplierContactMechValueMap
                     } else if (contactMechPurpose.contactMechPurposeTypeId.equals("PAYMENT_LOCATION")) {
-                        context.supplierPaymentContactMechValueMap = supplierContactMechValueMap;
+                        context.supplierPaymentContactMechValueMap = supplierContactMechValueMap
                     }
                 }
             }
         }
         // get purchase order item types
-        purchaseOrderItemTypeList = from("OrderItemType").where("parentTypeId", "PURCHASE_SPECIFIC").cache(true).queryList();
-        context.purchaseOrderItemTypeList = purchaseOrderItemTypeList;
+        purchaseOrderItemTypeList = from("OrderItemType").where("parentTypeId", "PURCHASE_SPECIFIC").cache(true).queryList()
+        context.purchaseOrderItemTypeList = purchaseOrderItemTypeList
     }
 
     // see if an approved order with all items completed exists
-    context.setOrderCompleteOption = false;
+    context.setOrderCompleteOption = false
     if ("ORDER_APPROVED".equals(orderHeader.statusId)) {
-        expr = EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED");
-        notCreatedItems = orderReadHelper.getOrderItemsByCondition(expr);
+        expr = EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED")
+        notCreatedItems = orderReadHelper.getOrderItemsByCondition(expr)
         if (!notCreatedItems) {
-            context.setOrderCompleteOption = true;
+            context.setOrderCompleteOption = true
         }
     }
 
     // get inventory summary for each shopping cart product item
     inventorySummary = runService('getProductInventorySummaryForItems', [orderItems : orderItems])
-    context.availableToPromiseMap = inventorySummary.availableToPromiseMap;
-    context.quantityOnHandMap = inventorySummary.quantityOnHandMap;
-    context.mktgPkgATPMap = inventorySummary.mktgPkgATPMap;
-    context.mktgPkgQOHMap = inventorySummary.mktgPkgQOHMap;
+    context.availableToPromiseMap = inventorySummary.availableToPromiseMap
+    context.quantityOnHandMap = inventorySummary.quantityOnHandMap
+    context.mktgPkgATPMap = inventorySummary.mktgPkgATPMap
+    context.mktgPkgQOHMap = inventorySummary.mktgPkgQOHMap
 
     // get inventory summary with respect to facility
-    productStore = orderReadHelper.getProductStore();
-    context.productStore = productStore;
+    productStore = orderReadHelper.getProductStore()
+    context.productStore = productStore
     if (productStore) {
-        facility = productStore.getRelatedOne("Facility", false);
+        facility = productStore.getRelatedOne("Facility", false)
         if (facility) {
-            inventorySummaryByFacility = runService("getProductInventorySummaryForItems", [orderItems : orderItems, facilityId : facility.facilityId]);
-            context.availableToPromiseByFacilityMap = inventorySummaryByFacility.availableToPromiseMap;
-            context.quantityOnHandByFacilityMap = inventorySummaryByFacility.quantityOnHandMap;
-            context.facility = facility;
+            inventorySummaryByFacility = runService("getProductInventorySummaryForItems", [orderItems : orderItems, facilityId : facility.facilityId])
+            context.availableToPromiseByFacilityMap = inventorySummaryByFacility.availableToPromiseMap
+            context.quantityOnHandByFacilityMap = inventorySummaryByFacility.quantityOnHandMap
+            context.facility = facility
         }
     }
 
@@ -344,163 +344,163 @@ if (orderHeader) {
     // For a given ship group, the allowed facilities are the ones associated
     // to the same contact mech of the ship group.
     if ("PURCHASE_ORDER".equals(orderType)) {
-        facilitiesForShipGroup = [:];
+        facilitiesForShipGroup = [:]
         if (orderReadHelper.getBillToParty()) {
-            ownerPartyId = orderReadHelper.getBillToParty().partyId;
-            Map ownedFacilities = [:];
+            ownerPartyId = orderReadHelper.getBillToParty().partyId
+            Map ownedFacilities = [:]
             shipGroups.each { shipGroup ->
-                lookupMap = [ownerPartyId : ownerPartyId];
+                lookupMap = [ownerPartyId : ownerPartyId]
                 if (shipGroup.contactMechId) {
-                    lookupMap.contactMechId = shipGroup.contactMechId;
+                    lookupMap.contactMechId = shipGroup.contactMechId
                 }
-                facilities = from("FacilityAndContactMech").where(lookupMap).cache(true).queryList();
-                facilitiesForShipGroup[shipGroup.shipGroupSeqId] = facilities;
+                facilities = from("FacilityAndContactMech").where(lookupMap).cache(true).queryList()
+                facilitiesForShipGroup[shipGroup.shipGroupSeqId] = facilities
                 facilities.each { facility ->
-                    ownedFacilities[facility.facilityId] = facility;
+                    ownedFacilities[facility.facilityId] = facility
                 }
             }
-            context.facilitiesForShipGroup = facilitiesForShipGroup;
+            context.facilitiesForShipGroup = facilitiesForShipGroup
             // Now get the list of all the facilities owned by the bill-to-party
-            context.ownedFacilities = ownedFacilities.values();
+            context.ownedFacilities = ownedFacilities.values()
         }
     }
 
     // set the type of return based on type of order
     if ("SALES_ORDER".equals(orderType)) {
-        context.returnHeaderTypeId = "CUSTOMER_RETURN";
+        context.returnHeaderTypeId = "CUSTOMER_RETURN"
         // also set the product store facility Id for sales orders
         if (productStore) {
-            context.storeFacilityId = productStore.inventoryFacilityId;
+            context.storeFacilityId = productStore.inventoryFacilityId
             if (productStore.reqReturnInventoryReceive) {
-                context.needsInventoryReceive = productStore.reqReturnInventoryReceive;
+                context.needsInventoryReceive = productStore.reqReturnInventoryReceive
             } else {
-                context.needsInventoryReceive = "Y";
+                context.needsInventoryReceive = "Y"
             }
         }
     } else {
-        context.returnHeaderTypeId = "VENDOR_RETURN";
+        context.returnHeaderTypeId = "VENDOR_RETURN"
     }
 
     // QUANTITY: get the returned quantity by order item map
-    context.returnQuantityMap = orderReadHelper.getOrderItemReturnedQuantities();
+    context.returnQuantityMap = orderReadHelper.getOrderItemReturnedQuantities()
 
     // INVENTORY: construct a Set of productIds in the order for use in querying for inventory, otherwise these queries can get expensive
-    productIds = orderReadHelper.getOrderProductIds();
+    productIds = orderReadHelper.getOrderProductIds()
 
     // INVENTORY: get the production quantity for each product and store the results in a map of productId -> quantity
-    productionMap = [:];
+    productionMap = [:]
     productIds.each { productId ->
         if (productId) {  // avoid order items without productIds, such as bulk order items
-            resultOutput = runService("getProductManufacturingSummaryByFacility", [productId : productId]);
-            manufacturingInQuantitySummaryByFacility = resultOutput.summaryInByFacility;
-            Double productionQuantity = 0;
+            resultOutput = runService("getProductManufacturingSummaryByFacility", [productId : productId])
+            manufacturingInQuantitySummaryByFacility = resultOutput.summaryInByFacility
+            Double productionQuantity = 0
             manufacturingInQuantitySummaryByFacility.values().each { manQuantity ->
-                productionQuantity += manQuantity.estimatedQuantityTotal;
+                productionQuantity += manQuantity.estimatedQuantityTotal
             }
-            productionMap[productId] = productionQuantity;
+            productionMap[productId] = productionQuantity
         }
     }
-    context.productionProductQuantityMap = productionMap;
+    context.productionProductQuantityMap = productionMap
 
     if (productIds.size() > 0) {
         // INVENTORY: find the number of products in outstanding sales orders for the same product store    
-        requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator);
-        context.requiredProductQuantityMap = requiredMap;
+        requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator)
+        context.requiredProductQuantityMap = requiredMap
     
         // INVENTORY: find the quantity of each product in outstanding purchase orders
-        onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator);
-        context.onOrderProductQuantityMap = onOrderMap;
+        onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator)
+        context.onOrderProductQuantityMap = onOrderMap
     } else {
-        context.requiredProductQuantityMap = [:];
-        context.onOrderProductQuantityMap = [:];
+        context.requiredProductQuantityMap = [:]
+        context.onOrderProductQuantityMap = [:]
     }
 
         // list to find all the POSTAL_ADDRESS for the shipment party.
-    orderParty = from("Party").where("partyId", partyId).queryOne();
-    shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false);
-    context.shippingContactMechList = shippingContactMechList;
+    orderParty = from("Party").where("partyId", partyId).queryOne()
+    shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)
+    context.shippingContactMechList = shippingContactMechList
 
     // list to find all the shipmentMethods from the view named "ProductStoreShipmentMethView".
-    shipGroupShippingMethods = [:];
+    shipGroupShippingMethods = [:]
     shipGroups.each { shipGroup ->
-        shipGroupSeqId = shipGroup.shipGroupSeqId;
-        shippableItemFeatures = orderReadHelper.getFeatureIdQtyMap(shipGroupSeqId);
-        shippableTotal = orderReadHelper.getShippableTotal(shipGroupSeqId);
-        shippableWeight = orderReadHelper.getShippableWeight(shipGroupSeqId);
-        shippableItemSizes = orderReadHelper.getShippableSizes(shipGroupSeqId);
-        shippingAddress = orderReadHelper.getShippingAddress(shipGroupSeqId);
+        shipGroupSeqId = shipGroup.shipGroupSeqId
+        shippableItemFeatures = orderReadHelper.getFeatureIdQtyMap(shipGroupSeqId)
+        shippableTotal = orderReadHelper.getShippableTotal(shipGroupSeqId)
+        shippableWeight = orderReadHelper.getShippableWeight(shipGroupSeqId)
+        shippableItemSizes = orderReadHelper.getShippableSizes(shipGroupSeqId)
+        shippingAddress = orderReadHelper.getShippingAddress(shipGroupSeqId)
 
         List<GenericValue> productStoreShipmentMethList = ProductStoreWorker.getAvailableStoreShippingMethods(delegator, orderReadHelper.getProductStoreId(),
-                shippingAddress, shippableItemSizes, shippableItemFeatures, shippableWeight, shippableTotal);
-        shipGroupShippingMethods.put(shipGroupSeqId, productStoreShipmentMethList);
-        context.shipGroupShippingMethods = shipGroupShippingMethods;
+                shippingAddress, shippableItemSizes, shippableItemFeatures, shippableWeight, shippableTotal)
+        shipGroupShippingMethods.put(shipGroupSeqId, productStoreShipmentMethList)
+        context.shipGroupShippingMethods = shipGroupShippingMethods
     }
 
     // Get a map of returnable items
-    returnableItems = [:];
+    returnableItems = [:]
     returnableItemServiceMap = run service: 'getReturnableItems', with: [orderId : orderId]
     if (returnableItemServiceMap.returnableItems) {
-        returnableItems = returnableItemServiceMap.returnableItems;
+        returnableItems = returnableItemServiceMap.returnableItems
     }
-    context.returnableItems = returnableItems;
+    context.returnableItems = returnableItems
 
     // get the catalogIds for appending items
     if (context.request != null) {
         if ("SALES_ORDER".equals(orderType) && productStore) {
-            catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStore.productStoreId, partyId);
+            catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStore.productStoreId, partyId)
         } else {
-            catalogCol = CatalogWorker.getAllCatalogIds(request);
+            catalogCol = CatalogWorker.getAllCatalogIds(request)
         }
         if (catalogCol) {
-            currentCatalogId = catalogCol[0];
-            currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId);
-            context.catalogCol = catalogCol;
-            context.currentCatalogId = currentCatalogId;
-            context.currentCatalogName = currentCatalogName;
+            currentCatalogId = catalogCol[0]
+            currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId)
+            context.catalogCol = catalogCol
+            context.currentCatalogId = currentCatalogId
+            context.currentCatalogName = currentCatalogName
         }
     }
 
    // list to find all the POSTAL_ADDRESS for the party.
-   orderParty = from("Party").where("partyId", partyId).queryOne();
-   postalContactMechList = ContactHelper.getContactMechByType(orderParty,"POSTAL_ADDRESS", false);
-   context.postalContactMechList = postalContactMechList;
+   orderParty = from("Party").where("partyId", partyId).queryOne()
+   postalContactMechList = ContactHelper.getContactMechByType(orderParty,"POSTAL_ADDRESS", false)
+   context.postalContactMechList = postalContactMechList
 
    // list to find all the TELECOM_NUMBER for the party.
-   telecomContactMechList = ContactHelper.getContactMechByType(orderParty,"TELECOM_NUMBER", false);
-   context.telecomContactMechList = telecomContactMechList;
+   telecomContactMechList = ContactHelper.getContactMechByType(orderParty,"TELECOM_NUMBER", false)
+   context.telecomContactMechList = telecomContactMechList
 
    // list to find all the EMAIL_ADDRESS for the party.
-   emailContactMechList = ContactHelper.getContactMechByType(orderParty,"EMAIL_ADDRESS", false);
-   context.emailContactMechList = emailContactMechList;
+   emailContactMechList = ContactHelper.getContactMechByType(orderParty,"EMAIL_ADDRESS", false)
+   context.emailContactMechList = emailContactMechList
 }
 
-paramString = "";
-if (orderId) paramString += "orderId=" + orderId;
-if (workEffortId) paramString += "&workEffortId=" + workEffortId;
-if (assignPartyId) paramString += "&partyId=" + assignPartyId;
-if (assignRoleTypeId) paramString += "&roleTypeId=" + assignRoleTypeId;
-if (fromDate) paramString += "&fromDate=" + fromDate;
-context.paramString = paramString;
+paramString = ""
+if (orderId) paramString += "orderId=" + orderId
+if (workEffortId) paramString += "&workEffortId=" + workEffortId
+if (assignPartyId) paramString += "&partyId=" + assignPartyId
+if (assignRoleTypeId) paramString += "&roleTypeId=" + assignRoleTypeId
+if (fromDate) paramString += "&fromDate=" + fromDate
+context.paramString = paramString
 
-workEffortStatus = null;
+workEffortStatus = null
 if (workEffortId && assignPartyId && assignRoleTypeId && fromDate) {
-    wepa = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId, "partyId", assignPartyId, "roleTypeId", assignRoleTypeId, "fromDate", fromDate).queryOne();
+    wepa = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId, "partyId", assignPartyId, "roleTypeId", assignRoleTypeId, "fromDate", fromDate).queryOne()
 
     if ("CAL_ACCEPTED".equals(wepa?.statusId)) {
-        workEffort = from("WorkEffort").where("workEffortId", workEffortId).queryOne();
-        workEffortStatus = workEffort.currentStatusId;
+        workEffort = from("WorkEffort").where("workEffortId", workEffortId).queryOne()
+        workEffortStatus = workEffort.currentStatusId
         if (workEffortStatus) {
-            context.workEffortStatus = workEffortStatus;
+            context.workEffortStatus = workEffortStatus
             if (workEffortStatus.equals("WF_RUNNING") || workEffortStatus.equals("WF_SUSPENDED"))
-                context.inProcess = true;
+                context.inProcess = true
         }
 
         if (workEffort) {
             if ("true".equals(delegate) || "WF_RUNNING".equals(workEffortStatus)) {
-                activity = from("WorkflowActivity").where("packageId", workEffort.workflowPackageId, "packageVersion", workEffort.workflowPackageVersion, "processId", workEffort.workflowProcessId, "processVersion", workEffort.workflowProcessVersion, "activityId", workEffort.workflowActivityId).queryOne();
+                activity = from("WorkflowActivity").where("packageId", workEffort.workflowPackageId, "packageVersion", workEffort.workflowPackageVersion, "processId", workEffort.workflowProcessId, "processVersion", workEffort.workflowProcessVersion, "activityId", workEffort.workflowActivityId).queryOne()
                 if (activity) {
-                    transitions = activity.getRelated("FromWorkflowTransition", null, ["-transitionId"], false);
-                    context.wfTransitions = transitions;
+                    transitions = activity.getRelated("FromWorkflowTransition", null, ["-transitionId"], false)
+                    context.wfTransitions = transitions
                 }
             }
         }
@@ -508,48 +508,48 @@ if (workEffortId && assignPartyId && ass
 }
 
 if (orderItems) {
-    orderItem = EntityUtil.getFirst(orderItems);
-    context.orderItem = orderItem;
+    orderItem = EntityUtil.getFirst(orderItems)
+    context.orderItem = orderItem
 }
 
 // getting online ship estimates corresponding to this Order from UPS when "Hold" button will be clicked, when user packs from weight package screen.
 // This case comes when order's shipping amount is  more then or less than default percentage (defined in shipment.properties) of online UPS shipping amount.
 
-shipments = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryList();
+shipments = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryList()
 if (shipments) {
-    pickedShipmentId = EntityUtil.getFirst(shipments).shipmentId;
-    shipmentRouteSegment = from("ShipmentRouteSegment").where("shipmentId", pickedShipmentId).queryFirst();
-    context.shipmentRouteSegmentId = shipmentRouteSegment.shipmentRouteSegmentId;
-    context.pickedShipmentId = pickedShipmentId;
+    pickedShipmentId = EntityUtil.getFirst(shipments).shipmentId
+    shipmentRouteSegment = from("ShipmentRouteSegment").where("shipmentId", pickedShipmentId).queryFirst()
+    context.shipmentRouteSegmentId = shipmentRouteSegment.shipmentRouteSegmentId
+    context.pickedShipmentId = pickedShipmentId
     if (pickedShipmentId && shipmentRouteSegment.trackingIdNumber) {
         if ("UPS" == shipmentRouteSegment.carrierPartyId && productStore) {
-            resultMap = runService('upsShipmentAlternateRatesEstimate', [productStoreId: productStore.productStoreId, shipmentId: pickedShipmentId]);
-            shippingRates = resultMap.shippingRates;
-            shippingRateList = [];
+            resultMap = runService('upsShipmentAlternateRatesEstimate', [productStoreId: productStore.productStoreId, shipmentId: pickedShipmentId])
+            shippingRates = resultMap.shippingRates
+            shippingRateList = []
             shippingRates.each { shippingRate ->
-                shippingMethodAndRate = [:];
-                serviceCodes = shippingRate.keySet();
+                shippingMethodAndRate = [:]
+                serviceCodes = shippingRate.keySet()
                 serviceCodes.each { serviceCode ->
-                    carrierShipmentMethod = from("CarrierShipmentMethod").where("partyId", "UPS", "carrierServiceCode", serviceCode).queryFirst();
-                    shipmentMethodTypeId = carrierShipmentMethod.shipmentMethodTypeId;
-                    rate = shippingRate.get(serviceCode);
-                    shipmentMethodDescription = EntityUtil.getFirst(carrierShipmentMethod.getRelated("ShipmentMethodType", null, null, false)).description;
-                    shippingMethodAndRate.shipmentMethodTypeId = carrierShipmentMethod.shipmentMethodTypeId;
-                    shippingMethodAndRate.rate = rate;
-                    shippingMethodAndRate.shipmentMethodDescription = shipmentMethodDescription;
-                    shippingRateList.add(shippingMethodAndRate);
+                    carrierShipmentMethod = from("CarrierShipmentMethod").where("partyId", "UPS", "carrierServiceCode", serviceCode).queryFirst()
+                    shipmentMethodTypeId = carrierShipmentMethod.shipmentMethodTypeId
+                    rate = shippingRate.get(serviceCode)
+                    shipmentMethodDescription = EntityUtil.getFirst(carrierShipmentMethod.getRelated("ShipmentMethodType", null, null, false)).description
+                    shippingMethodAndRate.shipmentMethodTypeId = carrierShipmentMethod.shipmentMethodTypeId
+                    shippingMethodAndRate.rate = rate
+                    shippingMethodAndRate.shipmentMethodDescription = shipmentMethodDescription
+                    shippingRateList.add(shippingMethodAndRate)
                 }
            }
-            context.shippingRateList = shippingRateList;
+            context.shippingRateList = shippingRateList
         }
     }
 }
 
 // get orderAdjustmentId for SHIPPING_CHARGES
-orderAdjustmentId = null;
+orderAdjustmentId = null
 orderAdjustments.each { orderAdjustment ->
     if(orderAdjustment.orderAdjustmentTypeId.equals("SHIPPING_CHARGES")) {
-        orderAdjustmentId = orderAdjustment.orderAdjustmentId;
+        orderAdjustmentId = orderAdjustment.orderAdjustmentId
     }
 }
-context.orderAdjustmentId = orderAdjustmentId;
+context.orderAdjustmentId = orderAdjustmentId

Modified: ofbiz/trunk/applications/order/groovyScripts/order/OrderViewWebSecure.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/OrderViewWebSecure.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/order/OrderViewWebSecure.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/order/OrderViewWebSecure.groovy Wed Nov  2 19:09:13 2016
@@ -17,39 +17,39 @@
  * under the License.
  */
 
-import java.util.*;
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.base.util.collections.*;
-import org.apache.ofbiz.order.order.*;
+import java.util.*
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.base.util.collections.*
+import org.apache.ofbiz.order.order.*
 
-orderHeader = context.orderHeader;
+orderHeader = context.orderHeader
 
 // if orderHeader is null in OrderView.groovy then it is not null but void here!
 if (orderHeader) {
     // set hasPermission, must always exist if the orderHeader != null
     // hasPermission if: has ORDERMGR_VIEW, ORDERMGR_ROLE_VIEW & associated with order, or is associated in the SUPPLIER_AGENT role
-    hasPermission = false;
-    canViewInternalDetails = false;
+    hasPermission = false
+    canViewInternalDetails = false
     if (("SALES_ORDER".equals(orderHeader.orderTypeId) && security.hasEntityPermission("ORDERMGR", "_VIEW", session))
         || ("PURCHASE_ORDER".equals(orderHeader.orderTypeId) && security.hasEntityPermission("ORDERMGR", "_PURCHASE_VIEW", session))) {
-        hasPermission = true;
-        canViewInternalDetails = true;
+        hasPermission = true
+        canViewInternalDetails = true
     } else if (security.hasEntityPermission("ORDERMGR_ROLE", "_VIEW", session)) {
-        currentUserOrderRoles = orderHeader.getRelated("OrderRole", [partyId : userLogin.partyId], null, false);
+        currentUserOrderRoles = orderHeader.getRelated("OrderRole", [partyId : userLogin.partyId], null, false)
         if (currentUserOrderRoles) {
-            hasPermission = true;
-            canViewInternalDetails = true;
+            hasPermission = true
+            canViewInternalDetails = true
         }
     } else {
         // regardless of permission, allow if this is the supplier
-        currentUserSupplierOrderRoles = orderHeader.getRelated("OrderRole", [partyId : userLogin.partyId, roleTypeId : "SUPPLIER_AGENT"], null, false);
+        currentUserSupplierOrderRoles = orderHeader.getRelated("OrderRole", [partyId : userLogin.partyId, roleTypeId : "SUPPLIER_AGENT"], null, false)
         if (currentUserSupplierOrderRoles) {
-            hasPermission = true;
+            hasPermission = true
         }
     }
-    context.hasPermission = hasPermission;
-    context.canViewInternalDetails = canViewInternalDetails;
+    context.hasPermission = hasPermission
+    context.canViewInternalDetails = canViewInternalDetails
 
-    orderContentWrapper = OrderContentWrapper.makeOrderContentWrapper(orderHeader, request);
-    context.orderContentWrapper = orderContentWrapper;
+    orderContentWrapper = OrderContentWrapper.makeOrderContentWrapper(orderHeader, request)
+    context.orderContentWrapper = orderContentWrapper
 }

Modified: ofbiz/trunk/applications/order/groovyScripts/order/ReceivePayment.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/ReceivePayment.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/order/ReceivePayment.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/order/ReceivePayment.groovy Wed Nov  2 19:09:13 2016
@@ -17,28 +17,28 @@
  * under the License.
  */
 
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.base.util.*;
-
-orderId = request.getParameter("orderId");
-paymentMethodTypes = from("PaymentMethodType").where(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.NOT_EQUAL, "EXT_OFFLINE")).queryList();
-context.paymentMethodTypes = paymentMethodTypes;
-
-workEffortId = request.getParameter("workEffortId");
-partyId = request.getParameter("partyId");
-roleTypeId = request.getParameter("roleTypeId");
-fromDate = request.getParameter("fromDate");
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.base.util.*
+
+orderId = request.getParameter("orderId")
+paymentMethodTypes = from("PaymentMethodType").where(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.NOT_EQUAL, "EXT_OFFLINE")).queryList()
+context.paymentMethodTypes = paymentMethodTypes
+
+workEffortId = request.getParameter("workEffortId")
+partyId = request.getParameter("partyId")
+roleTypeId = request.getParameter("roleTypeId")
+fromDate = request.getParameter("fromDate")
 
-donePage = request.getParameter("DONE_PAGE") ?: "orderview?orderId=" + orderId;
+donePage = request.getParameter("DONE_PAGE") ?: "orderview?orderId=" + orderId
 if (workEffortId)
-    donePage += "&workEffortId=" + workEffortId;
+    donePage += "&workEffortId=" + workEffortId
 if (partyId)
-    donePage += "&partyId=" + partyId;
+    donePage += "&partyId=" + partyId
 if (roleTypeId)
-    donePage += "&roleTypeId=" + roleTypeId;
+    donePage += "&roleTypeId=" + roleTypeId
 if (fromDate)
-    donePage += "&fromDate=" + fromDate;
-context.donePage = donePage;
+    donePage += "&fromDate=" + fromDate
+context.donePage = donePage
 
 

Modified: ofbiz/trunk/applications/order/groovyScripts/order/SendConfirmationEmail.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/SendConfirmationEmail.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/order/SendConfirmationEmail.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/order/SendConfirmationEmail.groovy Wed Nov  2 19:09:13 2016
@@ -16,32 +16,32 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.Delegator;
-import org.apache.ofbiz.entity.GenericValue;
-import org.apache.ofbiz.order.order.OrderReadHelper;
-import org.apache.ofbiz.common.email.NotificationServices;
-
-orderId = request.getParameter("orderId") ?: parameters.get("orderId");
-context.orderId = orderId;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.Delegator
+import org.apache.ofbiz.entity.GenericValue
+import org.apache.ofbiz.order.order.OrderReadHelper
+import org.apache.ofbiz.common.email.NotificationServices
+
+orderId = request.getParameter("orderId") ?: parameters.get("orderId")
+context.orderId = orderId
 
-partyId = request.getParameter("partyId");
-sendTo = request.getParameter("sendTo");
+partyId = request.getParameter("partyId")
+sendTo = request.getParameter("sendTo")
 
-context.partyId = partyId;
-context.sendTo = sendTo;
+context.partyId = partyId
+context.sendTo = sendTo
 
-donePage = request.getParameter("DONE_PAGE") ?: "orderview";
-context.donePage = donePage;
+donePage = request.getParameter("DONE_PAGE") ?: "orderview"
+context.donePage = donePage
 
 // Provide the correct order confirmation ProductStoreEmailSetting, if one exists
-orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
+orderHeader = from("OrderHeader").where("orderId", orderId).queryOne()
 if (orderHeader.productStoreId) {
-    productStoreEmailSetting = from("ProductStoreEmailSetting").where("productStoreId", orderHeader.productStoreId, "emailType", emailType).queryOne();
+    productStoreEmailSetting = from("ProductStoreEmailSetting").where("productStoreId", orderHeader.productStoreId, "emailType", emailType).queryOne()
     if (productStoreEmailSetting) {
-        context.productStoreEmailSetting = productStoreEmailSetting;
+        context.productStoreEmailSetting = productStoreEmailSetting
     }
 }
 
 // set the baseUrl parameter, required by some email bodies
-NotificationServices.setBaseUrl(delegator, context.webSiteId, context);
+NotificationServices.setBaseUrl(delegator, context.webSiteId, context)

Modified: ofbiz/trunk/applications/order/groovyScripts/order/ShipGroups.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/ShipGroups.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/order/ShipGroups.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/order/ShipGroups.groovy Wed Nov  2 19:09:13 2016
@@ -17,103 +17,103 @@
  * under the License.
  */
 
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.util.EntityTypeUtil;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.util.EntityTypeUtil
+import org.apache.ofbiz.entity.util.EntityUtil
 
-orderId = parameters.orderId;
-if (!orderId) return;
+orderId = parameters.orderId
+if (!orderId) return
 
-shipGroupSeqId = parameters.shipGroupSeqId;
+shipGroupSeqId = parameters.shipGroupSeqId
 
 // if a particular ship group is requested, we will limit ourselves to it
-findMap = [orderId: orderId];
-if (shipGroupSeqId) findMap.shipGroupSeqId = shipGroupSeqId;
+findMap = [orderId: orderId]
+if (shipGroupSeqId) findMap.shipGroupSeqId = shipGroupSeqId
 
-shipGroups = from("OrderItemShipGroup").where(findMap).orderBy("shipGroupSeqId").queryList();
-context.shipGroups = shipGroups;
+shipGroups = from("OrderItemShipGroup").where(findMap).orderBy("shipGroupSeqId").queryList()
+context.shipGroups = shipGroups
 
 // method to expand the marketing packages
 LinkedList expandProductGroup(product, quantityInGroup, quantityShipped, quantityOpen, assocType) {
-    sublines = [];
-    associations = product.getRelated("MainProductAssoc", [productAssocTypeId : assocType], null, false);
-    associations = EntityUtil.filterByDate(associations);
+    sublines = []
+    associations = product.getRelated("MainProductAssoc", [productAssocTypeId : assocType], null, false)
+    associations = EntityUtil.filterByDate(associations)
     associations.each { association ->
-        line = [:];
-        line.product = association.getRelatedOne("AssocProduct", false);
+        line = [:]
+        line.product = association.getRelatedOne("AssocProduct", false)
 
         // determine the quantities
-        quantityComposed = association.quantity ?: 0;
-        line.quantityInGroup = quantityInGroup * quantityComposed;
-        line.quantityShipped = quantityShipped * quantityComposed;
-        line.quantityOpen = quantityOpen * quantityComposed;
+        quantityComposed = association.quantity ?: 0
+        line.quantityInGroup = quantityInGroup * quantityComposed
+        line.quantityShipped = quantityShipped * quantityComposed
+        line.quantityOpen = quantityOpen * quantityComposed
 
-        sublines.add(line);
+        sublines.add(line)
     }
-    return sublines;
+    return sublines
 }
 
-groupData = [:];
+groupData = [:]
 shipGroups.each { shipGroup ->
-    data = [:];
+    data = [:]
 
-    address = shipGroup.getRelatedOne("PostalAddress", false);
-    data.address = address;
+    address = shipGroup.getRelatedOne("PostalAddress", false)
+    data.address = address
 
-    phoneNumber = shipGroup.getRelatedOne("TelecomTelecomNumber", false);
-    data.phoneNumber = phoneNumber;
+    phoneNumber = shipGroup.getRelatedOne("TelecomTelecomNumber", false)
+    data.phoneNumber = phoneNumber
 
-    carrierShipmentMethod = shipGroup.getRelatedOne("CarrierShipmentMethod", false);
+    carrierShipmentMethod = shipGroup.getRelatedOne("CarrierShipmentMethod", false)
     if (carrierShipmentMethod) {
-        data.carrierShipmentMethod = carrierShipmentMethod;
-        data.shipmentMethodType = carrierShipmentMethod.getRelatedOne("ShipmentMethodType", true);
+        data.carrierShipmentMethod = carrierShipmentMethod
+        data.shipmentMethodType = carrierShipmentMethod.getRelatedOne("ShipmentMethodType", true)
     }
 
     // the lines in a page, each line being a row of data to display
-    lines = [];
+    lines = []
 
     // process the order item to ship group associations, each being a line item for the group
-    orderItemAssocs = shipGroup.getRelated("OrderItemShipGroupAssoc", null, ["orderItemSeqId"], false);
+    orderItemAssocs = shipGroup.getRelated("OrderItemShipGroupAssoc", null, ["orderItemSeqId"], false)
     orderItemAssocs.each { orderItemAssoc ->
-        orderItem = orderItemAssoc.getRelatedOne("OrderItem", false);
-        product = orderItem.getRelatedOne("Product", false);
-        line = [:];
+        orderItem = orderItemAssoc.getRelatedOne("OrderItem", false)
+        product = orderItem.getRelatedOne("Product", false)
+        line = [:]
 
         // the quantity in group
-        quantityInGroup = orderItemAssoc.quantity;
+        quantityInGroup = orderItemAssoc.quantity
         if (orderItemAssoc.cancelQuantity) {
-            quantityInGroup -= orderItemAssoc.cancelQuantity;
+            quantityInGroup -= orderItemAssoc.cancelQuantity
         }
 
         // the quantity shipped
-        quantityShipped = 0.0;
-        issuances = from("ItemIssuance").where("orderId", orderItem.orderId, "orderItemSeqId", orderItem.orderItemSeqId, "shipGroupSeqId", orderItemAssoc.shipGroupSeqId).queryList();
+        quantityShipped = 0.0
+        issuances = from("ItemIssuance").where("orderId", orderItem.orderId, "orderItemSeqId", orderItem.orderItemSeqId, "shipGroupSeqId", orderItemAssoc.shipGroupSeqId).queryList()
         issuances.each { issuance ->
-            quantityShipped += issuance.quantity;
+            quantityShipped += issuance.quantity
         }
 
         // the quantity open (ordered - shipped)
-        quantityOpen = orderItem.quantity;
+        quantityOpen = orderItem.quantity
         if (orderItem.cancelQuantity) {
-            quantityOpen -= orderItem.cancelQuantity;
+            quantityOpen -= orderItem.cancelQuantity
         }
-        quantityOpen -= quantityShipped;
+        quantityOpen -= quantityShipped
 
-        line.orderItem = orderItem;
-        line.product = product;
-        line.quantityInGroup = quantityInGroup;
-        line.quantityShipped = quantityShipped;
-        line.quantityOpen = quantityOpen;
+        line.orderItem = orderItem
+        line.product = product
+        line.quantityInGroup = quantityInGroup
+        line.quantityShipped = quantityShipped
+        line.quantityOpen = quantityOpen
 
         if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG")) {
-            assocType = EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG_AUTO") ? "MANUF_COMPONENT" : "PRODUCT_COMPONENT";
-            sublines = expandProductGroup(product, quantityInGroup, quantityShipped, quantityOpen, assocType);
-            line.expandedList = sublines;
+            assocType = EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG_AUTO") ? "MANUF_COMPONENT" : "PRODUCT_COMPONENT"
+            sublines = expandProductGroup(product, quantityInGroup, quantityShipped, quantityOpen, assocType)
+            line.expandedList = sublines
         }
 
-        lines.add(line);
+        lines.add(line)
     }
-    data.lines = lines;
-    groupData[shipGroup.shipGroupSeqId] = data;
+    data.lines = lines
+    groupData[shipGroup.shipGroupSeqId] = data
 }
-context.groupData = groupData;
+context.groupData = groupData

Modified: ofbiz/trunk/applications/order/groovyScripts/order/ViewImage.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/order/ViewImage.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/order/ViewImage.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/order/ViewImage.groovy Wed Nov  2 19:09:13 2016
@@ -17,21 +17,21 @@
  * under the License.
  */
 
-import org.apache.ofbiz.base.util.*;
-import org.apache.ofbiz.order.order.*;
+import org.apache.ofbiz.base.util.*
+import org.apache.ofbiz.order.order.*
 
-orderId = request.getParameter("orderId");
-orderItemSeqId = request.getParameter("orderItemSeqId");
-orderContentTypeId = request.getParameter("orderContentTypeId");
+orderId = request.getParameter("orderId")
+orderItemSeqId = request.getParameter("orderItemSeqId")
+orderContentTypeId = request.getParameter("orderContentTypeId")
 
-order = null;
+order = null
 if (orderId && !orderItemSeqId) {
-    order = from("OrderHeader").where("orderId", orderId).queryOne();
+    order = from("OrderHeader").where("orderId", orderId).queryOne()
 }
 if (orderId && orderItemSeqId) {
-    order = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne();
+    order = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne()
 }
 
-wrapper = OrderContentWrapper.makeOrderContentWrapper(order, request);
-context.wrapper = wrapper;
-context.orderContentTypeId = orderContentTypeId;
+wrapper = OrderContentWrapper.makeOrderContentWrapper(order, request)
+context.wrapper = wrapper
+context.orderContentTypeId = orderContentTypeId

Modified: ofbiz/trunk/applications/order/groovyScripts/quote/GetPartyAddress.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/quote/GetPartyAddress.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/quote/GetPartyAddress.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/quote/GetPartyAddress.groovy Wed Nov  2 19:09:13 2016
@@ -17,14 +17,14 @@
  * under the License.
  */
 
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.party.contact.ContactHelper;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.party.contact.ContactHelper
 
 if (party) {
-    address = EntityUtil.getFirst(ContactHelper.getContactMech(party, "GENERAL_LOCATION", "POSTAL_ADDRESS", false));
+    address = EntityUtil.getFirst(ContactHelper.getContactMech(party, "GENERAL_LOCATION", "POSTAL_ADDRESS", false))
     if (address) {
-        toPostalAddress = address.getRelatedOne("PostalAddress", false);
-        context.toPostalAddress = toPostalAddress;
+        toPostalAddress = address.getRelatedOne("PostalAddress", false)
+        context.toPostalAddress = toPostalAddress
     }
 }
 

Modified: ofbiz/trunk/applications/order/groovyScripts/quote/GetPartyEmailAddress.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/quote/GetPartyEmailAddress.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/quote/GetPartyEmailAddress.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/quote/GetPartyEmailAddress.groovy Wed Nov  2 19:09:13 2016
@@ -17,13 +17,13 @@
  * under the License.
  */
 
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.party.contact.ContactHelper;
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.party.contact.ContactHelper
 
 if (party) {
-    emailAddress = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false));
+    emailAddress = EntityUtil.getFirst(ContactHelper.getContactMech(party, "PRIMARY_EMAIL", "EMAIL_ADDRESS", false))
     if (emailAddress) {
-        context.sendTo = emailAddress.infoString;
+        context.sendTo = emailAddress.infoString
     }
 }
 

Modified: ofbiz/trunk/applications/order/groovyScripts/quote/ManageQuotePrices.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/quote/ManageQuotePrices.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/quote/ManageQuotePrices.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/quote/ManageQuotePrices.groovy Wed Nov  2 19:09:13 2016
@@ -17,65 +17,65 @@
  * under the License.
  */
 
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.util.EntityUtil
 
-costMult = 0.0;
+costMult = 0.0
 quoteCoefficients.each { quoteCoefficient ->
-    value = quoteCoefficient.coeffValue;
+    value = quoteCoefficient.coeffValue
     if (value) {
-        costMult += value;
+        costMult += value
     }
 }
-costToPriceMult = 1.0;
+costToPriceMult = 1.0
 if (costMult != 100) {
-    costToPriceMult = 100 / (100 - costMult);
+    costToPriceMult = 100 / (100 - costMult)
 }
 
-totalCost = 0.0;
-totalPrice = 0.0;
-totalCostMult = 0.0;
-currency = quote.currencyUomId;
-quoteItemAndCostInfos = [];
+totalCost = 0.0
+totalPrice = 0.0
+totalCostMult = 0.0
+currency = quote.currencyUomId
+quoteItemAndCostInfos = []
 quoteItems.each { quoteItem ->
-    defaultQuoteUnitPrice = 0.0;
-    averageCost = 0.0;
-    unitPrice = 0.0;
-    quantity = 1.0;
-    selectedAmount = quoteItem.selectedAmount ?: 1.0;
+    defaultQuoteUnitPrice = 0.0
+    averageCost = 0.0
+    unitPrice = 0.0
+    quantity = 1.0
+    selectedAmount = quoteItem.selectedAmount ?: 1.0
     if (quoteItem.quantity != null) {
-        quantity = quoteItem.quantity;
+        quantity = quoteItem.quantity
     }
     if (quoteItem.quoteUnitPrice != null) {
-        unitPrice = quoteItem.quoteUnitPrice;
+        unitPrice = quoteItem.quoteUnitPrice
     }
 
     try {
         if (currency && quoteItem.productId) {
-            productPrice = from("ProductPrice").where("productId", quoteItem.productId, "currencyUomId", currency, "productPriceTypeId", "AVERAGE_COST").filterByDate().queryFirst();
+            productPrice = from("ProductPrice").where("productId", quoteItem.productId, "currencyUomId", currency, "productPriceTypeId", "AVERAGE_COST").filterByDate().queryFirst()
             if (productPrice?.price != null) {
-                averageCost = productPrice.price;
+                averageCost = productPrice.price
             }
         }
-        defaultQuoteUnitPrice = averageCost * costToPriceMult * selectedAmount;
-        totalCost += (averageCost * quantity);
-        totalPrice += (unitPrice * quantity * selectedAmount);
+        defaultQuoteUnitPrice = averageCost * costToPriceMult * selectedAmount
+        totalCost += (averageCost * quantity)
+        totalPrice += (unitPrice * quantity * selectedAmount)
     } catch (Exception exc) {
-        Debug.logError("Problems getting the averageCost for quoteItem: " + quoteItem);
+        Debug.logError("Problems getting the averageCost for quoteItem: " + quoteItem)
     }
 
-    quoteItemAndCostInfo = new java.util.HashMap(quoteItem);
-    quoteItemAndCostInfo.averageCost = averageCost;
-    quoteItemAndCostInfo.costToPriceMult = costToPriceMult;
-    quoteItemAndCostInfo.defaultQuoteUnitPrice = defaultQuoteUnitPrice;
-    quoteItemAndCostInfos.add(quoteItemAndCostInfo);
+    quoteItemAndCostInfo = new java.util.HashMap(quoteItem)
+    quoteItemAndCostInfo.averageCost = averageCost
+    quoteItemAndCostInfo.costToPriceMult = costToPriceMult
+    quoteItemAndCostInfo.defaultQuoteUnitPrice = defaultQuoteUnitPrice
+    quoteItemAndCostInfos.add(quoteItemAndCostInfo)
 }
 
-context.costMult = costMult;
-context.costToPriceMult = costToPriceMult;
-context.quoteItemAndCostInfos = quoteItemAndCostInfos;
-
-context.totalCost = totalCost;
-context.totalPrice = totalPrice;
-context.totalCostMult = (totalCost != 0 ? totalPrice / totalCost : 0);
+context.costMult = costMult
+context.costToPriceMult = costToPriceMult
+context.quoteItemAndCostInfos = quoteItemAndCostInfos
+
+context.totalCost = totalCost
+context.totalPrice = totalPrice
+context.totalCostMult = (totalCost != 0 ? totalPrice / totalCost : 0)
 

Modified: ofbiz/trunk/applications/order/groovyScripts/quote/ViewQuoteProfit.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/quote/ViewQuoteProfit.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/quote/ViewQuoteProfit.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/quote/ViewQuoteProfit.groovy Wed Nov  2 19:09:13 2016
@@ -17,71 +17,71 @@
  * under the License.
  */
 
-import java.util.Date;
-import java.sql.Timestamp;
-import org.apache.ofbiz.base.util.UtilDateTime;
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.base.util.Debug;
+import java.util.Date
+import java.sql.Timestamp
+import org.apache.ofbiz.base.util.UtilDateTime
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.base.util.Debug
 
-costMult = 0.0;
+costMult = 0.0
 quoteCoefficients.each { quoteCoefficient ->
-    value = quoteCoefficient.coeffValue;
+    value = quoteCoefficient.coeffValue
     if (value) {
-        costMult += value;
+        costMult += value
     }
 }
-totalProfit = 0.0;
-costToPriceMult = 1.0;
+totalProfit = 0.0
+costToPriceMult = 1.0
 if (costMult != 100) {
-    costToPriceMult = 100 / (100 - costMult);
+    costToPriceMult = 100 / (100 - costMult)
 }
 
-issueDate = quote.issueDate ?: nowTimestamp;
-totalCost = 0.0;
-totalPrice = 0.0;
-totalCostMult = 0.0;
-currency = quote.currencyUomId;
-quoteItemAndCostInfos = [];
+issueDate = quote.issueDate ?: nowTimestamp
+totalCost = 0.0
+totalPrice = 0.0
+totalCostMult = 0.0
+currency = quote.currencyUomId
+quoteItemAndCostInfos = []
 quoteItems.each { quoteItem ->
-    defaultQuoteUnitPrice = 0.0;
-    averageCost = 0.0;
-    unitPrice = quoteItem.quoteUnitPrice ?: 0.0;
-    quantity = quoteItem.quantity ?: 1.0;
-    selectedAmount = quoteItem.selectedAmount ?: 1.0;
-    profit = 0.0;
-    percProfit = 0.0;
+    defaultQuoteUnitPrice = 0.0
+    averageCost = 0.0
+    unitPrice = quoteItem.quoteUnitPrice ?: 0.0
+    quantity = quoteItem.quantity ?: 1.0
+    selectedAmount = quoteItem.selectedAmount ?: 1.0
+    profit = 0.0
+    percProfit = 0.0
 
     try {
         if (currency && quoteItem.productId) {
             productPrice = from("ProductPrice")
                               .where(productId : quoteItem.productId, currencyUomId : currency, productPriceTypeId : "AVERAGE_COST")
                               .filterByDate(issueDate)
-                              .queryFirst();
+                              .queryFirst()
             if (productPrice?.price != null) {
-                averageCost = productPrice.price * selectedAmount;
+                averageCost = productPrice.price * selectedAmount
             }
         }
-        totalCost += (averageCost * quantity);
-        totalPrice += (unitPrice * quantity * selectedAmount);
+        totalCost += (averageCost * quantity)
+        totalPrice += (unitPrice * quantity * selectedAmount)
     } catch (Exception exc) {
-        Debug.logError("Problems getting the averageCost for quoteItem: " + quoteItem);
+        Debug.logError("Problems getting the averageCost for quoteItem: " + quoteItem)
     }
-    profit = unitPrice - averageCost;
-    percProfit = averageCost != 0 ? (profit / unitPrice) * 100.00 : 0.00;
-    quoteItemAndCostInfo = new java.util.HashMap(quoteItem);
-    quoteItemAndCostInfo.averageCost = averageCost;
-    quoteItemAndCostInfo.profit = profit;
-    quoteItemAndCostInfo.percProfit = percProfit;
-    quoteItemAndCostInfos.add(quoteItemAndCostInfo);
+    profit = unitPrice - averageCost
+    percProfit = averageCost != 0 ? (profit / unitPrice) * 100.00 : 0.00
+    quoteItemAndCostInfo = new java.util.HashMap(quoteItem)
+    quoteItemAndCostInfo.averageCost = averageCost
+    quoteItemAndCostInfo.profit = profit
+    quoteItemAndCostInfo.percProfit = percProfit
+    quoteItemAndCostInfos.add(quoteItemAndCostInfo)
 }
-totalProfit = totalPrice - totalCost;
+totalProfit = totalPrice - totalCost
 
-context.costMult = costMult;
-context.costToPriceMult = costToPriceMult;
-context.quoteItemAndCostInfos = quoteItemAndCostInfos;
-
-context.totalCost = totalCost;
-context.totalPrice = totalPrice;
-context.totalProfit = totalProfit;
-context.totalPercProfit = totalCost != 0 ? (totalProfit / totalPrice) * 100.00: 0.00;
+context.costMult = costMult
+context.costToPriceMult = costToPriceMult
+context.quoteItemAndCostInfos = quoteItemAndCostInfos
+
+context.totalCost = totalCost
+context.totalPrice = totalPrice
+context.totalProfit = totalProfit
+context.totalPercProfit = totalCost != 0 ? (totalProfit / totalPrice) * 100.00: 0.00

Modified: ofbiz/trunk/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy Wed Nov  2 19:09:13 2016
@@ -23,37 +23,37 @@
  */
 
 
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.condition.*;
-import org.apache.ofbiz.entity.util.*;
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
-
-productStoreId = ObjectType.simpleTypeConvert(parameters.productStoreId, "List", null, null);
-orderTypeId = ObjectType.simpleTypeConvert(parameters.orderTypeId, "List", null, null);
-orderStatusId = ObjectType.simpleTypeConvert(parameters.orderStatusId, "List", null, null);
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.condition.*
+import org.apache.ofbiz.entity.util.*
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
+
+productStoreId = ObjectType.simpleTypeConvert(parameters.productStoreId, "List", null, null)
+orderTypeId = ObjectType.simpleTypeConvert(parameters.orderTypeId, "List", null, null)
+orderStatusId = ObjectType.simpleTypeConvert(parameters.orderStatusId, "List", null, null)
 
 
 // search by orderTypeId is mandatory
-conditions = [EntityCondition.makeCondition("orderTypeId", EntityOperator.IN, orderTypeId)];
+conditions = [EntityCondition.makeCondition("orderTypeId", EntityOperator.IN, orderTypeId)]
 
 if (fromOrderDate) {
-    conditions.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromOrderDate));
+    conditions.add(EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, fromOrderDate))
 }
 if (thruOrderDate) {
-    conditions.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, thruOrderDate));
+    conditions.add(EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, thruOrderDate))
 }
 
 if (productStoreId) {
-    conditions.add(EntityCondition.makeCondition("productStoreId", EntityOperator.IN, productStoreId));
+    conditions.add(EntityCondition.makeCondition("productStoreId", EntityOperator.IN, productStoreId))
     // for generating a title (given product store)
-    context.productStore = from("ProductStore").where("productStoreId", productStoreId).cache(true).queryOne();
+    context.productStore = from("ProductStore").where("productStoreId", productStoreId).cache(true).queryOne()
 } else {
     // for generating a title (all stores)  TODO: use UtilProperties to internationalize
-    context.productStore = [storeName : "All Stores"];
+    context.productStore = [storeName : "All Stores"]
 }
 if (orderStatusId) {
-    conditions.add(EntityCondition.makeCondition("orderStatusId", EntityOperator.IN, orderStatusId));
+    conditions.add(EntityCondition.makeCondition("orderStatusId", EntityOperator.IN, orderStatusId))
 } else {
     // search all orders that are not completed, cancelled or rejected
     conditions.add(
@@ -62,13 +62,13 @@ if (orderStatusId) {
                     EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"),
                     EntityCondition.makeCondition("orderStatusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED")
                     ], EntityOperator.AND)
-            );
+            )
 }
 
 // item conditions
-conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED"));
-conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"));
-conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"));
+conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED"))
+conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"))
+conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"))
 
 // get the results as an entity list iterator
 listIt = select("orderId", "orderDate", "productId", "quantityOrdered", "quantityIssued", "quantityOpen", "shipBeforeDate", "shipAfterDate", "itemDescription")
@@ -77,52 +77,52 @@ listIt = select("orderId", "orderDate",
             .orderBy("orderDate DESC")
             .cursorScrollInsensitive()
             .distinct()
-            .queryIterator();
-orderItemList = [];
-totalCostPrice = 0.0;
-totalListPrice = 0.0;
-totalMarkup = 0.0;
-totalDiscount = 0.0;
-totalRetailPrice = 0.0;
-totalquantityOrdered = 0.0;
-totalquantityOpen = 0.0;
+            .queryIterator()
+orderItemList = []
+totalCostPrice = 0.0
+totalListPrice = 0.0
+totalMarkup = 0.0
+totalDiscount = 0.0
+totalRetailPrice = 0.0
+totalquantityOrdered = 0.0
+totalquantityOpen = 0.0
 
 listIt.each { listValue ->
-    orderId = listValue.orderId;
-    productId = listValue.productId;
-    orderDate = listValue.orderDate;
-    quantityOrdered = listValue.quantityOrdered;
-    quantityOpen = listValue.quantityOpen;
-    quantityIssued = listValue.quantityIssued;
-    itemDescription = listValue.itemDescription;
-    shipAfterDate = listValue.shipAfterDate;
-    shipBeforeDate = listValue.shipBeforeDate;
-    productIdCondExpr =  [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)];
-    productPrices = select("price","productPriceTypeId").from("ProductPrice").where(productIdCondExpr).queryList();
-    costPrice = 0.0;
-    retailPrice = 0.0;
-    listPrice = 0.0;
+    orderId = listValue.orderId
+    productId = listValue.productId
+    orderDate = listValue.orderDate
+    quantityOrdered = listValue.quantityOrdered
+    quantityOpen = listValue.quantityOpen
+    quantityIssued = listValue.quantityIssued
+    itemDescription = listValue.itemDescription
+    shipAfterDate = listValue.shipAfterDate
+    shipBeforeDate = listValue.shipBeforeDate
+    productIdCondExpr =  [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)]
+    productPrices = select("price","productPriceTypeId").from("ProductPrice").where(productIdCondExpr).queryList()
+    costPrice = 0.0
+    retailPrice = 0.0
+    listPrice = 0.0
 
     productPrices.each { productPriceMap ->
         if (productPriceMap.productPriceTypeId.equals("AVERAGE_COST")) {
-            costPrice = productPriceMap.price;
+            costPrice = productPriceMap.price
         } else if (productPriceMap.productPriceTypeId.equals("DEFAULT_PRICE")) {
-            retailPrice = productPriceMap.price;
+            retailPrice = productPriceMap.price
         } else if (productPriceMap.productPriceTypeId.equals("LIST_PRICE")) {
-            listPrice = productPriceMap.price;
+            listPrice = productPriceMap.price
         }
     }
 
-    totalListPrice += listPrice;
-    totalRetailPrice += retailPrice;
-    totalCostPrice += costPrice;
-    totalquantityOrdered += quantityOrdered;
-    totalquantityOpen += quantityOpen;
-    costPriceDividendValue = costPrice;
+    totalListPrice += listPrice
+    totalRetailPrice += retailPrice
+    totalCostPrice += costPrice
+    totalquantityOrdered += quantityOrdered
+    totalquantityOpen += quantityOpen
+    costPriceDividendValue = costPrice
     if (costPriceDividendValue) {
-        percentMarkup = ((retailPrice - costPrice)/costPrice)*100;
+        percentMarkup = ((retailPrice - costPrice)/costPrice)*100
     } else{
-        percentMarkup = "";
+        percentMarkup = ""
     }
     orderItemMap = [orderDate : orderDate,
                     orderId : orderId,
@@ -138,18 +138,18 @@ listIt.each { listValue ->
                     listPrice : listPrice,
                     discount : listPrice - retailPrice,
                     calculatedMarkup : retailPrice - costPrice,
-                    percentMarkup : percentMarkup];
-    orderItemList.add(orderItemMap);
+                    percentMarkup : percentMarkup]
+    orderItemList.add(orderItemMap)
 }
 
-listIt.close();
-totalAmountList = [];
+listIt.close()
+totalAmountList = []
 if (orderItemList) {
-    totalCostPriceDividendValue = totalCostPrice;
+    totalCostPriceDividendValue = totalCostPrice
     if (totalCostPriceDividendValue) {
-        totalPercentMarkup = ((totalRetailPrice - totalCostPrice)/totalCostPrice)*100 ;
+        totalPercentMarkup = ((totalRetailPrice - totalCostPrice)/totalCostPrice)*100
     } else{
-        totalPercentMarkup = "";
+        totalPercentMarkup = ""
     }
     totalAmountMap = [totalCostPrice : totalCostPrice,
                       totalListPrice : totalListPrice,
@@ -159,8 +159,8 @@ if (orderItemList) {
                       totalquantityOpen : totalquantityOpen,
                       totalDiscount : totalListPrice - totalRetailPrice,
                       totalMarkup : totalRetailPrice - totalCostPrice,
-                      totalPercentMarkup : totalPercentMarkup];
-    totalAmountList.add(totalAmountMap);
+                      totalPercentMarkup : totalPercentMarkup]
+    totalAmountList.add(totalAmountMap)
 }
-context.orderItemList = orderItemList;
-context.totalAmountList = totalAmountList;
+context.orderItemList = orderItemList
+context.totalAmountList = totalAmountList

Modified: ofbiz/trunk/applications/order/groovyScripts/request/GetNextSequenceNum.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/request/GetNextSequenceNum.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/request/GetNextSequenceNum.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/request/GetNextSequenceNum.groovy Wed Nov  2 19:09:13 2016
@@ -17,17 +17,17 @@
  * under the License.
  */
 
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.util.EntityUtil;
-import org.apache.ofbiz.entity.GenericValue;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.util.EntityUtil
+import org.apache.ofbiz.entity.GenericValue
 
-long nextSequenceNum = 10;
+long nextSequenceNum = 10
 if (!custRequestItem && custRequest) {
-    items = custRequest.getRelated("CustRequestItem", null, ["-sequenceNum"], false);
-    lastItem = EntityUtil.getFirst(items);
+    items = custRequest.getRelated("CustRequestItem", null, ["-sequenceNum"], false)
+    lastItem = EntityUtil.getFirst(items)
     if (lastItem?.sequenceNum) {
-        lastSequenceNum = lastItem.sequenceNum;
-        nextSequenceNum = lastSequenceNum + 10;
+        lastSequenceNum = lastItem.sequenceNum
+        nextSequenceNum = lastSequenceNum + 10
     }
 }
-context.nextSequenceNum = nextSequenceNum;
+context.nextSequenceNum = nextSequenceNum

Modified: ofbiz/trunk/applications/order/groovyScripts/request/RequestItemNotes.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/request/RequestItemNotes.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/request/RequestItemNotes.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/request/RequestItemNotes.groovy Wed Nov  2 19:09:13 2016
@@ -17,19 +17,19 @@
  * under the License.
  */
 
-import org.apache.ofbiz.entity.*;
-import org.apache.ofbiz.base.util.*;
+import org.apache.ofbiz.entity.*
+import org.apache.ofbiz.base.util.*
 
-custRequestId = parameters.custRequestId;
-custRequestItemSeqId = parameters.custRequestItemSeqId;
-showAll = parameters.showAll ?: "false";
-context.showAll = showAll;
+custRequestId = parameters.custRequestId
+custRequestItemSeqId = parameters.custRequestItemSeqId
+showAll = parameters.showAll ?: "false"
+context.showAll = showAll
 
-fields = [custRequestId : custRequestId];
+fields = [custRequestId : custRequestId]
 if (showAll.equals("false")) {
-    fields.custRequestItemSeqId = custRequestItemSeqId;
+    fields.custRequestItemSeqId = custRequestItemSeqId
 }
-notes = from("CustRequestItemNoteView").where(fields).orderBy("-noteDateTime").queryList();
+notes = from("CustRequestItemNoteView").where(fields).orderBy("-noteDateTime").queryList()
 if (notes) {
-    context.notes = notes;
+    context.notes = notes
 }

Modified: ofbiz/trunk/applications/order/groovyScripts/request/SetRequestQuote.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/request/SetRequestQuote.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/request/SetRequestQuote.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/request/SetRequestQuote.groovy Wed Nov  2 19:09:13 2016
@@ -17,13 +17,13 @@
  * under the License.
  */
 
-import org.apache.ofbiz.base.util.UtilMisc;
-import org.apache.ofbiz.entity.util.EntityUtil;
+import org.apache.ofbiz.base.util.UtilMisc
+import org.apache.ofbiz.entity.util.EntityUtil
 
-custRequestId = parameters.custRequestId;
+custRequestId = parameters.custRequestId
 if (custRequestId) {
-    requestQuote = from("QuoteItem").where("custRequestId", custRequestId).queryFirst();
+    requestQuote = from("QuoteItem").where("custRequestId", custRequestId).queryFirst()
     if (requestQuote) {
-        context.quoteId = requestQuote.quoteId;
+        context.quoteId = requestQuote.quoteId
     }
 }