Modified: ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutReview.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutReview.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutReview.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutReview.groovy Wed Nov 2 19:09:13 2016 @@ -17,140 +17,140 @@ * under the License. */ -import java.lang.*; -import java.math.BigDecimal; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.accounting.payment.*; -import org.apache.ofbiz.order.order.*; -import org.apache.ofbiz.party.contact.*; -import org.apache.ofbiz.product.catalog.*; -import org.apache.ofbiz.order.shoppingcart.*; -import org.apache.ofbiz.product.store.*; -import org.apache.ofbiz.party.party.PartyWorker; +import java.lang.* +import java.math.BigDecimal +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.accounting.payment.* +import org.apache.ofbiz.order.order.* +import org.apache.ofbiz.party.contact.* +import org.apache.ofbiz.product.catalog.* +import org.apache.ofbiz.order.shoppingcart.* +import org.apache.ofbiz.product.store.* +import org.apache.ofbiz.party.party.PartyWorker import org.apache.ofbiz.webapp.website.WebSiteWorker -cart = ShoppingCartEvents.getCartObject(request); -context.cart = cart; -context.currencyUomId = cart.getCurrency(); -context.productStore = ProductStoreWorker.getProductStore(request); +cart = ShoppingCartEvents.getCartObject(request) +context.cart = cart +context.currencyUomId = cart.getCurrency() +context.productStore = ProductStoreWorker.getProductStore(request) // nuke the event messages -request.removeAttribute("_EVENT_MESSAGE_"); +request.removeAttribute("_EVENT_MESSAGE_") -orderItems = cart.makeOrderItems(); -context.orderItems = orderItems; +orderItems = cart.makeOrderItems() +context.orderItems = orderItems -orderAdjustments = cart.makeAllAdjustments(); +orderAdjustments = cart.makeAllAdjustments() -orderItemShipGroupInfo = cart.makeAllShipGroupInfos(); +orderItemShipGroupInfo = cart.makeAllShipGroupInfos() if (orderItemShipGroupInfo) { orderItemShipGroupInfo.each { osiInfo -> if ("OrderAdjustment".equals(osiInfo.getEntityName())) { // shipping / tax adjustment(s) - orderAdjustments.add(osiInfo); + orderAdjustments.add(osiInfo) } } } -context.orderAdjustments = orderAdjustments; +context.orderAdjustments = orderAdjustments -workEfforts = cart.makeWorkEfforts(); -context.workEfforts = workEfforts; +workEfforts = cart.makeWorkEfforts() +context.workEfforts = workEfforts -orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null); -context.orderHeaderAdjustments = orderHeaderAdjustments; -context.headerAdjustmentsToShow = OrderReadHelper.filterOrderAdjustments(orderHeaderAdjustments, true, false, false, false, false); - -orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments); -context.orderSubTotal = orderSubTotal; -context.placingCustomerPerson = userLogin?.getRelatedOne("Person", false); -context.shippingAddress = cart.getShippingAddress(); +orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null) +context.orderHeaderAdjustments = orderHeaderAdjustments +context.headerAdjustmentsToShow = OrderReadHelper.filterOrderAdjustments(orderHeaderAdjustments, true, false, false, false, false) + +orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments) +context.orderSubTotal = orderSubTotal +context.placingCustomerPerson = userLogin?.getRelatedOne("Person", false) +context.shippingAddress = cart.getShippingAddress() -paymentMethods = cart.getPaymentMethods(); -paymentMethod = null; +paymentMethods = cart.getPaymentMethods() +paymentMethod = null if (paymentMethods) { - paymentMethod = paymentMethods.get(0); - context.paymentMethod = paymentMethod; + paymentMethod = paymentMethods.get(0) + context.paymentMethod = paymentMethod } if ("CREDIT_CARD".equals(paymentMethod?.paymentMethodTypeId)) { - creditCard = paymentMethod.getRelatedOne("CreditCard", true); - context.creditCard = creditCard; - context.formattedCardNumber = ContactHelper.formatCreditCard(creditCard); + creditCard = paymentMethod.getRelatedOne("CreditCard", true) + context.creditCard = creditCard + context.formattedCardNumber = ContactHelper.formatCreditCard(creditCard) } else if ("EFT_ACCOUNT".equals(paymentMethod?.paymentMethodTypeId)) { - eftAccount = paymentMethod.getRelatedOne("EftAccount", true); - context.eftAccount = eftAccount; + eftAccount = paymentMethod.getRelatedOne("EftAccount", true) + context.eftAccount = eftAccount } -paymentMethodTypeIds = cart.getPaymentMethodTypeIds(); -paymentMethodType = null; -paymentMethodTypeId = null; +paymentMethodTypeIds = cart.getPaymentMethodTypeIds() +paymentMethodType = null +paymentMethodTypeId = null if (paymentMethodTypeIds) { - paymentMethodTypeId = paymentMethodTypeIds.get(0); - paymentMethodType = from("PaymentMethodType").where("paymentMethodTypeId", paymentMethodTypeId).queryOne(); - context.paymentMethodType = paymentMethodType; + paymentMethodTypeId = paymentMethodTypeIds.get(0) + paymentMethodType = from("PaymentMethodType").where("paymentMethodTypeId", paymentMethodTypeId).queryOne() + context.paymentMethodType = paymentMethodType } -webSiteId = WebSiteWorker.getWebSiteId(request); -productStoreId = ProductStoreWorker.getProductStoreId(request); -productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); +webSiteId = WebSiteWorker.getWebSiteId(request) +productStoreId = ProductStoreWorker.getProductStoreId(request) +productStore = ProductStoreWorker.getProductStore(productStoreId, delegator) if (productStore) { - payToPartyId = productStore.payToPartyId; - paymentAddress = PaymentWorker.getPaymentAddress(delegator, payToPartyId); - if (paymentAddress) context.paymentAddress = paymentAddress; + payToPartyId = productStore.payToPartyId + paymentAddress = PaymentWorker.getPaymentAddress(delegator, payToPartyId) + if (paymentAddress) context.paymentAddress = paymentAddress } -billingAddress = null; +billingAddress = null if (paymentMethod) { - creditCard = paymentMethod.getRelatedOne("CreditCard", false); - billingAddress = creditCard?.getRelatedOne("PostalAddress", false); + creditCard = paymentMethod.getRelatedOne("CreditCard", false) + billingAddress = creditCard?.getRelatedOne("PostalAddress", false) } -if (billingAddress) context.billingAddress = billingAddress; +if (billingAddress) context.billingAddress = billingAddress -billingAccount = cart.getBillingAccountId() ? from("BillingAccount").where("billingAccountId", cart.getBillingAccountId()).queryOne() : null; -if (billingAccount) context.billingAccount = billingAccount; +billingAccount = cart.getBillingAccountId() ? from("BillingAccount").where("billingAccountId", cart.getBillingAccountId()).queryOne() : null +if (billingAccount) context.billingAccount = billingAccount -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 = from("ShipmentMethodType").where("shipmentMethodTypeId", cart.getShipmentMethodTypeId()).queryOne(); -if (shipmentMethodType) context.shipMethDescription = shipmentMethodType.description; - -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.orderShippingTotal = shippingAmount; - -taxAmount = OrderReadHelper.getOrderTaxByTaxAuthGeoAndParty(orderAdjustments).taxGrandTotal; -context.orderTaxTotal = taxAmount; -context.orderGrandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments); +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 = from("ShipmentMethodType").where("shipmentMethodTypeId", cart.getShipmentMethodTypeId()).queryOne() +if (shipmentMethodType) context.shipMethDescription = shipmentMethodType.description + +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.orderShippingTotal = shippingAmount + +taxAmount = OrderReadHelper.getOrderTaxByTaxAuthGeoAndParty(orderAdjustments).taxGrandTotal +context.orderTaxTotal = taxAmount +context.orderGrandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, orderAdjustments) -orderName = cart.getOrderName(); -context.orderName = orderName; +orderName = cart.getOrderName() +context.orderName = orderName -orderPartyId = cart.getPartyId(); +orderPartyId = cart.getPartyId() if (orderPartyId) { - partyMap = PartyWorker.getPartyOtherValues(request, orderPartyId, "orderParty", "orderPerson", "orderPartyGroup"); + partyMap = PartyWorker.getPartyOtherValues(request, orderPartyId, "orderParty", "orderPerson", "orderPartyGroup") if (partyMap) { partyMap.each { key, value -> - context[key] = value; + context[key] = value } } } -orderTerms = cart.getOrderTerms(); +orderTerms = cart.getOrderTerms() if (orderTerms) { - context.orderTerms = orderTerms; + context.orderTerms = orderTerms } -orderType = cart.getOrderType(); -context.orderType = orderType; +orderType = cart.getOrderType() +context.orderType = orderType Modified: ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutShippingAddress.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutShippingAddress.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutShippingAddress.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutShippingAddress.groovy Wed Nov 2 19:09:13 2016 @@ -17,36 +17,36 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.party.contact.*; -import org.apache.ofbiz.product.store.*; -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityExpr; -import org.apache.ofbiz.entity.condition.EntityOperator; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.party.contact.* +import org.apache.ofbiz.product.store.* +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityExpr +import org.apache.ofbiz.entity.condition.EntityOperator -cart = session.getAttribute("shoppingCart"); -party = userLogin.getRelatedOne("Party", false); -partyId = party.partyId; -productStoreId = ProductStoreWorker.getProductStoreId(request); +cart = session.getAttribute("shoppingCart") +party = userLogin.getRelatedOne("Party", false) +partyId = party.partyId +productStoreId = ProductStoreWorker.getProductStoreId(request) -productStoreId = cart.getProductStoreId(); +productStoreId = cart.getProductStoreId() if (productStoreId) { - productStore = ProductStoreWorker.getProductStore(productStoreId, delegator); - payToPartyId = productStore.payToPartyId; + productStore = ProductStoreWorker.getProductStore(productStoreId, delegator) + payToPartyId = productStore.payToPartyId } -shippingContactMechId = request.getParameter("shipping_contact_mech_id"); +shippingContactMechId = request.getParameter("shipping_contact_mech_id") for (shipGroupIndex = 0; shipGroupIndex < cart.getShipGroupSize(); shipGroupIndex++) { - supplierPartyId = cart.getSupplierPartyId(shipGroupIndex); - context[shipGroupIndex + "_supplierPartyId"] = supplierPartyId; + supplierPartyId = cart.getSupplierPartyId(shipGroupIndex) + context[shipGroupIndex + "_supplierPartyId"] = supplierPartyId } -agreements = from("Agreement").where("partyIdTo", payToPartyId, "partyIdFrom", partyId).filterByDate().cache(true).queryList(); -context.agreements = agreements; +agreements = from("Agreement").where("partyIdTo", payToPartyId, "partyIdFrom", partyId).filterByDate().cache(true).queryList() +context.agreements = agreements -context.shoppingCart = cart; -context.userLogin = userLogin; -context.productStoreId = productStoreId; -context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); +context.shoppingCart = cart +context.userLogin = userLogin +context.productStoreId = productStoreId +context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false) Modified: ofbiz/trunk/applications/order/groovyScripts/entry/OptionSettings.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/OptionSettings.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/OptionSettings.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/OptionSettings.groovy Wed Nov 2 19:09:13 2016 @@ -17,54 +17,54 @@ * under the License. */ -import java.sql.Timestamp; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.order.shoppingcart.*; -import org.apache.ofbiz.party.contact.*; -import org.apache.ofbiz.product.store.*; +import java.sql.Timestamp +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.order.shoppingcart.* +import org.apache.ofbiz.party.contact.* +import org.apache.ofbiz.product.store.* -cart = session.getAttribute("shoppingCart"); -context.cart = cart; +cart = session.getAttribute("shoppingCart") +context.cart = cart -productStore = ProductStoreWorker.getProductStore(request); +productStore = ProductStoreWorker.getProductStore(request) if (productStore) { - context.productStore = productStore; - context.carrierShipmentMethodList = from("ProductStoreShipmentMethView").where("productStoreId", productStore.productStoreId).orderBy("sequenceNumber").cache(true).queryList(); + context.productStore = productStore + context.carrierShipmentMethodList = from("ProductStoreShipmentMethView").where("productStoreId", productStore.productStoreId).orderBy("sequenceNumber").cache(true).queryList() } // nuke the event messages -request.removeAttribute("_EVENT_MESSAGE_"); +request.removeAttribute("_EVENT_MESSAGE_") -party = null; -orderPartyIdId = cart.getPartyId(); +party = null +orderPartyIdId = cart.getPartyId() if (orderPartyIdId) { - orderPartyId = from("Party").where("partyId", orderPartyIdId).queryOne(); - context.orderPartyId = orderPartyId; + orderPartyId = from("Party").where("partyId", orderPartyIdId).queryOne() + context.orderPartyId = orderPartyId } -context.emailList = ContactHelper.getContactMechByType(orderPartyId, "EMAIL_ADDRESS", false); +context.emailList = ContactHelper.getContactMechByType(orderPartyId, "EMAIL_ADDRESS", false) // create the beforeDate for calendar -fromCal = Calendar.getInstance(); -fromCal.setTime(new java.util.Date()); -fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY)); -fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE)); -fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND)); -fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND)); -fromTs = new Timestamp(fromCal.getTimeInMillis()); -fromStr = fromTs.toString(); -fromStr = fromStr.substring(0, fromStr.indexOf('.')); -context.beforeDateStr = fromStr; +fromCal = Calendar.getInstance() +fromCal.setTime(new java.util.Date()) +fromCal.set(Calendar.HOUR_OF_DAY, fromCal.getActualMinimum(Calendar.HOUR_OF_DAY)) +fromCal.set(Calendar.MINUTE, fromCal.getActualMinimum(Calendar.MINUTE)) +fromCal.set(Calendar.SECOND, fromCal.getActualMinimum(Calendar.SECOND)) +fromCal.set(Calendar.MILLISECOND, fromCal.getActualMinimum(Calendar.MILLISECOND)) +fromTs = new Timestamp(fromCal.getTimeInMillis()) +fromStr = fromTs.toString() +fromStr = fromStr.substring(0, fromStr.indexOf('.')) +context.beforeDateStr = fromStr // create the afterDate for calendar -toCal = Calendar.getInstance(); -toCal.setTime(new java.util.Date()); -toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY)); -toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE)); -toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND)); -toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND)); -toTs = new Timestamp(toCal.getTimeInMillis()); -toStr = toTs.toString(); -context.afterDateStr = toStr; +toCal = Calendar.getInstance() +toCal.setTime(new java.util.Date()) +toCal.set(Calendar.HOUR_OF_DAY, toCal.getActualMaximum(Calendar.HOUR_OF_DAY)) +toCal.set(Calendar.MINUTE, toCal.getActualMaximum(Calendar.MINUTE)) +toCal.set(Calendar.SECOND, toCal.getActualMaximum(Calendar.SECOND)) +toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND)) +toTs = new Timestamp(toCal.getTimeInMillis()) +toStr = toTs.toString() +context.afterDateStr = toStr Modified: ofbiz/trunk/applications/order/groovyScripts/entry/OrderAgreements.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/OrderAgreements.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/OrderAgreements.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/OrderAgreements.groovy Wed Nov 2 19:09:13 2016 @@ -17,79 +17,79 @@ * under the License. */ -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.order.shoppingcart.*; -import org.apache.ofbiz.product.catalog.CatalogWorker; +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.order.shoppingcart.* +import org.apache.ofbiz.product.catalog.CatalogWorker -shoppingCart = ShoppingCartEvents.getCartObject(request); -context.cart = shoppingCart; +shoppingCart = ShoppingCartEvents.getCartObject(request) +context.cart = shoppingCart // get applicable agreements for order entry if ('PURCHASE_ORDER'.equals(shoppingCart.getOrderType())) { // for a purchase order, orderPartyId = billFromVendor (the supplier) - supplierPartyId = shoppingCart.getOrderPartyId(); - customerPartyId = shoppingCart.getBillToCustomerPartyId(); + supplierPartyId = shoppingCart.getOrderPartyId() + customerPartyId = shoppingCart.getBillToCustomerPartyId() // the agreement for a purchse order is from us to the supplier agreementCondition = EntityCondition.makeCondition([ EntityCondition.makeCondition('partyIdTo', EntityOperator.EQUALS, supplierPartyId), EntityCondition.makeCondition('partyIdFrom', EntityOperator.EQUALS, customerPartyId) - ], EntityOperator.AND); + ], EntityOperator.AND) agreementRoleCondition = EntityCondition.makeCondition([ EntityCondition.makeCondition('partyId', EntityOperator.EQUALS, supplierPartyId), EntityCondition.makeCondition('roleTypeId', EntityOperator.EQUALS, 'SUPPLIER') - ], EntityOperator.AND); + ], EntityOperator.AND) } else { // for a sales order, orderPartyId = billToCustomer (the customer) - customerPartyId = shoppingCart.getOrderPartyId(); - companyPartyId = shoppingCart.getBillFromVendorPartyId(); + customerPartyId = shoppingCart.getOrderPartyId() + companyPartyId = shoppingCart.getBillFromVendorPartyId() // the agreement for a sales order is from the customer to us agreementCondition = EntityCondition.makeCondition([ EntityCondition.makeCondition('partyIdTo', EntityOperator.EQUALS, companyPartyId), EntityCondition.makeCondition('partyIdFrom', EntityOperator.EQUALS, customerPartyId) - ], EntityOperator.AND); + ], EntityOperator.AND) agreementRoleCondition = EntityCondition.makeCondition([ EntityCondition.makeCondition('partyId', EntityOperator.EQUALS, customerPartyId), EntityCondition.makeCondition('roleTypeId', EntityOperator.EQUALS, 'CUSTOMER') - ], EntityOperator.AND); + ], EntityOperator.AND) } -agreements = from("Agreement").where(agreementCondition).filterByDate().cache(true).queryList(); +agreements = from("Agreement").where(agreementCondition).filterByDate().cache(true).queryList() if (agreements) { - context.agreements = agreements; + context.agreements = agreements } -agreementRoles = from("AgreementRole").where(agreementRoleCondition).cache(true).queryList(); +agreementRoles = from("AgreementRole").where(agreementRoleCondition).cache(true).queryList() if (agreementRoles) { - context.agreementRoles = agreementRoles; + context.agreementRoles = agreementRoles } // catalog id collection, current catalog id and name -productStoreId = shoppingCart.getProductStoreId(); +productStoreId = shoppingCart.getProductStoreId() if ('SALES_ORDER' == shoppingCart.getOrderType() && productStoreId) { - catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStoreId, shoppingCart.getOrderPartyId()); + catalogCol = CatalogWorker.getCatalogIdsAvailable(delegator, productStoreId, shoppingCart.getOrderPartyId()) } else { - catalogCol = CatalogWorker.getAllCatalogIds(request); + catalogCol = CatalogWorker.getAllCatalogIds(request) } if (catalogCol) { - context.catalogCol = catalogCol; + context.catalogCol = catalogCol - currentCatalogId = catalogCol.get(0); - context.currentCatalogId = currentCatalogId; - context.currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId); + currentCatalogId = catalogCol.get(0) + context.currentCatalogId = currentCatalogId + context.currentCatalogName = CatalogWorker.getCatalogName(request, currentCatalogId) } // currencies and shopping cart currency -context.currencies = from("Uom").where("uomTypeId", "CURRENCY_MEASURE").cache(true).queryList(); -context.currencyUomId = shoppingCart.getCurrency(); +context.currencies = from("Uom").where("uomTypeId", "CURRENCY_MEASURE").cache(true).queryList() +context.currencyUomId = shoppingCart.getCurrency() Modified: ofbiz/trunk/applications/order/groovyScripts/entry/OrderTerms.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/OrderTerms.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/OrderTerms.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/OrderTerms.groovy Wed Nov 2 19:09:13 2016 @@ -17,37 +17,37 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.order.shoppingcart.*; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.order.shoppingcart.* -cart = ShoppingCartEvents.getCartObject(request); -context.cart = cart; +cart = ShoppingCartEvents.getCartObject(request) +context.cart = cart -orderTerms = cart.getOrderTerms(); -context.orderTerms = orderTerms; +orderTerms = cart.getOrderTerms() +context.orderTerms = orderTerms if (request.getParameter('createNew') == 'Y') { - termIndexStr = request.getParameter('termIndex'); + termIndexStr = request.getParameter('termIndex') if (termIndexStr) { try { - termIndex = Integer.parseInt(termIndexStr); + termIndex = Integer.parseInt(termIndexStr) - orderTerm = orderTerms[termIndex]; + orderTerm = orderTerms[termIndex] if (orderTerm) { - context.termTypeId = orderTerm.termTypeId; - context.termValue = orderTerm.termValue; - context.termDays = orderTerm.termDays; - context.textValue = orderTerm.textValue; - context.description = orderTerm.description; + context.termTypeId = orderTerm.termTypeId + context.termValue = orderTerm.termValue + context.termDays = orderTerm.termDays + context.textValue = orderTerm.textValue + context.description = orderTerm.description - context.termIndex = termIndexStr; + context.termIndex = termIndexStr } } catch (NumberFormatException nfe) { - Debug.log("Error parsing termIndex: ${termIndexStr}"); + Debug.log("Error parsing termIndex: ${termIndexStr}") } } Modified: ofbiz/trunk/applications/order/groovyScripts/entry/SetAdditionalParty.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/SetAdditionalParty.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/SetAdditionalParty.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/SetAdditionalParty.groovy Wed Nov 2 19:09:13 2016 @@ -17,25 +17,25 @@ * under the License. */ -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.order.shoppingcart.*; +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.order.shoppingcart.* -shoppingCart = ShoppingCartEvents.getCartObject(request); -orderType = shoppingCart.getOrderType(); -context.orderType = orderType; +shoppingCart = ShoppingCartEvents.getCartObject(request) +orderType = shoppingCart.getOrderType() +context.orderType = orderType if (!request.getParameterValues("additionalRoleTypeId")) { - partyType = request.getParameter("additionalPartyType"); - context.additionalPartyType = partyType; + partyType = request.getParameter("additionalPartyType") + context.additionalPartyType = partyType - additionalPartyId = request.getParameter("additionalPartyId"); - context.additionalPartyId = additionalPartyId; + additionalPartyId = request.getParameter("additionalPartyId") + context.additionalPartyId = additionalPartyId - roles = from("PartyRole").where("partyId", additionalPartyId).queryList(); - roleData = []; + roles = from("PartyRole").where("partyId", additionalPartyId).queryList() + roleData = [] roles.each { role -> - roleData.add(role.getRelatedOne("RoleType", false)); + roleData.add(role.getRelatedOne("RoleType", false)) } - context.roles = roleData; + context.roles = roleData } Modified: ofbiz/trunk/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy Wed Nov 2 19:09:13 2016 @@ -17,13 +17,13 @@ * under the License. */ -import java.util.ArrayList; -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents; +import java.util.ArrayList +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents -checkoutSteps = []; +checkoutSteps = [] -shoppingCart = ShoppingCartEvents.getCartObject(request); +shoppingCart = ShoppingCartEvents.getCartObject(request) // ---------------------------------- // The ordered list of steps is prepared here @@ -47,19 +47,19 @@ checkoutSteps.add([label : "OrderReviewO // --------------------------------------- -isLastStep = "N"; -enabled = "Y"; +isLastStep = "N" +enabled = "Y" checkoutSteps.eachWithIndex { checkoutStep, i -> - checkoutStep.put("enabled", enabled); + checkoutStep.put("enabled", enabled) if (enabled.equals("Y")) { if (i == (checkoutSteps.size() - 1)) { - isLastStep = "Y"; + isLastStep = "Y" } if (stepLabelId.equals(checkoutStep.label)) { - enabled = "N"; + enabled = "N" } } } -context.isLastStep = isLastStep; -context.checkoutSteps = checkoutSteps; +context.isLastStep = isLastStep +context.checkoutSteps = checkoutSteps Modified: ofbiz/trunk/applications/order/groovyScripts/entry/SetShoppingCart.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/SetShoppingCart.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/SetShoppingCart.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/SetShoppingCart.groovy Wed Nov 2 19:09:13 2016 @@ -17,11 +17,11 @@ * under the License. */ -import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents; +import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents // Get the Cart and put it in the context. -shoppingCart = ShoppingCartEvents.getCartObject(request); -context.shoppingCart = shoppingCart; -context.currencyUomId = shoppingCart.getCurrency(); -context.partyId = shoppingCart.getPartyId(); +shoppingCart = ShoppingCartEvents.getCartObject(request) +context.shoppingCart = shoppingCart +context.currencyUomId = shoppingCart.getCurrency() +context.partyId = shoppingCart.getPartyId() Modified: ofbiz/trunk/applications/order/groovyScripts/entry/ShipSettings.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/ShipSettings.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/ShipSettings.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/ShipSettings.groovy Wed Nov 2 19:09:13 2016 @@ -17,101 +17,101 @@ * under the License. */ -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.order.shoppingcart.*; -import org.apache.ofbiz.party.contact.*; -import org.apache.ofbiz.product.catalog.*; -import org.apache.ofbiz.base.util.UtilValidate; -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.util.EntityUtil; +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.order.shoppingcart.* +import org.apache.ofbiz.party.contact.* +import org.apache.ofbiz.product.catalog.* +import org.apache.ofbiz.base.util.UtilValidate +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.util.EntityUtil -cart = session.getAttribute("shoppingCart"); +cart = session.getAttribute("shoppingCart") if (cart) { -createNewShipGroup = request.getParameter("createNewShipGroup"); +createNewShipGroup = request.getParameter("createNewShipGroup") if ("Y".equals(createNewShipGroup)) { - cart.addShipInfo(); + cart.addShipInfo() } -orderPartyId = cart.getPartyId(); -shipToPartyId = parameters.shipToPartyId; -context.cart = cart; +orderPartyId = cart.getPartyId() +shipToPartyId = parameters.shipToPartyId +context.cart = cart if(shipToPartyId) { - context.shipToPartyId = shipToPartyId; + context.shipToPartyId = shipToPartyId } else { - context.shipToPartyId = cart.getShipToCustomerPartyId(); + context.shipToPartyId = cart.getShipToCustomerPartyId() } // nuke the event messages -request.removeAttribute("_EVENT_MESSAGE_"); +request.removeAttribute("_EVENT_MESSAGE_") if ("SALES_ORDER".equals(cart.getOrderType())) { if (!"_NA_".equals(orderPartyId)) { - orderParty = from("Party").where("partyId", orderPartyId).queryOne(); + orderParty = from("Party").where("partyId", orderPartyId).queryOne() if (orderParty) { - shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); - orderPerson = orderParty.getRelatedOne("Person", false); - context.orderParty = orderParty; - context.orderPerson = orderPerson; - context.shippingContactMechList = shippingContactMechList; + shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false) + orderPerson = orderParty.getRelatedOne("Person", false) + context.orderParty = orderParty + context.orderPerson = orderPerson + context.shippingContactMechList = shippingContactMechList } } // Ship to another party if (!context.shipToPartyId.equals(orderPartyId)) { - shipToParty = from("Party").where("partyId", context.shipToPartyId).queryOne(); + shipToParty = from("Party").where("partyId", context.shipToPartyId).queryOne() if (shipToParty) { - shipToPartyShippingContactMechList = ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); - context.shipToPartyShippingContactMechList = shipToPartyShippingContactMechList; + shipToPartyShippingContactMechList = ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false) + context.shipToPartyShippingContactMechList = shipToPartyShippingContactMechList } } // suppliers for the drop-ship select box - suppliers = from("PartyRole").where("roleTypeId", "SUPPLIER").queryList(); - context.suppliers = suppliers; + suppliers = from("PartyRole").where("roleTypeId", "SUPPLIER").queryList() + context.suppliers = suppliers // facilities used to reserve the items per ship group - productStoreFacilities = from("ProductStoreFacility").where("productStoreId", cart.getProductStoreId()).queryList(); - context.productStoreFacilities = productStoreFacilities; + productStoreFacilities = from("ProductStoreFacility").where("productStoreId", cart.getProductStoreId()).queryList() + context.productStoreFacilities = productStoreFacilities } else { // Purchase order if (!"_NA_".equals(orderPartyId)) { - orderParty = from("Party").where("partyId", orderPartyId).queryOne(); + orderParty = from("Party").where("partyId", orderPartyId).queryOne() if (orderParty) { - orderPerson = orderParty.getRelatedOne("Person", false); - context.orderParty = orderParty; - context.orderPerson = orderPerson; + orderPerson = orderParty.getRelatedOne("Person", false) + context.orderParty = orderParty + context.orderPerson = orderPerson } } - companyId = cart.getBillToCustomerPartyId(); + companyId = cart.getBillToCustomerPartyId() if (companyId) { - facilityMaps = []; - facilities = from("Facility").where("ownerPartyId", companyId).cache(true).queryList(); + facilityMaps = [] + facilities = from("Facility").where("ownerPartyId", companyId).cache(true).queryList() // if facilites is null then check the PartyRelationship where there is a relationship set for Parent & Child organization. Then also fetch the value of companyId from there. if (UtilValidate.isEmpty(facilities)) { - partyRelationship = from("PartyRelationship").where("roleTypeIdFrom": "PARENT_ORGANIZATION", "partyIdTo": companyId).queryFirst(); + partyRelationship = from("PartyRelationship").where("roleTypeIdFrom": "PARENT_ORGANIZATION", "partyIdTo": companyId).queryFirst() if (UtilValidate.isNotEmpty(partyRelationship)) { - companyId = partyRelationship.partyIdFrom; - facilities = from("Facility").where("ownerPartyId", companyId).cache(true).queryList(); + companyId = partyRelationship.partyIdFrom + facilities = from("Facility").where("ownerPartyId", companyId).cache(true).queryList() } } facilities.each { facility -> - facilityMap = [:]; - facilityContactMechValueMaps = ContactMechWorker.getFacilityContactMechValueMaps(delegator, facility.facilityId, false, null); - facilityMap.facilityContactMechList = facilityContactMechValueMaps; - facilityMap.facility = facility; - facilityMaps.add(facilityMap); + facilityMap = [:] + facilityContactMechValueMaps = ContactMechWorker.getFacilityContactMechValueMaps(delegator, facility.facilityId, false, null) + facilityMap.facilityContactMechList = facilityContactMechValueMaps + facilityMap.facility = facility + facilityMaps.add(facilityMap) } - context.facilityMaps = facilityMaps; + context.facilityMaps = facilityMaps } // Ship to another party if (!context.shipToPartyId.equals(orderPartyId)) { - shipToParty = from("Party").where("partyId", context.shipToPartyId).queryOne(); + shipToParty = from("Party").where("partyId", context.shipToPartyId).queryOne() if (shipToParty) { - shipToPartyShippingContactMechList = ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); - context.shipToPartyShippingContactMechList = shipToPartyShippingContactMechList; + shipToPartyShippingContactMechList = ContactHelper.getContactMech(shipToParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false) + context.shipToPartyShippingContactMechList = shipToPartyShippingContactMechList } } } Modified: ofbiz/trunk/applications/order/groovyScripts/entry/ShoppingList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/ShoppingList.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/ShoppingList.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/ShoppingList.groovy Wed Nov 2 19:09:13 2016 @@ -17,18 +17,18 @@ * under the License. */ -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.entity.util.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.order.shoppingcart.*; +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.entity.util.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.order.shoppingcart.* -shoppingCart = session.getAttribute("shoppingCart"); -partyId = shoppingCart.getPartyId(); +shoppingCart = session.getAttribute("shoppingCart") +partyId = shoppingCart.getPartyId() // Get the party's collection of Shopping Lists -shoppingLists = from("ShoppingList").where("partyId", partyId).cache(true).queryList(); +shoppingLists = from("ShoppingList").where("partyId", partyId).cache(true).queryList() if (shoppingLists) { - context.shoppingLists = shoppingLists; + context.shoppingLists = shoppingLists } Modified: ofbiz/trunk/applications/order/groovyScripts/entry/ShowCart.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/ShowCart.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/ShowCart.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/ShowCart.groovy Wed Nov 2 19:09:13 2016 @@ -17,109 +17,109 @@ * under the License. */ -import org.apache.ofbiz.service.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.order.order.OrderReadHelper; -import org.apache.ofbiz.order.shoppingcart.*; -import org.apache.ofbiz.party.party.PartyWorker; -import org.apache.ofbiz.product.catalog.CatalogWorker; +import org.apache.ofbiz.service.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.order.order.OrderReadHelper +import org.apache.ofbiz.order.shoppingcart.* +import org.apache.ofbiz.party.party.PartyWorker +import org.apache.ofbiz.product.catalog.CatalogWorker -productId = parameters.productId; +productId = parameters.productId if (productId) { - quantityOnHandTotal = parameters.quantityOnHandTotal; + quantityOnHandTotal = parameters.quantityOnHandTotal if (!quantityOnHandTotal) { - quantityOnHandTotal = 0; + quantityOnHandTotal = 0 } - context.quantityOnHandTotal = quantityOnHandTotal; + context.quantityOnHandTotal = quantityOnHandTotal - availableToPromiseTotal = parameters.availableToPromiseTotal; + availableToPromiseTotal = parameters.availableToPromiseTotal if (!availableToPromiseTotal) { - availableToPromiseTotal = 0; + availableToPromiseTotal = 0 } - context.availableToPromiseTotal = availableToPromiseTotal; + context.availableToPromiseTotal = availableToPromiseTotal } -context.productId = productId; +context.productId = productId // Just in case we are here from the choosecatalog form, the // following call will save in the session the new catalogId -CatalogWorker.getCurrentCatalogId(request); +CatalogWorker.getCurrentCatalogId(request) // Get the Cart and Prepare Size -shoppingCart = ShoppingCartEvents.getCartObject(request); -context.shoppingCartSize = shoppingCart.size(); -context.shoppingCart = shoppingCart; -context.currencyUomId = shoppingCart.getCurrency(); -context.orderType = shoppingCart.getOrderType(); - -orderItems = shoppingCart.makeOrderItems(); -orderAdjustments = shoppingCart.makeAllAdjustments(); -orderItemShipGroupInfo = shoppingCart.makeAllShipGroupInfos(); +shoppingCart = ShoppingCartEvents.getCartObject(request) +context.shoppingCartSize = shoppingCart.size() +context.shoppingCart = shoppingCart +context.currencyUomId = shoppingCart.getCurrency() +context.orderType = shoppingCart.getOrderType() + +orderItems = shoppingCart.makeOrderItems() +orderAdjustments = shoppingCart.makeAllAdjustments() +orderItemShipGroupInfo = shoppingCart.makeAllShipGroupInfos() if (orderItemShipGroupInfo) { orderItemShipGroupInfo.each { osiInfo -> if ("OrderAdjustment".equals(osiInfo.getEntityName())) { // shipping / tax adjustment(s) - orderAdjustments.add(osiInfo); + orderAdjustments.add(osiInfo) } } } -orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null); -orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments); -shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true); -shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true)); -context.orderShippingTotal = shippingAmount; -taxAmount = OrderReadHelper.getOrderTaxByTaxAuthGeoAndParty(orderAdjustments).taxGrandTotal; -context.orderTaxTotal = taxAmount; +orderHeaderAdjustments = OrderReadHelper.getOrderHeaderAdjustments(orderAdjustments, null) +orderSubTotal = OrderReadHelper.getOrderItemsSubTotal(orderItems, orderAdjustments) +shippingAmount = OrderReadHelper.getAllOrderItemsAdjustmentsTotal(orderItems, orderAdjustments, false, false, true) +shippingAmount = shippingAmount.add(OrderReadHelper.calcOrderAdjustments(orderHeaderAdjustments, orderSubTotal, false, false, true)) +context.orderShippingTotal = shippingAmount +taxAmount = OrderReadHelper.getOrderTaxByTaxAuthGeoAndParty(orderAdjustments).taxGrandTotal +context.orderTaxTotal = taxAmount // get all the possible gift wrap options -allgiftWraps = from("ProductFeature").where("productFeatureTypeId", "GIFT_WRAP").orderBy("defaultSequenceNum").queryList(); -context.allgiftWraps = allgiftWraps; +allgiftWraps = from("ProductFeature").where("productFeatureTypeId", "GIFT_WRAP").orderBy("defaultSequenceNum").queryList() +context.allgiftWraps = allgiftWraps -context.contentPathPrefix = CatalogWorker.getContentPathPrefix(request); +context.contentPathPrefix = CatalogWorker.getContentPathPrefix(request) // retrieve the product store id from the cart -productStoreId = shoppingCart.getProductStoreId(); -context.productStoreId = productStoreId; +productStoreId = shoppingCart.getProductStoreId() +context.productStoreId = productStoreId -partyId = shoppingCart.getPartyId(); -if ("_NA_".equals(partyId)) partyId = null; -context.partyId = partyId; +partyId = shoppingCart.getPartyId() +if ("_NA_".equals(partyId)) partyId = null +context.partyId = partyId -defaultDesiredDeliveryDate = shoppingCart.getDefaultItemDeliveryDate(); +defaultDesiredDeliveryDate = shoppingCart.getDefaultItemDeliveryDate() if (!defaultDesiredDeliveryDate) { - defaultDesiredDeliveryDate = (new java.sql.Date(System.currentTimeMillis())).toString(); + defaultDesiredDeliveryDate = (new java.sql.Date(System.currentTimeMillis())).toString() } else { - context.useAsDefaultDesiredDeliveryDate = "true"; + context.useAsDefaultDesiredDeliveryDate = "true" } -context.defaultDesiredDeliveryDate = defaultDesiredDeliveryDate; +context.defaultDesiredDeliveryDate = defaultDesiredDeliveryDate -defaultComment = shoppingCart.getDefaultItemComment(); +defaultComment = shoppingCart.getDefaultItemComment() if (defaultComment) { - context.useAsDefaultComment = "true"; + context.useAsDefaultComment = "true" } -context.defaultComment = defaultComment; +context.defaultComment = defaultComment // get all party shopping lists if (partyId) { - shoppingLists = from("ShoppingList").where("partyId", partyId).queryList(); - context.shoppingLists = shoppingLists; + shoppingLists = from("ShoppingList").where("partyId", partyId).queryList() + context.shoppingLists = shoppingLists } // get product inventory summary for each shopping cart item -productStore = from("ProductStore").where("productStoreId", productStoreId).cache(true).queryOne(); +productStore = from("ProductStore").where("productStoreId", productStoreId).cache(true).queryOne() context.productStore = productStore -productStoreFacilityId = null; +productStoreFacilityId = null if (productStore) { - productStoreFacilityId = productStore.inventoryFacilityId; + productStoreFacilityId = productStore.inventoryFacilityId } -context.facilityId = productStoreFacilityId; -inventorySummary = runService('getProductInventorySummaryForItems', [orderItems : shoppingCart.makeOrderItems(), facilityId : productStoreFacilityId]); -context.availableToPromiseMap = inventorySummary.availableToPromiseMap; -context.quantityOnHandMap = inventorySummary.quantityOnHandMap; -context.mktgPkgATPMap = inventorySummary.mktgPkgATPMap; -context.mktgPkgQOHMap = inventorySummary.mktgPkgQOHMap; +context.facilityId = productStoreFacilityId +inventorySummary = runService('getProductInventorySummaryForItems', [orderItems : shoppingCart.makeOrderItems(), facilityId : productStoreFacilityId]) +context.availableToPromiseMap = inventorySummary.availableToPromiseMap +context.quantityOnHandMap = inventorySummary.quantityOnHandMap +context.mktgPkgATPMap = inventorySummary.mktgPkgATPMap +context.mktgPkgQOHMap = inventorySummary.mktgPkgQOHMap // get purchase order item types -purchaseOrderItemTypeList = from("OrderItemType").where("parentTypeId", "PURCHASE_SPECIFIC").cache(true).queryList(); -context.purchaseOrderItemTypeList = purchaseOrderItemTypeList; +purchaseOrderItemTypeList = from("OrderItemType").where("parentTypeId", "PURCHASE_SPECIFIC").cache(true).queryList() +context.purchaseOrderItemTypeList = purchaseOrderItemTypeList Modified: ofbiz/trunk/applications/order/groovyScripts/entry/ShowPromoText.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/ShowPromoText.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/ShowPromoText.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/ShowPromoText.groovy Wed Nov 2 19:09:13 2016 @@ -17,49 +17,49 @@ * under the License. */ -import org.apache.ofbiz.base.util.UtilMisc; -import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker; -import org.apache.ofbiz.order.shoppingcart.*; +import org.apache.ofbiz.base.util.UtilMisc +import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker +import org.apache.ofbiz.order.shoppingcart.* -shoppingCart = ShoppingCartEvents.getCartObject(request); -mode = shoppingCart.getOrderType(); +shoppingCart = ShoppingCartEvents.getCartObject(request) +mode = shoppingCart.getOrderType() -promoShowLimit = 3; +promoShowLimit = 3 if ("SALES_ORDER".equals(mode)) { //Get Promo Text Data - productPromosAll = ProductPromoWorker.getStoreProductPromos(delegator, dispatcher, request); + productPromosAll = ProductPromoWorker.getStoreProductPromos(delegator, dispatcher, request) //Make sure that at least one promo has non-empty promoText - showPromoText = false; - promoToShow = 0; - productPromosAllShowable = new ArrayList(productPromosAll.size()); + showPromoText = false + promoToShow = 0 + productPromosAllShowable = new ArrayList(productPromosAll.size()) productPromosAll.each { productPromo -> - promoText = productPromo.promoText; + promoText = productPromo.promoText if (promoText && !"N".equals(productPromo.showToCustomer)) { - showPromoText = true; - promoToShow++; - productPromosAllShowable.add(productPromo); + showPromoText = true + promoToShow++ + productPromosAllShowable.add(productPromo) } } // now slim it down to promoShowLimit - productPromosRandomTemp = new ArrayList(productPromosAllShowable); - productPromos = null; + productPromosRandomTemp = new ArrayList(productPromosAllShowable) + productPromos = null if (productPromosRandomTemp.size() > promoShowLimit) { - productPromos = new ArrayList(promoShowLimit); + productPromos = new ArrayList(promoShowLimit) for (i = 0; i < promoShowLimit; i++) { - randomIndex = Math.round(java.lang.Math.random() * (productPromosRandomTemp.size() - 1)) as int; - productPromos.add(productPromosRandomTemp.remove(randomIndex)); + randomIndex = Math.round(java.lang.Math.random() * (productPromosRandomTemp.size() - 1)) as int + productPromos.add(productPromosRandomTemp.remove(randomIndex)) } } else { - productPromos = productPromosRandomTemp; + productPromos = productPromosRandomTemp } - context.promoShowLimit = promoShowLimit; - context.productPromosAllShowable = productPromosAllShowable; - context.productPromos = productPromos; - context.showPromoText = showPromoText; - context.promoToShow = promoToShow; + context.promoShowLimit = promoShowLimit + context.productPromosAllShowable = productPromosAllShowable + context.productPromos = productPromos + context.showPromoText = showPromoText + context.promoToShow = promoToShow } else { - context.showPromoText = false; + context.showPromoText = false } Modified: ofbiz/trunk/applications/order/groovyScripts/entry/SplitShip.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/SplitShip.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/SplitShip.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/SplitShip.groovy Wed Nov 2 19:09:13 2016 @@ -17,17 +17,17 @@ * under the License. */ -import org.apache.ofbiz.party.contact.ContactHelper; -import org.apache.ofbiz.product.store.ProductStoreWorker; +import org.apache.ofbiz.party.contact.ContactHelper +import org.apache.ofbiz.product.store.ProductStoreWorker -shoppingCart = session.getAttribute("shoppingCart"); -partyId = shoppingCart.getPartyId(); -party = from("Party").where("partyId", partyId).cache(true).queryOne(); -productStoreId = ProductStoreWorker.getProductStoreId(request); +shoppingCart = session.getAttribute("shoppingCart") +partyId = shoppingCart.getPartyId() +party = from("Party").where("partyId", partyId).cache(true).queryOne() +productStoreId = ProductStoreWorker.getProductStoreId(request) -context.cart = shoppingCart; -context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); +context.cart = shoppingCart +context.shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false) -profiledefs = from("PartyProfileDefault").where("partyId", partyId, "productStoreId", productStoreId).cache(true).queryOne(); +profiledefs = from("PartyProfileDefault").where("partyId", partyId, "productStoreId", productStoreId).cache(true).queryOne() -context.profileDefs = profiledefs; +context.profileDefs = profiledefs Modified: ofbiz/trunk/applications/order/groovyScripts/entry/StorePaymentOptions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/StorePaymentOptions.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/StorePaymentOptions.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/StorePaymentOptions.groovy Wed Nov 2 19:09:13 2016 @@ -17,17 +17,17 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.product.store.*; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.product.store.* -productStore = ProductStoreWorker.getProductStore(request); +productStore = ProductStoreWorker.getProductStore(request) -productStorePaymentMethodTypeIdMap = new HashMap(); -productStorePaymentSettingList = productStore.getRelated("ProductStorePaymentSetting", null, null, true); -productStorePaymentSettingIter = productStorePaymentSettingList.iterator(); +productStorePaymentMethodTypeIdMap = new HashMap() +productStorePaymentSettingList = productStore.getRelated("ProductStorePaymentSetting", null, null, true) +productStorePaymentSettingIter = productStorePaymentSettingList.iterator() while (productStorePaymentSettingIter.hasNext()) { - productStorePaymentSetting = productStorePaymentSettingIter.next(); - productStorePaymentMethodTypeIdMap.put(productStorePaymentSetting.get("paymentMethodTypeId"), true); + productStorePaymentSetting = productStorePaymentSettingIter.next() + productStorePaymentMethodTypeIdMap.put(productStorePaymentSetting.get("paymentMethodTypeId"), true) } -context.put("productStorePaymentMethodTypeIdMap", productStorePaymentMethodTypeIdMap); +context.put("productStorePaymentMethodTypeIdMap", productStorePaymentMethodTypeIdMap) Modified: ofbiz/trunk/applications/order/groovyScripts/entry/cart/LookupBulkAddProducts.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/cart/LookupBulkAddProducts.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/cart/LookupBulkAddProducts.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/cart/LookupBulkAddProducts.groovy Wed Nov 2 19:09:13 2016 @@ -17,38 +17,38 @@ * under the License. */ -import org.apache.ofbiz.entity.condition.EntityExpr; -import org.apache.ofbiz.entity.condition.EntityFunction; -import org.apache.ofbiz.entity.condition.EntityOperator; -import org.apache.ofbiz.entity.condition.EntityFieldValue; -import org.apache.ofbiz.entity.condition.EntityConditionList; -import org.apache.ofbiz.entity.condition.EntityCondition; - -productId = request.getParameter("productId") ?: ""; - -conditionList = []; -orConditionList = []; -mainConditionList = []; +import org.apache.ofbiz.entity.condition.EntityExpr +import org.apache.ofbiz.entity.condition.EntityFunction +import org.apache.ofbiz.entity.condition.EntityOperator +import org.apache.ofbiz.entity.condition.EntityFieldValue +import org.apache.ofbiz.entity.condition.EntityConditionList +import org.apache.ofbiz.entity.condition.EntityCondition + +productId = request.getParameter("productId") ?: "" + +conditionList = [] +orConditionList = [] +mainConditionList = [] if (productId) { //make sure the look up is case insensitive conditionList.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("productId")), - EntityOperator.LIKE, productId.toUpperCase() + "%")); + EntityOperator.LIKE, productId.toUpperCase() + "%")) } // do not include configurable products -conditionList.add(EntityCondition.makeCondition("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED")); -conditionList.add(EntityCondition.makeCondition("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED_SERVICE")); +conditionList.add(EntityCondition.makeCondition("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED")) +conditionList.add(EntityCondition.makeCondition("productTypeId", EntityOperator.NOT_EQUAL, "AGGREGATED_SERVICE")) // no virtual products: note that isVirtual could be null, // we consider those products to be non-virtual and hence addable to the order in bulk -orConditionList.add(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, "N")); -orConditionList.add(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, null)); +orConditionList.add(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, "N")) +orConditionList.add(EntityCondition.makeCondition("isVirtual", EntityOperator.EQUALS, null)) -orConditions = EntityCondition.makeCondition(orConditionList, EntityOperator.OR); -conditions = EntityCondition.makeCondition(conditionList, EntityOperator.AND); +orConditions = EntityCondition.makeCondition(orConditionList, EntityOperator.OR) +conditions = EntityCondition.makeCondition(conditionList, EntityOperator.AND) -mainConditionList.add(orConditions); -mainConditionList.add(conditions); +mainConditionList.add(orConditions) +mainConditionList.add(conditions) -context.productList = select("productId", "brandName", "internalName").from("Product").where(mainConditionList).orderBy("productId").queryList(); +context.productList = select("productId", "brandName", "internalName").from("Product").where(mainConditionList).orderBy("productId").queryList() Modified: ofbiz/trunk/applications/order/groovyScripts/entry/cart/LookupBulkAddSupplierProducts.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/cart/LookupBulkAddSupplierProducts.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/cart/LookupBulkAddSupplierProducts.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/cart/LookupBulkAddSupplierProducts.groovy Wed Nov 2 19:09:13 2016 @@ -17,120 +17,120 @@ * under the License. */ -import org.apache.ofbiz.entity.condition.*; -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.order.shoppingcart.ShoppingCart; -import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents; -import org.apache.ofbiz.order.order.OrderReadHelper; +import org.apache.ofbiz.entity.condition.* +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.order.shoppingcart.ShoppingCart +import org.apache.ofbiz.order.shoppingcart.ShoppingCartEvents +import org.apache.ofbiz.order.order.OrderReadHelper // This script can take quite a while to run with a decent amount of data // so we'll take a best effort approach to limit the size of the results -maxRows = null; +maxRows = null // TODO: Find a way to get the pagination parameters for a given form if (!parameters.containsKey("VIEW_INDEX_2")) { // There's only one set of pagination parameters so it must be for us if (parameters.VIEW_SIZE_1) { if (parameters.VIEW_INDEX_1) { - viewSize = Integer.valueOf(parameters.VIEW_SIZE_1); - viewIndex = Integer.valueOf(parameters.VIEW_INDEX_1); - maxRows = viewSize * (viewIndex + 1); + viewSize = Integer.valueOf(parameters.VIEW_SIZE_1) + viewIndex = Integer.valueOf(parameters.VIEW_INDEX_1) + maxRows = viewSize * (viewIndex + 1) } } } if (!maxRows) { - maxRows = 50; + maxRows = 50 } -productId = parameters.productId; -supplier = null; -supplierPartyId = null; +productId = parameters.productId +supplier = null +supplierPartyId = null -orderId = parameters.orderId; +orderId = parameters.orderId if (orderId) { - orderItemShipGroup = from("OrderItemShipGroup").orderBy("orderId").queryFirst(); - orderHeader = from("OrderHeader").where("orderId", orderId).queryOne(); - supplier = from("OrderHeaderAndRoles").where("orderId", orderId, "roleTypeId", "BILL_FROM_VENDOR").queryFirst(); - context.shipGroupSeqId = orderItemShipGroup.shipGroupSeqId ; - context.orderHeader = orderHeader; + orderItemShipGroup = from("OrderItemShipGroup").orderBy("orderId").queryFirst() + orderHeader = from("OrderHeader").where("orderId", orderId).queryOne() + supplier = from("OrderHeaderAndRoles").where("orderId", orderId, "roleTypeId", "BILL_FROM_VENDOR").queryFirst() + context.shipGroupSeqId = orderItemShipGroup.shipGroupSeqId + context.orderHeader = orderHeader } -ShoppingCart shoppingCart = ShoppingCartEvents.getCartObject(request); +ShoppingCart shoppingCart = ShoppingCartEvents.getCartObject(request) -conditionList = []; +conditionList = [] if (productId) { // make sure the look up is case insensitive conditionList.add(EntityCondition.makeCondition(EntityFunction.UPPER(EntityFieldValue.makeFieldValue("productId")), - EntityOperator.LIKE, productId.toUpperCase() + "%")); + EntityOperator.LIKE, productId.toUpperCase() + "%")) } if (!supplier) { - supplierPartyId = shoppingCart.getOrderPartyId(); + supplierPartyId = shoppingCart.getOrderPartyId() } else { - supplierPartyId = supplier.getString("partyId"); + supplierPartyId = supplier.getString("partyId") } -conditionList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, supplierPartyId)); +conditionList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, supplierPartyId)) -conditionList.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, shoppingCart.getCurrency())); -conditionList.add(EntityCondition.makeConditionDate("availableFromDate", "availableThruDate")); +conditionList.add(EntityCondition.makeCondition("currencyUomId", EntityOperator.EQUALS, shoppingCart.getCurrency())) +conditionList.add(EntityCondition.makeConditionDate("availableFromDate", "availableThruDate")) supplierProducts = select("productId", "supplierProductId", "supplierProductName", "lastPrice", "minimumOrderQuantity", "orderQtyIncrements").from("SupplierProduct") .where(conditionList) .orderBy("productId") - .queryList(); + .queryList() -newProductList = []; +newProductList = [] for (supplierProduct in supplierProducts) { - productId = supplierProduct.productId; + productId = supplierProduct.productId - String facilityId = parameters.facilityId; + String facilityId = parameters.facilityId if (facilityId) { - productFacilityList = from("ProductFacility").where("productId", productId, "facilityId", facilityId).cache(true).queryList(); + productFacilityList = from("ProductFacility").where("productId", productId, "facilityId", facilityId).cache(true).queryList() } else { - productFacilityList = from("ProductFacility").where("productId", productId).cache(true).queryList(); + productFacilityList = from("ProductFacility").where("productId", productId).cache(true).queryList() } if (newProductList.size() >= maxRows) { // We've got enough results to display, keep going to get the result size but skip the heavy stuff - newProductList.add(null); + newProductList.add(null) } else { - quantityOnOrder = 0.0; + quantityOnOrder = 0.0 // find approved purchase orders - orderHeaders = from("OrderHeader").where("orderTypeId", "PURCHASE_ORDER", "statusId", "ORDER_APPROVED").orderBy("orderId DESC").queryList(); + orderHeaders = from("OrderHeader").where("orderTypeId", "PURCHASE_ORDER", "statusId", "ORDER_APPROVED").orderBy("orderId DESC").queryList() orderHeaders.each { orderHeader -> - orderReadHelper = new OrderReadHelper(orderHeader); - orderItems = orderReadHelper.getOrderItems(); + orderReadHelper = new OrderReadHelper(orderHeader) + orderItems = orderReadHelper.getOrderItems() orderItems.each { orderItem -> if (productId.equals(orderItem.productId) && "ITEM_APPROVED".equals(orderItem.statusId)) { if (!orderItem.cancelQuantity) { - cancelQuantity = 0.0; + cancelQuantity = 0.0 } - shippedQuantity = orderReadHelper.getItemShippedQuantity(orderItem); - quantityOnOrder += orderItem.quantity - cancelQuantity - shippedQuantity; + shippedQuantity = orderReadHelper.getItemShippedQuantity(orderItem) + quantityOnOrder += orderItem.quantity - cancelQuantity - shippedQuantity } } } - product = from("Product").where("productId", productId).cache(true).queryOne(); + product = from("Product").where("productId", productId).cache(true).queryOne() productFacilityList.each { productFacility -> - result = runService('getInventoryAvailableByFacility', ["productId" : productId, "facilityId" : productFacility.facilityId]); - qohAtp = result.quantityOnHandTotal.toPlainString() + "/" + result.availableToPromiseTotal.toPlainString(); - productInfoMap = [:]; + result = runService('getInventoryAvailableByFacility', ["productId" : productId, "facilityId" : productFacility.facilityId]) + qohAtp = result.quantityOnHandTotal.toPlainString() + "/" + result.availableToPromiseTotal.toPlainString() + productInfoMap = [:] - productInfoMap.internalName = product.internalName; + productInfoMap.internalName = product.internalName - productInfoMap.productId = productId; - productInfoMap.qohAtp = qohAtp; - productInfoMap.quantityOnOrder = quantityOnOrder; + productInfoMap.productId = productId + productInfoMap.qohAtp = qohAtp + productInfoMap.quantityOnOrder = quantityOnOrder - productInfoMap.supplierProductId = supplierProduct.supplierProductId; - productInfoMap.lastPrice = supplierProduct.lastPrice; - productInfoMap.orderQtyIncrements = supplierProduct.orderQtyIncrements; - productInfoMap.minimumOrderQuantity = supplierProduct.minimumOrderQuantity; + productInfoMap.supplierProductId = supplierProduct.supplierProductId + productInfoMap.lastPrice = supplierProduct.lastPrice + productInfoMap.orderQtyIncrements = supplierProduct.orderQtyIncrements + productInfoMap.minimumOrderQuantity = supplierProduct.minimumOrderQuantity - productInfoMap.minimumStock = productFacility.minimumStock; + productInfoMap.minimumStock = productFacility.minimumStock - newProductList.add(productInfoMap); + newProductList.add(productInfoMap) } } } -context.productListSize = newProductList.size(); -context.productList = newProductList; +context.productListSize = newProductList.size() +context.productList = newProductList Modified: ofbiz/trunk/applications/order/groovyScripts/entry/cart/ShowPromotionDetails.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/cart/ShowPromotionDetails.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/cart/ShowPromotionDetails.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/cart/ShowPromotionDetails.groovy Wed Nov 2 19:09:13 2016 @@ -17,66 +17,66 @@ * under the License. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.util.EntityUtil; -import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker; - -productPromoId = request.getParameter("productPromoId"); -if (!productPromoId) productPromoId = parameters.productPromoId; -productPromo = from("ProductPromo").where("productPromoId", productPromoId).queryOne(); - -promoAutoDescription = ProductPromoWorker.makeAutoDescription(productPromo, delegator, locale); - -productPromoCategoryList = from("ProductPromoCategory").where("productPromoId", productPromoId).cache(true).queryList(); -productPromoCategoryIncludeList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_INCLUDE"]); -productPromoCategoryExcludeList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_EXCLUDE"]); -productPromoCategoryAlwaysList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_ALWAYS"]); - -productIdsCond = [] as Set; -productIdsAction = [] as Set; -ProductPromoWorker.makeProductPromoCondActionIdSets(productPromoId, productIdsCond, productIdsAction, delegator, null); - -productIds = new TreeSet(productIdsCond); -productIds.addAll(productIdsAction); - -context.productPromoId = productPromoId; -context.productPromo = productPromo; -context.promoAutoDescription = promoAutoDescription; - -context.productPromoCategoryIncludeList = productPromoCategoryIncludeList; -context.productPromoCategoryExcludeList = productPromoCategoryExcludeList; -context.productPromoCategoryAlwaysList = productPromoCategoryAlwaysList; - -context.productIdsCond = productIdsCond; -context.productIdsAction = productIdsAction; -context.productIds = productIds as List; - -viewIndex = 0; -viewSize = 10; -highIndex = 0; -lowIndex = 0; -listSize = productIds.size(); +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.util.EntityUtil +import org.apache.ofbiz.order.shoppingcart.product.ProductPromoWorker + +productPromoId = request.getParameter("productPromoId") +if (!productPromoId) productPromoId = parameters.productPromoId +productPromo = from("ProductPromo").where("productPromoId", productPromoId).queryOne() + +promoAutoDescription = ProductPromoWorker.makeAutoDescription(productPromo, delegator, locale) + +productPromoCategoryList = from("ProductPromoCategory").where("productPromoId", productPromoId).cache(true).queryList() +productPromoCategoryIncludeList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_INCLUDE"]) +productPromoCategoryExcludeList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_EXCLUDE"]) +productPromoCategoryAlwaysList = EntityUtil.filterByAnd(productPromoCategoryList, [productPromoApplEnumId : "PPPA_ALWAYS"]) + +productIdsCond = [] as Set +productIdsAction = [] as Set +ProductPromoWorker.makeProductPromoCondActionIdSets(productPromoId, productIdsCond, productIdsAction, delegator, null) + +productIds = new TreeSet(productIdsCond) +productIds.addAll(productIdsAction) + +context.productPromoId = productPromoId +context.productPromo = productPromo +context.promoAutoDescription = promoAutoDescription + +context.productPromoCategoryIncludeList = productPromoCategoryIncludeList +context.productPromoCategoryExcludeList = productPromoCategoryExcludeList +context.productPromoCategoryAlwaysList = productPromoCategoryAlwaysList + +context.productIdsCond = productIdsCond +context.productIdsAction = productIdsAction +context.productIds = productIds as List + +viewIndex = 0 +viewSize = 10 +highIndex = 0 +lowIndex = 0 +listSize = productIds.size() try { - viewIndex = Integer.valueOf(request.getParameter("VIEW_INDEX")); + viewIndex = Integer.valueOf(request.getParameter("VIEW_INDEX")) } catch (Exception e) { - viewIndex = 0; + viewIndex = 0 } try { - viewSize = Integer.valueOf(request.getParameter("VIEW_SIZE")); + viewSize = Integer.valueOf(request.getParameter("VIEW_SIZE")) } catch (Exception e) { - viewSize = 10; + viewSize = 10 } -lowIndex = viewIndex * viewSize; -highIndex = (viewIndex + 1) * viewSize; +lowIndex = viewIndex * viewSize +highIndex = (viewIndex + 1) * viewSize if (listSize < highIndex) { - highIndex = listSize; + highIndex = listSize } -context.viewIndex = viewIndex; -context.viewSize = viewSize; -context.listSize = listSize; -context.lowIndex = lowIndex; -context.highIndex = highIndex; +context.viewIndex = viewIndex +context.viewSize = viewSize +context.listSize = listSize +context.lowIndex = lowIndex +context.highIndex = highIndex Modified: ofbiz/trunk/applications/order/groovyScripts/entry/catalog/AdvancedSearchOptions.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/catalog/AdvancedSearchOptions.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/catalog/AdvancedSearchOptions.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/catalog/AdvancedSearchOptions.groovy Wed Nov 2 19:09:13 2016 @@ -22,38 +22,38 @@ * should not contain order component's specific code. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.product.catalog.*; -import org.apache.ofbiz.product.feature.*; -import org.apache.ofbiz.product.product.*; -import org.apache.ofbiz.entity.condition.EntityCondition; -import org.apache.ofbiz.entity.condition.EntityOperator; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.product.catalog.* +import org.apache.ofbiz.product.feature.* +import org.apache.ofbiz.product.product.* +import org.apache.ofbiz.entity.condition.EntityCondition +import org.apache.ofbiz.entity.condition.EntityOperator -searchCategoryId = parameters.SEARCH_CATEGORY_ID; +searchCategoryId = parameters.SEARCH_CATEGORY_ID if (!searchCategoryId) { - currentCatalogId = CatalogWorker.getCurrentCatalogId(request); - searchCategoryId = CatalogWorker.getCatalogSearchCategoryId(request, currentCatalogId); + currentCatalogId = CatalogWorker.getCurrentCatalogId(request) + searchCategoryId = CatalogWorker.getCatalogSearchCategoryId(request, currentCatalogId) } -searchCategory = from("ProductCategory").where("productCategoryId", searchCategoryId).queryOne(); +searchCategory = from("ProductCategory").where("productCategoryId", searchCategoryId).queryOne() -productFeaturesByTypeMap = ParametricSearch.makeCategoryFeatureLists(searchCategoryId, delegator); -productFeatureTypeIdsOrdered = new TreeSet(productFeaturesByTypeMap.keySet()) as List; +productFeaturesByTypeMap = ParametricSearch.makeCategoryFeatureLists(searchCategoryId, delegator) +productFeatureTypeIdsOrdered = new TreeSet(productFeaturesByTypeMap.keySet()) as List if(productFeatureTypeIdsOrdered) { - context.productFeatureTypes = from("ProductFeatureType").where(EntityCondition.makeCondition("productFeatureTypeId", EntityOperator.IN, productFeatureTypeIdsOrdered)).queryList(); + context.productFeatureTypes = from("ProductFeatureType").where(EntityCondition.makeCondition("productFeatureTypeId", EntityOperator.IN, productFeatureTypeIdsOrdered)).queryList() } -searchOperator = parameters.SEARCH_OPERATOR; +searchOperator = parameters.SEARCH_OPERATOR if (!"AND".equals(searchOperator) && !"OR".equals(searchOperator)) { - searchOperator = "OR"; + searchOperator = "OR" } -searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator); -searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request); +searchConstraintStrings = ProductSearchSession.searchGetConstraintStrings(false, session, delegator) +searchSortOrderString = ProductSearchSession.searchGetSortOrderString(false, request) -context.searchCategoryId = searchCategoryId; -context.searchCategory = searchCategory; -context.productFeaturesByTypeMap = productFeaturesByTypeMap; -context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered; -context.searchOperator = searchOperator; -context.searchConstraintStrings = searchConstraintStrings; -context.searchSortOrderString = searchSortOrderString; +context.searchCategoryId = searchCategoryId +context.searchCategory = searchCategory +context.productFeaturesByTypeMap = productFeaturesByTypeMap +context.productFeatureTypeIdsOrdered = productFeatureTypeIdsOrdered +context.searchOperator = searchOperator +context.searchConstraintStrings = searchConstraintStrings +context.searchSortOrderString = searchSortOrderString Modified: ofbiz/trunk/applications/order/groovyScripts/entry/catalog/Category.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/catalog/Category.groovy?rev=1767764&r1=1767763&r2=1767764&view=diff ============================================================================== --- ofbiz/trunk/applications/order/groovyScripts/entry/catalog/Category.groovy (original) +++ ofbiz/trunk/applications/order/groovyScripts/entry/catalog/Category.groovy Wed Nov 2 19:09:13 2016 @@ -22,79 +22,79 @@ * should not contain order component's specific code. */ -import org.apache.ofbiz.base.util.*; -import org.apache.ofbiz.entity.*; -import org.apache.ofbiz.product.catalog.*; -import org.apache.ofbiz.product.category.CategoryWorker; -import org.apache.ofbiz.product.category.CategoryContentWrapper; -import org.apache.ofbiz.product.store.ProductStoreWorker; - -detailScreen = "categorydetail"; -catalogName = CatalogWorker.getCatalogName(request); - -productCategoryId = request.getAttribute("productCategoryId") ?: parameters.category_id; -context.productCategoryId = productCategoryId; - -context.productStore = ProductStoreWorker.getProductStore(request); - -pageTitle = null; -metaDescription = null; -metaKeywords = null; +import org.apache.ofbiz.base.util.* +import org.apache.ofbiz.entity.* +import org.apache.ofbiz.product.catalog.* +import org.apache.ofbiz.product.category.CategoryWorker +import org.apache.ofbiz.product.category.CategoryContentWrapper +import org.apache.ofbiz.product.store.ProductStoreWorker + +detailScreen = "categorydetail" +catalogName = CatalogWorker.getCatalogName(request) + +productCategoryId = request.getAttribute("productCategoryId") ?: parameters.category_id +context.productCategoryId = productCategoryId + +context.productStore = ProductStoreWorker.getProductStore(request) + +pageTitle = null +metaDescription = null +metaKeywords = null -category = from("ProductCategory").where("productCategoryId", productCategoryId).cache(true).queryOne(); +category = from("ProductCategory").where("productCategoryId", productCategoryId).cache(true).queryOne() if (category) { if (category.detailScreen) { - detailScreen = category.detailScreen; + detailScreen = category.detailScreen } - categoryPageTitle = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "PAGE_TITLE").cache(true).queryList(); + categoryPageTitle = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "PAGE_TITLE").cache(true).queryList() if (categoryPageTitle) { - pageTitle = from("ElectronicText").where("dataResourceId", categoryPageTitle.get(0).dataResourceId).cache(true).queryOne(); + pageTitle = from("ElectronicText").where("dataResourceId", categoryPageTitle.get(0).dataResourceId).cache(true).queryOne() } - categoryMetaDescription = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "META_DESCRIPTION").cache(true).queryList(); + categoryMetaDescription = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "META_DESCRIPTION").cache(true).queryList() if (categoryMetaDescription) { - metaDescription = from("ElectronicText").where("dataResourceId", categoryMetaDescription.get(0).dataResourceId).cache(true).queryOne(); + metaDescription = from("ElectronicText").where("dataResourceId", categoryMetaDescription.get(0).dataResourceId).cache(true).queryOne() } - categoryMetaKeywords = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "META_KEYWORD").cache(true).queryList(); + categoryMetaKeywords = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "META_KEYWORD").cache(true).queryList() if (categoryMetaKeywords) { - metaKeywords = from("ElectronicText").where("dataResourceId", categoryMetaKeywords.get(0).dataResourceId).cache(true).queryOne(); + metaKeywords = from("ElectronicText").where("dataResourceId", categoryMetaKeywords.get(0).dataResourceId).cache(true).queryOne() } - categoryContentWrapper = new CategoryContentWrapper(category, request); + categoryContentWrapper = new CategoryContentWrapper(category, request) - categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html"); + categoryDescription = categoryContentWrapper.get("DESCRIPTION", "html") if (pageTitle) { - context.title = pageTitle.textData; + context.title = pageTitle.textData } else { - context.title = categoryContentWrapper.get("CATEGORY_NAME", "html"); + context.title = categoryContentWrapper.get("CATEGORY_NAME", "html") } if (metaDescription) { - context.metaDescription = metaDescription.textData; + context.metaDescription = metaDescription.textData } else { if (categoryDescription) { - context.metaDescription = categoryDescription; + context.metaDescription = categoryDescription } } if (metaKeywords) { - context.metaKeywords = metaKeywords.textData; + context.metaKeywords = metaKeywords.textData } else { if (categoryDescription) { - context.metaKeywords = categoryDescription + ", " + catalogName; + context.metaKeywords = categoryDescription + ", " + catalogName } else { - context.metaKeywords = catalogName; + context.metaKeywords = catalogName } } - context.productCategory = category; + context.productCategory = category } // check the catalogs template path and update -templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request); +templatePathPrefix = CatalogWorker.getTemplatePathPrefix(request) if (templatePathPrefix) { - detailScreen = templatePathPrefix + detailScreen; + detailScreen = templatePathPrefix + detailScreen } -context.detailScreen = detailScreen; +context.detailScreen = detailScreen -request.setAttribute("productCategoryId", productCategoryId); -request.setAttribute("defaultViewSize", 10); -request.setAttribute("limitView", true); +request.setAttribute("productCategoryId", productCategoryId) +request.setAttribute("defaultViewSize", 10) +request.setAttribute("limitView", true) |
Free forum by Nabble | Edit this page |