Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy Mon Jan 5 08:50:30 2015 @@ -169,18 +169,18 @@ if (orderHeader) { context.itemIssuancesPerItem = itemIssuancesPerItem; // get a list of all invoices - orderBilling = delegator.findByAnd("OrderItemBilling", [orderId : orderId], ["invoiceId"], false); + orderBilling = from("OrderItemBilling").where("orderId", orderId).orderBy("invoiceId").queryList(); context.invoices = orderBilling*.invoiceId.unique(); ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderId), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED")], EntityOperator.AND); - orderPaymentPreferences = delegator.findList("OrderPaymentPreference", ecl, null, null, null, false); + orderPaymentPreferences = from("OrderPaymentPreference").where(ecl).queryList(); context.orderPaymentPreferences = orderPaymentPreferences; // ship groups - shipGroups = delegator.findByAnd("OrderItemShipGroup", [orderId : orderId], ["shipGroupSeqId"], false); + shipGroups = from("OrderItemShipGroup").where("orderId", orderId).orderBy("shipGroupSeqId").queryList(); context.shipGroups = shipGroups; @@ -243,15 +243,12 @@ if (orderHeader) { context.put("actualDateStr", actualDateStr); // get Shipment tracking info - osisCond = EntityCondition.makeCondition([orderId : orderId], EntityOperator.AND); - osisOrder = ["shipmentId", "shipmentRouteSegmentId", "shipmentPackageSeqId"]; - osisFields = ["shipGroupSeqId", "shipmentId", "shipmentRouteSegmentId", "carrierPartyId", "shipmentMethodTypeId"] as Set; - osisFields.add("shipmentPackageSeqId"); - osisFields.add("trackingCode"); - osisFields.add("boxNumber"); - osisFindOptions = new EntityFindOptions(); - osisFindOptions.setDistinct(true); - orderShipmentInfoSummaryList = delegator.findList("OrderShipmentInfoSummary", osisCond, osisFields, osisOrder, osisFindOptions, false); + orderShipmentInfoSummaryList = select("shipGroupSeqId", "shipmentId", "shipmentRouteSegmentId", "carrierPartyId", "shipmentMethodTypeId", "shipmentPackageSeqId", "trackingCode", "boxNumber") + .from("OrderShipmentInfoSummary") + .where("orderId", orderId) + .orderBy("shipmentId", "shipmentRouteSegmentId", "shipmentPackageSeqId") + .distinct() + .queryList(); context.orderShipmentInfoSummaryList = orderShipmentInfoSummaryList; customerPoNumber = null; @@ -260,7 +257,7 @@ if (orderHeader) { } context.customerPoNumber = customerPoNumber; - statusChange = delegator.findByAnd("StatusValidChange", [statusId : orderHeader.statusId], null, false); + statusChange = from("StatusValidChange").where("statusId", orderHeader.statusId).queryList(); context.statusChange = statusChange; currentStatus = orderHeader.getRelatedOne("StatusItem", false); @@ -269,10 +266,10 @@ if (orderHeader) { orderHeaderStatuses = orderReadHelper.getOrderHeaderStatuses(); context.orderHeaderStatuses = orderHeaderStatuses; - adjustmentTypes = delegator.findList("OrderAdjustmentType", null, null, ["description"], null, false); + adjustmentTypes = from("OrderAdjustmentType").orderBy("description").queryList(); context.orderAdjustmentTypes = adjustmentTypes; - notes = delegator.findByAnd("OrderHeaderNoteView", [orderId : orderId], ["-noteDateTime"], false); + notes = from("OrderHeaderNoteView").where("orderId", orderId).orderBy("-noteDateTime").queryList(); context.orderNotes = notes; showNoteHeadingOnPDF = false; @@ -284,7 +281,7 @@ if (orderHeader) { cmvm = ContactMechWorker.getOrderContactMechValueMaps(delegator, orderId); context.orderContactMechValueMaps = cmvm; - orderItemChangeReasons = delegator.findByAnd("Enumeration", [enumTypeId : "ODR_ITM_CH_REASON"], ["sequenceId"], false); + orderItemChangeReasons = from("Enumeration").where("enumTypeId", "ODR_ITM_CH_REASON").orderBy("sequenceId").queryList(); context.orderItemChangeReasons = orderItemChangeReasons; if ("PURCHASE_ORDER".equals(orderType)) { @@ -309,7 +306,7 @@ if (orderHeader) { } } // get purchase order item types - purchaseOrderItemTypeList = delegator.findByAnd("OrderItemType", [parentTypeId : "PURCHASE_SPECIFIC"], null, true); + purchaseOrderItemTypeList = from("OrderItemType").where("parentTypeId", "PURCHASE_SPECIFIC").cache(true).queryList(); context.purchaseOrderItemTypeList = purchaseOrderItemTypeList; } @@ -357,7 +354,7 @@ if (orderHeader) { if (shipGroup.contactMechId) { lookupMap.contactMechId = shipGroup.contactMechId; } - facilities = delegator.findByAnd("FacilityAndContactMech", lookupMap, null, true); + facilities = from("FacilityAndContactMech").where(lookupMap).cache(true).queryList(); facilitiesForShipGroup[shipGroup.shipGroupSeqId] = facilities; facilities.each { facility -> ownedFacilities[facility.facilityId] = facility; @@ -420,13 +417,13 @@ if (orderHeader) { } // list to find all the POSTAL_ADDRESS for the shipment party. - orderParty = delegator.findOne("Party", [partyId : partyId], false); + orderParty = from("Party").where("partyId", partyId).queryOne(); shippingContactMechList = ContactHelper.getContactMech(orderParty, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); context.shippingContactMechList = shippingContactMechList; // list to find all the shipmentMethods from the view named "ProductStoreShipmentMethView". if (productStore) { - context.productStoreShipmentMethList = delegator.findByAnd('ProductStoreShipmentMethView', [productStoreId: productStore.productStoreId], ['sequenceNumber'], true); + context.productStoreShipmentMethList = from("ProductStoreShipmentMethView").where("productStoreId", productStore.productStoreId).orderBy("sequenceNumber").cache(true).queryList(); } // Get a map of returnable items @@ -454,7 +451,7 @@ if (orderHeader) { } // list to find all the POSTAL_ADDRESS for the party. - orderParty = delegator.findOne("Party", [partyId : partyId], false); + orderParty = from("Party").where("partyId", partyId).queryOne(); postalContactMechList = ContactHelper.getContactMechByType(orderParty,"POSTAL_ADDRESS", false); context.postalContactMechList = postalContactMechList; @@ -477,11 +474,10 @@ context.paramString = paramString; workEffortStatus = null; if (workEffortId && assignPartyId && assignRoleTypeId && fromDate) { - fields = [workEffortId : workEffortId, partyId : assignPartyId, roleTypeId : assignRoleTypeId, fromDate : fromDate]; - wepa = delegator.findOne("WorkEffortPartyAssignment", fields, false); + wepa = from("WorkEffortPartyAssignment").where("workEffortId", workEffortId, "partyId", assignPartyId, "roleTypeId", assignRoleTypeId, "fromDate", fromDate).queryOne(); if ("CAL_ACCEPTED".equals(wepa?.statusId)) { - workEffort = delegator.findOne("WorkEffort", [workEffortId : workEffortId], false); + workEffort = from("WorkEffort").where("workEffortId", workEffortId).queryOne(); workEffortStatus = workEffort.currentStatusId; if (workEffortStatus) { context.workEffortStatus = workEffortStatus; @@ -491,8 +487,7 @@ if (workEffortId && assignPartyId && ass if (workEffort) { if ("true".equals(delegate) || "WF_RUNNING".equals(workEffortStatus)) { - actFields = [packageId : workEffort.workflowPackageId, packageVersion : workEffort.workflowPackageVersion, processId : workEffort.workflowProcessId, processVersion : workEffort.workflowProcessVersion, activityId : workEffort.workflowActivityId]; - activity = delegator.findOne("WorkflowActivity", actFields, false); + activity = from("WorkflowActivity").where("packageId", workEffort.workflowPackageId, "packageVersion", workEffort.workflowPackageVersion, "processId", workEffort.workflowProcessId, "processVersion", workEffort.workflowProcessVersion, "activityId", workEffort.workflowActivityId).queryOne(); if (activity) { transitions = activity.getRelated("FromWorkflowTransition", null, ["-transitionId"], false); context.wfTransitions = transitions; @@ -510,14 +505,10 @@ if (orderItems) { // getting online ship estimates corresponding to this Order from UPS when "Hold" button will be clicked, when user packs from weight package screen. // This case comes when order's shipping amount is more then or less than default percentage (defined in shipment.properties) of online UPS shipping amount. -condn = EntityCondition.makeCondition([ - EntityCondition.makeCondition("primaryOrderId", EntityOperator.EQUALS, orderId), - EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "SHIPMENT_PICKED")], - EntityOperator.AND); -shipments = delegator.findList("Shipment", condn, null, null, null, false); +shipments = from("Shipment").where("primaryOrderId", orderId, "statusId", "SHIPMENT_PICKED").queryList(); if (shipments) { pickedShipmentId = EntityUtil.getFirst(shipments).shipmentId; - shipmentRouteSegment = EntityUtil.getFirst(delegator.findList("ShipmentRouteSegment",EntityCondition.makeCondition([shipmentId : pickedShipmentId]), null, null, null, false)); + shipmentRouteSegment = from("ShipmentRouteSegment").where("shipmentId", pickedShipmentId).queryFirst(); context.shipmentRouteSegmentId = shipmentRouteSegment.shipmentRouteSegmentId; context.pickedShipmentId = pickedShipmentId; if (pickedShipmentId && shipmentRouteSegment.trackingIdNumber) { @@ -529,7 +520,7 @@ if (shipments) { shippingMethodAndRate = [:]; serviceCodes = shippingRate.keySet(); serviceCodes.each { serviceCode -> - carrierShipmentMethod = EntityUtil.getFirst(delegator.findByAnd("CarrierShipmentMethod", [partyId : "UPS", carrierServiceCode : serviceCode], null, false)); + carrierShipmentMethod = from("CarrierShipmentMethod").where("partyId", "UPS", "carrierServiceCode", serviceCode).queryFirst(); shipmentMethodTypeId = carrierShipmentMethod.shipmentMethodTypeId; rate = shippingRate.get(serviceCode); shipmentMethodDescription = EntityUtil.getFirst(carrierShipmentMethod.getRelated("ShipmentMethodType", null, null, false)).description; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy Mon Jan 5 08:50:30 2015 @@ -22,7 +22,7 @@ import org.ofbiz.entity.condition.*; import org.ofbiz.base.util.*; orderId = request.getParameter("orderId"); -paymentMethodTypes = delegator.findList("PaymentMethodType", EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.NOT_EQUAL, "EXT_OFFLINE"), null, null, null, false); +paymentMethodTypes = from("PaymentMethodType").where(EntityCondition.makeCondition("paymentMethodTypeId", EntityOperator.NOT_EQUAL, "EXT_OFFLINE")).queryList(); context.paymentMethodTypes = paymentMethodTypes; workEffortId = request.getParameter("workEffortId"); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy Mon Jan 5 08:50:30 2015 @@ -35,9 +35,9 @@ donePage = request.getParameter("DONE_PA context.donePage = donePage; // Provide the correct order confirmation ProductStoreEmailSetting, if one exists -orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false); +orderHeader = from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader.productStoreId) { - productStoreEmailSetting = delegator.findOne("ProductStoreEmailSetting", [productStoreId : orderHeader.productStoreId, emailType : emailType], true); + productStoreEmailSetting = from("ProductStoreEmailSetting").where("productStoreId", orderHeader.productStoreId, "emailType", emailType)context.queryOne(); if (productStoreEmailSetting) { context.productStoreEmailSetting = productStoreEmailSetting; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy Mon Jan 5 08:50:30 2015 @@ -33,7 +33,7 @@ shipGroupSeqId = parameters.shipGroupSeq findMap = [orderId: orderId]; if (shipGroupSeqId) findMap.shipGroupSeqId = shipGroupSeqId; -shipGroups = delegator.findByAnd("OrderItemShipGroup", findMap, ["shipGroupSeqId"], false); +shipGroups = from("OrderItemShipGroup").where(findMap).orderBy("shipGroupSeqId").queryList(); context.shipGroups = shipGroups; // method to expand the marketing packages @@ -90,7 +90,7 @@ shipGroups.each { shipGroup -> // the quantity shipped quantityShipped = 0.0; - issuances = delegator.findByAnd("ItemIssuance", [orderId : orderItem.orderId, orderItemSeqId : orderItem.orderItemSeqId, shipGroupSeqId : orderItemAssoc.shipGroupSeqId], null, false); + issuances = from("ItemIssuance").where("orderId", orderItem.orderId, "orderItemSeqId", orderItem.orderItemSeqId, "shipGroupSeqId", orderItemAssoc.shipGroupSeqId).queryList(); issuances.each { issuance -> quantityShipped += issuance.quantity; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy Mon Jan 5 08:50:30 2015 @@ -26,10 +26,10 @@ orderContentTypeId = request.getParamete order = null; if (orderId && !orderItemSeqId) { - order = delegator.findOne("OrderHeader", [orderId : orderId], false); + order = from("OrderHeader").where("orderId", orderId).queryOne(); } if (orderId && orderItemSeqId) { - order = delegator.findOne("OrderItem", [orderId : orderId, orderItemSeqId : orderItemSeqId], false); + order = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne(); } wrapper = OrderContentWrapper.makeOrderContentWrapper(order, request); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ManageQuotePrices.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ManageQuotePrices.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ManageQuotePrices.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ManageQuotePrices.groovy Mon Jan 5 08:50:30 2015 @@ -52,9 +52,7 @@ quoteItems.each { quoteItem -> try { if (currency && quoteItem.productId) { - productPrices = delegator.findByAnd("ProductPrice", [productId : quoteItem.productId, currencyUomId : currency, productPriceTypeId : "AVERAGE_COST"], null, false); - productPrices = EntityUtil.filterByDate(productPrices); - productPrice = EntityUtil.getFirst(productPrices); + productPrice = from("ProductPrice").where("productId", quoteItem.productId, "currencyUomId", currency, "productPriceTypeId", "AVERAGE_COST").filterByDate().queryFirst(); if (productPrice?.price != null) { averageCost = productPrice.price; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy Mon Jan 5 08:50:30 2015 @@ -22,6 +22,7 @@ import java.sql.Timestamp; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.util.EntityUtil; +import org.ofbiz.base.util.Debug; costMult = 0.0; quoteCoefficients.each { quoteCoefficient -> @@ -53,11 +54,10 @@ quoteItems.each { quoteItem -> try { if (currency && quoteItem.productId) { - productPrices = delegator.findByAnd("ProductPrice", [productId : quoteItem.productId, - currencyUomId : currency, - productPriceTypeId : "AVERAGE_COST"], null, false); - productPrices = EntityUtil.filterByDate(productPrices, issueDate); - productPrice = EntityUtil.getFirst(productPrices); + productPrice = from("ProductPrice") + .where(productId : quoteItem.productId, currencyUomId : currency, productPriceTypeId : "AVERAGE_COST") + .filterByDate(issueDate) + .queryFirst(); if (productPrice?.price != null) { averageCost = productPrice.price * selectedAmount; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.groovy Mon Jan 5 08:50:30 2015 @@ -46,7 +46,7 @@ if (thruOrderDate) { if (productStoreId) { conditions.add(EntityCondition.makeCondition("productStoreId", EntityOperator.EQUALS, productStoreId)); // for generating a title (given product store) - context.productStore = delegator.findOne("ProductStore", [productStoreId : productStoreId], true); + context.productStore = from("ProductStore").where("productStoreId", productStoreId).cache(true).queryOne(); } else { // for generating a title (all stores) TODO: use UtilProperties to internationalize context.productStore = [storeName : "All Stores"]; @@ -70,13 +70,13 @@ conditions.add(EntityCondition.makeCondi conditions.add(EntityCondition.makeCondition("orderItemStatusId", EntityOperator.NOT_EQUAL, "ITEM_REJECTED")); // get the results as an entity list iterator -allConditions = EntityCondition.makeCondition( conditions, EntityOperator.AND ); -fieldsToSelect = ["orderId", "orderDate", "productId", "quantityOrdered", "quantityIssued", "quantityOpen"] as Set; -fieldsToSelect.add("shipBeforeDate"); -fieldsToSelect.add("shipAfterDate"); -fieldsToSelect.add("itemDescription"); -findOptions = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true); -listIt = delegator.find("OrderItemQuantityReportGroupByItem", allConditions, null, fieldsToSelect, ["orderDate DESC"], findOptions); +listIt = select("orderId", "orderDate", "productId", "quantityOrdered", "quantityIssued", "quantityOpen", "shipBeforeDate", "shipAfterDate", "itemDescription") + .from("OrderItemQuantityReportGroupByItem") + .where(conditions) + .orderBy("orderDate DESC") + .cursorScrollInsensitive() + .distinct() + .queryIterator(); orderItemList = []; totalCostPrice = 0.0; totalListPrice = 0.0; @@ -96,10 +96,8 @@ listIt.each { listValue -> itemDescription = listValue.itemDescription; shipAfterDate = listValue.shipAfterDate; shipBeforeDate = listValue.shipBeforeDate; - fieldsToSelect = ["price","productPriceTypeId"] as Set; productIdCondExpr = [EntityCondition.makeCondition("productId", EntityOperator.EQUALS, productId)]; - prodPriceCond = EntityCondition.makeCondition(productIdCondExpr, EntityOperator.AND); - productPrices = delegator.findList("ProductPrice", prodPriceCond, fieldsToSelect, null, null, false); + productPrices = select("price","productPriceTypeId").from("ProductPrice").where(productIdCondExpr).queryList(); costPrice = 0.0; retailPrice = 0.0; listPrice = 0.0; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/request/RequestItemNotes.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/request/RequestItemNotes.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/request/RequestItemNotes.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/request/RequestItemNotes.groovy Mon Jan 5 08:50:30 2015 @@ -29,7 +29,7 @@ fields = [custRequestId : custRequestId] if (showAll.equals("false")) { fields.custRequestItemSeqId = custRequestItemSeqId; } -notes = delegator.findByAnd("CustRequestItemNoteView", fields, ["-noteDateTime"], false); +notes = from("CustRequestItemNoteView").where(fields).orderBy("-noteDateTime").queryList(); if (notes) { context.notes = notes; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/request/SetRequestQuote.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/request/SetRequestQuote.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/request/SetRequestQuote.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/request/SetRequestQuote.groovy Mon Jan 5 08:50:30 2015 @@ -22,8 +22,7 @@ import org.ofbiz.entity.util.EntityUtil; custRequestId = parameters.custRequestId; if (custRequestId) { - requestQuotes = delegator.findByAnd("QuoteItem", [custRequestId : custRequestId], null, false); - requestQuote = EntityUtil.getFirst(requestQuotes); + requestQuote = from("QuoteItem").where("custRequestId", custRequestId).queryFirst(); if (requestQuote) { context.quoteId = requestQuote.quoteId; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirements.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirements.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirements.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirements.groovy Mon Jan 5 08:50:30 2015 @@ -17,9 +17,9 @@ * under the License. */ -prepare = dispatcher.runSync("prepareFind", [inputFields : parameters, entityName : "Requirement"]); +prepare = runService('prepareFind', [inputFields : parameters, entityName : "Requirement"]); if (prepare.entityConditionList) { - results = dispatcher.runSync("getRequirementsForSupplier", [requirementConditions : prepare.entityConditionList, partyId : parameters.partyId]); + results = runService('getRequirementsForSupplier', [requirementConditions : prepare.entityConditionList, partyId : parameters.partyId]); context.requirementsForSupplier = results.requirementsForSupplier; context.quantityReport = [distinctProductCount : results.distinctProductCount, quantityTotal : results.quantityTotal, amountTotal : results.amountTotal]; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirementsByVendor.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirementsByVendor.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirementsByVendor.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirementsByVendor.groovy Mon Jan 5 08:50:30 2015 @@ -29,14 +29,11 @@ import org.ofbiz.entity.*; import org.ofbiz.entity.util.*; import org.ofbiz.entity.condition.*; -fields = ["partyId", "productId"] as Set; -options = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true); -orderBy = ["partyId"]; conditions = EntityCondition.makeCondition([ EntityCondition.makeCondition("roleTypeId", EntityOperator.EQUALS, "SUPPLIER"), EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "REQ_APPROVED"), EntityCondition.makeCondition("requirementTypeId", EntityOperator.EQUALS, "PRODUCT_REQUIREMENT"), EntityUtil.getFilterByDateExpr() ], EntityOperator.AND); -requirements = delegator.find("RequirementPartyProductCount", conditions, null, fields, orderBy, options); +requirements = select("partyId", "productId").from("RequirementPartyProductCount").where(conditions).orderBy("partyId").cursorScrollInsensitive().distinct().queryIterator(); context.requirements = requirements; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/SelectCreatedProposed.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/SelectCreatedProposed.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/SelectCreatedProposed.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/SelectCreatedProposed.groovy Mon Jan 5 08:50:30 2015 @@ -24,7 +24,7 @@ import org.ofbiz.entity.condition.Entity import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; -prepare = dispatcher.runSync("prepareFind", [inputFields : parameters, entityName : "Requirement"]); +prepare = runService('prepareFind', [inputFields : parameters, entityName : "Requirement"]); statusCondition = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "REQ_CREATED"), EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "REQ_PROPOSED")], @@ -35,5 +35,5 @@ if (prepare.entityConditionList) { } else { ecl = statusCondition; } -results = dispatcher.runSync("executeFind", [entityConditionList : ecl, entityName : "Requirement"]); +results = runService('executeFind', [entityConditionList : ecl, entityName : "Requirement"]); context.requirements = results.listIt; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/QuickReturn.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/QuickReturn.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/QuickReturn.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/QuickReturn.groovy Mon Jan 5 08:50:30 2015 @@ -36,16 +36,16 @@ if (partyId) { if (("VENDOR_RETURN").equals(returnHeaderTypeId)) { context.toPartyId = partyId; } - party = delegator.findOne("Party", [partyId : partyId], false); + party = from("Party").where("partyId", partyId).queryOne(); context.party = party; } -returnHeaders = delegator.findByAnd("ReturnHeader", [statusId : "RETURN_REQUESTED"], ["entryDate"], false); +returnHeaders = from("ReturnHeader").where("statusId", "RETURN_REQUESTED").queryList(); context.returnHeaders = returnHeaders; // put in the return to party information from the order header if (orderId) { - order = delegator.findOne("OrderHeader", [orderId : orderId], false); + order = from("OrderHeader").where("orderId", orderId).queryOne(); productStore = order.getRelatedOne("ProductStore", false); if (productStore) { if (("VENDOR_RETURN").equals(returnHeaderTypeId)) { @@ -64,37 +64,37 @@ if (orderId) { // payment method info if (partyId) { - creditCardList = EntityUtil.filterByDate(delegator.findByAnd("PaymentMethodAndCreditCard", [partyId : partyId], null, false)); + creditCardList = from("PaymentMethodAndCreditCard").where("partyId", partyId).filterByDate().queryList(); if (creditCardList) { context.creditCardList = creditCardList; } - eftAccountList = EntityUtil.filterByDate(delegator.findByAnd("PaymentMethodAndEftAccount", [partyId : partyId], null, false)); + eftAccountList = from("PaymentMethodAndEftAccount").where("partyId", partyId).filterByDate().queryList(); if (eftAccountList) { context.eftAccountList = eftAccountList; } } -returnTypes = delegator.findList("ReturnType", null, null, ["sequenceId"], null, false); +returnTypes = from("ReturnType").orderBy("sequenceId").queryList(); context.returnTypes = returnTypes; -returnReasons = delegator.findList("ReturnReason", null, null, ["sequenceId"], null, false); +returnReasons = from("ReturnReason").orderBy("sequenceId").queryList(); context.returnReasons = returnReasons; -itemStts = delegator.findByAnd("StatusItem", [statusTypeId : "INV_SERIALIZED_STTS"], ["sequenceId"], false); +itemStts = from("StatusItem").where("statusTypeId", "INV_SERIALIZED_STTS").orderBy("sequenceId").queryList(); context.itemStts = itemStts; typeMap = [:]; -returnItemTypeMap = delegator.findByAnd("ReturnItemTypeMap", [returnHeaderTypeId : returnHeaderTypeId], null, false); +returnItemTypeMap = from("ReturnItemTypeMap").where("returnHeaderTypeId", returnHeaderTypeId).queryList(); returnItemTypeMap.each { value -> typeMap[value.returnItemMapKey] = value.returnItemTypeId; } context.returnItemTypeMap = typeMap; if (orderId) { - returnRes = dispatcher.runSync("getReturnableItems", [orderId : orderId]); + returnRes = runService('getReturnableItems', [orderId : orderId]); context.returnableItems = returnRes.returnableItems; - orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false); + orderHeader = from("OrderHeader").where("orderId", orderId).queryOne(); context.orderHeader = orderHeader; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHeader.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHeader.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHeader.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHeader.groovy Mon Jan 5 08:50:30 2015 @@ -40,7 +40,7 @@ if (parameters.returnHeader) { returnId = parameters.returnId; } if (returnId) { - returnHeader = delegator.findOne("ReturnHeader", [returnId : returnId], false); + returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne(); if (returnHeader) { partyId = returnHeader.fromPartyId; toPartyId = parameters.toPartyId; @@ -54,16 +54,14 @@ context.returnId = returnId; //fin account info finAccounts = null; if (partyId) { - finAccounts = delegator.findByAnd("FinAccountAndRole", [partyId: partyId, finAccountTypeId: "STORE_CREDIT_ACCT", roleTypeId: "OWNER", statusId: "FNACT_ACTIVE"], null, false); - finAccounts = EntityUtil.filterByDate(finAccounts); + finAccounts = from("FinAccountAndRole").where("partyId", partyId, "finAccountTypeId", "STORE_CREDIT_ACCT", "roleTypeId", "OWNER", "statusId", "FNACT_ACTIVE").filterByDate().queryList(); } context.finAccounts = finAccounts; // billing account info billingAccountList = null; if (partyId) { - billingAccountList = delegator.findByAnd("BillingAccountAndRole", [partyId : partyId], null, false); - billingAccountList = EntityUtil.filterByDate(billingAccountList); + billingAccountList = from("BillingAccountAndRole").where("partyId", partyId).filterByDate().queryList(); } context.billingAccountList = billingAccountList; @@ -71,8 +69,8 @@ context.billingAccountList = billingAcco List creditCardList = null; List eftAccountList = null; if (partyId) { - creditCardList = EntityUtil.filterByDate(delegator.findByAnd("PaymentMethodAndCreditCard", [partyId : partyId], null, false)); - eftAccountList = EntityUtil.filterByDate(delegator.findByAnd("PaymentMethodAndEftAccount", [partyId : partyId], null, false)); + creditCardList = from("PaymentMethodAndCreditCard").where("partyId", partyId).filterByDate().queryList(); + eftAccountList = from("PaymentMethodAndEftAccount").where("partyId", partyId).filterByDate().queryList(); } context.creditCardList = creditCardList; context.eftAccountList = eftAccountList; @@ -80,9 +78,8 @@ context.eftAccountList = eftAccountList; orderRole = null; orderHeader = null; if (orderId) { - orderRoles = delegator.findByAnd("OrderRole", [orderId : orderId, roleTypeId : "BILL_TO_CUSTOMER"], null, false); - orderRole = EntityUtil.getFirst(orderRoles); - orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false); + orderRole = from("OrderRole").where("orderId", orderId, "roleTypeId", "BILL_TO_CUSTOMER").queryFirst(); + orderHeader = from("OrderHeader").where("orderId", orderId).queryOne(); } context.orderRole = orderRole; context.orderHeader = orderHeader; @@ -98,15 +95,15 @@ context.addresses = addresses; if (returnHeader) { contactMechTo = ContactMechWorker.getFacilityContactMechByPurpose(delegator, returnHeader.destinationFacilityId, ["PUR_RET_LOCATION", "SHIPPING_LOCATION", "PRIMARY_LOCATION"]); if (contactMechTo) { - postalAddressTo = delegator.findOne("PostalAddress", [contactMechId : contactMechTo.contactMechId], true); + postalAddressTo = from("PostalAddress").where("contactMechId", contactMechTo.contactMechId).cache(true).queryOne(); context.postalAddressTo = postalAddressTo; } - party = delegator.findOne("Party", [partyId : partyId], true); + party = from("Party").where("partyId", partyId).cache(true).queryOne(); if (party) { shippingContactMechList = ContactHelper.getContactMech(party, "SHIPPING_LOCATION", "POSTAL_ADDRESS", false); if (shippingContactMechList) { - context.postalAddressFrom = delegator.findOne("PostalAddress", [contactMechId : EntityUtil.getFirst(shippingContactMechList).contactMechId], true); + context.postalAddressFrom = from("PostalAddress").where("contactMechId", EntityUtil.getFirst(shippingContactMechList).contactMechId).cache(true).queryOne(); } } } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHistory.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHistory.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHistory.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHistory.groovy Mon Jan 5 08:50:30 2015 @@ -26,7 +26,7 @@ commonReturnHistoryCond = [EntityConditi EntityCondition.makeCondition("newValueText", EntityOperator.NOT_EQUAL, null), EntityCondition.makeCondition("oldValueText", EntityOperator.NOT_EQUAL, null)]; -returnHistoryList = delegator.findList("EntityAuditLog", EntityCondition.makeCondition(commonReturnHistoryCond, EntityOperator.AND), null, null, null, false); +returnHistoryList = from("EntityAuditLog").where(commonReturnHistoryCond).queryList(); orderReturnItemHistories = []; returnHistoryList.each { returnHistory -> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnItems.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnItems.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnItems.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnItems.groovy Mon Jan 5 08:50:30 2015 @@ -31,32 +31,32 @@ context.returnId = returnId; orderId = parameters.orderId; context.orderId = orderId; -returnHeader = delegator.findOne("ReturnHeader", [returnId : returnId], false); +returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne(); context.returnHeader = returnHeader; returnHeaderTypeId = returnHeader.returnHeaderTypeId; context.toPartyId = returnHeader.toPartyId; -returnItems = delegator.findByAnd("ReturnItem", [returnId : returnId], null, false); +returnItems = from("ReturnItem").where("returnId", returnId).queryList(); context.returnItems = returnItems; // these are just the adjustments not associated directly with a return item--the rest are gotten with a .getRelated on the returnItems in the .FTL -returnAdjustments = delegator.findByAnd("ReturnAdjustment", [returnId : returnId, returnItemSeqId : "_NA_"], ["returnItemSeqId", "returnAdjustmentTypeId"], false); +returnAdjustments = from("ReturnAdjustment").where("returnId", returnId, "returnItemSeqId", "_NA_").orderBy("returnItemSeqId", "returnAdjustmentTypeId").queryList(); context.returnAdjustments = returnAdjustments; -returnTypes = delegator.findList("ReturnType", null, null, ["sequenceId"], null, false); +returnTypes = from("ReturnType").orderBy("sequenceId").queryList(); context.returnTypes = returnTypes; -itemStatus = delegator.findByAnd("StatusItem", [statusTypeId : "INV_SERIALIZED_STTS"], ["statusId", "description"], false); +itemStatus = from("StatusItem").where("statusTypeId", "INV_SERIALIZED_STTS").orderBy("statusId", "description").queryList(); context.itemStatus = itemStatus; -returnReasons = delegator.findList("ReturnReason", null, null, ["sequenceId"], null, false); +returnReasons = from("ReturnReason").orderBy("sequenceId").queryList(); context.returnReasons = returnReasons; -itemStts = delegator.findByAnd("StatusItem", [statusTypeId : "INV_SERIALIZED_STTS"], ["sequenceId"], false); +itemStts = from("StatusItem").where("statusTypeId", "INV_SERIALIZED_STTS").orderBy("sequenceId").queryList(); context.itemStts = itemStts; -returnItemTypeMap = delegator.findByAnd("ReturnItemTypeMap", [returnHeaderTypeId : returnHeaderTypeId], null, false); +returnItemTypeMap = from("ReturnItemTypeMap").where("returnHeaderTypeId", returnHeaderTypeId).queryList(); typeMap = [:]; returnItemTypeMap.each { value -> typeMap[value.returnItemMapKey] = value.returnItemTypeId; @@ -64,8 +64,8 @@ returnItemTypeMap.each { value -> context.returnItemTypeMap = typeMap; if (orderId) { - order = delegator.findOne("OrderHeader", [orderId : orderId], false); - returnRes = dispatcher.runSync("getReturnableItems", [orderId : orderId]); + order = from("OrderHeader").where("orderId", orderId).queryOne(); + returnRes = runService('getReturnableItems', [orderId : orderId]); context.returnableItems = returnRes.returnableItems; orh = new OrderReadHelper(order); @@ -73,7 +73,7 @@ if (orderId) { context.orderHeaderAdjustments = orh.getAvailableOrderHeaderAdjustments(); // get the order shipping amount - shipRes = dispatcher.runSync("getOrderShippingAmount", [orderId : orderId]); + shipRes = runService('getOrderShippingAmount', [orderId : orderId]); shippingAmount = shipRes.shippingAmount; context.shippingAmount = shippingAmount; } @@ -83,12 +83,10 @@ if (returnHeaderTypeId == "VENDOR_RETURN roleTypeId = "BILL_FROM_VENDOR"; partyId = returnHeader.toPartyId; } -partyOrders = delegator.findByAnd("OrderHeaderAndRoles", [roleTypeId : roleTypeId, partyId : partyId], ["orderId"], false); +partyOrders = from("OrderHeaderAndRoles").where("roleTypeId", roleTypeId, "partyId", partyId).orderBy("orderId").queryList(); context.partyOrders = partyOrders; context.partyId = partyId; // get the list of return shipments associated to the return -findOptions = new EntityFindOptions(); -findOptions.setDistinct(true); -returnShipmentIds = delegator.findList("ReturnItemShipment", EntityCondition.makeCondition("returnId", returnId), ["shipmentId"] as Set, null, findOptions, true); +returnShipmentIds = select("shipmentId").from("ReturnItemShipment").where("returnId", returnId).distinct().cache(true).queryList(); context.returnShipmentIds = returnShipmentIds; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/setup/PaymentSetup.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/setup/PaymentSetup.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/setup/PaymentSetup.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/setup/PaymentSetup.groovy Mon Jan 5 08:50:30 2015 @@ -20,7 +20,7 @@ import org.ofbiz.entity.*; import org.ofbiz.base.util.*; -paymentSetup = delegator.findList("WebSitePaymentSettingView", null, null, ["webSiteId", "paymentMethodTypeId"], null, false); +paymentSetup = from("WebSitePaymentSettingView").orderBy("webSiteId", "paymentMethodTypeId").queryList(); context.paymentSetups = paymentSetup; webSiteId = parameters.webSiteId; @@ -28,14 +28,14 @@ paymentMethodTypeId = parameters.payment webSitePayment = null; if (webSiteId && paymentMethodTypeId) { - webSitePayment = delegator.findOne("WebSitePaymentSettingView", [webSiteId : webSiteId, paymentMethodTypeId : paymentMethodTypeId], false); + webSitePayment = from("WebSitePaymentSettingView").where("webSiteId", webSiteId, "paymentMethodTypeId", paymentMethodTypeId).queryOne(); } context.webSitePayment = webSitePayment; -webSites = delegator.findList("WebSite", null, null, ["siteName"], null, false); +webSites = from("WebSite").orderBy("siteName").queryList(); context.webSites = webSites; -paymentMethodTypes = delegator.findList("PaymentMethodType", null, null, ["description"], null, false); +paymentMethodTypes = from("PaymentMethodType").orderBy("description").queryList(); context.paymentMethodTypes = paymentMethodTypes; payInfo = UtilHttp.getParameterMap(request); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/task/OrderTaskList.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/task/OrderTaskList.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/task/OrderTaskList.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/task/OrderTaskList.groovy Mon Jan 5 08:50:30 2015 @@ -42,8 +42,7 @@ if (sort) { partyBase = [EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "CAL_ACCEPTED"), EntityCondition.makeCondition("wepaPartyId", EntityOperator.EQUALS, userLogin.partyId)]; partyRole = [EntityCondition.makeCondition("orderRoleTypeId", EntityOperator.EQUALS, "PLACING_CUSTOMER"), EntityCondition.makeCondition("orderRoleTypeId", EntityOperator.EQUALS, "SUPPLIER_AGENT")]; partyExpr = [EntityCondition.makeCondition(partyBase, EntityOperator.AND), EntityCondition.makeCondition(partyRole, EntityOperator.OR)]; -partyCond = EntityCondition.makeCondition(partyExpr, EntityOperator.AND); -partyTasks = delegator.findList("OrderTaskList", partyCond, null, sortOrder, null, false); +partyTasks = from("OrderTaskList").where(partyExpr).orderBy(sortOrder).queryList(); if (partyTasks) partyTasks = EntityUtil.filterByDate(partyTasks); context.partyTasks = partyTasks; @@ -51,12 +50,12 @@ context.partyTasks = partyTasks; // Build a map of orderId and currency orderCurrencyMap = [:]; partyTasks.each { ptItem -> - orderHeader = delegator.findOne("OrderHeader", [orderId : ptItem.orderId], false); + orderHeader = from("OrderHeader").where("orderId", ptItem.orderId).queryOne(); orderCurrencyMap[ptItem.orderId] = orderHeader.currencyUom; } // get this user's roles -partyRoles = delegator.findByAnd("PartyRole", [partyId : userLogin.partyId], null, false); +partyRoles = from("PartyRole").where("partyId", userLogin.partyId).queryList(); // build the role list pRolesList = []; @@ -71,17 +70,16 @@ expressions = []; expressions.add(EntityCondition.makeCondition(custList, EntityOperator.OR)); if (pRolesList) expressions.add(EntityCondition.makeCondition(pRolesList, EntityOperator.OR)); expressions.add(EntityCondition.makeCondition(baseList, EntityOperator.AND)); -conditions = EntityCondition.makeCondition(expressions, EntityOperator.AND); // invoke the query -roleTasks = delegator.findList("OrderTaskList", conditions, null, sortOrder, null, false); +roleTasks = from("OrderTaskList").where(expressions).orderBy(sortOrder).queryList(); roleTasks = EntityUtil.filterByAnd(roleTasks, baseList); roleTasks = EntityUtil.filterByDate(roleTasks); context.roleTasks = roleTasks; // Add to the map of orderId and currency roleTasks.each { rtItem -> - orderHeader = delegator.findOne("OrderHeader", [orderId : rtItem.orderId], false); + orderHeader = from("OrderHeader").where("orderId", rtItem.orderId).queryOne(); orderCurrencyMap[rtItem.orderId] = orderHeader.currencyUom; } context.orderCurrencyMap = orderCurrencyMap; @@ -89,7 +87,7 @@ context.orderCurrencyMap = orderCurrency context.now = nowTimestamp; // purchase order schedule -poList = delegator.findByAnd("OrderHeaderAndRoles", [partyId : userLogin.partyId, orderTypeId : "PURCHASE_ORDER"], null, false); +poList = from("OrderHeaderAndRoles").where("partyId", userLogin.partyId, "orderTypeId", "PURCHASE_ORDER").queryList(); poIter = poList.iterator(); listedPoIds = new HashSet(); while (poIter.hasNext()) { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/return/returnItems.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/return/returnItems.ftl?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/return/returnItems.ftl (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/return/returnItems.ftl Mon Jan 5 08:50:30 2015 @@ -94,7 +94,7 @@ under the License. </div> <div class="screenlet-body"> <!-- if we're called with loadOrderItems or createReturn, then orderId would exist --> -<#if !requestParameters.orderId??> +<#if !requestParameters.orderId?? && returnHeader?has_content> <form method="post" action="<@ofbizUrl>updateReturnItems</@ofbizUrl>"> <input type="hidden" name="_useRowSubmit" value="Y" /> <table cellspacing="0" class="basic-table"> @@ -386,13 +386,14 @@ under the License. </form> </#if> <!-- if no requestParameters.orderId??, then show list of items --> -<#else> - <#assign selectAllFormName = "returnItems"/> +<#elseif returnHeader?has_content> <form name="returnItems" method="post" action="<@ofbizUrl>createReturnItems</@ofbizUrl>"> <input type="hidden" name="returnId" value="${returnId}" /> <input type="hidden" name="_useRowSubmit" value="Y" /> <#include "returnItemInc.ftl"/> </form> +<#else> + ${uiLabelMap.CommonErrorMessage2} : ${uiLabelMap.CommonPleaseSelect}. ${uiLabelMap.CommonUseBackButton} </#if> </div> </div> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/entitydef/entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/entitydef/entitymodel.xml?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/entitydef/entitymodel.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/entitydef/entitymodel.xml Mon Jan 5 08:50:30 2015 @@ -1482,9 +1482,6 @@ under the License. <relation type="one" fk-name="PARTY_NEED_PCAT" rel-entity-name="ProductCategory"> <key-map field-name="productCategoryId"/> </relation> - <relation type="one" fk-name="PARTY_NEED_VSIT" rel-entity-name="Visit"> - <key-map field-name="visitId"/> - </relation> </entity> <!-- ========================================================= --> @@ -2013,9 +2010,6 @@ under the License. <relation type="one" fk-name="PARTY_DATSRC_DSC" rel-entity-name="DataSource"> <key-map field-name="dataSourceId"/> </relation> - <relation type="one" fk-name="PARTY_DATSRC_VST" rel-entity-name="Visit"> - <key-map field-name="visitId"/> - </relation> </entity> <entity entity-name="PartyGroup" package-name="org.ofbiz.party.party" @@ -2183,39 +2177,6 @@ under the License. <key-map field-name="partyId"/> </relation> </view-entity> - <view-entity entity-name="PartyNameVisitView" - package-name="org.ofbiz.party.party" - title="Party Name visit View Entity"> - <member-entity entity-alias="PTY" entity-name="Party"/> - <member-entity entity-alias="PER" entity-name="Person"/> - <member-entity entity-alias="PTYGRP" entity-name="PartyGroup"/> - <member-entity entity-alias="VISIT" entity-name="Visit"/> - <alias entity-alias="PTY" name="partyId"/> - <alias entity-alias="PTY" name="partyTypeId"/> - <alias entity-alias="PER" name="firstName"/> - <alias entity-alias="PER" name="middleName"/> - <alias entity-alias="PER" name="lastName"/> - <alias entity-alias="PER" name="firstNameLocal"/> - <alias entity-alias="PER" name="lastNameLocal"/> - <alias entity-alias="PER" name="personalTitle"/> - <alias entity-alias="PER" name="suffix"/> - <alias entity-alias="PTYGRP" name="groupName"/> - <alias entity-alias="PTYGRP" name="groupNameLocal"/> - <alias entity-alias="VISIT" name="webappName"/> - <alias entity-alias="VISIT" name="fromDate"/> - <view-link entity-alias="PTY" rel-entity-alias="PER" rel-optional="true"> - <key-map field-name="partyId"/> - </view-link> - <view-link entity-alias="PTY" rel-entity-alias="PTYGRP" rel-optional="true"> - <key-map field-name="partyId"/> - </view-link> - <view-link entity-alias="PTY" rel-entity-alias="VISIT" rel-optional="false"> - <key-map field-name="partyId"/> - </view-link> - <relation type="one-nofk" rel-entity-name="Party"> - <key-map field-name="partyId"/> - </relation> - </view-entity> <entity entity-name="PartyNote" package-name="org.ofbiz.party.party" title="Party Note Entity"> @@ -2899,25 +2860,9 @@ under the License. <field name="contactMechId" type="id"></field> <field name="partyId" type="id"></field> <field name="roleTypeId" type="id"></field> - <relation type="one" fk-name="VISIT_CONT_MECH" rel-entity-name="ContactMech"> - <key-map field-name="contactMechId"/> - </relation> - <relation type="one" fk-name="VISIT_PARTY" rel-entity-name="Party"> - <key-map field-name="partyId"/> - </relation> - <relation type="one" fk-name="VISIT_ROLE_TYPE" rel-entity-name="RoleType"> - <key-map field-name="roleTypeId"/> - </relation> - <relation type="one" fk-name="VISIT_PARTY_ROLE" rel-entity-name="PartyRole"> - <key-map field-name="partyId"/> - <key-map field-name="roleTypeId"/> - </relation> </extend-entity> <extend-entity entity-name="Visitor"> <field name="partyId" type="id"></field> - <relation type="one" fk-name="VISITOR_PARTY" rel-entity-name="Party"> - <key-map field-name="partyId"/> - </relation> </extend-entity> <extend-entity entity-name="UserLogin"> <field name="partyId" type="id"></field> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/test/PartyTests.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/test/PartyTests.xml?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/test/PartyTests.xml (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/script/org/ofbiz/party/test/PartyTests.xml Mon Jan 5 08:50:30 2015 @@ -149,6 +149,47 @@ under the License. <check-errors/> </simple-method> + <simple-method method-name="testEnsurePartyRole" short-description="A test to ensure the association between a party and a role" login-required="false"> + <set field="partyId" value="DemoCustomer"/> + <set field="roleTypeId" value="SUPPLIER"/> + <set field="serviceCtx.partyId" from-field="partyId"/> + <set field="serviceCtx.roleTypeId" from-field="roleTypeId"/> + <entity-one entity-name="UserLogin" value-field="userLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <entity-one entity-name="PartyRole" value-field="partyRole"/> + <assert> + <not><if-empty field="partyRole"/></not> + <if-compare-field field="partyRole.partyId" operator="equals" to-field="partyId"/> + <if-compare-field field="partyRole.roleTypeId" operator="equals" to-field="roleTypeId"/> + </assert> + <check-errors/> + <set field="serviceCtx.userLogin" from-field="userLogin"/> + <call-service service-name="ensurePartyRole" in-map-name="serviceCtx"/> + <entity-one entity-name="PartyRole" value-field="partyRole"/> + <assert> + <not><if-empty field="partyRole"/></not> + <if-compare-field field="partyRole.partyId" operator="equals" to-field="partyId"/> + <if-compare-field field="partyRole.roleTypeId" operator="equals" to-field="roleTypeId"/> + </assert> + <check-errors/> + <set field="roleTypeId" value="EMPLOYEE"/> + <set field="serviceCtx.roleTypeId" from-field="roleTypeId"/> + <entity-one entity-name="PartyRole" value-field="partyRole"/> + <assert> + <if-empty field="partyRole"/> + </assert> + <check-errors/> + <call-service service-name="ensurePartyRole" in-map-name="serviceCtx"/> + <entity-one entity-name="PartyRole" value-field="partyRole"/> + <assert> + <not><if-empty field="partyRole"/></not> + <if-compare-field field="partyRole.partyId" operator="equals" to-field="partyId"/> + <if-compare-field field="partyRole.roleTypeId" operator="equals" to-field="roleTypeId"/> + </assert> + <check-errors/> + </simple-method> + <simple-method method-name="testCreateNewCommEvent" short-description="test to create a new communication event" login-required="false"> <set field="createNewCommEventMap.communicationEventTypeId" value="EMAIL_COMMUNICATION"/> <set field="createNewCommEventMap.statusId" value="COM_ENTERED"/> Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/FindCommEventContactMechs.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/FindCommEventContactMechs.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/FindCommEventContactMechs.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/FindCommEventContactMechs.groovy Mon Jan 5 08:50:30 2015 @@ -32,12 +32,10 @@ partyIdTo = context.partyIdTo; if (parameters.communicationEventTypeId) { if ("EMAIL_COMMUNICATION".equals(parameters.communicationEventTypeId)) { - userEmailAddresses = delegator.findByAnd("PartyContactWithPurpose", [contactMechTypeId : "EMAIL_ADDRESS" , partyId : partyIdFrom], null, false); - userEmailAddresses = EntityUtil.filterByDate(userEmailAddresses, UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate", true); + userEmailAddresses = from("PartyContactWithPurpose").where("contactMechTypeId", "EMAIL_ADDRESS" , "partyId", partyIdFrom).filterByDate(UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate").queryList(); context.userEmailAddresses = userEmailAddresses; - targetEmailAddresses = delegator.findByAnd("PartyContactWithPurpose", [contactMechTypeId : "EMAIL_ADDRESS", partyId : partyIdTo], null, false); - targetEmailAddresses = EntityUtil.filterByDate(targetEmailAddresses, UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate", true); + targetEmailAddresses = from("PartyContactWithPurpose").where("contactMechTypeId", "EMAIL_ADDRESS", "partyId", partyIdTo).filterByDate(UtilDateTime.nowTimestamp(), "contactFromDate", "contactThruDate").queryList(); context.targetEmailAddresses = targetEmailAddresses; } } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/GetMyCommunicationEventRole.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/GetMyCommunicationEventRole.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/GetMyCommunicationEventRole.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/GetMyCommunicationEventRole.groovy Mon Jan 5 08:50:30 2015 @@ -22,11 +22,9 @@ import org.ofbiz.entity.util.EntityUtil; import org.ofbiz.base.component.ComponentConfig; if (parameters.communicationEventId) { - context.communicationEventRole = delegator.findOne("CommunicationEventRole", - ["communicationEventId" : parameters.communicationEventId, - "partyId" : parameters.partyId, - "roleTypeId" : parameters.roleTypeId - ], false); + context.communicationEventRole = from("CommunicationEventRole") + .where("communicationEventId", parameters.communicationEventId, "partyId", parameters.partyId, "roleTypeId", parameters.roleTypeId) + .queryOne(); context.projectMgrExists = ComponentConfig.componentExists("projectmgr"); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/ListCommunications.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/ListCommunications.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/ListCommunications.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/ListCommunications.groovy Mon Jan 5 08:50:30 2015 @@ -25,7 +25,7 @@ import javolution.util.FastList; partyId = parameters.partyId; context.partyId = partyId; -party = delegator.findOne("Party", [partyId : partyId], false); +party = from("Party").where("partyId", partyId).queryOne(); context.party = party; // get the sort field @@ -44,7 +44,7 @@ eventExprs.add(expr); expr = EntityCondition.makeCondition("partyIdFrom", EntityOperator.EQUALS, "partyId"); eventExprs.add(expr); ecl = EntityCondition.makeCondition(eventExprs, EntityOperator.OR); -events = delegator.findList("CommunicationEvent", ecl, null, [sortField], null, false); +events = from("CommunicationEvent").where(ecl).orderBy(sortField).queryList(); context.eventList = events; context.eventListSize = events.size(); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/getPartyEmailFromCommEventInfo.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/getPartyEmailFromCommEventInfo.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/getPartyEmailFromCommEventInfo.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/getPartyEmailFromCommEventInfo.groovy Mon Jan 5 08:50:30 2015 @@ -21,7 +21,7 @@ import org.ofbiz.base.util.*; import org.ofbiz.entity.util.EntityUtil; import javolution.util.FastList; -communicationEvent = delegator.findOne("CommunicationEvent", [communicationEventId : parameters.communicationEventId], true); +communicationEvent = from("CommunicationEvent").where("communicationEventId", parameters.communicationEventId).cache(true).queryOne(); if (!communicationEvent.note) return; nameString = "Sent from: "; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/recentVisitor.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/recentVisitor.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/recentVisitor.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/communication/recentVisitor.groovy Mon Jan 5 08:50:30 2015 @@ -17,12 +17,19 @@ * under the License. */ -import org.ofbiz.entity.* import org.ofbiz.entity.condition.*; import org.ofbiz.entity.util.* import org.ofbiz.base.util.*; lastDate = UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), -21); // should be there the last 3 weeks. -searchCondition = EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN, lastDate); -options = new EntityFindOptions(false, 0, 0,, true); -context.recentParties = delegator.findList("PartyNameVisitView", searchCondition, (Set)["partyId", "firstName", "middleName", "lastName", "groupName"], null, options, true); +visits = select('partyId') + .from('Visit') + .where(EntityCondition.makeCondition("fromDate", EntityOperator.GREATER_THAN, lastDate)) + .distinct() + .queryList() +partyIds = EntityUtil.getFieldListFromEntityList(visits, 'partyId', false) +context.recentParties = select("partyId", "firstName", "middleName", "lastName", "groupName") + .from("PartyNameView") + .where(EntityCondition.makeCondition('partyId', EntityOperator.IN, partyIds)) + .distinct() + .queryList(); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/EditContactMech.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/EditContactMech.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/EditContactMech.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/EditContactMech.groovy Mon Jan 5 08:50:30 2015 @@ -32,7 +32,7 @@ context.paymentMethodId = parameters.pay cmNewPurposeTypeId = parameters.contactMechPurposeTypeId; if (cmNewPurposeTypeId) { - contactMechPurposeType = delegator.findOne("ContactMechPurposeType", [contactMechPurposeTypeId : cmNewPurposeTypeId], false); + contactMechPurposeType = from("ContactMechPurposeType").where("contactMechPurposeTypeId", cmNewPurposeTypeId).queryOne(); if (contactMechPurposeType) { context.contactMechPurposeType = contactMechPurposeType; } else { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/EditShoppingList.groovy Mon Jan 5 08:50:30 2015 @@ -32,7 +32,7 @@ context.currencyUomId = currencyUomId; partyId = parameters.partyId ?:request.getAttribute("partyId"); -party = delegator.findOne("Party", [partyId : partyId], false); +party = from("Party").where("partyId", partyId).queryOne(); context.party = party; if (party) { context.lookupPerson = party.getRelatedOne("Person", false); @@ -43,18 +43,18 @@ shoppingListId = parameters.shoppingList //get the party for listid if it exists if (!partyId && shoppingListId) { - partyId = delegator.findOne("ShoppingList", [shoppingListId : shoppingListId], false).partyId; + partyId = from("ShoppingList").where("shoppingListId", shoppingListId).queryOne().partyId; } context.partyId = partyId; // get the top level shopping lists for the party -allShoppingLists = delegator.findByAnd("ShoppingList", [partyId : partyId], ["listName"], false); +allShoppingLists = from("ShoppingList").where("partyId", partyId).queryList(); shoppingLists = EntityUtil.filterByAnd(allShoppingLists, [parentShoppingListId : null]); context.allShoppingLists = allShoppingLists; context.shoppingLists = shoppingLists; // get all shoppingListTypes -shoppingListTypes = delegator.findList("ShoppingListType", null, null, ["description"], null, true); +shoppingListTypes = from("ShoppingListType").orderBy("description").cache(true).queryList(); context.shoppingListTypes = shoppingListTypes; // no passed shopping list id default to first list @@ -67,7 +67,7 @@ if (!shoppingListId) { // if we passed a shoppingListId get the shopping list info if (shoppingListId) { - shoppingList = delegator.findOne("ShoppingList", [shoppingListId : shoppingListId], false); + shoppingList = from("ShoppingList").where("shoppingListId", shoppingListId).queryOne(); context.shoppingList = shoppingList; context.shoppingListId = shoppingListId; @@ -83,8 +83,7 @@ if (shoppingListId) { product = shoppingListItem.getRelatedOne("Product", true); // DEJ20050704 not sure about calculating price here, will have some bogus data when not in a store webapp - calcPriceInMap = [product : product, quantity : shoppingListItem.quantity , currencyUomId : currencyUomId, userLogin : userLogin, productStoreId : shoppingList.productStoreId]; - calcPriceOutMap = dispatcher.runSync("calculateProductPrice", calcPriceInMap); + calcPriceOutMap = runService('calculateProductPrice', [product : product, quantity : shoppingListItem.quantity , currencyUomId : currencyUomId, userLogin : userLogin, productStoreId : shoppingList.productStoreId]); price = calcPriceOutMap.price; totalPrice = price * shoppingListItem.getDouble("quantity"); shoppingListItemTotal += totalPrice; @@ -124,7 +123,7 @@ if (shoppingListId) { context.shoppingListType = shoppingListType; // get the child shopping lists of the current list for the logged in user - childShoppingLists = delegator.findByAnd("ShoppingList", [partyId : partyId, parentShoppingListId : shoppingListId], ["listName"], true); + childShoppingLists = from("ShoppingList").where("partyId", partyId, "parentShoppingListId", shoppingListId).orderBy("listName").cache(true).queryList(); // now get prices for each child shopping list... if (childShoppingLists) { childShoppingListDatas = new ArrayList(childShoppingLists.size()); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/FindLookUp.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/FindLookUp.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/FindLookUp.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/FindLookUp.groovy Mon Jan 5 08:50:30 2015 @@ -19,17 +19,18 @@ import org.ofbiz.base.util.*; import org.ofbiz.entity.condition.*; +import org.ofbiz.entity.util.EntityUtilProperties; if (context.noConditionFind == null) { context.noConditionFind = parameters.noConditionFind; } if (context.noConditionFind == null) { - context.noConditionFind = UtilProperties.getPropertyValue("widget", "widget.defaultNoConditionFind"); + context.noConditionFind = EntityUtilProperties.getPropertyValue("widget", "widget.defaultNoConditionFind", delegator); } if (context.filterByDate == null) { context.filterByDate = parameters.filterByDate; } -prepareResult = dispatcher.runSync("prepareFind", [entityName : context.entityName, +prepareResult = runService('prepareFind', [entityName : context.entityName, orderBy : context.orderBy, inputFields : parameters, filterByDate : context.filterByDate, @@ -49,7 +50,7 @@ if (prepareResult.entityConditionList != entityConditionList = statusPartyDisable; } -executeResult = dispatcher.runSync("executeFind", [entityName : context.entityName, +executeResult = runService('executeFind', [entityName : context.entityName, orderByList : prepareResult.orderByList, entityConditionList : entityConditionList, noConditionFind :context.noConditionFind Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/FindMatches.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/FindMatches.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/FindMatches.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/FindMatches.groovy Mon Jan 5 08:50:30 2015 @@ -33,7 +33,7 @@ if (match) { postalCode = parameters.postalCode ?: null; if (state) { - context.currentStateGeo = delegator.findOne("Geo", [geoId : state], false); + context.currentStateGeo = from("Geo").where("geoId", state).queryOne(); } if (!firstName || !lastName || !address1 || !city || !postalCode) { Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetCurrentCart.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetCurrentCart.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetCurrentCart.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetCurrentCart.groovy Mon Jan 5 08:50:30 2015 @@ -21,8 +21,7 @@ import org.ofbiz.entity.util.EntityUtil; partyId = partyId ?: parameters.partyId; -savedCart = EntityUtil.getFirst(delegator.findByAnd("ShoppingList", [partyId : partyId, - shoppingListTypeId : "SLT_SPEC_PURP" , listName : "auto-save"], null, false)); +savedCart = from("ShoppingList").where("partyId", partyId, "shoppingListTypeId", "SLT_SPEC_PURP" , "listName", "auto-save").queryFirst(); if (savedCart) { context.savedCartListId = savedCart.shoppingListId; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetLoyaltyPoints.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetLoyaltyPoints.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetLoyaltyPoints.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetLoyaltyPoints.groovy Mon Jan 5 08:50:30 2015 @@ -23,13 +23,12 @@ partyId = parameters.partyId ? parameter if (partyId) { // get the system user - system = delegator.findOne("UserLogin", [userLoginId : "system"], false); + system = from("UserLogin").where("userLoginId", "system").queryOne(); monthsToInclude = 12; - Map serviceIn = UtilMisc.toMap("partyId", partyId, "roleTypeId", "PLACING_CUSTOMER", "orderTypeId", "SALES_ORDER", - "statusId", "ORDER_COMPLETED", "monthsToInclude", monthsToInclude, "userLogin", system); - Map result = dispatcher.runSync("getOrderedSummaryInformation", serviceIn); + Map result = runService('getOrderedSummaryInformation', ["partyId": partyId, "roleTypeId": "PLACING_CUSTOMER", "orderTypeId": "SALES_ORDER", + "statusId": "ORDER_COMPLETED", "monthsToInclude": monthsToInclude, "userLogin": system]); context.monthsToInclude = monthsToInclude; context.totalSubRemainingAmount = result.totalSubRemainingAmount; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy Mon Jan 5 08:50:30 2015 @@ -18,10 +18,7 @@ */ if (userLogin) { - companies = delegator.findByAnd("PartyRelationship", - [partyIdTo: userLogin.partyId, - roleTypeIdTo: "CONTACT", - roleTypeIdFrom: "ACCOUNT"], null, false); + companies = from("PartyRelationship").where(partyIdTo: userLogin.partyId, roleTypeIdTo: "CONTACT", roleTypeIdFrom: "ACCOUNT").queryList(); if (companies) { company = companies[0]; context.myCompanyId = company.partyIdFrom; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPaymentMethods.groovy Mon Jan 5 08:50:30 2015 @@ -27,7 +27,7 @@ showOld = "true".equals(parameters.SHOW_ currencyUomId = null; billingAccounts = []; if (partyId) { - billingAccountAndRoles = delegator.findByAnd("BillingAccountAndRole", [partyId : partyId]); + billingAccountAndRoles = from("BillingAccountAndRole").where("partyId", partyId).queryList(); if (billingAccountAndRoles) currencyUomId = billingAccountAndRoles.first().accountCurrencyUomId; if (currencyUomId) billingAccounts = BillingAccountWorker.makePartyBillingAccountList(userLogin, currencyUomId, partyId, delegator, dispatcher); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy Mon Jan 5 08:50:30 2015 @@ -35,7 +35,6 @@ actualCurrencyUomId = context.actualCurr if (!actualCurrencyUomId) { actualCurrencyUomId = context.defaultOrganizationPartyCurrencyUomId; } -findOpts = new EntityFindOptions(true, EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY, true); //get total/unapplied/applied invoices separated by sales/purch amount: totalInvSaApplied = BigDecimal.ZERO; totalInvSaNotApplied = BigDecimal.ZERO; @@ -59,7 +58,7 @@ invExprs = ],EntityOperator.OR) ],EntityOperator.AND); -invIterator = delegator.find("InvoiceAndType", invExprs, null, null, null, findOpts); +invIterator = from("InvoiceAndType").where(invExprs).cursorScrollInsensitive().distinct().queryIterator(); while (invoice = invIterator.next()) { if ("PURCHASE_INVOICE".equals(invoice.parentTypeId)) { @@ -99,7 +98,7 @@ payExprs = ], EntityOperator.OR) ], EntityOperator.AND); -payIterator = delegator.find("PaymentAndType", payExprs, null, null, null, findOpts); +payIterator = from("PaymentAndType").where(payExprs).cursorScrollInsensitive().distinct().queryIterator(); while (payment = payIterator.next()) { if ("DISBURSEMENT".equals(payment.parentTypeId) || "TAX_PAYMENT".equals(payment.parentTypeId)) { Propchange: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Jan 5 08:50:30 2015 @@ -2,3 +2,4 @@ /ofbiz/branches/dojo1.4/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy:951708-952957 /ofbiz/branches/jquery/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy:952958-1044489 /ofbiz/branches/multitenant20100310/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy:921280-927264 +/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/PartyFinancialHistory.groovy:1535158-1649475 |
Free forum by Nabble | Edit this page |