Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/InlineProductDetail.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/InlineProductDetail.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/InlineProductDetail.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/InlineProductDetail.groovy Sat Dec 20 04:31:20 2014 @@ -47,7 +47,7 @@ catalogName = CatalogWorker.getCatalogNa currentCatalogId = CatalogWorker.getCurrentCatalogId(request); if (inlineProductId) { - inlineProduct = delegator.findOne("Product", [productId : inlineProductId], true); + inlineProduct = from("Product").where("productId", inlineProductId).cache(true).queryOne(); if (inlineProduct) { context.product = inlineProduct; contentWrapper = new ProductContentWrapper(inlineProduct, request); @@ -176,7 +176,7 @@ if (inlineProduct) { if (variantTree) { featureOrder = new LinkedList(featureSet); featureOrder.each { featureKey -> - featureValue = delegator.findOne("ProductFeatureType", [productFeatureTypeId : featureKey], true); + featureValue = from("ProductFeatureType").where("productFeatureTypeId", featureKey).cache(true).queryOne(); fValue = featureValue.get("description") ?: featureValue.productFeatureTypeId; featureTypes[featureKey] = fValue; } Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy Sat Dec 20 04:31:20 2014 @@ -42,12 +42,11 @@ metaKeywords = null; // get the product entity if (productId) { - product = delegator.findOne("Product", [productId : productId], true); + product = from("Product").where("productId", productId).cache(true).queryOne(); if (product) { // first make sure this isn't a virtual-variant that has an associated virtual product, if it does show that instead of the variant if("Y".equals(product.isVirtual) && "Y".equals(product.isVariant)){ - virtualVariantProductAssocs = delegator.findByAnd("ProductAssoc", ["productId": productId, "productAssocTypeId": "ALTERNATIVE_PACKAGE"], ["-fromDate"], true); - virtualVariantProductAssocs = EntityUtil.filterByDate(virtualVariantProductAssocs); + virtualVariantProductAssocs = from("ProductAssoc").where("productId", productId, "productAssocTypeId", "ALTERNATIVE_PACKAGE").orderBy("-fromDate").filterByDate().cache(true).queryList(); if (virtualVariantProductAssocs) { productAssoc = EntityUtil.getFirst(virtualVariantProductAssocs); product = productAssoc.getRelatedOne("AssocProduct", true); @@ -59,20 +58,20 @@ if (productId) { virtualProductId = ProductWorker.getVariantVirtualId(product); if (virtualProductId) { productId = virtualProductId; - product = delegator.findOne("Product", [productId : productId], true); + product = from("Product").where("productId", productId).cache(true).queryOne(); } - productPageTitle = delegator.findByAnd("ProductContentAndInfo", [productId : productId, productContentTypeId : "PAGE_TITLE"], null, true); + productPageTitle = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "PAGE_TITLE").cache(true).queryList(); if (productPageTitle) { - pageTitle = delegator.findOne("ElectronicText", [dataResourceId : productPageTitle.get(0).dataResourceId], true); + pageTitle = from("ElectronicText").where("dataResourceId", productPageTitle.get(0).dataResourceId).cache(true).queryOne(); } - productMetaDescription = delegator.findByAnd("ProductContentAndInfo", [productId : productId, productContentTypeId : "META_DESCRIPTION"], null, true); + productMetaDescription = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "META_DESCRIPTION").cache(true).queryList(); if (productMetaDescription) { - metaDescription = delegator.findOne("ElectronicText", [dataResourceId : productMetaDescription.get(0).dataResourceId], true); + metaDescription = from("ElectronicText").where("dataResourceId", productMetaDescription.get(0).dataResourceId).cache(true).queryOne(); } - productMetaKeywords = delegator.findByAnd("ProductContentAndInfo", [productId : productId, productContentTypeId : "META_KEYWORD"], null, true); + productMetaKeywords = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "META_KEYWORD").cache(true).queryList(); if (productMetaKeywords) { - metaKeywords = delegator.findOne("ElectronicText", [dataResourceId : productMetaKeywords.get(0).dataResourceId], true); + metaKeywords = from("ElectronicText").where("dataResourceId", productMetaKeywords.get(0).dataResourceId).cache(true).queryOne(); } context.productId = productId; @@ -110,7 +109,7 @@ if (productId) { keywords = []; keywords.add(contentWrapper.get("PRODUCT_NAME")); keywords.add(catalogName); - members = delegator.findByAnd("ProductCategoryMember", [productId : productId], null, true); + members = from("ProductCategoryMember").where("productId", productId).cache(true).queryList(); members.each { member -> category = member.getRelatedOne("ProductCategory", true); if (category.description) { Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy Sat Dec 20 04:31:20 2014 @@ -83,8 +83,7 @@ if (!currencyUomId) currencyUomId = Enti if (userLogin) { exprList = [EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, userLogin.partyId), EntityCondition.makeCondition("listName", EntityOperator.NOT_EQUAL, "auto-save")]; - condition = EntityCondition.makeCondition(exprList, EntityOperator.AND); - allShoppingLists = delegator.findList("ShoppingList", condition, null, ["listName"], null, false); + allShoppingLists = from("ShoppingList").where(exprList).orderBy("listName").queryList(); context.shoppingLists = allShoppingLists; } @@ -222,12 +221,11 @@ if (product) { resultOutput = runService('getInventoryAvailableByFacility', [productId : productId, facilityId : facilityId, useCache : false]); totalAvailableToPromise = resultOutput.availableToPromiseTotal; if (totalAvailableToPromise) { - productFacility = delegator.findOne("ProductFacility", [productId : productId, facilityId : facilityId], true); + productFacility = from("ProductFacility").where("productId", productId, "facilityId", facilityId).cache(true).queryOne(); context.daysToShip = productFacility?.daysToShip } } else { - supplierProducts = delegator.findByAnd("SupplierProduct", [productId : productId], ["-availableFromDate"], true); - supplierProduct = EntityUtil.getFirst(supplierProducts); + supplierProduct = from("SupplierProduct").where("productId", productId).orderBy("-availableFromDate").cache(true).queryFirst(); if (supplierProduct?.standardLeadTimeDays) { standardLeadTimeDays = supplierProduct.standardLeadTimeDays; daysToShip = standardLeadTimeDays + 1; @@ -241,7 +239,7 @@ if (product) { context.disFeatureList = disFeatureList; // an example of getting features of a certain type to show - sizeProductFeatureAndAppls = delegator.findByAnd("ProductFeatureAndAppl", [productId : productId, productFeatureTypeId : "SIZE"], ["sequenceNum", "defaultSequenceNum"], false); + sizeProductFeatureAndAppls = from("ProductFeatureAndAppl").where("productId", productId, "productFeatureTypeId", "SIZE").orderBy("sequenceNum", "defaultSequenceNum").queryList(); context.sizeProductFeatureAndAppls = sizeProductFeatureAndAppls; // get product variant for Box/Case/Each @@ -249,7 +247,7 @@ if (product) { boolean isAlternativePacking = ProductWorker.isAlternativePacking(delegator, product.productId, null); mainProducts = []; if(isAlternativePacking){ - productVirtualVariants = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productIdTo", product.productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE"), null, true); + productVirtualVariants = from("ProductAssoc").where("productIdTo", product.productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE").cache(true).queryList(); if(productVirtualVariants){ productVirtualVariants.each { virtualVariantKey -> mainProductMap = [:]; @@ -300,7 +298,7 @@ if (product) { if (variantTree) { featureOrder = new LinkedList(featureSet); featureOrder.each { featureKey -> - featureValue = delegator.findOne("ProductFeatureType", [productFeatureTypeId : featureKey], true); + featureValue = from("ProductFeatureType").where("productFeatureTypeId", featureKey).cache(true).queryOne(); fValue = featureValue.get("description") ?: featureValue.productFeatureTypeId; featureTypes[featureKey] = fValue; } @@ -564,7 +562,7 @@ if (product) { availableInventory = resultOutput.availableToPromiseTotal; } else { //get last inventory count from product facility for the product - facilities = delegator.findList("ProductFacility", EntityCondition.makeCondition([productId : product.productId]), null, null, null, false) + facilities = from("ProductFacility").where("productId", product.productId).queryList(); if(facilities) { facilities.each { facility -> lastInventoryCount = facility.lastInventoryCount; @@ -639,7 +637,7 @@ if (product) { */ // get the DIGITAL_DOWNLOAD related Content records to show the contentName/description - downloadProductContentAndInfoList = delegator.findByAnd("ProductContentAndInfo", [productId : productId, productContentTypeId : "DIGITAL_DOWNLOAD"], null, true); + downloadProductContentAndInfoList = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "DIGITAL_DOWNLOAD").cache(true).queryList(); context.downloadProductContentAndInfoList = downloadProductContentAndInfoList; // not the best to save info in an action, but this is probably the best place to count a view; it is done async @@ -647,15 +645,14 @@ if (product) { //get product image from image management productImageList = []; - productContentAndInfoImageManamentList = delegator.findByAnd("ProductContentAndInfo", ["productId": productId, productContentTypeId : "IMAGE", "statusId" : "IM_APPROVED", "drIsPublic" : "Y"], ["sequenceNum"], false); + productContentAndInfoImageManamentList = from("ProductContentAndInfo").where("productId", productId, "productContentTypeId", "IMAGE", "statusId", "IM_APPROVED", "drIsPublic", "Y").orderBy("sequenceNum").queryList(); if(productContentAndInfoImageManamentList) { productContentAndInfoImageManamentList.each { productContentAndInfoImageManament -> - contentAssocThumbList = delegator.findByAnd("ContentAssoc", [contentId : productContentAndInfoImageManament.contentId, contentAssocTypeId : "IMAGE_THUMBNAIL"], null, false); - contentAssocThumb = EntityUtil.getFirst(contentAssocThumbList); + contentAssocThumb = from("ContentAssoc").where("contentId", productContentAndInfoImageManament.contentId, "contentAssocTypeId", "IMAGE_THUMBNAIL").queryFirst(); if(contentAssocThumb) { - imageContentThumb = delegator.findOne("Content", [contentId : contentAssocThumb.contentIdTo], false); + imageContentThumb = from("Content").where("contentId", contentAssocThumb.contentIdTo).queryOne(); if(imageContentThumb) { - productImageThumb = delegator.findOne("ContentDataResourceView", [contentId : imageContentThumb.contentId, drDataResourceId : imageContentThumb.dataResourceId], false); + productImageThumb = from("ContentDataResourceView").where("contentId", imageContentThumb.contentId, "drDataResourceId", imageContentThumb.dataResourceId).queryOne(); productImageMap = [:]; productImageMap.productImageThumb = productImageThumb.drObjectInfo; productImageMap.productImage = productContentAndInfoImageManament.drObjectInfo; @@ -672,15 +669,11 @@ if (product) { } // get product tags - productKeywords = delegator.findByAnd("ProductKeyword", ["productId": productId, "keywordTypeId" : "KWT_TAG", "statusId" : "KW_APPROVED"], null, false); + productKeywords = from("ProductKeyword").where("productId": productId, "keywordTypeId" : "KWT_TAG", "statusId" : "KW_APPROVED").queryList(); keywordMap = [:]; if (productKeywords) { for (productKeyword in productKeywords) { - keywordConds = [EntityCondition.makeCondition("keyword", EntityOperator.EQUALS, productKeyword.keyword), - EntityCondition.makeCondition("keywordTypeId", EntityOperator.EQUALS, "KWT_TAG"), - EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "KW_APPROVED")]; - keywordCond = EntityCondition.makeCondition(keywordConds, EntityOperator.AND); - productKeyWordCount = delegator.findCountByCondition("ProductKeyword", keywordCond, null, null); + productKeyWordCount = from("ProductKeyword").where("keyword", productKeyword.keyword, "keywordTypeId", "KWT_TAG", "statusId", "KW_APPROVED").queryCount(); keywordMap.put(productKeyword.keyword,productKeyWordCount); } context.productTags = keywordMap; Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy Sat Dec 20 04:31:20 2014 @@ -70,7 +70,7 @@ context.remove("totalPrice"); // get the product entity if (!product && productId) { - product = delegator.findOne("Product", [productId : productId], true); + product = from("Product").where("productId", productId).cache(true).queryOne(); } if (product) { //if order is purchase then don't calculate available inventory for product. @@ -78,14 +78,13 @@ if (product) { resultOutput = runService('getInventoryAvailableByFacility', [productId : product.productId, facilityId : facilityId, useCache : true]); totalAvailableToPromise = resultOutput.availableToPromiseTotal; if (totalAvailableToPromise && totalAvailableToPromise.doubleValue() > 0) { - productFacility = delegator.findOne("ProductFacility", [productId : product.productId, facilityId : facilityId], true); + productFacility = from("ProductFacility").where("productId", product.productId, "facilityId", facilityId).cache(true).queryOne(); if (productFacility?.daysToShip != null) { context.daysToShip = productFacility.daysToShip; } } } else { - supplierProducts = delegator.findByAnd("SupplierProduct", [productId : product.productId], ["-availableFromDate"], true); - supplierProduct = EntityUtil.getFirst(supplierProducts); + supplierProduct = from("SupplierProduct").where("productId", product.productId).orderBy("-availableFromDate").cache(true).queryFirst(); if (supplierProduct?.standardLeadTimeDays != null) { standardLeadTimeDays = supplierProduct.standardLeadTimeDays; daysToShip = standardLeadTimeDays + 1; @@ -142,7 +141,7 @@ if (product) { boolean isAlternativePacking = ProductWorker.isAlternativePacking(delegator, product.productId, null); mainProducts = []; if(isAlternativePacking){ - productVirtualVariants = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productIdTo", product.productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE"), null, true); + productVirtualVariants = from("ProductAssoc").where("productIdTo", product.productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE").cache(true).queryList(); if(productVirtualVariants){ productVirtualVariants.each { virtualVariantKey -> mainProductMap = [:]; @@ -223,7 +222,7 @@ if (reviews) { } // an example of getting features of a certain type to show -sizeProductFeatureAndAppls = delegator.findByAnd("ProductFeatureAndAppl", [productId : productId, productFeatureTypeId : "SIZE"], ["sequenceNum", "defaultSequenceNum"], true); +sizeProductFeatureAndAppls = from("ProductFeatureAndAppl").where("productId", productId, "productFeatureTypeId", "SIZE").orderBy("sequenceNum", "defaultSequenceNum").cache(true).queryList(); context.product = product; context.categoryId = categoryId; Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductUomDropDownOnly.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductUomDropDownOnly.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductUomDropDownOnly.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductUomDropDownOnly.groovy Sat Dec 20 04:31:20 2014 @@ -19,9 +19,9 @@ import org.ofbiz.base.util.*; -product = delegator.findOne("Product", UtilMisc.toMap("productId", parameters.productId), false); +product = from("Product").where("productId", parameters.productId).queryOne(); if (product) { - productVirtualVariants = delegator.findByAnd("ProductAssoc", UtilMisc.toMap("productIdTo", product.productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE"), null, true); + productVirtualVariants = from("ProductAssoc").where("productIdTo", product.productId , "productAssocTypeId", "ALTERNATIVE_PACKAGE").cache(true).queryList(); if(productVirtualVariants){ def mainProducts = []; productVirtualVariants.each { virtualVariantKey -> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/QuickAdd.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/QuickAdd.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/QuickAdd.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/QuickAdd.groovy Sat Dec 20 04:31:20 2014 @@ -45,6 +45,6 @@ if (categoryId) { context[key] = value; } } - productCategory = delegator.findOne("ProductCategory", ["productCategoryId" : categoryId], false); + productCategory = from("ProductCategory").where("productCategoryId", categoryId).queryOne(); context.productCategory = productCategory; } Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy Sat Dec 20 04:31:20 2014 @@ -26,7 +26,7 @@ import org.ofbiz.entity.util.EntityUtil; productId = request.getParameter("productId"); if (productId != null) { - product = delegator.findOne("Product", [productId : productId], false); + product = from("Product").where("productId", productId).queryOne(); prodAssocs = product.getRelated("MainProductAssoc", null, null, false); if (UtilValidate.isNotEmpty(prodAssocs)) { products = EntityUtil.filterByAnd(prodAssocs, [EntityCondition.makeCondition("productAssocTypeId", EntityOperator.NOT_EQUAL, "PRODUCT_VARIANT")]); @@ -36,8 +36,7 @@ if (productId != null) { products.each { product -> if (product != null) { String productIdTo = product.getString("productIdTo"); - prodAssocRecord = delegator.findByAnd("Product", [productId : productIdTo], null, false); - productList.add(EntityUtil.getFirst(prodAssocRecord)); + productList.add(from("Product").where("productId", productIdTo).queryFirst()); } } context.put("productList",productList); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy Sat Dec 20 04:31:20 2014 @@ -41,22 +41,22 @@ quoteId = parameters.quoteId; fromPartyId = parameters.fromPartyId; if (!orderHeader && orderId) { - orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false); + orderHeader = from("OrderHeader").where("orderId", orderId).queryOne(); } else if (shipmentId) { - shipment = delegator.findOne("Shipment", [shipmentId : shipmentId], false); + shipment = from("Shipment").where("shipmentId", shipmentId).queryOne(); orderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false); } if (!invoice && invoiceId) { - invoice = delegator.findOne("Invoice", [invoiceId : invoiceId], false); + invoice = from("Invoice").where("invoiceId", invoiceId).queryOne(); } if (!returnHeader && returnId) { - returnHeader = delegator.findOne("ReturnHeader", [returnId : returnId], false); + returnHeader = from("ReturnHeader").where("returnId", returnId).queryOne(); } if (quoteId) { - quote = delegator.findOne("Quote", [quoteId : quoteId], false); + quote = from("Quote").where("quoteId", quoteId).queryOne(); } // defaults: @@ -118,7 +118,7 @@ if (!partyId) { } // the logo -partyGroup = delegator.findOne("PartyGroup", [partyId : partyId], false); +partyGroup = from("PartyGroup").where("partyId", partyId).queryOne(); if (partyGroup) { partyContentWrapper = new PartyContentWrapper(dispatcher, partyGroup, locale, "text/html"); partyContent = partyContentWrapper.getFirstPartyContentByType(partyGroup.partyId , partyGroup, "LGOIMGURL", delegator); @@ -143,12 +143,13 @@ if (partyGroup?.groupName) { context.companyName = companyName; // the address -addresses = delegator.findByAnd("PartyContactWithPurpose", [partyId : partyId, contactMechPurposeTypeId : "GENERAL_LOCATION"], null, false); -addresses = EntityUtil.filterByDate(addresses, nowTimestamp, "contactFromDate", "contactThruDate", true); -addresses = EntityUtil.filterByDate(addresses, nowTimestamp, "purposeFromDate", "purposeThruDate", true); +addresses = from("PartyContactWithPurpose") + .where("partyId", partyId, "contactMechPurposeTypeId", "GENERAL_LOCATION") + .filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate") + .queryList(); address = null; if (addresses) { - address = delegator.findOne("PostalAddress", [contactMechId : addresses[0].contactMechId], false); + address = from("PostalAddress").where("contactMechId", addresses[0].contactMechId).queryOne(); } if (address) { // get the country name and state/province abbreviation @@ -164,30 +165,34 @@ if (address) { context.postalAddress = address; //telephone -phones = delegator.findByAnd("PartyContactWithPurpose", [partyId : partyId, contactMechPurposeTypeId : "PRIMARY_PHONE"], null, false); -phones = EntityUtil.filterByDate(phones, nowTimestamp, "contactFromDate", "contactThruDate", true); -phones = EntityUtil.filterByDate(phones, nowTimestamp, "purposeFromDate", "purposeThruDate", true); +phones = from("PartyContactWithPurpose") + .where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_PHONE") + .filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate") + .queryList(); if (phones) { - context.phone = delegator.findOne("TelecomNumber", [contactMechId : phones[0].contactMechId], false); + context.phone = from("TelecomNumber").where("contactMechId", phones[0].contactMechId).queryOne(); } // Fax -faxNumbers = delegator.findByAnd("PartyContactWithPurpose", [partyId : partyId, contactMechPurposeTypeId : "FAX_NUMBER"], null, false); -faxNumbers = EntityUtil.filterByDate(faxNumbers, nowTimestamp, "contactFromDate", "contactThruDate", true); -faxNumbers = EntityUtil.filterByDate(faxNumbers, nowTimestamp, "purposeFromDate", "purposeThruDate", true); +faxNumbers = from("PartyContactWithPurpose") + .where("partyId", partyId, "contactMechPurposeTypeId", "FAX_NUMBER") + .filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate") + .queryList(); if (faxNumbers) { - context.fax = delegator.findOne("TelecomNumber", [contactMechId : faxNumbers[0].contactMechId], false); + context.fax = from("TelecomNumber").where("contactMechId", faxNumbers[0].contactMechId).queryOne(); } -emails = delegator.findByAnd("PartyContactWithPurpose", [partyId : partyId, contactMechPurposeTypeId : "PRIMARY_EMAIL"], null, false); -emails = EntityUtil.filterByDate(emails, nowTimestamp, "contactFromDate", "contactThruDate", true); -emails = EntityUtil.filterByDate(emails, nowTimestamp, "purposeFromDate", "purposeThruDate", true); +emails = from("PartyContactWithPurpose") + .where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_EMAIL") + .filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate") + .queryList(); if (emails) { - context.email = delegator.findOne("ContactMech", [contactMechId : emails[0].contactMechId], false); + context.email = from("ContactMech").where("contactMechId", emails[0].contactMechId).queryOne(); } else { //get email address from party contact mech - contacts = delegator.findByAnd("PartyContactMech", [partyId : partyId], null, false); - selContacts = EntityUtil.filterByDate(contacts, nowTimestamp, "fromDate", "thruDate", true); + selContacts = from("PartyContactMech") + .where("partyId", partyId).filterByDate(nowTimestamp, "fromDate", "thruDate") + .queryList(); if (selContacts) { i = selContacts.iterator(); while (i.hasNext()) { @@ -201,15 +206,18 @@ if (emails) { } // website -websiteUrls = delegator.findByAnd("PartyContactWithPurpose", [partyId : partyId, contactMechPurposeTypeId : "PRIMARY_WEB_URLs"], null, false); -websiteUrls = EntityUtil.filterByDate(websiteUrls, nowTimestamp, "contactFromDate", "contactThruDate", true); -websiteUrls = EntityUtil.filterByDate(websiteUrls, nowTimestamp, "purposeFromDate", "purposeThruDate", true); +websiteUrls = from("PartyContactWithPurpose") + .where("partyId", partyId, "contactMechPurposeTypeId", "PRIMARY_WEB_URLs") + .filterByDate("contactFromDate", "contactThruDate", "purposeFromDate", "purposeThruDate") + .queryList(); if (websiteUrls) { websiteUrl = EntityUtil.getFirst(websiteUrls); - context.website = delegator.findOne("ContactMech", [contactMechId : websiteUrl.contactMechId], false); + context.website = from("ContactMech").where("contactMechId", websiteUrl.contactMechId).queryOne(); } else { //get web address from party contact mech -contacts = delegator.findByAnd("PartyContactMech", [partyId : partyId], null, false); -selContacts = EntityUtil.filterByDate(contacts, nowTimestamp, "fromDate", "thruDate", true); +selContacts = from("PartyContactMech") + .where("partyId", partyId) + .filterByDate(nowTimestamp, "fromDate", "thruDate") + .queryList(); if (selContacts) { Iterator i = selContacts.iterator(); while (i.hasNext()) { @@ -223,14 +231,16 @@ if (selContacts) { } //Bank account -paymentMethods = delegator.findByAnd("PaymentMethod", [partyId : partyId, paymentMethodTypeId : "EFT_ACCOUNT"], null, false); -selPayments = EntityUtil.filterByDate(paymentMethods, nowTimestamp, "fromDate", "thruDate", true); +selPayments = from("PaymentMethod") + .where("partyId", partyId, "paymentMethodTypeId", "EFT_ACCOUNT") + .filterByDate(nowTimestamp, "fromDate", "thruDate") + .queryList(); if (selPayments) { - context.eftAccount = delegator.findOne("EftAccount", [paymentMethodId : selPayments[0].paymentMethodId], false); + context.eftAccount = from("EftAccount").where("paymentMethodId", selPayments[0].paymentMethodId).queryOne(); } // Tax ID Info -partyTaxAuthInfoList = delegator.findByAnd("PartyTaxAuthInfo", [partyId : partyId], null, false); +partyTaxAuthInfoList = from("PartyTaxAuthInfo").where("partyId", partyId).queryList(); if (partyTaxAuthInfoList) { if (address.countryGeoId) { // if we have an address with country filter by that Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy Sat Dec 20 04:31:20 2014 @@ -26,72 +26,72 @@ import org.ofbiz.entity.util.*; module = "FindOrders.groovy"; // get the order types -orderTypes = delegator.findList("OrderType", null, null, ["description"], null, false); +orderTypes = from("OrderType").orderBy("description").queryList(); context.orderTypes = orderTypes; // get the role types -roleTypes = delegator.findList("RoleType", null, null, ["description"], null, false); +roleTypes = from("RoleType").orderBy("description").queryList(); context.roleTypes = roleTypes; // get the order statuses -orderStatuses = delegator.findByAnd("StatusItem", [statusTypeId : "ORDER_STATUS"], ["sequenceId", "description"], false); +orderStatuses = from("StatusItem").where("statusTypeId", "ORDER_STATUS").orderBy("sequenceId", "description").queryList(); context.orderStatuses = orderStatuses; // get websites -websites = delegator.findList("WebSite", null, null, ["siteName"], null, false); +websites = from("WebSite").orderBy("siteName").queryList(); context.webSites = websites; // get the stores -stores = delegator.findList("ProductStore", null, null, ["storeName"], null, false); +stores = from("ProductStore").orderBy("storeName").queryList(); context.productStores = stores; // get the channels -channels = delegator.findByAnd("Enumeration", [enumTypeId : "ORDER_SALES_CHANNEL"], ["sequenceId"], false); +channels = from("Enumeration").where("enumTypeId", "ORDER_SALES_CHANNEL").orderBy("sequenceId").queryList(); context.salesChannels = channels; // get the Shipping Methods -carrierShipmentMethods = delegator.findList("CarrierShipmentMethod", null, null, null, null, false); +carrierShipmentMethods = from("CarrierShipmentMethod").queryList(); context.carrierShipmentMethods = carrierShipmentMethods; // get the Payment Status -paymentStatusList = delegator.findByAnd("StatusItem", [statusTypeId : "PAYMENT_PREF_STATUS"], ["description"], false); +paymentStatusList = from("StatusItem").where("statusTypeId", "PAYMENT_PREF_STATUS").orderBy("description").queryList(); context.paymentStatusList = paymentStatusList; // get the good identification types -goodIdentificationTypes = delegator.findList("GoodIdentificationType", null, null, ["goodIdentificationTypeId", "description"], null, false); +goodIdentificationTypes = from("GoodIdentificationType").orderBy("goodIdentificationTypeId", "description").queryList(); context.goodIdentificationTypes = goodIdentificationTypes; // current role type currentRoleTypeId = request.getParameter("roleTypeId"); if (currentRoleTypeId) { - currentRole = delegator.findOne("RoleType", [roleTypeId : currentRoleTypeId], true); + currentRole = from("RoleType").where("roleTypeId", currentRoleTypeId).cache(true).queryOne(); context.currentRole = currentRole; } // current selected type currentTypeId = request.getParameter("orderTypeId"); if (currentTypeId) { - currentType = delegator.findOne("OrderType", [orderTypeId : currentTypeId], true); + currentType = from("OrderType").where("orderTypeId", currentTypeId).cache(true).queryOne(); context.currentType = currentType; } // current selected status currentStatusId = request.getParameter("orderStatusId"); if (currentStatusId) { - currentStatus = delegator.findOne("StatusItem", [statusId : currentStatusId], true); + currentStatus = from("StatusItem").where("statusId", currentStatusId).cache(true).queryOne(); context.currentStatus = currentStatus; } // current website currentWebSiteId = request.getParameter("orderWebSiteId"); if (currentWebSiteId) { - currentWebSite = delegator.findOne("WebSite", [webSiteId : currentWebSiteId], true); + currentWebSite = from("WebSite").where("webSiteId", currentWebSiteId).cache(true).queryOne(); context.currentWebSite = currentWebSite; } // current store currentProductStoreId = request.getParameter("productStoreId"); if (currentProductStoreId) { - currentProductStore = delegator.findOne("ProductStore", [productStoreId : currentProductStoreId], true); + currentProductStore = from("ProductStore").where("productStoreId", currentProductStoreId).cache(true).queryOne(); context.currentProductStore = currentProductStore; } @@ -101,7 +101,7 @@ if (shipmentMethod) { carrierPartyId = shipmentMethod.substring(0, shipmentMethod.indexOf("@")); shipmentMethodTypeId = shipmentMethod.substring(shipmentMethod.indexOf("@")+1); if (carrierPartyId && shipmentMethodTypeId) { - currentCarrierShipmentMethod = EntityUtil.getFirst(delegator.findByAnd("CarrierShipmentMethod", [partyId : carrierPartyId, shipmentMethodTypeId : shipmentMethodTypeId], null, false)); + currentCarrierShipmentMethod = from("CarrierShipmentMethod").where("partyId", carrierPartyId, "shipmentMethodTypeId", shipmentMethodTypeId).queryFirst(); context.currentCarrierShipmentMethod = currentCarrierShipmentMethod; } } @@ -109,14 +109,14 @@ if (shipmentMethod) { // current channel currentSalesChannelId = request.getParameter("salesChannelEnumId"); if (currentSalesChannelId) { - currentSalesChannel = delegator.findOne("Enumeration", [enumId : currentSalesChannelId], false); + currentSalesChannel = from("Enumeration").where("enumId", currentSalesChannelId).queryOne(); context.currentSalesChannel = currentSalesChannel; } // current good identification type currentGoodIdentificationTypeId = request.getParameter("goodIdentificationTypeId"); if (currentGoodIdentificationTypeId) { - currentGoodIdentificationType = delegator.findByPrimaryKey("GoodIdentificationType", ["goodIdentificationTypeId" : currentGoodIdentificationTypeId]); + currentGoodIdentificationType = from("GoodIdentificationType").where("goodIdentificationTypeId", currentGoodIdentificationTypeId).queryOne(); context.currentGoodIdentificationType = currentGoodIdentificationType; } Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy Sat Dec 20 04:31:20 2014 @@ -23,13 +23,13 @@ import org.ofbiz.widget.html.*; orderId = request.getParameter("orderId"); orderTypeId = null; -orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false); +orderHeader = from("OrderHeader").where("orderId", orderId).queryOne(); if (orderHeader) { orderTypeId = orderHeader.orderTypeId; } //Determine whether a schedule has already been defined for this PO -schedule = delegator.findOne("OrderDeliverySchedule", [orderId : orderId, orderItemSeqId : "_NA_"], false); +schedule = from("OrderDeliverySchedule").where("orderId", orderId, "orderItemSeqId", "_NA_").queryOne(); // Determine whether the current user can VIEW the order checkResult = runService('checkSupplierRelatedOrderPermission', [orderId : orderId, userLogin : session.getAttribute("userLogin"), checkAction : "VIEW"]); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderHistory.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderHistory.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderHistory.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderHistory.groovy Sat Dec 20 04:31:20 2014 @@ -25,25 +25,25 @@ context.orderId = orderId; orderHeader = null; if (orderId) { - orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false); + orderHeader = from("OrderHeader").where(orderId : orderId).queryOne(); } if (orderHeader) { shipmentMethodCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItemShipGroup"), EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "shipmentMethodTypeId"), EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]; - shipmentMethodHistories = delegator.findList("EntityAuditLog", EntityCondition.makeCondition(shipmentMethodCond, EntityOperator.AND), null, ["-changedDate"], null, false); + shipmentMethodHistories = from("EntityAuditLog").where(shipmentMethodCond).orderBy("-changedDate").queryList(); carrierPartyCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItemShipGroup"), EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "carrierPartyId"), EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]; - carrierPartyHistories = delegator.findList("EntityAuditLog", EntityCondition.makeCondition(carrierPartyCond, EntityOperator.AND), null, null, null, false); + carrierPartyHistories = from("EntityAuditLog").where(carrierPartyCond).queryList(); orderShipmentHistories = []; shipmentMethodHistories.each { shipmentMethodHistory -> orderShipmentHistory = [:]; if ("shipmentMethodTypeId".equals(shipmentMethodHistory.changedFieldName)) { - shipmentMethodType = delegator.findOne("ShipmentMethodType", ["shipmentMethodTypeId" : shipmentMethodHistory.newValueText], false); + shipmentMethodType = from("ShipmentMethodType").where("shipmentMethodTypeId", shipmentMethodHistory.newValueText).queryOne(); if (shipmentMethodType != null){ carrierPartyHistories.each { carrierPartyHistory -> if (carrierPartyHistory.lastUpdatedTxStamp == shipmentMethodHistory.lastUpdatedTxStamp) { @@ -66,13 +66,13 @@ if (orderHeader) { changedByInfoCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItem"), EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "changeByUserLoginId"), EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]; - changedByInfoHistories = delegator.findList("EntityAuditLog", EntityCondition.makeCondition(changedByInfoCond, EntityOperator.AND), null, ["-changedDate"], null, false); + changedByInfoHistories = from("EntityAuditLog").where(changedByInfoCond).orderBy("-changedDate").queryList(); orderUnitPriceHistories = []; unitPriceCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItem"), EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "unitPrice"), EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]; - unitPriceHistories = delegator.findList("EntityAuditLog", EntityCondition.makeCondition(unitPriceCond, EntityOperator.AND), null, ["-changedDate"], null, false); + unitPriceHistories = from("EntityAuditLog").where(unitPriceCond).orderBy("-changedDate").queryList(); unitPriceHistories.each { unitPriceHistory -> orderUnitPriceHistory = [:]; if ((unitPriceHistory.oldValueText) && (unitPriceHistory.newValueText)) { @@ -81,7 +81,7 @@ if (orderHeader) { orderUnitPriceHistory.newValue = unitPriceHistory.newValueText; orderUnitPriceHistory.changedDate = unitPriceHistory.changedDate; orderItemSeqId = (unitPriceHistory.pkCombinedValueText).substring((unitPriceHistory.pkCombinedValueText).indexOf("::") + 2, (unitPriceHistory.pkCombinedValueText).length()); - orderItem = delegator.findOne("OrderItem", [orderId : orderId, orderItemSeqId : orderItemSeqId], false); + orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne(); orderUnitPriceHistory.productId = orderItem.productId; changedByInfoHistories.each { changedByInfoHistory -> if (changedByInfoHistory.lastUpdatedTxStamp == unitPriceHistory.lastUpdatedTxStamp) { @@ -102,7 +102,7 @@ if (orderHeader) { quantityCond = [EntityCondition.makeCondition("changedEntityName", EntityOperator.EQUALS, "OrderItem"), EntityCondition.makeCondition("changedFieldName", EntityOperator.EQUALS, "quantity"), EntityCondition.makeCondition("pkCombinedValueText", EntityOperator.LIKE, orderId + "%")]; - quantityHistories = delegator.findList("EntityAuditLog", EntityCondition.makeCondition(quantityCond, EntityOperator.AND), null, ["-changedDate"], null, false); + quantityHistories = from("EntityAuditLog").where(quantityCond).orderBy("-changedDate").queryList(); quantityHistories.each { quantityHistory -> orderQuantityHistory = [:]; if ((quantityHistory.oldValueText) && (quantityHistory.newValueText)) { @@ -111,7 +111,7 @@ if (orderHeader) { orderQuantityHistory.newValue = quantityHistory.newValueText; orderQuantityHistory.changedDate = quantityHistory.changedDate; orderItemSeqId = (quantityHistory.pkCombinedValueText).substring((quantityHistory.pkCombinedValueText).indexOf("::") + 2, (quantityHistory.pkCombinedValueText).length()); - orderItem = delegator.findOne("OrderItem", [orderId : orderId, orderItemSeqId : orderItemSeqId], false); + orderItem = from("OrderItem").where("orderId", orderId, "orderItemSeqId", orderItemSeqId).queryOne(); orderQuantityHistory.productId = orderItem.productId; changedByInfoHistories.each { changedByInfoHistory -> if (changedByInfoHistory.lastUpdatedTxStamp == quantityHistory.lastUpdatedTxStamp) { Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy Sat Dec 20 04:31:20 2014 @@ -50,7 +50,7 @@ orderHeaderList = state.getOrders(facili context.orderHeaderList = orderHeaderList; // a list of order type descriptions -ordertypes = delegator.findList("OrderType", null, null, null, null, true); +ordertypes = from("OrderType").cache(true).queryList(); ordertypes.each { type -> context["descr_" + type.orderTypeId] = type.get("description",locale); } Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy Sat Dec 20 04:31:20 2014 @@ -58,7 +58,7 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, dayBegin), EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN_EQUAL_TO, dayEnd)], EntityOperator.AND); -dayList = delegator.findList("OrderStatus", ecl, null, null, null, false); +dayList = from("OrderStatus").where(ecl).queryList(); context.dayOrder = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_CREATED"]); context.dayApprove = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_APPROVED"]); context.dayComplete = EntityUtil.filterByAnd(dayList, [statusId : "ORDER_COMPLETED"]); @@ -71,7 +71,7 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, weekBegin), EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN_EQUAL_TO, weekEnd)], EntityOperator.AND); -weekList = delegator.findList("OrderStatus", ecl, null, null, null, false); +weekList = from("OrderStatus").where(ecl).queryList(); context.weekOrder = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_CREATED"]); context.weekApprove = EntityUtil.filterByAnd(weekList, [statusId: "ORDER_APPROVED"]); context.weekComplete = EntityUtil.filterByAnd(weekList, [statusId : "ORDER_COMPLETED"]); @@ -84,7 +84,7 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, monthBegin), EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN_EQUAL_TO, monthEnd)], EntityOperator.AND); -monthList = delegator.findList("OrderStatus", ecl, null, null, null, false); +monthList = from("OrderStatus").where(ecl).queryList(); context.monthOrder = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_CREATED"]); context.monthApprove = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_APPROVED"]); context.monthComplete = EntityUtil.filterByAnd(monthList, [statusId : "ORDER_COMPLETED"]); @@ -97,7 +97,7 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("statusDatetime", EntityOperator.GREATER_THAN_EQUAL_TO, yearBegin), EntityCondition.makeCondition("statusDatetime", EntityOperator.LESS_THAN_EQUAL_TO, yearEnd)], EntityOperator.AND); -yearList = delegator.findList("OrderStatus", ecl, null, null, null, false); +yearList = from("OrderStatus").where(ecl).queryList(); context.yearOrder = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_CREATED"]); context.yearApprove = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_APPROVED"]); context.yearComplete = EntityUtil.filterByAnd(yearList, [statusId : "ORDER_COMPLETED"]); @@ -112,7 +112,7 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, dayEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -dayItems = delegator.findList("OrderHeaderAndItems", ecl, null, null, null, false); +dayItems = from("OrderHeaderAndItems").where(ecl).queryList(); dayItemsPending = EntityUtil.filterByAnd(dayItems, [itemStatusId : "ITEM_ORDERED"]); ecl = EntityCondition.makeCondition([ @@ -122,7 +122,7 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, dayEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -dayHeaders = delegator.findList("OrderHeader", ecl, null, null, null, false); +dayHeaders = from("OrderHeader").where(ecl).queryList(); dayHeadersPending = EntityUtil.filterByAnd(dayHeaders, [statusId : "ORDER_CREATED"]); dayItemTotal = calcItemTotal(dayHeaders); @@ -145,7 +145,7 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, weekEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -weekItems = delegator.findList("OrderHeaderAndItems", ecl, null, null, null, false); +weekItems = from("OrderHeaderAndItems").where(ecl).queryList(); weekItemsPending = EntityUtil.filterByAnd(weekItems, [itemStatusId : "ITEM_ORDERED"]); ecl = EntityCondition.makeCondition([ @@ -155,7 +155,7 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, weekEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -weekHeaders = delegator.findList("OrderHeader", ecl, null, null, null, false); +weekHeaders = from("OrderHeader").where(ecl).queryList(); weekHeadersPending = EntityUtil.filterByAnd(weekHeaders, [statusId : "ORDER_CREATED"]); weekItemTotal = calcItemTotal(weekHeaders); @@ -178,7 +178,7 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, monthEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -monthItems = delegator.findList("OrderHeaderAndItems", ecl, null, null, null, false); +monthItems = from("OrderHeaderAndItems").where(ecl).queryList() monthItemsPending = EntityUtil.filterByAnd(monthItems, [itemStatusId : "ITEM_ORDERED"]); ecl = EntityCondition.makeCondition([ @@ -188,7 +188,7 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, monthEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -monthHeaders = delegator.findList("OrderHeader", ecl, null, null, null, false); +monthHeaders = from("OrderHeader").where(ecl).queryList(); monthHeadersPending = EntityUtil.filterByAnd(monthHeaders, [statusId : "ORDER_CREATED"]); monthItemTotal = calcItemTotal(monthHeaders); @@ -211,7 +211,7 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, yearEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -yearItems = delegator.findList("OrderHeaderAndItems", ecl, null, null, null, false); +yearItems = from("OrderHeaderAndItems").where(ecl).queryList(); yearItemsPending = EntityUtil.filterByAnd(yearItems, [itemStatusId : "ITEM_ORDERED"]); ecl = EntityCondition.makeCondition([ @@ -221,7 +221,7 @@ ecl = EntityCondition.makeCondition([ EntityCondition.makeCondition("orderDate", EntityOperator.LESS_THAN_EQUAL_TO, yearEnd), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "SALES_ORDER")], EntityOperator.AND); -yearHeaders = delegator.findList("OrderHeader", ecl, null, null, null, false); +yearHeaders = from("OrderHeader").where(ecl).queryList(); yearHeadersPending = EntityUtil.filterByAnd(yearHeaders, [statusId : "ORDER_CREATED"]); yearItemTotal = calcItemTotal(yearHeaders); @@ -238,11 +238,11 @@ context.yearItemTotalPaid = yearItemTota context.yearItemCountPaid = yearItemCountPaid; // order state report -waitingPayment = delegator.findByAnd("OrderHeader", [statusId : "ORDER_CREATED", orderTypeId : "SALES_ORDER"], null, false); +waitingPayment = from("OrderHeader").where("statusId", "ORDER_CREATED", "orderTypeId", "SALES_ORDER").queryList(); context.waitingPayment = waitingPayment.size(); -waitingApproval = delegator.findByAnd("OrderHeader", [statusId : "ORDER_PROCESSING", orderTypeId : "SALES_ORDER"], null, false); +waitingApproval = from("OrderHeader").where("statusId", "ORDER_PROCESSING", "orderTypeId", "SALES_ORDER").queryList(); context.waitingApproval = waitingApproval.size(); -waitingComplete = delegator.findByAnd("OrderHeader", [statusId : "ORDER_APPROVED", orderTypeId : "SALES_ORDER"], null, false); +waitingComplete = from("OrderHeader").where("statusId", "ORDER_APPROVED", "orderTypeId", "SALES_ORDER").queryList(); context.waitingComplete = waitingComplete.size(); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ReceivePayment.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/SendConfirmationEmail.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ShipGroups.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/ViewImage.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ManageQuotePrices.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ManageQuotePrices.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ManageQuotePrices.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ManageQuotePrices.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/quote/ViewQuoteProfit.groovy Sat Dec 20 04:31:20 2014 @@ -53,11 +53,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, issueDate); - productPrice = EntityUtil.getFirst(productPrices); + productPrice = from("ProductPrice").where(productId : quoteItem.productId, currencyUomId : currency, productPriceTypeId : "AVERAGE_COST").filteryDate(issueDate).queryFirst(); if (productPrice?.price != null) { averageCost = productPrice.price * selectedAmount; } Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/reports/OpenOrderItemsReport.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/RequestItemNotes.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/RequestItemNotes.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/RequestItemNotes.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/RequestItemNotes.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/SetRequestQuote.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/SetRequestQuote.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/SetRequestQuote.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/request/SetRequestQuote.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirementsByVendor.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirementsByVendor.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirementsByVendor.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/requirement/ApprovedProductRequirementsByVendor.groovy Sat Dec 20 04:31:20 2014 @@ -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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/QuickReturn.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/QuickReturn.groovy?rev=1646916&r1=1646915&r2=1646916&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/QuickReturn.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/return/QuickReturn.groovy Sat Dec 20 04:31:20 2014 @@ -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,28 +64,28 @@ 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; } @@ -94,7 +94,7 @@ context.returnItemTypeMap = typeMap; if (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; } |
Free forum by Nabble | Edit this page |