Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHeader.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHeader.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHeader.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHeader.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHistory.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHistory.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHistory.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnHistory.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnItems.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnItems.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnItems.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/ReturnItems.groovy Sat Dec 20 04:31:20 2014 @@ -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,7 +64,7 @@ returnItemTypeMap.each { value -> context.returnItemTypeMap = typeMap; if (orderId) { - order = delegator.findOne("OrderHeader", [orderId : orderId], false); + order = from("OrderHeader").where("orderId", orderId).queryOne(); returnRes = runService('getReturnableItems', [orderId : orderId]); context.returnableItems = returnRes.returnableItems; @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/setup/PaymentSetup.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/setup/PaymentSetup.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/setup/PaymentSetup.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/setup/PaymentSetup.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/task/OrderTaskList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/task/OrderTaskList.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/task/OrderTaskList.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/task/OrderTaskList.groovy Sat Dec 20 04:31:20 2014 @@ -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()) { |
Free forum by Nabble | Edit this page |