Author: lektran
Date: Sat Jul 12 14:53:22 2008 New Revision: 676242 URL: http://svn.apache.org/viewvc?rev=676242&view=rev Log: A few more bsh -> groovy conversions Added: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutReview.groovy - copied, changed from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutreview.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutShippingAddress.groovy - copied, changed from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutshippingaddress.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OptionSettings.groovy - copied, changed from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/optionsettings.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OrderAgreements.groovy - copied, changed from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OrderTerms.groovy - copied, changed from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderterms.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetAdditionalParty.groovy - copied, changed from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/setAdditionalParty.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetCheckOutTabBar.groovy - copied, changed from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetCheckOutTabBar.bsh Removed: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetCheckOutTabBar.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutreview.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutshippingaddress.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/optionsettings.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderparty.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderterms.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/setAdditionalParty.bsh Modified: ofbiz/trunk/applications/ecommerce/widget/OrderScreens.xml ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryOrderScreens.xml ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryScreens.xml Modified: ofbiz/trunk/applications/ecommerce/widget/OrderScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/widget/OrderScreens.xml?rev=676242&r1=676241&r2=676242&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/widget/OrderScreens.xml (original) +++ ofbiz/trunk/applications/ecommerce/widget/OrderScreens.xml Sat Jul 12 14:53:22 2008 @@ -255,7 +255,7 @@ <set field="MainColumnStyle" value="rightonly"/> <set field="titleProperty" value="PageTitleCheckoutOptions"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/checkoutshippingaddress.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutShippingAddress.groovy"/> </actions> <widgets> <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutReview.groovy (from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutreview.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutReview.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutReview.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutreview.bsh&r1=676141&r2=676242&rev=676242&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutreview.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutReview.groovy Sat Jul 12 14:53:22 2008 @@ -29,137 +29,127 @@ import org.ofbiz.product.store.*; import org.ofbiz.party.party.PartyWorker; -delegator = request.getAttribute("delegator"); -userLogin = session.getAttribute("userLogin"); cart = ShoppingCartEvents.getCartObject(request); -context.put("cart", cart); -context.put("currencyUomId", cart.getCurrency()); +context.cart = cart; +context.currencyUomId = cart.getCurrency(); // nuke the event messages request.removeAttribute("_EVENT_MESSAGE_"); orderItems = cart.makeOrderItems(); -context.put("orderItems", orderItems); +context.orderItems = orderItems; orderAdjustments = cart.makeAllAdjustments(); -List orderItemShipGroupInfo = cart.makeAllShipGroupInfos(); -if (orderItemShipGroupInfo != null && orderItemShipGroupInfo.size() > 0) { - Iterator osiInfos = orderItemShipGroupInfo.iterator(); - while (osiInfos.hasNext()) { - GenericValue valueObj = (GenericValue) osiInfos.next(); - if ("OrderAdjustment".equals(valueObj.getEntityName())) { +orderItemShipGroupInfo = cart.makeAllShipGroupInfos(); +if (orderItemShipGroupInfo) { + orderItemShipGroupInfo.each { osiInfo -> + if ("OrderAdjustment".equals(osiInfo.getEntityName())) { // shipping / tax adjustment(s) - orderAdjustments.add(valueObj); + orderAdjustments.add(osiInfo); } } } -context.put("orderAdjustments", orderAdjustments); +context.orderAdjustments = orderAdjustments; workEfforts = cart.makeWorkEfforts(); -context.put("workEfforts", workEfforts); +context.workEfforts = workEfforts; orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null); -context.put("orderHeaderAdjustments", orderHeaderAdjustments); -context.put("headerAdjustmentsToShow", OrderReadHelper.filterOrderAdjustments(orderHeaderAdjustments, true, false, false, false, false)); +context.orderHeaderAdjustments = orderHeaderAdjustments; +context.headerAdjustmentsToShow = OrderReadHelper.filterOrderAdjustments(orderHeaderAdjustments, true, false, false, false, false); orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments); -context.put("orderSubTotal", orderSubTotal); -context.put("placingCustomerPerson", userLogin == null ? null : userLogin.getRelatedOne("Person")); -context.put("shippingAddress", cart.getShippingAddress()); +context.orderSubTotal = orderSubTotal; +context.placingCustomerPerson = userLogin?.getRelatedOne("Person"); +context.shippingAddress = cart.getShippingAddress(); paymentMethods = cart.getPaymentMethods(); paymentMethod = null; -if (paymentMethods != null && paymentMethods.size() > 0) { +if (paymentMethods) { paymentMethod = paymentMethods.get(0); - context.put("paymentMethod", paymentMethod); + context.paymentMethod = paymentMethod; } -if (paymentMethod != null && "CREDIT_CARD".equals(paymentMethod.getString("paymentMethodTypeId"))) { +if ("CREDIT_CARD".equals(paymentMethod?.paymentMethodTypeId)) { creditCard = paymentMethod.getRelatedOneCache("CreditCard"); - context.put("creditCard", creditCard); - context.put("formattedCardNumber", ContactHelper.formatCreditCard(creditCard)); -} else if (paymentMethod != null && "EFT_ACCOUNT".equals(paymentMethod.getString("paymentMethodTypeId"))) { + context.creditCard = creditCard; + context.formattedCardNumber = ContactHelper.formatCreditCard(creditCard); +} else if ("EFT_ACCOUNT".equals(paymentMethod?.paymentMethodTypeId)) { eftAccount = paymentMethod.getRelatedOneCache("EftAccount"); - context.put("eftAccount", eftAccount); + context.eftAccount = eftAccount; } paymentMethodTypeIds = cart.getPaymentMethodTypeIds(); paymentMethodType = null; paymentMethodTypeId = null; -if (paymentMethodTypeIds != null && paymentMethodTypeIds.size() > 0) { +if (paymentMethodTypeIds) { paymentMethodTypeId = paymentMethodTypeIds.get(0); - paymentMethodType = delegator.findByPrimaryKey("PaymentMethodType", UtilMisc.toMap("paymentMethodTypeId", paymentMethodTypeId)); - context.put("paymentMethodType", paymentMethodType); -} + paymentMethodType = delegator.findByPrimaryKey("PaymentMethodType", [paymentMethodTypeId : paymentMethodTypeId]); + context.paymentMethodType = paymentMethodType; +} webSiteId = CatalogWorker.getWebSiteId(request); -String productStoreId = ProductStoreWorker.getProductStoreId(request); +productStoreId = ProductStoreWorker.getProductStoreId(request); productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); -if (productStore != null) { - payToPartyId = productStore.getString("payToPartyId"); +if (productStore) { + payToPartyId = productStore.payToPartyId; paymentAddress = PaymentWorker.getPaymentAddress(delegator, payToPartyId); - if (paymentAddress != null) context.put("paymentAddress", paymentAddress); + if (paymentAddress) context.paymentAddress = paymentAddress; } billingAddress = null; -if (paymentMethod != null) { +if (paymentMethod) { creditCard = paymentMethod.getRelatedOne("CreditCard"); - if (creditCard != null) { - billingAddress = creditCard.getRelatedOne("PostalAddress"); - } + billingAddress = creditCard?.getRelatedOne("PostalAddress"); } -if (billingAddress != null) - context.put("billingAddress", billingAddress); +if (billingAddress) context.billingAddress = billingAddress; -billingAccount = cart.getBillingAccountId() != null ? delegator.findByPrimaryKey("BillingAccount", UtilMisc.toMap("billingAccountId", cart.getBillingAccountId())) : null; -if (billingAccount != null) - context.put("billingAccount", billingAccount); +billingAccount = cart.getBillingAccountId() ? delegator.findByPrimaryKey("BillingAccount", [billingAccountId : cart.getBillingAccountId()]) : null; +if (billingAccount) context.billingAccount = billingAccount; -context.put("customerPoNumber", cart.getPoNumber()); -context.put("carrierPartyId", cart.getCarrierPartyId()); -context.put("shipmentMethodTypeId", cart.getShipmentMethodTypeId()); -context.put("shippingInstructions", cart.getShippingInstructions()); -context.put("maySplit", cart.getMaySplit()); -context.put("giftMessage", cart.getGiftMessage()); -context.put("isGift", cart.getIsGift()); -context.put("shipBeforeDate", cart.getShipBeforeDate()); -context.put("shipAfterDate", cart.getShipAfterDate()); +context.customerPoNumber = cart.getPoNumber(); +context.carrierPartyId = cart.getCarrierPartyId(); +context.shipmentMethodTypeId = cart.getShipmentMethodTypeId(); +context.shippingInstructions = cart.getShippingInstructions(); +context.maySplit = cart.getMaySplit(); +context.giftMessage = cart.getGiftMessage(); +context.isGift = cart.getIsGift(); +context.shipBeforeDate = cart.getShipBeforeDate(); +context.shipAfterDate = cart.getShipAfterDate(); -shipmentMethodType = delegator.findByPrimaryKey("ShipmentMethodType", UtilMisc.toMap("shipmentMethodTypeId", cart.getShipmentMethodTypeId())); -if (shipmentMethodType != null) context.put("shipMethDescription", shipmentMethodType.getString("description")); +shipmentMethodType = delegator.findByPrimaryKey("ShipmentMethodType", [shipmentMethodTypeId : cart.getShipmentMethodTypeId()]); +if (shipmentMethodType) context.shipMethDescription = shipmentMethodType.description; -OrderReadHelper orh = new OrderReadHelper(orderAdjustments, orderItems); -context.put("localOrderReadHelper", orh); +orh = new OrderReadHelper(orderAdjustments, orderItems); +context.localOrderReadHelper = orh; shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true); shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true)); -context.put("orderShippingTotal", shippingAmount); +context.orderShippingTotal = shippingAmount; taxAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, true, false); taxAmount = taxAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, true, false)); -context.put("orderTaxTotal", taxAmount); -context.put("orderGrandTotal", OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments)); - +context.orderTaxTotal = taxAmount; +context.orderGrandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments); + orderName = cart.getOrderName(); -context.put("orderName", orderName); +context.orderName = orderName; orderPartyId = cart.getPartyId(); -if (orderPartyId != null) { +if (orderPartyId) { partyMap = PartyWorker.getPartyOtherValues(request, orderPartyId, "orderParty", "orderPerson", "orderPartyGroup"); - if (partyMap != null) { - iter = partyMap.entrySet().iterator(); - while (iter.hasNext()) { - entry = iter.next(); - context.put(entry.getKey(), entry.getValue()); + if (partyMap) { + partyMap.each { key, value -> + context[key] = value; } } } orderTerms = cart.getOrderTerms(); -if (orderTerms != null) { - context.put("orderTerms",orderTerms); +if (orderTerms) { + context.orderTerms = orderTerms; } orderType = cart.getOrderType(); -context.put("orderType", orderType); +context.orderType = orderType; Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutShippingAddress.groovy (from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutshippingaddress.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutShippingAddress.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutShippingAddress.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutshippingaddress.bsh&r1=676141&r2=676242&rev=676242&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/checkoutshippingaddress.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutShippingAddress.groovy Sat Jul 12 14:53:22 2008 @@ -28,34 +28,30 @@ import org.ofbiz.entity.condition.EntityOperator; import javolution.util.FastList; -delegator = request.getAttribute("delegator"); cart = session.getAttribute("shoppingCart"); -userLogin = session.getAttribute("userLogin"); party = userLogin.getRelatedOne("Party"); -partyId = party.getString("partyId"); +partyId = party.partyId; productStoreId = ProductStoreWorker.getProductStoreId(request); productStoreId = cart.getProductStoreId(); -if (UtilValidate.isNotEmpty(productStoreId)) { +if (productStoreId) { productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); - payToPartyId = productStore.getString("payToPartyId"); + payToPartyId = productStore.payToPartyId; } -String shippingContactMechId = request.getParameter("shipping_contact_mech_id"); -for (int shipGroupIndex = 0; shipGroupIndex < cart.getShipGroupSize(); shipGroupIndex++) { +shippingContactMechId = request.getParameter("shipping_contact_mech_id"); +for (shipGroupIndex = 0; shipGroupIndex < cart.getShipGroupSize(); shipGroupIndex++) { supplierPartyId = cart.getSupplierPartyId(shipGroupIndex); - context.put(shipGroupIndex+"_supplierPartyId",supplierPartyId); + context[shipGroupIndex + "_supplierPartyId"] = supplierPartyId; } -List exprs = FastList.newInstance(); +exprs = FastList.newInstance(); exprs.add(EntityCondition.makeCondition("partyIdTo", EntityOperator.EQUALS, payToPartyId)); exprs.add(EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, partyId)); agreements = delegator.findList("Agreement", EntityCondition.makeCondition(exprs, EntityOperator.AND), null, null, null, true); agreements = EntityUtil.filterByDate(agreements); -context.put("agreements", agreements); - -context.put("shoppingCart", cart); -context.put("userLogin", userLogin); -context.put("productStoreId", productStoreId); -context.put("shippingContactMechList", ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false)); - +context.agreements = agreements; +context.shoppingCart = cart; +context.userLogin = userLogin; +context.productStoreId = productStoreId; +context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OptionSettings.groovy (from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/optionsettings.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OptionSettings.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OptionSettings.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/optionsettings.bsh&r1=676141&r2=676242&rev=676242&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/optionsettings.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OptionSettings.groovy Sat Jul 12 14:53:22 2008 @@ -24,9 +24,8 @@ import org.ofbiz.party.contact.*; import org.ofbiz.product.store.*; -delegator = request.getAttribute("delegator"); cart = session.getAttribute("shoppingCart"); -context.put("cart", cart); +context.cart = cart; productStoreId = ProductStoreWorker.getProductStoreId(request); // nuke the event messages @@ -34,13 +33,13 @@ party = null; orderPartyIdId = cart.getPartyId(); -if (orderPartyIdId != null) { - orderPartyId = delegator.findByPrimaryKey("Party", UtilMisc.toMap("partyId", orderPartyIdId)); - context.put("orderPartyId", orderPartyId); +if (orderPartyIdId) { + orderPartyId = delegator.findByPrimaryKey("Party", [partyId : orderPartyIdId]); + context.orderPartyId = orderPartyId; } -context.put("carrierShipmentMethodList", delegator.findByAndCache("ProductStoreShipmentMethView", UtilMisc.toMap("productStoreId", productStoreId), UtilMisc.toList("sequenceNumber"))); -context.put("emailList", ContactHelper.getContactMechByType(orderPartyId, "EMAIL_ADDRESS", false)); +context.carrierShipmentMethodList = delegator.findByAndCache("ProductStoreShipmentMethView", [productStoreId : productStoreId], ["sequenceNumber"]); +context.emailList = ContactHelper.getContactMechByType(orderPartyId, "EMAIL_ADDRESS", false); // create the beforeDate for calendar fromCal = Calendar.getInstance(); @@ -52,7 +51,7 @@ fromTs = new Timestamp(fromCal.getTimeInMillis()); fromStr = fromTs.toString(); fromStr = fromStr.substring(0, fromStr.indexOf('.')); -context.put("beforeDateStr", fromStr); +context.beforeDateStr = fromStr; // create the afterDate for calendar toCal = Calendar.getInstance(); @@ -64,4 +63,4 @@ toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND)); toTs = new Timestamp(toCal.getTimeInMillis()); toStr = toTs.toString(); -context.put("afterDateStr", toStr); +context.afterDateStr = toStr; Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OrderAgreements.groovy (from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OrderAgreements.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OrderAgreements.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh&r1=676141&r2=676242&rev=676242&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OrderAgreements.groovy Sat Jul 12 14:53:22 2008 @@ -36,21 +36,21 @@ // Get the Cart and Prepare Size shoppingCart = ShoppingCartEvents.getCartObject(request); -context.put("cart", shoppingCart); +context.cart = shoppingCart; // check the selected product store productStoreId = shoppingCart.getProductStoreId(); productStore = null; -if (UtilValidate.isNotEmpty(productStoreId)) { +if (productStoreId) { productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); - if (productStore != null) { + if (productStore) { // put in the default currency, to help selecting a currency for a purchase order - context.put("defaultCurrencyUomId", productStore.getString("defaultCurrencyUomId")); - payToPartyId = productStore.getString("payToPartyId"); + context.defaultCurrencyUomId = productStore.defaultCurrencyUomId; + payToPartyId = productStore.payToPartyId; partyId = shoppingCart.getOrderPartyId(); - - List exprsAgreements = FastList.newInstance(); - List exprsAgreementRoles = FastList.newInstance(); + + exprsAgreements = FastList.newInstance(); + exprsAgreementRoles = FastList.newInstance(); // get applicable agreements for order entry if ("PURCHASE_ORDER".equals(shoppingCart.getOrderType())) { // the agreement for a PO is from customer to payToParty (ie, us) @@ -72,30 +72,30 @@ catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStoreId, partyId); } - if (agreements != null && agreements.size() > 0) { - agreements = EntityUtil.filterByDate(agreements); - context.put("agreements", agreements); + agreements = EntityUtil.filterByDate(agreements); + if (agreements) { + context.agreements = agreements; } - if (UtilValidate.isNotEmpty(agreementRoles)) { - context.put("agreementRoles", agreementRoles); + if (agreementRoles) { + context.agreementRoles =agreementRoles; } - - - if (catalogCol != null && catalogCol.size() > 0) { - currentCatalogId = (String) catalogCol.get(0); + + + if (catalogCol) { + currentCatalogId = catalogCol.get(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; } } } partyId = shoppingCart.getPartyId(); -if (partyId != null && partyId.equals("_NA_")) partyId = null; -context.put("partyId", partyId); +if ("_NA_".equals(partyId)) partyId = null; +context.partyId = partyId; // currencies and shopping cart currency -currencies = delegator.findByAndCache("Uom", UtilMisc.toMap("uomTypeId","CURRENCY_MEASURE")); -context.put("currencies", currencies); -context.put("currencyUomId", shoppingCart.getCurrency()); \ No newline at end of file +currencies = delegator.findByAndCache("Uom", [uomTypeId : "CURRENCY_MEASURE"]); +context.currencies = currencies; +context.currencyUomId = shoppingCart.getCurrency(); Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OrderTerms.groovy (from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderterms.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OrderTerms.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OrderTerms.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderterms.bsh&r1=676141&r2=676242&rev=676242&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/orderterms.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/OrderTerms.groovy Sat Jul 12 14:53:22 2008 @@ -23,25 +23,24 @@ import org.ofbiz.party.contact.*; import org.ofbiz.product.catalog.*; -delegator = request.getAttribute("delegator"); cart = session.getAttribute("shoppingCart"); -context.put("cart", cart); +context.cart = cart; orderTerms = cart.getOrderTerms(); -context.put("orderTerms",orderTerms); +context.orderTerms = orderTerms; termTypes = delegator.findList("TermType", null, null, null, null,false); -context.put("termTypes",termTypes); +context.termTypes = termTypes; createNew = request.getParameter("createNew"); termIndex = request.getParameter("termIndex"); -if (createNew != null && createNew.equals("Y") && termIndex != null && (!termIndex.equals("-1"))) { - context.put("termIndex",termIndex); - orderTerm = orderTerms.get(Integer.parseInt(termIndex)); - if (orderTerm != null) { - context.put("termTypeId",orderTerm.getString("termTypeId")); - context.put("termValue",orderTerm.get("termValue")); - context.put("termDays",orderTerm.get("termDays")); - context.put("textValue",orderTerm.get("textValue")); +if ("Y".equals(createNew) && (!"-1".equals(termIndex))) { + context.termIndex = termIndex; + orderTerm = orderTerms[Integer.parseInt(termIndex)]; + if (orderTerm) { + context.termTypeId = orderTerm.termTypeId; + context.termValue = orderTerm.termValue; + context.termDays = orderTerm.termDays; + context.textValue = orderTerm.textValue; } } Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetAdditionalParty.groovy (from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/setAdditionalParty.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetAdditionalParty.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetAdditionalParty.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/setAdditionalParty.bsh&r1=676141&r2=676242&rev=676242&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/setAdditionalParty.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetAdditionalParty.groovy Sat Jul 12 14:53:22 2008 @@ -21,24 +21,21 @@ import org.ofbiz.base.util.*; import org.ofbiz.order.shoppingcart.*; -delegator = request.getAttribute("delegator"); shoppingCart = ShoppingCartEvents.getCartObject(request); -orderType=shoppingCart.getOrderType(); -context.put("orderType", orderType); +orderType = shoppingCart.getOrderType(); +context.orderType = orderType; -if (request.getParameterValues("additionalRoleTypeId") == null) { +if (!request.getParameterValues("additionalRoleTypeId")) { partyType = request.getParameter("additionalPartyType"); - context.put("additionalPartyType", partyType); + context.additionalPartyType = partyType; additionalPartyId = request.getParameter("additionalPartyId"); - context.put("additionalPartyId", additionalPartyId); + context.additionalPartyId = additionalPartyId; - roles = delegator.findByAnd("PartyRole", UtilMisc.toMap("partyId", additionalPartyId)); - roleData = new LinkedList(); - it = roles.iterator(); - while (it.hasNext()) { - role = it.next(); + roles = delegator.findByAnd("PartyRole", [partyId : additionalPartyId]); + roleData = []; + roles.each { role -> roleData.add(role.getRelatedOne("RoleType")); } - context.put("roles", roleData); + context.roles = roleData; } Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetCheckOutTabBar.groovy (from r676141, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetCheckOutTabBar.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetCheckOutTabBar.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetCheckOutTabBar.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetCheckOutTabBar.bsh&r1=676141&r2=676242&rev=676242&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetCheckOutTabBar.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/SetCheckOutTabBar.groovy Sat Jul 12 14:53:22 2008 @@ -21,55 +21,45 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.order.shoppingcart.ShoppingCartEvents; -List checkoutSteps = new ArrayList(); - -void addStep(String label, String uri) { - checkoutSteps.add(UtilMisc.toMap("label", label, "uri", uri, "enabled", "Y")); -} - -String setEnabledSteps() { - String isLast = "N"; - if (stepLabelId == void) return isLast; - String enabled = "Y"; - for (int i = 0; i < checkoutSteps.size(); i++) { - checkoutStep = (Map)checkoutSteps.get(i); - checkoutStep.put("enabled", enabled); - if (enabled.equals("Y")) { - if (i == (checkoutSteps.size() - 1)) { - isLast = "Y"; - } - if (stepLabelId.equals(checkoutStep.get("label"))) { - enabled = "N"; - } - } - } - return isLast; -} +checkoutSteps = []; shoppingCart = ShoppingCartEvents.getCartObject(request); // ---------------------------------- // The ordered list of steps is prepared here // ---------------------------------- -addStep("OrderOrderItems", "/orderentry"); +checkoutSteps.add([label : "OrderOrderItems", uri : "/orderentry", enabled : "Y"]) if ("PURCHASE_ORDER".equals(shoppingCart.getOrderType())) { - addStep("OrderOrderTerms", "/setOrderTerm"); + checkoutSteps.add([label : "OrderOrderTerms", uri : "/setOrderTerm", enabled : "Y"]) } -addStep("FacilityShipping", "/setShipping"); +checkoutSteps.add([label : "FacilityShipping", uri : "/setShipping", enabled : "Y"]) if (shoppingCart.getShipGroupSize() > 1) { - addStep("OrderShipGroups", "/SetItemShipGroups"); + checkoutSteps.add([label : "OrderShipGroups", uri : "/SetItemShipGroups", enabled : "Y"]) } -addStep("CommonOptions", "/setOptions"); +checkoutSteps.add([label : "CommonOptions", uri : "/setOptions", enabled : "Y"]) if ("SALES_ORDER".equals(shoppingCart.getOrderType())) { - addStep("OrderOrderTerms", "/setOrderTerm"); - addStep("AccountingPayment", "/setBilling"); + checkoutSteps.add([label : "OrderOrderTerms", uri : "/setOrderTerm", enabled : "Y"]) + checkoutSteps.add([label : "AccountingPayment", uri : "/setBilling", enabled : "Y"]) } -addStep("PartyParties", "/setAdditionalParty"); -addStep("OrderReviewOrder", "/confirmOrder"); +checkoutSteps.add([label : "PartyParties", uri : "/setAdditionalParty", enabled : "Y"]) +checkoutSteps.add([label : "OrderReviewOrder", uri : "/confirmOrder", enabled : "Y"]) // --------------------------------------- -isLastStep = setEnabledSteps(); -context.put("isLastStep", isLastStep); -context.put("checkoutSteps", checkoutSteps); +isLastStep = "N"; +enabled = "Y"; +checkoutSteps.eachWithIndex { checkoutStep, i -> + checkoutStep.put("enabled", enabled); + if (enabled.equals("Y")) { + if (i == (checkoutSteps.size() - 1)) { + isLastStep = "Y"; + } + if (stepLabelId.equals(checkoutStep.label)) { + enabled = "N"; + } + } +} + +context.isLastStep = isLastStep; +context.checkoutSteps = checkoutSteps; Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryOrderScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryOrderScreens.xml?rev=676242&r1=676241&r2=676242&view=diff ============================================================================== --- ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryOrderScreens.xml (original) +++ ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryOrderScreens.xml Sat Jul 12 14:53:22 2008 @@ -26,7 +26,7 @@ <actions> <set field="headerItem" value="orderentry"/> <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/SetShoppingCart.bsh"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/SetCheckOutTabBar.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/SetCheckOutTabBar.groovy"/> </actions> <widgets> <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> @@ -142,7 +142,7 @@ <actions> <set field="stepTitleId" value="OrderOrderOptionSettings"/> <set field="stepLabelId" value="CommonOptions"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/optionsettings.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/OptionSettings.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderCheckoutDecorator"> @@ -178,7 +178,7 @@ <actions> <set field="stepTitleId" value="PartyAdditionalPartyEntry"/> <set field="stepLabelId" value="PartyParties"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/setAdditionalParty.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/SetAdditionalParty.groovy"/> <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/AdditionalPartyListing.groovy"/> </actions> <widgets> @@ -200,7 +200,7 @@ <actions> <set field="stepTitleId" value="OrderOrderEntryOrderTerms"/> <set field="stepLabelId" value="OrderOrderTerms"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/orderterms.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/OrderTerms.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderCheckoutDecorator"> @@ -219,7 +219,7 @@ <set field="stepTitleId" value="OrderOrderConfirmation"/> <set field="stepLabelId" value="OrderReviewOrder"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/checkoutreview.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutReview.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderCheckoutDecorator"> @@ -248,7 +248,7 @@ <set field="MainColumnStyle" value="rightonly"/> <set field="titleProperty" value="PageTitleCheckoutOptions"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/checkoutshippingaddress.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/CheckoutShippingAddress.groovy"/> </actions> <widgets> <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryScreens.xml?rev=676242&r1=676241&r2=676242&view=diff ============================================================================== --- ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryScreens.xml (original) +++ ofbiz/trunk/applications/order/widget/ordermgr/OrderEntryScreens.xml Sat Jul 12 14:53:22 2008 @@ -39,7 +39,7 @@ <actions> <set field="titleProperty" value="PageTitleOrderAgreements"/> <set field="headerItem" value="orderentry"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/orderagreements.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/entry/OrderAgreements.groovy"/> </actions> <widgets> <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}"> |
Free forum by Nabble | Edit this page |