Author: lektran
Date: Mon Jul 14 02:11:46 2008 New Revision: 676519 URL: http://svn.apache.org/viewvc?rev=676519&view=rev Log: A few more bsh -> groovy conversions (and they're tested I promise!) Added: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy - copied, changed from r676251, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/companyHeader.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FilterOrderList.groovy - copied, changed from r676251, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/filterorderlist.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy - copied, changed from r676251, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/findOrders.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/NewNote.groovy - copied, changed from r676251, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/newnote.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy - copied, changed from r676251, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy - copied, changed from r676251, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderlist.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy - copied, changed from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh Removed: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/companyHeader.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/filterorderlist.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/findOrders.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/newnote.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderlist.bsh ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintScreens.xml ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy (from r676251, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/companyHeader.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/companyHeader.bsh&r1=676251&r2=676519&rev=676519&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/companyHeader.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy Mon Jul 14 02:11:46 2008 @@ -28,35 +28,34 @@ import org.ofbiz.order.order.OrderReadHelper; import java.sql.Timestamp; -orderHeader = (GenericValue) parameters.get("orderHeader"); -orderId = parameters.get("orderId"); -invoice = (GenericValue) parameters.get("invoice"); -invoiceId = parameters.get("invoiceId"); -shipmentId = parameters.get("shipmentId"); -returnHeader = (GenericValue) parameters.get("returnHeader"); -returnId = parameters.get("returnId"); +orderHeader = parameters.orderHeader; +orderId = parameters.orderId; +invoice = parameters.invoice; +invoiceId = parameters.invoiceId; +shipmentId = parameters.shipmentId; +returnHeader = parameters.returnHeader; +returnId = parameters.returnId; quote = null; -quoteId = parameters.get("quoteId"); -nowTimestamp = UtilDateTime.nowTimestamp(); -fromPartyId = parameters.get("fromPartyId"); - -if (orderHeader == null && orderId != null) { - orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); -} else if (shipmentId != null) { - shipment = delegator.findByPrimaryKey("Shipment", UtilMisc.toMap("shipmentId", shipmentId)); +quoteId = parameters.quoteId; +fromPartyId = parameters.fromPartyId; + +if (!orderHeader && orderId) { + orderHeader = delegator.findByPrimaryKey("OrderHeader", [orderId : orderId]); +} else if (shipmentId) { + shipment = delegator.findByPrimaryKey("Shipment", [shipmentId : shipmentId]); orderHeader = shipment.getRelatedOne("PrimaryOrderHeader"); } -if (invoice == null && invoiceId != null) { - invoice = delegator.findByPrimaryKey("Invoice", UtilMisc.toMap("invoiceId", invoiceId)); +if (!invoice && invoiceId) { + invoice = delegator.findByPrimaryKey("Invoice", [invoiceId : invoiceId]); } -if (returnHeader == null && returnId != null) { - returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId)); +if (!returnHeader && returnId) { + returnHeader = delegator.findByPrimaryKey("ReturnHeader", [returnId : returnId]); } -if (quoteId != null) { - quote = delegator.findByPrimaryKey("Quote", UtilMisc.toMap("quoteId", quoteId)); +if (quoteId) { + quote = delegator.findByPrimaryKey("Quote", [quoteId : quoteId]); } // defaults: @@ -64,51 +63,47 @@ partyId = null; // get the logo partyId from order or invoice - note that it is better to do comparisons this way in case the there are null values -if (orderHeader != null) { +if (orderHeader) { orh = new OrderReadHelper(orderHeader); // for sales order, the logo party is the "BILL_FROM_VENDOR" of the order. If that's not available, we'll use the OrderHeader's ProductStore's payToPartyId - if ("SALES_ORDER".equals(orderHeader.getString("orderTypeId"))) { - if (orh.getBillToParty() != null) { - partyId = orh.getBillFromParty().getString("partyId"); + if ("SALES_ORDER".equals(orderHeader.orderTypeId)) { + if (orh.getBillToParty()) { + partyId = orh.getBillFromParty().partyId; } else { productStore = orderHeader.getRelatedOne("ProductStore"); - if (orderHeader.getString("orderTypeId").equals("SALES_ORDER") && productStore != null && productStore.get("payToPartyId") != null) { - partyId = productStore.getString("payToPartyId"); - } + if (orderHeader.orderTypeId.equals("SALES_ORDER") && productStore?.payToPartyId) { + partyId = productStore.payToPartyId; + } } // purchase orders - use the BILL_TO_CUSTOMER of the order - } else if ("PURCHASE_ORDER".equals(orderHeader.getString("orderTypeId"))) { - partyId = orh.getBillToParty().getString("partyId"); - GenericValue billToCustomer = EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderRole", UtilMisc.toMap("roleTypeId", "BILL_TO_CUSTOMER"))); - if (billToCustomer != null) { - partyId = billToCustomer.getString("partyId"); + } else if ("PURCHASE_ORDER".equals(orderHeader.orderTypeId)) { + partyId = orh.getBillToParty().partyId; + billToCustomer = EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderRole", [roleTypeId : "BILL_TO_CUSTOMER"])); + if (billToCustomer) { + partyId = billToCustomer.partyId; } } -} else if (invoice != null) { - if (("SALES_INVOICE".equals(invoice.getString("invoiceTypeId"))) && - (invoice.get("partyIdFrom") != null)) { - partyId = invoice.getString("partyIdFrom"); - } - if (("PURCHASE_INVOICE".equals(invoice.getString("invoiceTypeId"))) || - ("CUST_RTN_INVOICE".equals(invoice.getString("invoiceTypeId"))) && - (invoice.get("partyId") != null)) { - partyId = invoice.getString("partyId"); - } -} else if (returnHeader != null) { - if (("CUSTOMER_RETURN".equals(returnHeader.getString("returnHeaderTypeId"))) && - (returnHeader.get("toPartyId") != null)) { - partyId = returnHeader.getString("toPartyId"); +} else if (invoice) { + if ("SALES_INVOICE".equals(invoice.invoiceTypeId) && invoice.partyIdFrom) { + partyId = invoice.partyIdFrom; + } + if ("PURCHASE_INVOICE".equals(invoice.invoiceTypeId) || "CUST_RTN_INVOICE".equals(invoice.invoiceTypeId) && invoice.partyId) { + partyId = invoice.partyId; + } +} else if (returnHeader) { + if ("CUSTOMER_RETURN".equals(returnHeader.returnHeaderTypeId) && returnHeader.toPartyId) { + partyId = returnHeader.toPartyId; } -} else if (quote != null) { +} else if (quote) { productStore = quote.getRelatedOne("ProductStore"); - if (productStore != null && productStore.get("payToPartyId") != null) { - partyId = productStore.getString("payToPartyId"); + if (productStore?.payToPartyId) { + partyId = productStore.payToPartyId; } } // if partyId wasn't found use fromPartyId-parameter -if (partyId == null) { - if (fromPartyId != null) { +if (!partyId) { + if (fromPartyId) { partyId = fromPartyId; } else { partyId = "Company"; @@ -116,65 +111,60 @@ } // the logo -GenericValue partyGroup = delegator.findByPrimaryKey("PartyGroup", UtilMisc.toMap("partyId",partyId)); -if (partyGroup != null && UtilValidate.isNotEmpty(partyGroup.getString("logoImageUrl"))) { - logoImageUrl = partyGroup.getString("logoImageUrl"); +partyGroup = delegator.findByPrimaryKey("PartyGroup", [partyId : partyId]); +if (partyGroup?.logoImageUrl) { + logoImageUrl = partyGroup.logoImageUrl; } -context.put("logoImageUrl", logoImageUrl); +context.logoImageUrl = logoImageUrl; // the company name -String companyName = "not found"; -if (partyGroup != null && UtilValidate.isNotEmpty(partyGroup.get("groupName"))) { - companyName = partyGroup.getString("groupName"); +companyName = "not found"; +if (partyGroup?.groupName) { + companyName = partyGroup.groupName; } -context.put("companyName", companyName); +context.companyName = companyName; // the address -List addresses = delegator.findByAnd("PartyContactMechPurpose", - UtilMisc.toMap("partyId",partyId,"contactMechPurposeTypeId","GENERAL_LOCATION")); -List selAddresses = EntityUtil.filterByDate(addresses, nowTimestamp, "fromDate", "thruDate", true); -GenericValue address = null; -if (addresses != null && addresses.size() > 0) { - address = delegator.findByPrimaryKey("PostalAddress",UtilMisc.toMap("contactMechId",selAddresses.iterator().next().getString("contactMechId"))); +addresses = delegator.findByAnd("PartyContactMechPurpose", [partyId : partyId, contactMechPurposeTypeId : "GENERAL_LOCATION"]); +selAddresses = EntityUtil.filterByDate(addresses, nowTimestamp, "fromDate", "thruDate", true); +address = null; +if (selAddresses) { + address = delegator.findByPrimaryKey("PostalAddress", [contactMechId : selAddresses[0].contactMechId]); } -if (address != null) { +if (address) { // get the country name and state/province abbreviation country = address.getRelatedOneCache("CountryGeo"); - if (country != null) { - context.put("countryName", country.getString("geoName")); + if (country) { + context.countryName = country.geoName; } stateProvince = address.getRelatedOneCache("StateProvinceGeo"); - if (stateProvince != null) { - context.put("stateProvinceAbbr", stateProvince.getString("abbreviation")); + if (stateProvince) { + context.stateProvinceAbbr = stateProvince.abbreviation; } } -context.put("postalAddress", address); +context.postalAddress = address; //telephone -List phones = delegator.findByAnd("PartyContactMechPurpose", - UtilMisc.toMap("partyId",partyId,"contactMechPurposeTypeId","PRIMARY_PHONE")); -List selPhones = EntityUtil.filterByDate(phones, nowTimestamp, "fromDate", "thruDate", true); -if (phones != null && phones.size() > 0) { - context.put("phone",delegator.findByPrimaryKey("TelecomNumber",UtilMisc.toMap("contactMechId",selPhones.iterator().next().getString("contactMechId")))); +phones = delegator.findByAnd("PartyContactMechPurpose", [partyId : partyId, contactMechPurposeTypeId : "PRIMARY_PHONE"]); +selPhones = EntityUtil.filterByDate(phones, nowTimestamp, "fromDate", "thruDate", true); +if (selPhones) { + context.phone = delegator.findByPrimaryKey("TelecomNumber", [contactMechId : selPhones[0].contactMechId]); } -List emails = delegator.findByAnd("PartyContactMechPurpose", - UtilMisc.toMap("partyId",partyId,"contactMechPurposeTypeId","PRIMARY_EMAIL")); -List selEmails = EntityUtil.filterByDate(emails, nowTimestamp, "fromDate", "thruDate", true); -if (emails != null && emails.size() > 0) { - context.put("email",delegator.findByPrimaryKey("ContactMech",UtilMisc.toMap("contactMechId",selEmails.iterator().next().getString("contactMechId")))); -} -else { //get email address from party contact mech - List contacts = delegator.findByAnd("PartyContactMech", - UtilMisc.toMap("partyId",partyId)); - List selContacts = EntityUtil.filterByDate(contacts, nowTimestamp, "fromDate", "thruDate", true); - if (selContacts != null && selContacts.size() > 0) { - Iterator i = selContacts.iterator(); +emails = delegator.findByAnd("PartyContactMechPurpose", [partyId : partyId, contactMechPurposeTypeId : "PRIMARY_EMAIL"]); +selEmails = EntityUtil.filterByDate(emails, nowTimestamp, "fromDate", "thruDate", true); +if (selEmails) { + context.email = delegator.findByPrimaryKey("ContactMech", [contactMechId : selEmails[0].contactMechId]); +} else { //get email address from party contact mech + contacts = delegator.findByAnd("PartyContactMech", [partyId : partyId]); + selContacts = EntityUtil.filterByDate(contacts, nowTimestamp, "fromDate", "thruDate", true); + if (selContacts) { + i = selContacts.iterator(); while (i.hasNext()) { email = i.next().getRelatedOne("ContactMech"); - if (email.getString("contactMechTypeId").equals("ELECTRONIC_ADDRESS")) { - context.put("email",email); + if ("ELECTRONIC_ADDRESS".equals(email.contactMechTypeId)) { + context.email = email; break; } } @@ -182,24 +172,22 @@ } // website -List contacts = delegator.findByAnd("PartyContactMech", - UtilMisc.toMap("partyId",partyId)); -List selContacts = EntityUtil.filterByDate(contacts, nowTimestamp, "fromDate", "thruDate", true); -if (selContacts != null && selContacts.size() > 0) { +contacts = delegator.findByAnd("PartyContactMech", [partyId : partyId]); +selContacts = EntityUtil.filterByDate(contacts, nowTimestamp, "fromDate", "thruDate", true); +if (selContacts) { Iterator i = selContacts.iterator(); while (i.hasNext()) { website = i.next().getRelatedOne("ContactMech"); - if (website.getString("contactMechTypeId").equals("WEB_ADDRESS")) { - context.put("website",website); + if ("WEB_ADDRESS".equals(website.contactMechTypeId)) { + context.website = website; break; } } } //Bank account -List paymentMethods = delegator.findByAnd("PaymentMethod",UtilMisc.toMap("partyId",partyId,"paymentMethodTypeId", "EFT_ACCOUNT")); -List selPayments = EntityUtil.filterByDate(paymentMethods, nowTimestamp, "fromDate", "thruDate", true); -if (selPayments != null && selPayments.size() > 0) - context.put("eftAccount",delegator.findByPrimaryKey("EftAccount",UtilMisc.toMap("paymentMethodId",selPayments.iterator().next().getString("paymentMethodId")))); - - +paymentMethods = delegator.findByAnd("PaymentMethod", [partyId : partyId, paymentMethodTypeId : "EFT_ACCOUNT"]); +selPayments = EntityUtil.filterByDate(paymentMethods, nowTimestamp, "fromDate", "thruDate", true); +if (selPayments) { + context.eftAccount = delegator.findByPrimaryKey("EftAccount", [paymentMethodId : selPayments[0].paymentMethodId]); +} Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FilterOrderList.groovy (from r676251, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/filterorderlist.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FilterOrderList.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FilterOrderList.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/filterorderlist.bsh&r1=676251&r2=676519&rev=676519&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/filterorderlist.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FilterOrderList.groovy Mon Jul 14 02:11:46 2008 @@ -24,25 +24,24 @@ import org.ofbiz.product.store.ProductStoreWorker; import org.ofbiz.order.order.OrderListState; -orderHeaderList = context.get("orderHeaderList"); +orderHeaderList = context.orderHeaderList; productStore = ProductStoreWorker.getProductStore(request); -List filterInventoryProblems = new ArrayList(); +filterInventoryProblems = []; -if (state.hasFilter("filterInventoryProblems") && UtilValidate.isNotEmpty(orderHeaderList)) { - for (ohi = orderHeaderList.iterator(); ohi.hasNext();) { - orderHeader = (GenericValue) ohi.next(); +if (state.hasFilter("filterInventoryProblems") && orderHeaderList) { + orderHeaderList.each { orderHeader -> orderReadHelper = OrderReadHelper.getHelper(orderHeader); backorderQty = orderReadHelper.getOrderBackorderQuantity(); - if (backorderQty.compareTo(BigDecimal.ZERO) == 1) { - filterInventoryProblems.add(orderHeader.get("orderId")); + if (backorderQty.compareTo(BigDecimal.ZERO) > 0) { + filterInventoryProblems.add(orderHeader.orderId); } } } -List filterPOsOpenPastTheirETA = new ArrayList(); -List filterPOsWithRejectedItems = new ArrayList(); -List filterPartiallyReceivedPOs = new ArrayList(); +filterPOsOpenPastTheirETA = []; +filterPOsWithRejectedItems = []; +filterPartiallyReceivedPOs = []; state = OrderListState.getInstance(request); //print("### " + state.toString()); @@ -50,51 +49,40 @@ if ((state.hasFilter("filterPartiallyReceivedPOs") || state.hasFilter("filterPOsOpenPastTheirETA") || state.hasFilter("filterPOsWithRejectedItems")) && - UtilValidate.isNotEmpty(orderHeaderList)) { - for (ohi = orderHeaderList.iterator(); ohi.hasNext();) { - orderHeader = (GenericValue) ohi.next(); - facilityId = orderHeader.getString("originFacilityId"); - if (facilityId == null) { - facilityId = productStore.getString("inventoryFacilityId"); - } + orderHeaderList) { + orderHeaderList.each { orderHeader -> + facilityId = orderHeader.originFacilityId ?: productStore.inventoryFacilityId; orderReadHelper = OrderReadHelper.getHelper(orderHeader); - if ("PURCHASE_ORDER".equals(orderHeader.getString("orderTypeId"))) { + if ("PURCHASE_ORDER".equals(orderHeader.orderTypeId)) { if (orderReadHelper.getRejectedOrderItems() && state.hasFilter("filterPOsWithRejectedItems")) { filterPOsWithRejectedItems.add(orderHeader.get("orderId")); - continue; - } - if (orderReadHelper.getPastEtaOrderItems(orderHeader.get("orderId")) && + } else if (orderReadHelper.getPastEtaOrderItems(orderHeader.get("orderId")) && state.hasFilter("filterPOsOpenPastTheirETA")) { - filterPOsOpenPastTheirETA.add(orderHeader.get("orderId")); - continue; - } - if (orderReadHelper.getPartiallyReceivedItems() && + filterPOsOpenPastTheirETA.add(orderHeader.orderId); + } else if (orderReadHelper.getPartiallyReceivedItems() && state.hasFilter("filterPartiallyReceivedPOs")) { - filterPartiallyReceivedPOs.add(orderHeader.get("orderId")); - continue; + filterPartiallyReceivedPOs.add(orderHeader.orderId); } } } } -List filterAuthProblems = new ArrayList(); +filterAuthProblems = []; -if (state.hasFilter("filterAuthProblems") && UtilValidate.isNotEmpty(orderHeaderList)) { - for (ohi = orderHeaderList.iterator(); ohi.hasNext();) { - orderHeader = (GenericValue) ohi.next(); +if (state.hasFilter("filterAuthProblems") && orderHeaderList) { + orderHeaderList.each { orderHeader -> orderReadHelper = OrderReadHelper.getHelper(orderHeader); - List paymentPrefList = orderReadHelper.getPaymentPreferences(); - for (Iterator ppi = paymentPrefList.iterator(); ppi.hasNext();) { - paymentPref = (GenericValue) ppi.next(); - if ("PAYMENT_NOT_AUTH".equals(paymentPref.getString("statusId"))) { - filterAuthProblems.add(orderHeader.get("orderId")); + paymentPrefList = orderReadHelper.getPaymentPreferences(); + paymentPrefList.each { paymentPref -> + if ("PAYMENT_NOT_AUTH".equals(paymentPref.statusId)) { + filterAuthProblems.add(orderHeader.orderId); } - } + } } } -context.put("filterInventoryProblems", filterInventoryProblems); -context.put("filterPOsWithRejectedItems", filterPOsWithRejectedItems); -context.put("filterPOsOpenPastTheirETA", filterPOsOpenPastTheirETA); -context.put("filterPartiallyReceivedPOs", filterPartiallyReceivedPOs); -context.put("filterAuthProblems", filterAuthProblems); \ No newline at end of file +context.filterInventoryProblems = filterInventoryProblems; +context.filterPOsWithRejectedItems = filterPOsWithRejectedItems; +context.filterPOsOpenPastTheirETA = filterPOsOpenPastTheirETA; +context.filterPartiallyReceivedPOs = filterPartiallyReceivedPOs; +context.filterAuthProblems = filterAuthProblems; Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy (from r676251, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/findOrders.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/findOrders.bsh&r1=676251&r2=676519&rev=676519&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/findOrders.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy Mon Jul 14 02:11:46 2008 @@ -22,74 +22,71 @@ import org.ofbiz.entity.*; import org.ofbiz.base.util.*; -module = "findOrders.bsh"; - -delegator = request.getAttribute("delegator"); -security = request.getAttribute("security"); +module = "FindOrders.groovy"; // get the order types -orderTypes = delegator.findList("OrderType", null, null, UtilMisc.toList("description"), null, false); -context.put("orderTypes", orderTypes); +orderTypes = delegator.findList("OrderType", null, null, ["description"], null, false); +context.orderTypes = orderTypes; // get the role types -roleTypes = delegator.findList("RoleType", null, null, UtilMisc.toList("description"), null, false); -context.put("roleTypes", roleTypes); +roleTypes = delegator.findList("RoleType", null, null, ["description"], null, false); +context.roleTypes = roleTypes; // get the order statuses -orderStatuses = delegator.findByAnd("StatusItem", UtilMisc.toMap("statusTypeId", "ORDER_STATUS"), UtilMisc.toList("sequenceId", "description")); -context.put("orderStatuses", orderStatuses); +orderStatuses = delegator.findByAnd("StatusItem", [statusTypeId : "ORDER_STATUS"], ["sequenceId", "description"]); +context.orderStatuses = orderStatuses; // get websites -websites = delegator.findList("WebSite", null, null, UtilMisc.toList("siteName"), null, false); -context.put("webSites", websites); +websites = delegator.findList("WebSite", null, null, ["siteName"], null, false); +context.webSites = websites; // get the stores -stores = delegator.findList("ProductStore", null, null, UtilMisc.toList("storeName"), null, false); -context.put("productStores", stores); +stores = delegator.findList("ProductStore", null, null, ["storeName"], null, false); +context.productStores = stores; // get the channels -channels = delegator.findByAnd("Enumeration", UtilMisc.toMap("enumTypeId", "ORDER_SALES_CHANNEL"), UtilMisc.toList("sequenceId")); -context.put("salesChannels", channels); +channels = delegator.findByAnd("Enumeration", [enumTypeId : "ORDER_SALES_CHANNEL"], ["sequenceId"]); +context.salesChannels = channels; // current role type currentRoleTypeId = request.getParameter("roleTypeId"); -if (currentRoleTypeId != null && currentRoleTypeId.length() > 0) { - currentRole = delegator.findByPrimaryKeyCache("RoleType", UtilMisc.toMap("roleTypeId", currentRoleTypeId)); - context.put("currentRole", currentRole); +if (currentRoleTypeId) { + currentRole = delegator.findByPrimaryKeyCache("RoleType", [roleTypeId : currentRoleTypeId]); + context.currentRole = currentRole; } // current selected type currentTypeId = request.getParameter("orderTypeId"); -if (currentTypeId != null && currentTypeId.length() > 0) { - currentType = delegator.findByPrimaryKeyCache("OrderType", UtilMisc.toMap("orderTypeId", currentTypeId)); - context.put("currentType", currentType); +if (currentTypeId) { + currentType = delegator.findByPrimaryKeyCache("OrderType", [orderTypeId : currentTypeId]); + context.currentType = currentType; } // current selected status currentStatusId = request.getParameter("orderStatusId"); -if (currentStatusId != null && currentStatusId.length() > 0) { - currentStatus = delegator.findByPrimaryKeyCache("StatusItem", UtilMisc.toMap("statusId", currentStatusId)); - context.put("currentStatus", currentStatus); +if (currentStatusId) { + currentStatus = delegator.findByPrimaryKeyCache("StatusItem", [statusId : currentStatusId]); + context.currentStatus = currentStatus; } // current website currentWebSiteId = request.getParameter("orderWebSiteId"); -if (currentWebSiteId != null && currentWebSiteId.length() > 0) { - currentWebSite = delegator.findByPrimaryKeyCache("WebSite", UtilMisc.toMap("webSiteId", currentWebSiteId)); - context.put("currentWebSite", currentWebSite); +if (currentWebSiteId) { + currentWebSite = delegator.findByPrimaryKeyCache("WebSite", [webSiteId : currentWebSiteId]); + context.currentWebSite = currentWebSite; } // current store currentProductStoreId = request.getParameter("productStoreId"); -if (currentProductStoreId != null && currentProductStoreId.length() > 0) { - currentProductStore = delegator.findByPrimaryKeyCache("ProductStore", UtilMisc.toMap("productStoreId", currentProductStoreId)); - context.put("currentProductStore", currentProductStore); +if (currentProductStoreId) { + currentProductStore = delegator.findByPrimaryKeyCache("ProductStore", [productStoreId : currentProductStoreId]); + context.currentProductStore = currentProductStore; } // current channel currentSalesChannelId = request.getParameter("salesChannelEnumId"); -if (currentSalesChannelId != null && currentSalesChannelId.length() > 0) { - currentSalesChannel = delegator.findByPrimaryKey("Enumeration", UtilMisc.toMap("enumId", currentSalesChannelId)); - context.put("currentSalesChannel", currentSalesChannel); +if (currentSalesChannelId) { + currentSalesChannel = delegator.findByPrimaryKey("Enumeration", [enumId : currentSalesChannelId]); + context.currentSalesChannel = currentSalesChannel; } // create the fromDate for calendar @@ -103,7 +100,7 @@ fromTs = new Timestamp(fromCal.getTimeInMillis()); fromStr = fromTs.toString(); fromStr = fromStr.substring(0, fromStr.indexOf('.')); -context.put("fromDateStr", fromStr); +context.fromDateStr = fromStr; // create the thruDate for calendar toCal = Calendar.getInstance(); @@ -115,48 +112,35 @@ toCal.set(Calendar.MILLISECOND, toCal.getActualMaximum(Calendar.MILLISECOND)); toTs = new Timestamp(toCal.getTimeInMillis()); toStr = toTs.toString(); -context.put("thruDateStr", toStr); +context.thruDateStr = toStr; // set the page parameters -viewIndex = 1; -try { - viewIndex = Integer.valueOf((String) request.getParameter("viewIndex")).intValue(); -} catch (Exception e) { - viewIndex = 1; -} -context.put("viewIndex", viewIndex); - -viewSize = 20; -try { - viewSize = Integer.valueOf((String) request.getParameter("viewSize")).intValue(); -} catch (Exception e) { - viewSize = 20; -} -context.put("viewSize", viewSize); +viewIndex = request.getParameter("viewIndex") ? Integer.valueOf(request.getParameter("viewIndex")) : 1; +context.viewIndex = viewIndex; + +viewSize = request.getParameter("viewSize") ? Integer.valueOf(request.getParameter("viewSize")) : 20; +context.viewSize = viewSize; // get the lookup flag lookupFlag = request.getParameter("lookupFlag"); // fields from the service call -paramList = request.getAttribute("paramList"); -if (paramList == null) { - paramList = ""; -} -context.put("paramList", paramList); +paramList = request.getAttribute("paramList") ?: ""; +context.paramList = paramList; orderList = request.getAttribute("orderList"); -context.put("orderList", orderList); +context.orderList = orderList; orderListSize = request.getAttribute("orderListSize"); -context.put("orderListSize", orderListSize); +context.orderListSize = orderListSize; -context.put("filterInventoryProblems", request.getAttribute("filterInventoryProblemsList")); -context.put("filterPOsWithRejectedItems", request.getAttribute("filterPOsWithRejectedItemsList")); -context.put("filterPOsOpenPastTheirETA", request.getAttribute("filterPOsOpenPastTheirETAList")); -context.put("filterPartiallyReceivedPOs", request.getAttribute("filterPartiallyReceivedPOsList")); +context.filterInventoryProblems = request.getAttribute("filterInventoryProblemsList"); +context.filterPOsWithRejectedItems = request.getAttribute("filterPOsWithRejectedItemsList"); +context.filterPOsOpenPastTheirETA = request.getAttribute("filterPOsOpenPastTheirETAList"); +context.filterPartiallyReceivedPOs = request.getAttribute("filterPartiallyReceivedPOsList"); lowIndex = request.getAttribute("lowIndex"); -context.put("lowIndex", lowIndex); +context.lowIndex = lowIndex; highIndex = request.getAttribute("highIndex"); -context.put("highIndex", highIndex); +context.highIndex = highIndex; Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/NewNote.groovy (from r676251, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/newnote.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/NewNote.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/NewNote.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/newnote.bsh&r1=676251&r2=676519&rev=676519&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/newnote.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/NewNote.groovy Mon Jul 14 02:11:46 2008 @@ -18,23 +18,22 @@ */ orderId = request.getParameter("orderId"); -context.put("orderId", orderId); +context.orderId = orderId; workEffortId = request.getParameter("workEffortId"); partyId = request.getParameter("partyId"); roleTypeId = request.getParameter("roleTypeId"); fromDate = request.getParameter("fromDate"); -donePage = request.getParameter("DONE_PAGE"); -if (donePage == null || donePage.length() <= 0) - donePage="orderview?orderId=" + orderId; -if (workEffortId != null && workEffortId.length() > 0) - donePage = donePage + "&workEffortId=" + workEffortId; -if (partyId != null && partyId.length() > 0) - donePage = donePage + "&partyId=" + partyId; -if (roleTypeId != null && roleTypeId.length() > 0) - donePage = donePage + "&roleTypeId=" + roleTypeId; -if (fromDate != null && fromDate.length() > 0) - donePage = donePage + "&fromDate=" + fromDate; -context.put("donePage", donePage); +donePage = request.getParameter("DONE_PAGE") ?: "orderview?orderId=" + orderId; +if (workEffortId) + donePage += "&workEffortId=" + workEffortId; +if (partyId) + donePage += "&partyId=" + partyId; +if (roleTypeId) + donePage += "&roleTypeId=" + roleTypeId; +if (fromDate) + donePage += "&fromDate=" + fromDate; + +context.donePage = donePage; Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy (from r676251, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.bsh&r1=676251&r2=676519&rev=676519&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy Mon Jul 14 02:11:46 2008 @@ -21,37 +21,33 @@ import org.ofbiz.entity.*; import org.ofbiz.widget.html.*; -security = request.getAttribute("security"); -delegator = request.getAttribute("delegator"); -dispatcher = request.getAttribute("dispatcher"); - -String orderId = request.getParameter("orderId"); -String orderTypeId = null; -GenericValue orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId)); -if (orderHeader != null) { - orderTypeId = orderHeader.getString("orderTypeId"); +orderId = request.getParameter("orderId"); +orderTypeId = null; +orderHeader = delegator.findByPrimaryKey("OrderHeader", [orderId : orderId]); +if (orderHeader) { + orderTypeId = orderHeader.orderTypeId; } //Determine whether a schedule has already been defined for this PO -GenericValue schedule = delegator.findByPrimaryKey("OrderDeliverySchedule", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", "_NA_")); +schedule = delegator.findByPrimaryKey("OrderDeliverySchedule", [orderId : orderId, orderItemSeqId : "_NA_"]); // Determine whether the current user can VIEW the order -Map checkMap = UtilMisc.toMap("orderId", orderId, "userLogin", session.getAttribute("userLogin"), "checkAction", "VIEW"); -Map checkResult = dispatcher.runSync("checkSupplierRelatedOrderPermission", checkMap); -String hasSupplierRelatedPermissionStr = (String) checkResult.get("hasSupplierRelatedPermission"); +checkMap = [orderId : orderId, userLogin : session.getAttribute("userLogin"), checkAction : "VIEW"]; +checkResult = dispatcher.runSync("checkSupplierRelatedOrderPermission", checkMap); +hasSupplierRelatedPermissionStr = checkResult.hasSupplierRelatedPermission; // Determine what the reuslt is, no result is FALSE hasSupplierRelatedPermission = "true".equals(hasSupplierRelatedPermissionStr); // Initialize the PO Delivery Schedule form -HtmlFormWrapper updatePODeliveryInfoWrapper = new HtmlFormWrapper("component://order/webapp/ordermgr/order/OrderDeliveryScheduleForms.xml", "UpdateDeliveryScheduleInformation", request, response); +updatePODeliveryInfoWrapper = new HtmlFormWrapper("component://order/webapp/ordermgr/order/OrderDeliveryScheduleForms.xml", "UpdateDeliveryScheduleInformation", request, response); updatePODeliveryInfoWrapper.putInContext("orderId", orderId); updatePODeliveryInfoWrapper.putInContext("orderItemSeqId", "_NA_"); updatePODeliveryInfoWrapper.putInContext("schedule", schedule); updatePODeliveryInfoWrapper.putInContext("hasSupplierRelatedPermission", hasSupplierRelatedPermission); -context.put("orderId", orderId); -context.put("orderTypeId", orderTypeId); -context.put("orderHeader", orderHeader); -context.put("hasPermission", hasSupplierRelatedPermission); -context.put("updatePODeliveryInfoWrapper", updatePODeliveryInfoWrapper); +context.orderId = orderId; +context.orderTypeId = orderTypeId; +context.orderHeader = orderHeader; +context.hasPermission = hasSupplierRelatedPermission; +context.updatePODeliveryInfoWrapper = updatePODeliveryInfoWrapper; Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy (from r676251, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderlist.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderlist.bsh&r1=676251&r2=676519&rev=676519&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderlist.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy Mon Jul 14 02:11:46 2008 @@ -23,17 +23,12 @@ import org.ofbiz.entity.condition.*; import org.ofbiz.order.order.OrderListState; -delegator = request.getAttribute("delegator"); -session = request.getSession(true); -dispatcher = request.getAttribute("dispatcher"); -userLogin = session.getAttribute("userLogin"); -security = request.getAttribute("security"); partyId = request.getParameter("partyId"); facilityId = request.getParameter("facilityId"); state = OrderListState.getInstance(request); state.update(request); -context.put("state", state); +context.state = state; // check permission for each order type hasPermission = false; @@ -45,17 +40,13 @@ hasPermission = true; purchaseOrdersCondition = EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER"); } -context.put("hasPermission", hasPermission); +context.hasPermission = hasPermission; orderHeaderList = state.getOrders(facilityId, delegator); -context.put("orderHeaderList", orderHeaderList); - -locale = UtilHttp.getLocale(request); +context.orderHeaderList = orderHeaderList; // a list of order type descriptions ordertypes = delegator.findList("OrderType", null, null, null, null, true); -iter = ordertypes.iterator(); -while (iter.hasNext()) { - type = iter.next(); - context.put("descr_" + type.getString("orderTypeId"), type.get("description",locale)); +ordertypes.each { type -> + context["descr_" + type.orderTypeId] = type.get("description",locale); } Copied: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy (from r676509, ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh) URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy?p2=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy&p1=ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh&r1=676509&r2=676519&rev=676519&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy Mon Jul 14 02:11:46 2008 @@ -26,224 +26,217 @@ double calcItemTotal(List headers) { double total = 0.00; - Iterator i = headers.iterator(); - while (i.hasNext()) { - GenericValue header = (GenericValue) i.next(); - total += (header.get("grandTotal") != null ? header.getDouble("grandTotal").doubleValue() : 0.00); + headers.each { header -> + total += header.grandTotal ?: 0.00; } return total; } - + double calcItemCount(List items) { - double count = 0.0000; - Iterator i = items.iterator(); - while (i.hasNext()) { - GenericValue item = (GenericValue) i.next(); - count += (item.get("quantity") != null ? item.getDouble("quantity").doubleValue() : 0.0000); + double count = 0.00; + items.each { item -> + count += item.quantity ?: 0.00; } return count; } -delegator = request.getAttribute("delegator"); - -Timestamp endTime = UtilDateTime.nowTimestamp(); -Calendar cal = Calendar.getInstance(); +cal = Calendar.getInstance(); cal.set(Calendar.AM_PM, Calendar.AM); cal.set(Calendar.HOUR, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); -Timestamp dayBegin = new Timestamp(cal.getTime().getTime()); +dayBegin = new Timestamp(cal.getTime().getTime()); cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); -Timestamp weekBegin = new Timestamp(cal.getTime().getTime()); +weekBegin = new Timestamp(cal.getTime().getTime()); cal.set(Calendar.DAY_OF_MONTH, 1); -Timestamp monthBegin = new Timestamp(cal.getTime().getTime()); +monthBegin = new Timestamp(cal.getTime().getTime()); cal.set(Calendar.MONTH, 0); -Timestamp yearBegin = new Timestamp(cal.getTime().getTime()); +yearBegin = new Timestamp(cal.getTime().getTime()); // order status report -EntityConditionList ecl = EntityCondition.makeCondition(UtilMisc.toList( - EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null), - EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null), - EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin)), - EntityOperator.AND); -List dayList = delegator.findList("OrderStatus", ecl, null, null, null, false); -context.put("dayOrder", EntityUtil.filterByAnd(dayList, UtilMisc.toMap("statusId", "ORDER_ORDERED"))); -context.put("dayApprove", EntityUtil.filterByAnd(dayList, UtilMisc.toMap("statusId", "ORDER_APPROVED"))); -context.put("dayComplete", EntityUtil.filterByAnd(dayList, UtilMisc.toMap("statusId", "ORDER_COMPLETED"))); -context.put("dayCancelled", EntityUtil.filterByAnd(dayList, UtilMisc.toMap("statusId", "ORDER_CANCELLED"))); -context.put("dayRejected", EntityUtil.filterByAnd(dayList, UtilMisc.toMap("statusId", "ORDER_REJECTED"))); +ecl = EntityCondition.makeCondition([ + EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null), + EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null), + EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin)], + EntityOperator.AND); +dayList = delegator.findList("OrderStatus", ecl, null, null, null, false); +context.dayOrder = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_ORDERED"]); +context.dayApprove = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_APPROVED"]); +context.dayComplete = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_COMPLETED"]); +context.dayCancelled = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_CANCELLED"]); +context.dayRejected = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_REJECTED"]); -ecl = EntityCondition.makeCondition(UtilMisc.toList( +ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null), - EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin)), + EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin)], EntityOperator.AND); -List weekList = delegator.findList("OrderStatus", ecl, null, null, null, false); -context.put("weekOrder", EntityUtil.filterByAnd(weekList, UtilMisc.toMap("statusId", "ORDER_ORDERED"))); -context.put("weekApprove", EntityUtil.filterByAnd(weekList, UtilMisc.toMap("statusId", "ORDER_APPROVED"))); -context.put("weekComplete", EntityUtil.filterByAnd(weekList, UtilMisc.toMap("statusId", "ORDER_COMPLETED"))); -context.put("weekCancelled", EntityUtil.filterByAnd(weekList, UtilMisc.toMap("statusId", "ORDER_CANCELLED"))); -context.put("weekRejected", EntityUtil.filterByAnd(weekList, UtilMisc.toMap("statusId", "ORDER_REJECTED"))); +weekList = delegator.findList("OrderStatus", ecl, null, null, null, false); +context.weekOrder = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_ORDERED"]); +context.weekApprove = EntityUtil.filterByAnd(weekList, [statusId: "ORDER_APPROVED"]); +context.weekComplete = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_COMPLETED"]); +context.weekCancelled = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_CANCELLED"]); +context.weekRejected = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_REJECTED"]); -ecl = EntityCondition.makeCondition(UtilMisc.toList( +ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null), - EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin)), + EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin)], EntityOperator.AND); -List monthList = delegator.findList("OrderStatus", ecl, null, null, null, false); -context.put("monthOrder", EntityUtil.filterByAnd(monthList, UtilMisc.toMap("statusId", "ORDER_ORDERED"))); -context.put("monthApprove", EntityUtil.filterByAnd(monthList, UtilMisc.toMap("statusId", "ORDER_APPROVED"))); -context.put("monthComplete", EntityUtil.filterByAnd(monthList, UtilMisc.toMap("statusId", "ORDER_COMPLETED"))); -context.put("monthCancelled", EntityUtil.filterByAnd(monthList, UtilMisc.toMap("statusId", "ORDER_CANCELLED"))); -context.put("monthRejected", EntityUtil.filterByAnd(monthList, UtilMisc.toMap("statusId", "ORDER_REJECTED"))); +monthList = delegator.findList("OrderStatus", ecl, null, null, null, false); +context.monthOrder = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_ORDERED"]); +context.monthApprove = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_APPROVED"]); +context.monthComplete = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_COMPLETED"]); +context.monthCancelled = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_CANCELLED"]); +context.monthRejected = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_REJECTED"]); -ecl = EntityCondition.makeCondition(UtilMisc.toList( +ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null), EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null), - EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin)), + EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin)], EntityOperator.AND); -List yearList = delegator.findList("OrderStatus", ecl, null, null, null, false); -context.put("yearOrder", EntityUtil.filterByAnd(yearList, UtilMisc.toMap("statusId", "ORDER_ORDERED"))); -context.put("yearApprove", EntityUtil.filterByAnd(yearList, UtilMisc.toMap("statusId", "ORDER_APPROVED"))); -context.put("yearComplete", EntityUtil.filterByAnd(yearList, UtilMisc.toMap("statusId", "ORDER_COMPLETED"))); -context.put("yearCancelled", EntityUtil.filterByAnd(yearList, UtilMisc.toMap("statusId", "ORDER_CANCELLED"))); -context.put("yearRejected", EntityUtil.filterByAnd(yearList, UtilMisc.toMap("statusId", "ORDER_REJECTED"))); +yearList = delegator.findList("OrderStatus", ecl, null, null, null, false); +context.yearOrder = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_ORDERED"]); +context.yearApprove = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_APPROVED"]); +context.yearComplete = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_COMPLETED"]); +context.yearCancelled = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_CANCELLED"]); +context.yearRejected = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_REJECTED"]); // order totals and item counts -ecl = EntityCondition.makeCondition(UtilMisc.toList( +ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"), EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"), EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin), - EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")), + EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -List dayItems = delegator.findList("OrderHeaderAndItems", ecl, null, null, null, false); -List dayItemsPending = EntityUtil.filterByAnd(dayItems, UtilMisc.toMap("itemStatusId", "ITEM_ORDERED")); +dayItems = delegator.findList("OrderHeaderAndItems", ecl, null, null, null, false); +dayItemsPending = EntityUtil.filterByAnd(dayItems, [itemStatusId : "ITEM_ORDERED"]); -ecl = EntityCondition.makeCondition(UtilMisc.toList( +ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"), EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin), - EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")), + EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -List dayHeaders = delegator.findList("OrderHeader", ecl, null, null, null, false); -List dayHeadersPending = EntityUtil.filterByAnd(dayHeaders, UtilMisc.toMap("statusId", "ORDER_ORDERED")); +dayHeaders = delegator.findList("OrderHeader", ecl, null, null, null, false); +dayHeadersPending = EntityUtil.filterByAnd(dayHeaders, [statusId : "ORDER_ORDERED"]); -double dayItemTotal = calcItemTotal(dayHeaders); -double dayItemCount = calcItemCount(dayItems); -double dayItemTotalPending = calcItemTotal(dayHeadersPending); -double dayItemCountPending = calcItemCount(dayItemsPending); -double dayItemTotalPaid = dayItemTotal - dayItemTotalPending; -double dayItemCountPaid = dayItemCount - dayItemCountPending; -context.put("dayItemTotal", dayItemTotal); -context.put("dayItemCount", dayItemCount); -context.put("dayItemTotalPending", dayItemTotalPending); -context.put("dayItemCountPending", dayItemCountPending); -context.put("dayItemTotalPaid", dayItemTotalPaid); -context.put("dayItemCountPaid", dayItemCountPaid); +dayItemTotal = calcItemTotal(dayHeaders); +dayItemCount = calcItemCount(dayItems); +dayItemTotalPending = calcItemTotal(dayHeadersPending); +dayItemCountPending = calcItemCount(dayItemsPending); +dayItemTotalPaid = dayItemTotal - dayItemTotalPending; +dayItemCountPaid = dayItemCount - dayItemCountPending; +context.dayItemTotal = dayItemTotal; +context.dayItemCount = dayItemCount; +context.dayItemTotalPending = dayItemTotalPending; +context.dayItemCountPending = dayItemCountPending; +context.dayItemTotalPaid = dayItemTotalPaid; +context.dayItemCountPaid = dayItemCountPaid; -ecl = EntityCondition.makeCondition(UtilMisc.toList( +ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"), EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"), EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin), - EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")), + EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -List weekItems = delegator.findList("OrderHeaderAndItems", ecl, null, null, null, false); -List weekItemsPending = EntityUtil.filterByAnd(weekItems, UtilMisc.toMap("itemStatusId", "ITEM_ORDERED")); +weekItems = delegator.findList("OrderHeaderAndItems", ecl, null, null, null, false); +weekItemsPending = EntityUtil.filterByAnd(weekItems, [itemStatusId : "ITEM_ORDERED"]); -ecl = EntityCondition.makeCondition(UtilMisc.toList( +ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"), EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin), - EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")), + EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -List weekHeaders = delegator.findList("OrderHeader", ecl, null, null, null, false); -List weekHeadersPending = EntityUtil.filterByAnd(weekHeaders, UtilMisc.toMap("statusId", "ORDER_ORDERED")); +weekHeaders = delegator.findList("OrderHeader", ecl, null, null, null, false); +weekHeadersPending = EntityUtil.filterByAnd(weekHeaders, [statusId : "ORDER_ORDERED"]); -double weekItemTotal = calcItemTotal(weekHeaders); -double weekItemCount = calcItemCount(weekItems); -double weekItemTotalPending = calcItemTotal(weekHeadersPending); -double weekItemCountPending = calcItemCount(weekItemsPending); -double weekItemTotalPaid = weekItemTotal - weekItemTotalPending; -double weekItemCountPaid = weekItemCount - weekItemCountPending; -context.put("weekItemTotal", weekItemTotal); -context.put("weekItemCount", weekItemCount); -context.put("weekItemTotalPending", weekItemTotalPending); -context.put("weekItemCountPending", weekItemCountPending); -context.put("weekItemTotalPaid", weekItemTotalPaid); -context.put("weekItemCountPaid", weekItemCountPaid); +weekItemTotal = calcItemTotal(weekHeaders); +weekItemCount = calcItemCount(weekItems); +weekItemTotalPending = calcItemTotal(weekHeadersPending); +weekItemCountPending = calcItemCount(weekItemsPending); +weekItemTotalPaid = weekItemTotal - weekItemTotalPending; +weekItemCountPaid = weekItemCount - weekItemCountPending; +context.weekItemTotal = weekItemTotal; +context.weekItemCount = weekItemCount; +context.weekItemTotalPending = weekItemTotalPending; +context.weekItemCountPending = weekItemCountPending; +context.weekItemTotalPaid = weekItemTotalPaid; +context.weekItemCountPaid = weekItemCountPaid; -ecl = EntityCondition.makeCondition(UtilMisc.toList( +ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"), EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"), EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin), - EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")), + EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -List monthItems = delegator.findList("OrderHeaderAndItems", ecl, null, null, null, false); -List monthItemsPending = EntityUtil.filterByAnd(monthItems, UtilMisc.toMap("itemStatusId", "ITEM_ORDERED")); +monthItems = delegator.findList("OrderHeaderAndItems", ecl, null, null, null, false); +monthItemsPending = EntityUtil.filterByAnd(monthItems, [itemStatusId : "ITEM_ORDERED"]); -ecl = EntityCondition.makeCondition(UtilMisc.toList( +ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"), EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin), - EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")), + EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -List monthHeaders = delegator.findList("OrderHeader", ecl, null, null, null, false); -List monthHeadersPending = EntityUtil.filterByAnd(monthHeaders, UtilMisc.toMap("statusId", "ORDER_ORDERED")); +monthHeaders = delegator.findList("OrderHeader", ecl, null, null, null, false); +monthHeadersPending = EntityUtil.filterByAnd(monthHeaders, [statusId : "ORDER_ORDERED"]); -double monthItemTotal = calcItemTotal(monthHeaders); -double monthItemCount = calcItemCount(monthItems); -double monthItemTotalPending = calcItemTotal(monthHeadersPending); -double monthItemCountPending = calcItemCount(monthItemsPending); -double monthItemTotalPaid = monthItemTotal - monthItemTotalPending; -double monthItemCountPaid = monthItemCount - monthItemCountPending; -context.put("monthItemTotal", monthItemTotal); -context.put("monthItemCount", monthItemCount); -context.put("monthItemTotalPending", monthItemTotalPending); -context.put("monthItemCountPending", monthItemCountPending); -context.put("monthItemTotalPaid", monthItemTotalPaid); -context.put("monthItemCountPaid", monthItemCountPaid); - -ecl = EntityCondition.makeCondition(UtilMisc.toList( +monthItemTotal = calcItemTotal(monthHeaders); +monthItemCount = calcItemCount(monthItems); +monthItemTotalPending = calcItemTotal(monthHeadersPending); +monthItemCountPending = calcItemCount(monthItemsPending); +monthItemTotalPaid = monthItemTotal - monthItemTotalPending; +monthItemCountPaid = monthItemCount - monthItemCountPending; +context.monthItemTotal = monthItemTotal; +context.monthItemCount = monthItemCount; +context.monthItemTotalPending = monthItemTotalPending; +context.monthItemCountPending = monthItemCountPending; +context.monthItemTotalPaid = monthItemTotalPaid; +context.monthItemCountPaid = monthItemCountPaid; + +ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED"), EntityCondition.makeCondition("itemStatusId", EntityOperator.NOT_EQUAL, "ITEM_CANCELLED"), EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin), - EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")), + EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -List yearItems = delegator.findList("OrderHeaderAndItems", ecl, null, null, null, false); -List yearItemsPending = EntityUtil.filterByAnd(yearItems, UtilMisc.toMap("itemStatusId", "ITEM_ORDERED")); +yearItems = delegator.findList("OrderHeaderAndItems", ecl, null, null, null, false); +yearItemsPending = EntityUtil.filterByAnd(yearItems, [itemStatusId : "ITEM_ORDERED"]); -ecl = EntityCondition.makeCondition(UtilMisc.toList( +ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_CANCELLED"), EntityCondition.makeCondition("orderDate", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin), - EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")), + EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -List yearHeaders = delegator.findList("OrderHeader", ecl, null, null, null, false); -List yearHeadersPending = EntityUtil.filterByAnd(yearHeaders, UtilMisc.toMap("statusId", "ORDER_ORDERED")); +yearHeaders = delegator.findList("OrderHeader", ecl, null, null, null, false); +yearHeadersPending = EntityUtil.filterByAnd(yearHeaders, [statusId : "ORDER_ORDERED"]); -double yearItemTotal = calcItemTotal(yearHeaders); -double yearItemCount = calcItemCount(yearItems); -double yearItemTotalPending = calcItemTotal(yearHeadersPending); -double yearItemCountPending = calcItemCount(yearItemsPending); -double yearItemTotalPaid = yearItemTotal - yearItemTotalPending; -double yearItemCountPaid = yearItemCount - yearItemCountPending; -context.put("yearItemTotal", yearItemTotal); -context.put("yearItemCount", yearItemCount); -context.put("yearItemTotalPending", yearItemTotalPending); -context.put("yearItemCountPending", yearItemCountPending); -context.put("yearItemTotalPaid", yearItemTotalPaid); -context.put("yearItemCountPaid", yearItemCountPaid); +yearItemTotal = calcItemTotal(yearHeaders); +yearItemCount = calcItemCount(yearItems); +yearItemTotalPending = calcItemTotal(yearHeadersPending); +yearItemCountPending = calcItemCount(yearItemsPending); +yearItemTotalPaid = yearItemTotal - yearItemTotalPending; +yearItemCountPaid = yearItemCount - yearItemCountPending; +context.yearItemTotal = yearItemTotal; +context.yearItemCount = yearItemCount; +context.yearItemTotalPending = yearItemTotalPending; +context.yearItemCountPending = yearItemCountPending; +context.yearItemTotalPaid = yearItemTotalPaid; +context.yearItemCountPaid = yearItemCountPaid; // order state report -List waitingPayment = delegator.findByAnd("OrderHeader", UtilMisc.toMap("statusId", "ORDER_ORDERED", "orderTypeId", "SALES_ORDER")); -context.put("waitingPayment", waitingPayment.size()); +waitingPayment = delegator.findByAnd("OrderHeader", [statusId : "ORDER_ORDERED", orderTypeId : "SALES_ORDER"]); +context.waitingPayment = waitingPayment.size(); -List waitingApproval = delegator.findByAnd("OrderHeader", UtilMisc.toMap("statusId", "ORDER_PROCESSING", "orderTypeId", "SALES_ORDER")); -context.put("waitingApproval", waitingApproval.size()); +waitingApproval = delegator.findByAnd("OrderHeader", [statusId : "ORDER_PROCESSING", orderTypeId : "SALES_ORDER"]); +context.waitingApproval = waitingApproval.size(); -List waitingComplete = delegator.findByAnd("OrderHeader", UtilMisc.toMap("statusId", "ORDER_APPROVED", "orderTypeId", "SALES_ORDER")); -context.put("waitingComplete", waitingComplete.size()); +waitingComplete = delegator.findByAnd("OrderHeader", [statusId : "ORDER_APPROVED", orderTypeId : "SALES_ORDER"]); +context.waitingComplete = waitingComplete.size(); Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintScreens.xml?rev=676519&r1=676518&r2=676519&view=diff ============================================================================== --- ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintScreens.xml (original) +++ ofbiz/trunk/applications/order/widget/ordermgr/OrderPrintScreens.xml Mon Jul 14 02:11:46 2008 @@ -79,7 +79,7 @@ <screen name="CompanyLogo"> <section> <actions> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/companyHeader.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy"/> </actions> <widgets> <platform-specific><xsl-fo><html-template location="component://order/webapp/ordermgr/order/companyHeader.fo.ftl"/></xsl-fo></platform-specific> Modified: ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml?rev=676519&r1=676518&r2=676519&view=diff ============================================================================== --- ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml (original) +++ ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml Mon Jul 14 02:11:46 2008 @@ -131,8 +131,8 @@ <actions> <set field="titleProperty" value="OrderLookupOrder"/> <set field="headerItem" value="orderlist"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/orderlist.bsh"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/filterorderlist.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/FilterOrderList.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderViewDecorator"> @@ -174,7 +174,7 @@ <actions> <set field="titleProperty" value="OrderFindOrder"/> <set field="headerItem" value="findorders"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/findOrders.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy"/> <script location="component://content/webapp/content/WEB-INF/actions/print/FindPrinters.groovy"/> </actions> <widgets> @@ -193,7 +193,7 @@ <actions> <set field="titleProperty" value="OrderAddNote"/> <set field="headerItem" value="findorders"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/newnote.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/NewNote.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderViewDecorator"> @@ -215,7 +215,7 @@ <property-map resource="AccountingUiLabels" map-name="uiLabelMap" global="true"/> <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/> <property-map resource="CommonUiLabels" map-name="uiLabelMap" global="true"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderViewDecorator"> @@ -233,7 +233,7 @@ <actions> <set field="titleProperty" value="OrderOrderStatisticsPage"/> <set field="headerItem" value="stats"/> - <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/orderstats.bsh"/> + <script location="component://order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy"/> </actions> <widgets> <decorator-screen name="CommonOrderViewDecorator"> |
Free forum by Nabble | Edit this page |