Author: lektran
Date: Tue Jul 15 03:34:16 2008 New Revision: 676862 URL: http://svn.apache.org/viewvc?rev=676862&view=rev Log: A few more bsh -> groovy conversions (and they're tested I promise!) Added: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy - copied, changed from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderViewWebSecure.groovy - copied, changed from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderviewwebsecure.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy - copied, changed from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/receivepayment.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy - copied, changed from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/sendconfirmationemail.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy - copied, changed from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy - copied, changed from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/viewimage.bsh Removed: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderviewwebsecure.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/receivepayment.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/sendconfirmationemail.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/viewimage.bsh Modified: ofbiz/trunk/applications/ecommerce/widget/EmailOrderScreens.xml ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintScreens.xml ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml Modified: ofbiz/trunk/applications/ecommerce/widget/EmailOrderScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/EmailOrderScreens.xml?rev=676862&r1=676861&r2=676862&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/widget/EmailOrderScreens.xml (original) +++ ofbiz/trunk/applications/ecommerce/widget/EmailOrderScreens.xml Tue Jul 15 03:34:16 2008 @@ -31,7 +31,7 @@ <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/> <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/> <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy"/> </actions> <widgets> <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml"> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy?rev=676862&r1=676861&r2=676862&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy Tue Jul 15 03:34:16 2008 @@ -37,7 +37,6 @@ returnId = parameters.returnId; quote = null; quoteId = parameters.quoteId; -nowTimestamp = UtilDateTime.nowTimestamp(); fromPartyId = parameters.fromPartyId; if (!orderHeader && orderId) { Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy (from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh&r1=676509&r2=676862&rev=676862&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy Tue Jul 15 03:34:16 2008 @@ -31,33 +31,34 @@ import org.ofbiz.product.catalog.CatalogWorker; import org.ofbiz.accounting.payment.*; -orderId = parameters.get("orderId"); -context.put("orderId", orderId); +orderId = parameters.orderId; +context.orderId = orderId; -workEffortId = parameters.get("workEffortId"); -assignPartyId = parameters.get("partyId"); -assignRoleTypeId = parameters.get("roleTypeId"); -fromDate = parameters.get("fromDate"); -delegate = parameters.get("delegate"); -if (delegate != null && parameters.get("toFromDate") != null) { - fromDate = parameters.get("toFromDate"); +workEffortId = parameters.workEffortId; +assignPartyId = parameters.partyId; +assignRoleTypeId = parameters.roleTypeId; +fromDate = parameters.fromDate; +delegate = parameters.delegate; +if (delegate && fromDate) { + fromDate = parameters.toFromDate; } -context.put("workEffortId", workEffortId); -context.put("assignPartyId", assignPartyId); -context.put("assignRoleTypeId", assignRoleTypeId); -context.put("fromDate", fromDate); -context.put("delegate", delegate); -context.put("toDayDate", (new java.sql.Date(System.currentTimeMillis())).toString()); +context.workEffortId = workEffortId; +context.assignPartyId = assignPartyId; +context.assignRoleTypeId = assignRoleTypeId; +context.fromDate = fromDate; +context.delegate = delegate; +context.toDayDate = new java.sql.Date(System.currentTimeMillis()).toString(); + orderHeader = null; -if (orderId != null && orderId.length() > 0) { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); +if (orderId) { + orderHeader = delegator.findByPrimaryKey("OrderHeader", [orderId : orderId]); } -if (orderHeader != null) { - // note these are overridden in the orderviewwebsecure.bsh script if run - context.put("hasPermission", true); - context.put("canViewInternalDetails", true); +if (orderHeader) { + // note these are overridden in the OrderViewWebSecure.groovy script if run + context.hasPermission = true; + context.canViewInternalDetails = true; orderReadHelper = new OrderReadHelper(orderHeader); orderItems = orderReadHelper.getOrderItems(); @@ -66,18 +67,18 @@ orderSubTotal = orderReadHelper.getOrderItemsSubTotal(); orderTerms = orderHeader.getRelated("OrderTerm"); - context.put("orderHeader", orderHeader); - context.put("orderReadHelper", orderReadHelper); - context.put("orderItems", orderItems); - context.put("orderAdjustments", orderAdjustments); - context.put("orderHeaderAdjustments", orderHeaderAdjustments); - context.put("orderSubTotal", orderSubTotal); - context.put("currencyUomId", orderReadHelper.getCurrency()); - context.put("orderTerms", orderTerms); + context.orderHeader = orderHeader; + context.orderReadHelper = orderReadHelper; + context.orderItems = orderItems; + context.orderAdjustments = orderAdjustments; + context.orderHeaderAdjustments = orderHeaderAdjustments; + context.orderSubTotal = orderSubTotal; + context.currencyUomId = orderReadHelper.getCurrency(); + context.orderTerms = orderTerms; // get the order type - orderType = orderHeader.getString("orderTypeId"); - context.put("orderType", orderType); + orderType = orderHeader.orderTypeId; + context.orderType = orderType; // get the display party displayParty = null; @@ -86,157 +87,149 @@ } else { displayParty = orderReadHelper.getPlacingParty(); } - if (displayParty != null) { - partyId = displayParty.getString("partyId"); - context.put("displayParty", displayParty); - context.put("partyId", partyId); + if (displayParty) { + partyId = displayParty.partyId; + context.displayParty = displayParty; + context.partyId = partyId; - List paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, displayParty.getString("partyId"), false); - context.put("paymentMethodValueMaps", paymentMethodValueMaps); + paymentMethodValueMaps = PaymentWorker.getPartyPaymentMethodValueMaps(delegator, displayParty.partyId, false); + context.paymentMethodValueMaps = paymentMethodValueMaps; } otherAdjAmount = OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, true, false, false); - context.put("otherAdjAmount", otherAdjAmount); + context.otherAdjAmount = otherAdjAmount; shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true); shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true)); - context.put("shippingAmount", shippingAmount); + context.shippingAmount = shippingAmount; taxAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, true, false); taxAmount = taxAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, true, false)); - context.put("taxAmount", taxAmount); + context.taxAmount = taxAmount; grandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments); - context.put("grandTotal", grandTotal); + context.grandTotal = grandTotal; orderItemList = orderReadHelper.getOrderItems(); - context.put("orderItemList", orderItemList); + context.orderItemList = orderItemList; shippingAddress = orderReadHelper.getShippingAddress(); - context.put("shippingAddress", shippingAddress); + context.shippingAddress = shippingAddress; billingAddress = orderReadHelper.getBillingAddress(); - context.put("billingAddress", billingAddress); + context.billingAddress = billingAddress; distributorId = orderReadHelper.getDistributorId(); - context.put("distributorId", distributorId); + context.distributorId = distributorId; affiliateId = orderReadHelper.getAffiliateId(); - context.put("affiliateId", affiliateId); + context.affiliateId = affiliateId; billingAccount = orderHeader.getRelatedOne("BillingAccount"); - context.put("billingAccount", billingAccount); - context.put("billingAccountMaxAmount", orderReadHelper.getBillingAccountMaxAmount()); + context.billingAccount = billingAccount; + context.billingAccountMaxAmount = orderReadHelper.getBillingAccountMaxAmount(); // get a list of all shipments, and a list of ItemIssuances per order item - allShipmentsMap = new HashMap(); + allShipmentsMap = [:]; primaryShipments = orderHeader.getRelated("PrimaryShipment"); - primaryShipmentIter = primaryShipments.iterator(); - while (primaryShipmentIter.hasNext()) { - primaryShipment = primaryShipmentIter.next(); - allShipmentsMap.put(primaryShipment.get("shipmentId"), primaryShipment); - } - itemIssuancesPerItem = new HashMap(); - itemIssuances = orderHeader.getRelated("ItemIssuance", null, UtilMisc.toList("shipmentId", "shipmentItemSeqId")); - itemIssuanceIter = itemIssuances.iterator(); - while (itemIssuanceIter.hasNext()) { - itemIssuance = itemIssuanceIter.next(); - if (!allShipmentsMap.containsKey(itemIssuance.get("shipmentId"))) { + primaryShipments.each { primaryShipment -> + allShipmentsMap[primaryShipment.shipmentId] = primaryShipment; + } + itemIssuancesPerItem = [:]; + itemIssuances = orderHeader.getRelated("ItemIssuance", null, ["shipmentId", "shipmentItemSeqId"]); + itemIssuances.each { itemIssuance -> + if (!allShipmentsMap.containsKey(itemIssuance.shipmentId)) { iiShipment = itemIssuance.getRelatedOne("Shipment"); - if (iiShipment != null) { - allShipmentsMap.put(iiShipment.get("shipmentId"), iiShipment); + if (iiShipment) { + allShipmentsMap[iiShipment.shipmentId] = iiShipment; } } - perItemList = itemIssuancesPerItem.get(itemIssuance.get("orderItemSeqId")); - if (perItemList == null) { - perItemList = new LinkedList(); - itemIssuancesPerItem.put(itemIssuance.get("orderItemSeqId"), perItemList); + perItemList = itemIssuancesPerItem[itemIssuance.orderItemSeqId]; + if (!perItemList) { + perItemList = []; + itemIssuancesPerItem[itemIssuance.orderItemSeqId] = perItemList; } perItemList.add(itemIssuance); } - context.put("allShipments", allShipmentsMap.values()); - context.put("itemIssuancesPerItem", itemIssuancesPerItem); + context.allShipments = allShipmentsMap.values(); + context.itemIssuancesPerItem = itemIssuancesPerItem; // get a list of all invoices - allInvoices = new LinkedHashSet(); - orderBilling = delegator.findByAnd("OrderItemBilling", UtilMisc.toMap("orderId", orderId), UtilMisc.toList("invoiceId")); - obIter = orderBilling.iterator(); - while (obIter.hasNext()) { - billingGv = obIter.next(); - allInvoices.add(billingGv.getString("invoiceId")); + allInvoices = [:]; + orderBilling = delegator.findByAnd("OrderItemBilling", [orderId : orderId], ["invoiceId"]); + orderBilling.each { billingGv -> + allInvoices.add(billingGv.invoiceId); } - context.put("invoices", allInvoices); + context.invoices = allInvoices; - EntityConditionList ecl = EntityCondition.makeCondition(UtilMisc.toList( + ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId), - EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")), + EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")], EntityOperator.AND); orderPaymentPreferences = delegator.findList("OrderPaymentPreference", ecl, null, null, null, false); - context.put("orderPaymentPreferences", orderPaymentPreferences); + context.orderPaymentPreferences = orderPaymentPreferences; // ship groups - shipGroups = delegator.findByAnd("OrderItemShipGroup", UtilMisc.toMap("orderId", orderId), UtilMisc.toList("shipGroupSeqId")); - context.put("shipGroups", shipGroups); + shipGroups = delegator.findByAnd("OrderItemShipGroup", [orderId : orderId], ["shipGroupSeqId"]); + context.shipGroups = shipGroups; // get Shipment tracking info - osisCond = EntityCondition.makeCondition(UtilMisc.toMap("orderId", orderId), EntityOperator.AND); - osisOrder = UtilMisc.toList("shipmentId", "shipmentRouteSegmentId", "shipmentPackageSeqId"); - osisFields = UtilMisc.toSet("shipGroupSeqId", "shipmentId", "shipmentRouteSegmentId", "carrierPartyId", "shipmentMethodTypeId"); - osisFields.add("shipmentPackageSeqId"); osisFields.add("trackingCode"); osisFields.add("boxNumber"); - osisFindOptions = new EntityFindOptions(); osisFindOptions.setDistinct(true); + osisCond = EntityCondition.makeCondition([orderId : orderId], EntityOperator.AND); + osisOrder = ["shipmentId", "shipmentRouteSegmentId", "shipmentPackageSeqId"]; + osisFields = ["shipGroupSeqId", "shipmentId", "shipmentRouteSegmentId", "carrierPartyId", "shipmentMethodTypeId"] as Set; + osisFields.add("shipmentPackageSeqId"); + osisFields.add("trackingCode"); + osisFields.add("boxNumber"); + osisFindOptions = new EntityFindOptions(); + osisFindOptions.setDistinct(true); orderShipmentInfoSummaryList = delegator.findList("OrderShipmentInfoSummary", osisCond, osisFields, osisOrder, osisFindOptions, false); - context.put("orderShipmentInfoSummaryList", orderShipmentInfoSummaryList); + context.orderShipmentInfoSummaryList = orderShipmentInfoSummaryList; customerPoNumber = null; - orderItemPOIter = UtilMisc.toIterator(orderItemList); - if (orderItemPOIter != null && orderItemPOIter.hasNext()) { - customerPoNumber = ((GenericValue)orderItemPOIter.next()).getString("correspondingPoId"); + orderItemList.each { orderItem -> + customerPoNumber = orderItem.correspondingPoId; } - context.put("customerPoNumber", customerPoNumber); + context.customerPoNumber = customerPoNumber; - statusChange = delegator.findByAnd("StatusValidChange", UtilMisc.toMap("statusId",orderHeader.getString("statusId"))); - context.put("statusChange", statusChange); + statusChange = delegator.findByAnd("StatusValidChange", [statusId : orderHeader.statusId]); + context.statusChange = statusChange; currentStatus = orderHeader.getRelatedOne("StatusItem"); - context.put("currentStatus", currentStatus); + context.currentStatus = currentStatus; orderHeaderStatuses = orderReadHelper.getOrderHeaderStatuses(); - context.put("orderHeaderStatuses", orderHeaderStatuses); + context.orderHeaderStatuses = orderHeaderStatuses; - adjustmentTypes = delegator.findList("OrderAdjustmentType", null, null, UtilMisc.toList("description"), null, false); - context.put("orderAdjustmentTypes", adjustmentTypes); + adjustmentTypes = delegator.findList("OrderAdjustmentType", null, null, ["description"], null, false); + context.orderAdjustmentTypes = adjustmentTypes; - notes = delegator.findByAnd("OrderHeaderNoteView", UtilMisc.toMap("orderId", orderId), UtilMisc.toList("-noteDateTime")); - context.put("orderNotes", notes); + notes = delegator.findByAnd("OrderHeaderNoteView", [orderId : orderId], ["-noteDateTime"]); + context.orderNotes = notes; cmvm = ContactMechWorker.getOrderContactMechValueMaps(delegator, orderId); - context.put("orderContactMechValueMaps", cmvm); + context.orderContactMechValueMaps = cmvm; - orderItemChangeReasons = delegator.findByAnd("Enumeration", UtilMisc.toMap("enumTypeId", "ODR_ITM_CH_REASON"), UtilMisc.toList("sequenceId")); - context.put("orderItemChangeReasons", orderItemChangeReasons); + orderItemChangeReasons = delegator.findByAnd("Enumeration", [enumTypeId : "ODR_ITM_CH_REASON"], ["sequenceId"]); + context.orderItemChangeReasons = orderItemChangeReasons; if ("PURCHASE_ORDER".equals(orderType)) { // for purchase orders, we need also the supplier's postal address - GenericValue supplier = orderReadHelper.getBillFromParty(); - if (supplier != null) { - List supplierContactMechValueMaps = ContactMechWorker.getPartyContactMechValueMaps(delegator, supplier.getString("partyId"), false, "POSTAL_ADDRESS"); - context.put("supplierContactMechValueMaps", supplierContactMechValueMaps); - Iterator supplierContactMechValueMapsIt = supplierContactMechValueMaps.iterator(); - while (supplierContactMechValueMapsIt.hasNext()) { - Map supplierContactMechValueMap = (Map)supplierContactMechValueMapsIt.next(); - List contactMechPurposes = supplierContactMechValueMap.get("partyContactMechPurposes"); - Iterator contactMechPurposesIt = contactMechPurposes.iterator(); - while (contactMechPurposesIt.hasNext()) { - GenericValue contactMechPurpose = (GenericValue)contactMechPurposesIt.next(); - if (contactMechPurpose.getString("contactMechPurposeTypeId").equals("GENERAL_LOCATION")) { - context.put("supplierGeneralContactMechValueMap", supplierContactMechValueMap); - } else if (contactMechPurpose.getString("contactMechPurposeTypeId").equals("SHIPPING_LOCATION")) { - context.put("supplierShippingContactMechValueMap", supplierContactMechValueMap); - } else if (contactMechPurpose.getString("contactMechPurposeTypeId").equals("BILLING_LOCATION")) { - context.put("supplierBillingContactMechValueMap", supplierContactMechValueMap); - } else if (contactMechPurpose.getString("contactMechPurposeTypeId").equals("PAYMENT_LOCATION")) { - context.put("supplierPaymentContactMechValueMap", supplierContactMechValueMap); + supplier = orderReadHelper.getBillFromParty(); + if (supplier) { + supplierContactMechValueMaps = ContactMechWorker.getPartyContactMechValueMaps(delegator, supplier.partyId, false, "POSTAL_ADDRESS"); + context.supplierContactMechValueMaps = supplierContactMechValueMaps; + supplierContactMechValueMaps.each { supplierContactMechValueMap -> + contactMechPurposes = supplierContactMechValueMap.partyContactMechPurposes; + contactMechPurposes.each { contactMechPurpose -> + if (contactMechPurpose.contactMechPurposeTypeId.equals("GENERAL_LOCATION")) { + context.supplierGeneralContactMechValueMap = supplierContactMechValueMap; + } else if (contactMechPurpose.contactMechPurposeTypeId.equals("SHIPPING_LOCATION")) { + context.supplierShippingContactMechValueMap = supplierContactMechValueMap; + } else if (contactMechPurpose.contactMechPurposeTypeId.equals("BILLING_LOCATION")) { + context.supplierBillingContactMechValueMap = supplierContactMechValueMap; + } else if (contactMechPurpose.contactMechPurposeTypeId.equals("PAYMENT_LOCATION")) { + context.supplierPaymentContactMechValueMap = supplierContactMechValueMap; } } } @@ -244,171 +237,170 @@ } // see if an approved order with all items completed exists - context.put("setOrderCompleteOption", false); - if ("ORDER_APPROVED".equals(orderHeader.getString("statusId"))) { + context.setOrderCompleteOption = false; + if ("ORDER_APPROVED".equals(orderHeader.statusId)) { expr = EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ITEM_COMPLETED"); notCreatedItems = orderReadHelper.getOrderItemsByCondition(expr); - if (notCreatedItems.size() == 0) { - context.put("setOrderCompleteOption", true); + if (!notCreatedItems) { + context.setOrderCompleteOption = true; } } // get inventory summary for each shopping cart product item - inventorySummary = dispatcher.runSync("getProductInventorySummaryForItems", UtilMisc.toMap("orderItems", orderItems)); - context.put("availableToPromiseMap", inventorySummary.get("availableToPromiseMap")); - context.put("quantityOnHandMap", inventorySummary.get("quantityOnHandMap")); - context.put("mktgPkgATPMap", inventorySummary.get("mktgPkgATPMap")); - context.put("mktgPkgQOHMap", inventorySummary.get("mktgPkgQOHMap")); + inventorySummary = dispatcher.runSync("getProductInventorySummaryForItems", [orderItems : orderItems]); + context.availableToPromiseMap = inventorySummary.availableToPromiseMap; + context.quantityOnHandMap = inventorySummary.quantityOnHandMap; + context.mktgPkgATPMap = inventorySummary.mktgPkgATPMap; + context.mktgPkgQOHMap = inventorySummary.mktgPkgQOHMap; // get inventory summary with respect to facility productStore = orderHeader.getRelatedOne("ProductStore"); - if (productStore != null) { + if (productStore) { facility = productStore.getRelatedOne("Facility"); - inventorySummaryByFacility = dispatcher.runSync("getProductInventorySummaryForItems", UtilMisc.toMap("orderItems", orderItems, "facilityId", facility.getString("facilityId"))); - context.put("availableToPromiseByFacilityMap", inventorySummaryByFacility.get("availableToPromiseMap")); - context.put("quantityOnHandByFacilityMap", inventorySummaryByFacility.get("quantityOnHandMap")); - context.put("facility", facility); + inventorySummaryByFacility = dispatcher.runSync("getProductInventorySummaryForItems", [orderItems : orderItems, facilityId : facility.facilityId]); + context.availableToPromiseByFacilityMap = inventorySummaryByFacility.availableToPromiseMap; + context.quantityOnHandByFacilityMap = inventorySummaryByFacility.quantityOnHandMap; + context.facility = facility; } - + // Get a list of facilities for purchase orders to receive against. // These facilities must be owned by the bill-to party of the purchase order. // 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)) { - Map facilitiesForShipGroup = new HashMap(); - String ownerPartyId = orderReadHelper.getBillToParty().getString("partyId"); - for (int i = 0; i < shipGroups.size(); i++) { - GenericValue shipGroup = (GenericValue)shipGroups.get(i); - Map lookupMap = UtilMisc.toMap("ownerPartyId", ownerPartyId); - if (shipGroup.get("contactMechId") != null) { - lookupMap.put("contactMechId", shipGroup.getString("contactMechId")); + facilitiesForShipGroup = [:]; + ownerPartyId = orderReadHelper.getBillToParty().partyId; + shipGroups.each { shipGroup -> + lookupMap = [ownerPartyId : ownerPartyId]; + if (shipGroup.contactMechId) { + lookupMap.contactMechId = shipGroup.contactMechId; } - List facilities = delegator.findByAndCache("FacilityAndContactMech", lookupMap); - facilitiesForShipGroup.put(shipGroup.getString("shipGroupSeqId"), facilities); + facilities = delegator.findByAndCache("FacilityAndContactMech", lookupMap); + facilitiesForShipGroup[shipGroup.shipGroupSeqId] = facilities; } - context.put("facilitiesForShipGroup", facilitiesForShipGroup); + context.facilitiesForShipGroup = facilitiesForShipGroup; } // set the type of return based on type of order if ("SALES_ORDER".equals(orderType)) { - context.put("returnHeaderTypeId", "CUSTOMER_RETURN"); + context.returnHeaderTypeId = "CUSTOMER_RETURN"; // also set the product store facility Id for sales orders - GenericValue productStore = orderHeader.getRelatedOne("ProductStore"); - context.put("storeFacilityId", productStore.getString("inventoryFacilityId")); - if (UtilValidate.isNotEmpty(productStore.getString("reqReturnInventoryReceive"))) { - context.put("needsInventoryReceive", productStore.getString("reqReturnInventoryReceive")); + productStore = orderHeader.getRelatedOne("ProductStore"); + context.storeFacilityId = productStore.inventoryFacilityId; + if (productStore.reqReturnInventoryReceive) { + context.needsInventoryReceive = productStore.reqReturnInventoryReceive; } else { - context.put("needsInventoryReceive", "Y"); + context.needsInventoryReceive = "Y"; } } else { - context.put("returnHeaderTypeId", "VENDOR_RETURN"); + context.returnHeaderTypeId = "VENDOR_RETURN"; } // QUANTITY: get the returned quantity by order item map - context.put("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(); // INVENTORY: get the production quantity for each product and store the results in a map of productId -> quantity - productionMap = new HashMap(); - for (iter = productIds.iterator(); iter.hasNext(); ) { - productId = iter.next(); - if (productId == null) continue; // avoid order items without productIds, such as bulk order items - contextInput = UtilMisc.toMap("productId", productId, "userLogin", userLogin); - resultOutput = dispatcher.runSync("getProductManufacturingSummaryByFacility", contextInput); - manufacturingInQuantitySummaryByFacility = resultOutput.get("summaryInByFacility"); - Double productionQuantity = 0; - for (manQuantityIter = manufacturingInQuantitySummaryByFacility.values().iterator(); manQuantityIter.hasNext();) { - productionQuantity += (Double)manQuantityIter.next().get("estimatedQuantityTotal"); - } - productionMap.put(productId, productionQuantity); + productionMap = [:]; + productIds.each { productId -> + if (productId) { // avoid order items without productIds, such as bulk order items + contextInput = [productId : productId, userLogin : userLogin]; + resultOutput = dispatcher.runSync("getProductManufacturingSummaryByFacility", contextInput); + manufacturingInQuantitySummaryByFacility = resultOutput.summaryInByFacility; + Double productionQuantity = 0; + manufacturingInQuantitySummaryByFacility.values().each { manQuantity -> + productionQuantity += manQuantity.estimatedQuantityTotal; + } + productionMap[productId] = productionQuantity; + } } - context.put("productionProductQuantityMap", productionMap); + context.productionProductQuantityMap = productionMap; // INVENTORY: find the number of products in outstanding sales orders for the same product store requiredMap = InventoryWorker.getOutstandingProductQuantitiesForSalesOrders(productIds, delegator); - context.put("requiredProductQuantityMap", requiredMap); + context.requiredProductQuantityMap = requiredMap; // INVENTORY: find the quantity of each product in outstanding purchase orders onOrderMap = InventoryWorker.getOutstandingProductQuantitiesForPurchaseOrders(productIds, delegator); - context.put("onOrderProductQuantityMap", onOrderMap); + context.onOrderProductQuantityMap = onOrderMap; } paramString = ""; -if (orderId != null) paramString = paramString + "orderId=" + orderId; -if (workEffortId != null) paramString = paramString + "&workEffortId=" + workEffortId; -if (assignPartyId != null) paramString = paramString + "&partyId=" + assignPartyId; -if (assignRoleTypeId != null) paramString = paramString + "&roleTypeId=" + assignRoleTypeId; -if (fromDate != null) paramString = paramString + "&fromDate=" + fromDate; -context.put("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; -if (workEffortId != null && assignPartyId != null && assignRoleTypeId != null && fromDate != null) { - fields = UtilMisc.toMap("workEffortId", workEffortId, "partyId", assignPartyId, "roleTypeId", assignRoleTypeId, "fromDate", fromDate); +if (workEffortId && assignPartyId && assignRoleTypeId && fromDate) { + fields = [workEffortId : workEffortId, partyId : assignPartyId, roleTypeId : assignRoleTypeId, fromDate : fromDate]; wepa = delegator.findByPrimaryKey("WorkEffortPartyAssignment", fields); - if (wepa != null && wepa.get("statusId") != null && wepa.getString("statusId").equals("CAL_ACCEPTED")) { - workEffort = delegator.findByPrimaryKey("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId)); - workEffortStatus = workEffort.getString("currentStatusId"); - if (workEffortStatus != null) { - context.put("workEffortStatus", workEffortStatus); + if ("CAL_ACCEPTED".equals(wepa?.statusId)) { + workEffort = delegator.findByPrimaryKey("WorkEffort", [workEffortId : workEffortId]); + workEffortStatus = workEffort.currentStatusId; + if (workEffortStatus) { + context.workEffortStatus = workEffortStatus; if (workEffortStatus.equals("WF_RUNNING") || workEffortStatus.equals("WF_SUSPENDED")) - context.put("inProcess", new Boolean(true)); + context.inProcess = true; } - if (workEffort != null) { - if ((delegate != null && delegate.equals("true")) || (workEffortStatus != null && workEffortStatus.equals("WF_RUNNING"))) { - actFields = UtilMisc.toMap("packageId", workEffort.getString("workflowPackageId"), "packageVersion", workEffort.getString("workflowPackageVersion"), "processId", workEffort.getString("workflowProcessId"), "processVersion", workEffort.getString("workflowProcessVersion"), "activityId", workEffort.getString("workflowActivityId")); + if (workEffort) { + if ("true".equals(delegate) || "WF_RUNNING".equals(workEffortStatus)) { + actFields = [packageId : workEffort.workflowPackageId, packageVersion : workEffort.workflowPackageVersion, processId : workEffort.workflowProcessId, processVersion : workEffort.workflowProcessVersion, activityId : workEffort.workflowActivityId]; activity = delegator.findByPrimaryKey("WorkflowActivity", actFields); - if (activity != null) { - transitions = activity.getRelated("FromWorkflowTransition", null, UtilMisc.toList("-transitionId")); - context.put("wfTransitions", transitions); + if (activity) { + transitions = activity.getRelated("FromWorkflowTransition", null, ["-transitionId"]); + context.wfTransitions = transitions; } } } } } -if (orderHeader != null) { +if (orderHeader) { // list to find all the POSTAL_ADDRESS for the shipment party. - orderParty = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId)); + orderParty = delegator.findByPrimaryKey("Party", [partyId : partyId]); shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); - context.put("shippingContactMechList",shippingContactMechList); + context.shippingContactMechList = shippingContactMechList; // list to find all the shipmentMethods from the view named "ProductStoreShipmentMethView". - productStoreId = orderHeader.getRelatedOne("ProductStore").getString("productStoreId"); - productStoreShipmentMethList = delegator.findByAndCache("ProductStoreShipmentMethView", UtilMisc.toMap("productStoreId", productStoreId), UtilMisc.toList("sequenceNumber")); - context.put("productStoreShipmentMethList",productStoreShipmentMethList); + productStoreId = orderHeader.getRelatedOne("ProductStore").productStoreId; + productStoreShipmentMethList = delegator.findByAndCache("ProductStoreShipmentMethView", [productStoreId : productStoreId], ["sequenceNumber"]); + context.productStoreShipmentMethList = productStoreShipmentMethList; // Get a map of returnable items - returnableItems = new HashMap(); - returnableItemServiceMap = dispatcher.runSync("getReturnableItems", UtilMisc.toMap("orderId", orderId)); - if (returnableItemServiceMap.get("returnableItems") != null) { - returnableItems = returnableItemServiceMap.get("returnableItems"); + returnableItems = [:]; + returnableItemServiceMap = dispatcher.runSync("getReturnableItems", [orderId : orderId]); + if (returnableItemServiceMap.returnableItems) { + returnableItems = returnableItemServiceMap.returnableItems; } - context.put("returnableItems", returnableItems); + context.returnableItems = returnableItems; // get the catalogIds for appending items - if ((request != null) && (request != void)) { + if (context.request != null) { if ("SALES_ORDER".equals(orderType)) { catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStoreId, partyId); } else { catalogCol = CatalogWorker.getAllCatalogIds(request); } - if (catalogCol != null && catalogCol.size() > 0) { - currentCatalogId = (String) catalogCol.get(0); + if (catalogCol) { + currentCatalogId = catalogCol[0]; currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId); - context.put("catalogCol", catalogCol); - context.put("currentCatalogId", currentCatalogId); - context.put("currentCatalogName", currentCatalogName); + context.catalogCol = catalogCol; + context.currentCatalogId = currentCatalogId; + context.currentCatalogName = currentCatalogName; } } } -if (orderHeader != null) { +if (orderHeader) { // list to find all the POSTAL_ADDRESS for the party. - orderParty = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", partyId)); + orderParty = delegator.findByPrimaryKey("Party", [partyId : partyId]); postalContactMechList = ContactHelper.getContactMechByType(orderParty,"POSTAL_ADDRESS", false); - context.put("postalContactMechList",postalContactMechList); + context.postalContactMechList = postalContactMechList; } Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderViewWebSecure.groovy (from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderviewwebsecure.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderViewWebSecure.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderViewWebSecure.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderviewwebsecure.bsh&r1=676509&r2=676862&rev=676862&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderviewwebsecure.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderViewWebSecure.groovy Tue Jul 15 03:34:16 2008 @@ -22,34 +22,34 @@ import org.ofbiz.base.util.collections.*; import org.ofbiz.order.order.*; -orderHeader = context.get("orderHeader"); +orderHeader = context.orderHeader; -// if orderHeader is null in orderview.bsh then it is not null but void here! -if ((orderHeader != null) && (orderHeader != void)) { +// 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; - if (("SALES_ORDER".equals(orderHeader.getString("orderTypeId")) && security.hasEntityPermission("ORDERMGR", "_VIEW", session)) - || ("PURCHASE_ORDER".equals(orderHeader.getString("orderTypeId")) && security.hasEntityPermission("ORDERMGR", "_PURCHASE_VIEW", session))) { + 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; } else if (security.hasEntityPermission("ORDERMGR_ROLE", "_VIEW", session)) { - currentUserOrderRoles = orderHeader.getRelated("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId")), null); - if (currentUserOrderRoles != null && currentUserOrderRoles.size() > 0) { + currentUserOrderRoles = orderHeader.getRelated("OrderRole", [partyId : userLogin.partyId], null); + if (currentUserOrderRoles) { hasPermission = true; canViewInternalDetails = true; } } else { // regardless of permission, allow if this is the supplier - currentUserSupplierOrderRoles = orderHeader.getRelated("OrderRole", UtilMisc.toMap("partyId", userLogin.get("partyId"), "roleTypeId", "SUPPLIER_AGENT"), null); - if (currentUserSupplierOrderRoles != null && currentUserSupplierOrderRoles.size() > 0) { + currentUserSupplierOrderRoles = orderHeader.getRelated("OrderRole", [partyId : userLogin.partyId, roleTypeId : "SUPPLIER_AGENT"], null); + if (currentUserSupplierOrderRoles) { hasPermission = true; } } - context.put("hasPermission", hasPermission); - context.put("canViewInternalDetails", canViewInternalDetails); + context.hasPermission = hasPermission; + context.canViewInternalDetails = canViewInternalDetails; orderContentWrapper = OrderContentWrapper.makeOrderContentWrapper(orderHeader, request); - context.put("orderContentWrapper", orderContentWrapper); + context.orderContentWrapper = orderContentWrapper; } Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy (from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/receivepayment.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/receivepayment.bsh&r1=676509&r2=676862&rev=676862&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/receivepayment.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy Tue Jul 15 03:34:16 2008 @@ -21,27 +21,24 @@ import org.ofbiz.entity.condition.*; import org.ofbiz.base.util.*; -delegator = request.getAttribute("delegator"); orderId = request.getParameter("orderId"); paymentMethodTypes = delegator.findList("PaymentMethodType", EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.NOT_EQUAL, "EXT_OFFLINE"), null, null, null, false); -context.put("paymentMethodTypes", paymentMethodTypes); +context.paymentMethodTypes = paymentMethodTypes; workEffortId = request.getParameter("workEffortId"); partyId = request.getParameter("partyId"); roleTypeId = request.getParameter("roleTypeId"); fromDate = request.getParameter("fromDate"); -donePage = request.getParameter("DONE_PAGE"); -if (donePage == null || donePage.length() <= 0) - donePage="orderview?orderId=" + orderId; -if (workEffortId != null && workEffortId.length() > 0) - donePage = donePage + "&workEffortId=" + workEffortId; -if (partyId != null && partyId.length() > 0) - donePage = donePage + "&partyId=" + partyId; -if (roleTypeId != null && roleTypeId.length() > 0) - donePage = donePage + "&roleTypeId=" + roleTypeId; -if (fromDate != null && fromDate.length() > 0) - donePage = donePage + "&fromDate=" + fromDate; -context.put("donePage", donePage); +donePage = request.getParameter("DONE_PAGE") ?: "orderview?orderId=" + orderId; +if (workEffortId) + donePage += "&workEffortId=" + workEffortId; +if (partyId) + donePage += "&partyId=" + partyId; +if (roleTypeId) + donePage += "&roleTypeId=" + roleTypeId; +if (fromDate) + donePage += "&fromDate=" + fromDate; +context.donePage = donePage; Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy (from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/sendconfirmationemail.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/sendconfirmationemail.bsh&r1=676509&r2=676862&rev=676862&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/sendconfirmationemail.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy Tue Jul 15 03:34:16 2008 @@ -22,31 +22,26 @@ import org.ofbiz.order.order.OrderReadHelper; import org.ofbiz.content.email.NotificationServices; -delegator = request.getAttribute("delegator"); - -orderId = request.getParameter("orderId"); -if (orderId == null) orderId = parameters.get("orderId"); -context.put("orderId", orderId); +orderId = request.getParameter("orderId") ?: parameters.get("orderId"); +context.orderId = orderId; partyId = request.getParameter("partyId"); sendTo = request.getParameter("sendTo"); -context.put("partyId", partyId); -context.put("sendTo", sendTo); +context.partyId = partyId; +context.sendTo = sendTo; -donePage = request.getParameter("DONE_PAGE"); -if (donePage == null || donePage.length() <= 0) - donePage="orderview?orderId=" + orderId; -context.put("donePage", donePage); +donePage = request.getParameter("DONE_PAGE") ?: "orderview?orderId=" + orderId; +context.donePage = donePage; // Provide the correct order confirmation ProductStoreEmailSetting, if one exists -orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); -if (orderHeader.getString("productStoreId") != null) { - productStoreEmailSetting = delegator.findByPrimaryKeyCache("ProductStoreEmailSetting", UtilMisc.toMap("productStoreId", orderHeader.getString("productStoreId"), "emailType", "PRDS_ODR_CONFIRM")); - if (productStoreEmailSetting != null) { - context.put("productStoreEmailSetting", productStoreEmailSetting); +orderHeader = delegator.findByPrimaryKey("OrderHeader", [orderId : orderId]); +if (orderHeader.productStoreId) { + productStoreEmailSetting = delegator.findByPrimaryKeyCache("ProductStoreEmailSetting", [productStoreId : orderHeader.productStoreId, emailType : "PRDS_ODR_CONFIRM"]); + if (productStoreEmailSetting) { + context.productStoreEmailSetting = productStoreEmailSetting; } } // set the baseUrl parameter, required by some email bodies -NotificationServices.setBaseUrl(delegator, context.get("webSiteId"), context); +NotificationServices.setBaseUrl(delegator, context.webSiteId, context); Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy (from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh&r1=676509&r2=676862&rev=676862&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy Tue Jul 15 03:34:16 2008 @@ -23,33 +23,32 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.util.EntityUtil; -orderId = parameters.get("orderId"); -if (orderId == null) return; +orderId = parameters.orderId; +if (!orderId) return; -shipGroupSeqId = parameters.get("shipGroupSeqId"); +shipGroupSeqId = parameters.shipGroupSeqId; // if a particular ship group is requested, we will limit ourselves to it -findMap = UtilMisc.toMap("orderId", orderId); -if (shipGroupSeqId != null) findMap.put("shipGroupSeqId", shipGroupSeqId); +findMap = [orderId: orderId]; +if (shipGroupSeqId) findMap.shipGroupSeqId = shipGroupSeqId; -shipGroups = delegator.findByAnd("OrderItemShipGroup", findMap, UtilMisc.toList("shipGroupSeqId")); -context.put("shipGroups", shipGroups); +shipGroups = delegator.findByAnd("OrderItemShipGroup", findMap, ["shipGroupSeqId"]); +context.shipGroups = shipGroups; // method to expand the marketing packages FastList expandProductGroup(product, quantityInGroup, quantityShipped, quantityOpen, assocType) { sublines = FastList.newInstance(); - associations = product.getRelatedByAnd("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", assocType)); + associations = product.getRelatedByAnd("MainProductAssoc", [productAssocTypeId : assocType]); associations = EntityUtil.filterByDate(associations); - for (iter = associations.iterator(); iter.hasNext(); ) { - association = iter.next(); + associations.each { association -> line = FastMap.newInstance(); - line.put("product", association.getRelatedOne("AssocProduct")); + line.product = association.getRelatedOne("AssocProduct"); // determine the quantities - quantityComposed = (association.getDouble("quantity") == null ? 0 : association.getDouble("quantity").doubleValue()); - line.put("quantityInGroup", quantityInGroup * quantityComposed); - line.put("quantityShipped", quantityShipped * quantityComposed); - line.put("quantityOpen", quantityOpen * quantityComposed); + quantityComposed = association.quantity ?: 0; + line.quantityInGroup = quantityInGroup * quantityComposed; + line.quantityShipped = quantityShipped * quantityComposed; + line.quantityOpen = quantityOpen * quantityComposed; sublines.add(line); } @@ -57,70 +56,67 @@ } groupData = FastMap.newInstance(); -for (iter = shipGroups.iterator(); iter.hasNext(); ) { - shipGroup = iter.next(); +shipGroups.each { shipGroup -> data = FastMap.newInstance(); address = shipGroup.getRelatedOne("PostalAddress"); - data.put("address", address); + data.address = address; phoneNumber = shipGroup.getRelatedOne("TelecomTelecomNumber"); - data.put("phoneNumber", phoneNumber); + data.phoneNumber = phoneNumber; carrierShipmentMethod = shipGroup.getRelatedOne("CarrierShipmentMethod"); - if (carrierShipmentMethod != null) { - data.put("carrierShipmentMethod", carrierShipmentMethod); - data.put("shipmentMethodType", carrierShipmentMethod.getRelatedOneCache("ShipmentMethodType")); + if (carrierShipmentMethod) { + data.carrierShipmentMethod = carrierShipmentMethod; + data.shipmentMethodType = carrierShipmentMethod.getRelatedOneCache("ShipmentMethodType"); } // the lines in a page, each line being a row of data to display lines = FastList.newInstance(); // process the order item to ship group associations, each being a line item for the group - orderItemAssocs = shipGroup.getRelated("OrderItemShipGroupAssoc", UtilMisc.toList("orderItemSeqId")); - for (oiter = orderItemAssocs.iterator(); oiter.hasNext(); ) { - orderItemAssoc = oiter.next(); + orderItemAssocs = shipGroup.getRelated("OrderItemShipGroupAssoc", ["orderItemSeqId"]); + orderItemAssocs.each { orderItemAssoc -> orderItem = orderItemAssoc.getRelatedOne("OrderItem"); product = orderItem.getRelatedOne("Product"); line = FastMap.newInstance(); // the quantity in group - quantityInGroup = orderItemAssoc.get("quantity").doubleValue(); - if (orderItemAssoc.get("cancelQuantity") != null) { - quantityInGroup -= orderItemAssoc.get("cancelQuantity").doubleValue(); + quantityInGroup = orderItemAssoc.quantity; + if (orderItemAssoc.cancelQuantity) { + quantityInGroup -= orderItemAssoc.cancelQuantity; } // the quantity shipped quantityShipped = 0.0; - List issuances = delegator.findByAnd("ItemIssuance", UtilMisc.toMap("orderId", orderItem.get("orderId"), "orderItemSeqId", orderItem.get("orderItemSeqId"), "shipGroupSeqId", orderItemAssoc.get("shipGroupSeqId"))); - for (iiter = issuances.iterator(); iiter.hasNext(); ) { - issuance = iiter.next(); - quantityShipped += issuance.get("quantity").doubleValue(); + issuances = delegator.findByAnd("ItemIssuance", [orderId : orderItem.orderId, orderItemSeqId : orderItem.orderItemSeqId, shipGroupSeqId : orderItemAssoc.shipGroupSeqId]); + issuances.each { issuance -> + quantityShipped += issuance.quantity; } // the quantity open (ordered - shipped) - quantityOpen = orderItem.get("quantity").doubleValue(); - if (orderItem.get("cancelQuantity") != null) { - quantityOpen -= orderItem.get("cancelQuantity").doubleValue(); + quantityOpen = orderItem.quantity; + if (orderItem.cancelQuantity) { + quantityOpen -= orderItem.cancelQuantity; } quantityOpen -= quantityShipped; - line.put("orderItem", orderItem); - line.put("product", product); - line.put("quantityInGroup", quantityInGroup); - line.put("quantityShipped", quantityShipped); - line.put("quantityOpen", quantityOpen); - - if ("MARKETING_PKG_AUTO".equals(product.get("productTypeId")) || - "MARKETING_PKG_PICK".equals(product.get("productTypeId"))) { - String assocType = ("MARKETING_PKG_AUTO".equals(product.get("productTypeId"))? "MANUF_COMPONENT": "PRODUCT_COMPONENT"); + line.orderItem = orderItem; + line.product = product; + line.quantityInGroup = quantityInGroup; + line.quantityShipped = quantityShipped; + line.quantityOpen = quantityOpen; + + if ("MARKETING_PKG_AUTO".equals(product.productTypeId) || + "MARKETING_PKG_PICK".equals(product.productTypeId)) { + assocType = "MARKETING_PKG_AUTO".equals(product.productTypeId) ? "MANUF_COMPONENT" : "PRODUCT_COMPONENT"; sublines = expandProductGroup(product, quantityInGroup, quantityShipped, quantityOpen, assocType); - line.put("expandedList", sublines); + line.expandedList = sublines; } lines.add(line); } - data.put("lines", lines); - groupData.put(shipGroup.get("shipGroupSeqId"), data); + data.lines = lines; + groupData[shipGroup.shipGroupSeqId] = data; } -context.put("groupData", groupData); +context.groupData = groupData; Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy (from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/viewimage.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/viewimage.bsh&r1=676509&r2=676862&rev=676862&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/viewimage.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy Tue Jul 15 03:34:16 2008 @@ -20,20 +20,18 @@ import org.ofbiz.base.util.*; import org.ofbiz.order.order.*; -delegator = request.getAttribute("delegator"); - orderId = request.getParameter("orderId"); orderItemSeqId = request.getParameter("orderItemSeqId"); orderContentTypeId = request.getParameter("orderContentTypeId"); order = null; -if (orderId != null && orderItemSeqId == null && orderId.length() > 0) { - order = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); +if (orderId && !orderItemSeqId) { + order = delegator.findByPrimaryKey("OrderHeader", [orderId : orderId]); } -if (orderId != null && orderItemSeqId != null && orderId.length() > 0) { - order = delegator.findByPrimaryKey("OrderItem", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId)); +if (orderId && orderItemSeqId) { + order = delegator.findByPrimaryKey("OrderItem", [orderId : orderId, orderItemSeqId : orderItemSeqId]); } wrapper = OrderContentWrapper.makeOrderContentWrapper(order, request); -context.put("wrapper", wrapper); -context.put("orderContentTypeId", orderContentTypeId); +context.wrapper = wrapper; +context.orderContentTypeId = orderContentTypeId; Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintScreens.xml?rev=676862&r1=676861&r2=676862&view=diff ============================================================================== --- ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintScreens.xml (original) +++ ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintScreens.xml Tue Jul 15 03:34:16 2008 @@ -32,7 +32,7 @@ <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/> <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy"/> </actions> <widgets> <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml"> @@ -144,7 +144,7 @@ <set field="title" value="Ship Groups"/> <property-map resource="OrderUiLabels" map-name="uiLabelMap" global="true"/> <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/shipGroups.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy"/> </actions> <widgets> <decorator-screen name="FoReportDecorator" location="component://common/widget/CommonScreens.xml"> Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml?rev=676862&r1=676861&r2=676862&view=diff ============================================================================== --- ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml (original) +++ ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml Tue Jul 15 03:34:16 2008 @@ -38,8 +38,8 @@ <actions> <set field="titleProperty" value="OrderViewOrder"/> <set field="headerItem" value="findorders"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/orderviewwebsecure.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/OrderViewWebSecure.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderViewDecorator"> @@ -150,8 +150,8 @@ <actions> <set field="titleProperty" value="OrderEditItems"/> <set field="headerItem" value="orderlist"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/orderviewwebsecure.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/OrderViewWebSecure.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderViewDecorator"> @@ -251,7 +251,7 @@ <actions> <set field="titleProperty" value="OrderReceiveOfflinePayments"/> <set field="headerItem" value="findorders"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/receivepayment.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderViewDecorator"> @@ -268,7 +268,7 @@ <section> <actions> <set field="titleProperty" value="OrderViewImage"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/viewimage.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy"/> </actions> <widgets> <platform-specific><html><html-template location="component://order/webapp/ordermgr/order/viewimage.ftl"/></html></platform-specific> @@ -280,7 +280,7 @@ <actions> <set field="titleProperty" value="OrderSendConfirmationEmail"/> <set field="headerItem" value="findorders"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/sendconfirmationemail.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderViewDecorator"> |
Free forum by Nabble | Edit this page |