Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy Mon Jan 5 08:50:30 2015 @@ -60,22 +60,22 @@ if (productCategoryId) { } */ -category = delegator.findOne("ProductCategory", [productCategoryId : productCategoryId], true); +category = from("ProductCategory").where("productCategoryId", productCategoryId).cache(true).queryOne(); if (category) { if (category.detailScreen) { detailScreen = category.detailScreen; } - categoryPageTitle = delegator.findByAnd("ProductCategoryContentAndInfo", [productCategoryId : productCategoryId, prodCatContentTypeId : "PAGE_TITLE"], null, true); + categoryPageTitle = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "PAGE_TITLE").cache(true).queryList(); if (categoryPageTitle) { - pageTitle = delegator.findOne("ElectronicText", [dataResourceId : categoryPageTitle.get(0).dataResourceId], true); + pageTitle = from("ElectronicText").where("dataResourceId", categoryPageTitle.get(0).dataResourceId).cache(true).queryOne(); } - categoryMetaDescription = delegator.findByAnd("ProductCategoryContentAndInfo", [productCategoryId : productCategoryId, prodCatContentTypeId : "META_DESCRIPTION"], null, true); + categoryMetaDescription = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "META_DESCRIPTION").cache(true).queryList(); if (categoryMetaDescription) { - metaDescription = delegator.findOne("ElectronicText", [dataResourceId : categoryMetaDescription.get(0).dataResourceId], true); + metaDescription = from("ElectronicText").where("dataResourceId", categoryMetaDescription.get(0).dataResourceId).cache(true).queryOne(); } - categoryMetaKeywords = delegator.findByAnd("ProductCategoryContentAndInfo", [productCategoryId : productCategoryId, prodCatContentTypeId : "META_KEYWORD"], null, true); + categoryMetaKeywords = from("ProductCategoryContentAndInfo").where("productCategoryId", productCategoryId, "prodCatContentTypeId", "META_KEYWORD").cache(true).queryList(); if (categoryMetaKeywords) { - metaKeywords = delegator.findOne("ElectronicText", [dataResourceId : categoryMetaKeywords.get(0).dataResourceId], true); + metaKeywords = from("ElectronicText").where("dataResourceId", categoryMetaKeywords.get(0).dataResourceId).cache(true).queryOne(); } categoryContentWrapper = new CategoryContentWrapper(category, request); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy Mon Jan 5 08:50:30 2015 @@ -39,7 +39,7 @@ viewIndex = parameters.VIEW_INDEX; currentCatalogId = CatalogWorker.getCurrentCatalogId(request); // set the default view size -defaultViewSize = request.getAttribute("defaultViewSize") ?: UtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20"); +defaultViewSize = request.getAttribute("defaultViewSize") ?: EntityUtilProperties.getPropertyValue("widget", "widget.form.defaultViewSize", "20", delegator); context.defaultViewSize = defaultViewSize; // set the limit view @@ -64,7 +64,7 @@ if (context.orderByFields) { } else { andMap.put("orderByFields", ["sequenceNum", "productId"]); } -catResult = dispatcher.runSync("getProductCategoryAndLimitedMembers", andMap); +catResult = runService('getProductCategoryAndLimitedMembers', andMap); productCategory = catResult.productCategory; productCategoryMembers = catResult.productCategoryMembers; context.productCategoryMembers = productCategoryMembers; Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CompareProducts.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CompareProducts.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CompareProducts.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CompareProducts.groovy Mon Jan 5 08:50:30 2015 @@ -54,15 +54,14 @@ compareList.each { product -> priceContext.agreementId = cart.getAgreementId(); priceContext.partyId = cart.getPartyId(); // IMPORTANT: otherwise it'll be calculating prices using the logged in user which could be a CSR instead of the customer priceContext.checkIncludeVat = "Y"; - productData.priceMap = dispatcher.runSync("calculateProductPrice", priceContext); + productData.priceMap = runService('calculateProductPrice', priceContext); condList = [ EntityCondition.makeCondition("productId", product.productId), EntityUtil.getFilterByDateExpr(), EntityCondition.makeCondition("productFeatureApplTypeId", EntityOperator.IN, ["STANDARD_FEATURE", "DISTINGUISHING_FEAT", "SELECTABLE_FEATURE"]) ]; - cond = EntityCondition.makeCondition(condList); - productFeatureAppls = delegator.findList("ProductFeatureAppl", cond, null, ["sequenceNum"], null, true); + productFeatureAppls = from("ProductFeatureAppl").where(condList).orderBy("sequenceNum").cache(true).queryList(); productFeatureAppls.each { productFeatureAppl -> productFeature = productFeatureAppl.getRelatedOne("ProductFeature", true); if (!productData[productFeature.productFeatureTypeId]) { @@ -76,5 +75,5 @@ compareList.each { product -> } } productFeatureTypeIds.each { productFeatureTypeId -> - productFeatureTypeMap[productFeatureTypeId] = delegator.findOne("ProductFeatureType", [productFeatureTypeId : productFeatureTypeId], true); + productFeatureTypeMap[productFeatureTypeId] = from("ProductFeatureType").where("productFeatureTypeId", productFeatureTypeId).cache(true).queryOne(); } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/InlineProductDetail.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/InlineProductDetail.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/InlineProductDetail.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/InlineProductDetail.groovy Mon Jan 5 08:50:30 2015 @@ -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); @@ -134,13 +134,13 @@ if (inlineProduct) { priceContext.checkIncludeVat = "Y"; priceContext.agreementId = cart.getAgreementId(); priceContext.partyId = cart.getPartyId(); // IMPORTANT: must put this in, or price will be calculated for the CSR instead of the customer - priceMap = dispatcher.runSync("calculateProductPrice", priceContext); + priceMap = runService('calculateProductPrice', priceContext); context.priceMap = priceMap; } else { // purchase order: run the "calculatePurchasePrice" service priceContext = [product : inlineProduct, currencyUomId : cart.getCurrency(), partyId : cart.getPartyId(), userLogin : userLogin]; - priceMap = dispatcher.runSync("calculatePurchasePrice", priceContext); + priceMap = runService('calculatePurchasePrice', priceContext); context.priceMap = priceMap; } @@ -154,10 +154,10 @@ if (inlineProduct) { if ("VV_FEATURETREE".equals(ProductWorker.getProductVirtualVariantMethod(delegator, inlineProductId))) { context.featureLists = ProductWorker.getSelectableProductFeaturesByTypesAndSeq(inlineProduct); } else { - featureMap = dispatcher.runSync("getProductFeatureSet", [productId : inlineProductId]); + featureMap = runService("getProductFeatureSet", [productId : inlineProductId]); featureSet = featureMap.featureSet; if (featureSet) { - variantTreeMap = dispatcher.runSync("getProductVariantTree", [productId : inlineProductId, featureOrder : featureSet, productStoreId : productStoreId]); + variantTreeMap = runService('getProductVariantTree', [productId : inlineProductId, featureOrder : featureSet, productStoreId : productStoreId]); variantTree = variantTreeMap.variantTree; imageMap = variantTreeMap.variantSample; virtualVariant = variantTreeMap.virtualVariant; @@ -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; } @@ -268,7 +268,7 @@ if (inlineProduct) { } // make a list of variant sku with requireAmount - variantsRes = dispatcher.runSync("getAssociatedProducts", [productId : inlineProductId, type : "PRODUCT_VARIANT", checkViewAllow : true, prodCatalogId : currentCatalogId]); + variantsRes = runService('getAssociatedProducts', [productId : inlineProductId, type : "PRODUCT_VARIANT", checkViewAllow : true, prodCatalogId : currentCatalogId]); variants = variantsRes.assocProducts; if (variants) { amt = new StringBuffer(); @@ -289,7 +289,7 @@ if (inlineProduct) { if (cart.isSalesOrder()) { // sales order: run the "calculateProductPrice" service priceContext.product = variant; - variantPriceMap = dispatcher.runSync("calculateProductPrice", priceContext); + variantPriceMap = runService('calculateProductPrice', priceContext); } amt.append(" if (sku == \"" + variant.productId + "\") return \"" + (variant.requireAmount ?: "N") + "\"; "); variantPriceJS.append(" if (sku == \"" + variant.productId + "\") return \"" + numberFormat.format(variantPriceMap.basePrice) + "\"; "); Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy Mon Jan 5 08:50:30 2015 @@ -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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy Mon Jan 5 08:50:30 2015 @@ -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; } @@ -136,7 +135,7 @@ if (product) { if (categoryId) { prevNextMap = [categoryId : categoryId, productId : productId]; prevNextMap.orderByFields = context.orderByFields ?: ["sequenceNum", "productId"]; - catNextPreviousResult = dispatcher.runSync("getPreviousNextProducts", prevNextMap); + catNextPreviousResult = runService('getPreviousNextProducts', prevNextMap); if (ServiceUtil.isError(catNextPreviousResult)) { request.setAttribute("errorMessageList", [ServiceUtil.getErrorMessage(catNextPreviousResult)]); return; @@ -182,13 +181,13 @@ if (product) { priceContext.checkIncludeVat = "Y"; priceContext.agreementId = cart.getAgreementId(); priceContext.partyId = cart.getPartyId(); // IMPORTANT: must put this in, or price will be calculated for the CSR instead of the customer - priceMap = dispatcher.runSync("calculateProductPrice", priceContext); + priceMap = runService('calculateProductPrice', priceContext); context.priceMap = priceMap; } else { // purchase order: run the "calculatePurchasePrice" service priceContext = [product : product, currencyUomId : cart.getCurrency(), partyId : cart.getPartyId(), userLogin : userLogin]; - priceMap = dispatcher.runSync("calculatePurchasePrice", priceContext); + priceMap = runService('calculatePurchasePrice', priceContext); context.priceMap = priceMap; } @@ -219,15 +218,14 @@ if (product) { context.daysToShip = productFacility?.daysToShip */ - resultOutput = dispatcher.runSync("getInventoryAvailableByFacility", [productId : productId, facilityId : facilityId, useCache : false]); + 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; @@ -236,12 +234,12 @@ if (product) { } // get the product distinguishing features - disFeatureMap = dispatcher.runSync("getProductFeatures", [productId : productId, type : "DISTINGUISHING_FEAT"]); + disFeatureMap = runService('getProductFeatures', [productId : productId, type : "DISTINGUISHING_FEAT"]); disFeatureList = disFeatureMap.productFeatures; 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 = [:]; @@ -269,14 +267,14 @@ if (product) { if ("VV_FEATURETREE".equals(ProductWorker.getProductVirtualVariantMethod(delegator, productId))) { context.featureLists = ProductWorker.getSelectableProductFeaturesByTypesAndSeq(product); } else { - featureMap = dispatcher.runSync("getProductFeatureSet", [productId : productId]); + featureMap = runService('getProductFeatureSet', [productId : productId]); featureSet = featureMap.featureSet; if (featureSet) { //if order is purchase then don't calculate available inventory for product. if (cart.isPurchaseOrder()) { - variantTreeMap = dispatcher.runSync("getProductVariantTree", [productId : productId, featureOrder : featureSet, checkInventory: false]); + variantTreeMap = runService('getProductVariantTree', [productId : productId, featureOrder : featureSet, checkInventory: false]); } else { - variantTreeMap = dispatcher.runSync("getProductVariantTree", [productId : productId, featureOrder : featureSet, productStoreId : productStoreId]); + variantTreeMap = runService('getProductVariantTree', [productId : productId, featureOrder : featureSet, productStoreId : productStoreId]); } variantTree = variantTreeMap.variantTree; imageMap = variantTreeMap.variantSample; @@ -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; } @@ -392,7 +390,7 @@ if (product) { } // make a list of variant sku with requireAmount - variantsRes = dispatcher.runSync("getAssociatedProducts", [productId : productId, type : "PRODUCT_VARIANT", checkViewAllow : true, prodCatalogId : currentCatalogId]); + variantsRes = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_VARIANT", checkViewAllow : true, prodCatalogId : currentCatalogId]); variants = variantsRes.assocProducts; variantPriceList = []; if (variants) { @@ -414,7 +412,7 @@ if (product) { priceContext.product = variant; if (cart.isSalesOrder()) { // sales order: run the "calculateProductPrice" service - variantPriceMap = dispatcher.runSync("calculateProductPrice", priceContext); + variantPriceMap = runService('calculateProductPrice', priceContext); BigDecimal calculatedPrice = (BigDecimal)variantPriceMap.get("price"); // Get the minimum quantity for variants if MINIMUM_ORDER_PRICE is set for variants. variantPriceMap.put("minimumQuantity", ShoppingCart.getMinimumOrderQuantity(delegator, calculatedPrice, variant.get("productId"))); @@ -440,7 +438,7 @@ if (product) { } variantPriceList.add(variantPriceMap); } else { - variantPriceMap = dispatcher.runSync("calculatePurchasePrice", priceContext); + variantPriceMap = runService('calculatePurchasePrice', priceContext); } amt.append(" if (sku == \"" + variant.productId + "\") return \"" + (variant.requireAmount ?: "N") + "\"; "); if (variantPriceMap && variantPriceMap.basePrice) { @@ -448,7 +446,7 @@ if (product) { } // make a list of virtual variants sku with requireAmount - virtualVariantsRes = dispatcher.runSync("getAssociatedProducts", [productIdTo : variant.productId, type : "ALTERNATIVE_PACKAGE", checkViewAllow : true, prodCatalogId : currentCatalogId]); + virtualVariantsRes = runService('getAssociatedProducts', [productIdTo : variant.productId, type : "ALTERNATIVE_PACKAGE", checkViewAllow : true, prodCatalogId : currentCatalogId]); virtualVariants = virtualVariantsRes.assocProducts; if(virtualVariants){ @@ -458,7 +456,7 @@ if (product) { priceContext.product = virtual; if (cart.isSalesOrder()) { // sales order: run the "calculateProductPrice" service - virtualPriceMap = dispatcher.runSync("calculateProductPrice", priceContext); + virtualPriceMap = runService('calculateProductPrice', priceContext); BigDecimal calculatedPrice = (BigDecimal)virtualPriceMap.get("price"); // Get the minimum quantity for variants if MINIMUM_ORDER_PRICE is set for variants. virtualPriceMap.put("minimumQuantity", ShoppingCart.getMinimumOrderQuantity(delegator, calculatedPrice, virtual.get("productId"))); @@ -485,7 +483,7 @@ if (product) { variantPriceList.add(virtualPriceMap); variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.basePrice, currencyUomId, locale, 10) + "\"; "); } else { - virtualPriceMap = dispatcher.runSync("calculatePurchasePrice", priceContext); + virtualPriceMap = runService('calculatePurchasePrice', priceContext); variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(variantPriceMap.price, currencyUomId, locale, 10) + "\"; "); } } @@ -512,7 +510,7 @@ if (product) { jsBuf.append("<script language=\"JavaScript\" type=\"text/javascript\">"); // make a list of variant sku with requireAmount - virtualVariantsRes = dispatcher.runSync("getAssociatedProducts", [productIdTo : productId, type : "ALTERNATIVE_PACKAGE", checkViewAllow : true, prodCatalogId : categoryId]); + virtualVariantsRes = runService('getAssociatedProducts', [productIdTo : productId, type : "ALTERNATIVE_PACKAGE", checkViewAllow : true, prodCatalogId : categoryId]); virtualVariants = virtualVariantsRes.assocProducts; // Format to apply the currency code to the variant price in the javascript if (productStore) { @@ -535,13 +533,13 @@ if (product) { priceContext.product = virtual; if (cart.isSalesOrder()) { // sales order: run the "calculateProductPrice" service - virtualPriceMap = dispatcher.runSync("calculateProductPrice", priceContext); + virtualPriceMap = runService('calculateProductPrice', priceContext); BigDecimal calculatedPrice = (BigDecimal)virtualPriceMap.get("price"); // Get the minimum quantity for variants if MINIMUM_ORDER_PRICE is set for variants. virtualVariantPriceList.add(virtualPriceMap); variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(virtualPriceMap.basePrice, currencyUomId, locale, 10) + "\"; "); } else { - virtualPriceMap = dispatcher.runSync("calculatePurchasePrice", priceContext); + virtualPriceMap = runService('calculatePurchasePrice', priceContext); variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + UtilFormatOut.formatCurrency(virtualPriceMap.price, currencyUomId, locale, 10) + "\"; "); } } @@ -560,11 +558,11 @@ if (product) { // if the product is a MARKETING_PKG_AUTO/PICK, then also get the quantity which can be produced from components if (isMarketingPackage) { - resultOutput = dispatcher.runSync("getMktgPackagesAvailable", [productId : productId]); + resultOutput = runService('getMktgPackagesAvailable', [productId : productId]); 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; @@ -577,22 +575,22 @@ if (product) { context.availableInventory = availableInventory; // get product associations - alsoBoughtProducts = dispatcher.runSync("getAssociatedProducts", [productId : productId, type : "ALSO_BOUGHT", checkViewAllow : true, prodCatalogId : currentCatalogId, bidirectional : false, sortDescending : true]); + alsoBoughtProducts = runService('getAssociatedProducts', [productId : productId, type : "ALSO_BOUGHT", checkViewAllow : true, prodCatalogId : currentCatalogId, bidirectional : false, sortDescending : true]); context.alsoBoughtProducts = alsoBoughtProducts.assocProducts; - obsoleteProducts = dispatcher.runSync("getAssociatedProducts", [productId : productId, type : "PRODUCT_OBSOLESCENCE", checkViewAllow : true, prodCatalogId : currentCatalogId]); + obsoleteProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_OBSOLESCENCE", checkViewAllow : true, prodCatalogId : currentCatalogId]); context.obsoleteProducts = obsoleteProducts.assocProducts; - crossSellProducts = dispatcher.runSync("getAssociatedProducts", [productId : productId, type : "PRODUCT_COMPLEMENT", checkViewAllow : true, prodCatalogId : currentCatalogId]); + crossSellProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_COMPLEMENT", checkViewAllow : true, prodCatalogId : currentCatalogId]); context.crossSellProducts = crossSellProducts.assocProducts; - upSellProducts = dispatcher.runSync("getAssociatedProducts", [productId : productId, type : "PRODUCT_UPGRADE", checkViewAllow : true, prodCatalogId : currentCatalogId]); + upSellProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_UPGRADE", checkViewAllow : true, prodCatalogId : currentCatalogId]); context.upSellProducts = upSellProducts.assocProducts; - obsolenscenseProducts = dispatcher.runSync("getAssociatedProducts", [productIdTo : productId, type : "PRODUCT_OBSOLESCENCE", checkViewAllow : true, prodCatalogId : currentCatalogId]); + obsolenscenseProducts = runService('getAssociatedProducts', [productIdTo : productId, type : "PRODUCT_OBSOLESCENCE", checkViewAllow : true, prodCatalogId : currentCatalogId]); context.obsolenscenseProducts = obsolenscenseProducts.assocProducts; - accessoryProducts = dispatcher.runSync("getAssociatedProducts", [productId : productId, type : "PRODUCT_ACCESSORY", checkViewAllow : true, prodCatalogId : currentCatalogId]); + accessoryProducts = runService('getAssociatedProducts', [productId : productId, type : "PRODUCT_ACCESSORY", checkViewAllow : true, prodCatalogId : currentCatalogId]); context.accessoryProducts = accessoryProducts.assocProducts; /* @@ -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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy Mon Jan 5 08:50:30 2015 @@ -54,7 +54,7 @@ if (cart.isSalesOrder()) { } if (!facilityId) { - productStoreFacility = EntityQuery.use(delegator).select("facilityId").from("ProductStoreFacility").where(UtilMisc.toList(EntityCondition.makeCondition("productStoreId", EntityOperator.EQUALS, productStoreId))).queryFirst(); + productStoreFacility = EntityQuery.use(delegator).select("facilityId").from("ProductStoreFacility").where("productStoreId", productStoreId).queryFirst(); if (productStoreFacility) { facilityId = productStoreFacility.facilityId; } @@ -70,22 +70,21 @@ 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. if (cart.isSalesOrder()) { - resultOutput = dispatcher.runSync("getInventoryAvailableByFacility", [productId : product.productId, facilityId : facilityId, useCache : true]); + 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; @@ -113,14 +112,14 @@ if (product) { priceContext.agreementId = cart.getAgreementId(); priceContext.partyId = cart.getPartyId(); // IMPORTANT: otherwise it'll be calculating prices using the logged in user which could be a CSR instead of the customer priceContext.checkIncludeVat = "Y"; - priceMap = dispatcher.runSync("calculateProductPrice", priceContext); + priceMap = runService('calculateProductPrice', priceContext); context.price = priceMap; } else { // purchase order: run the "calculatePurchasePrice" service priceContext = [product : product, currencyUomId : cart.getCurrency(), partyId : cart.getPartyId(), userLogin : userLogin]; - priceMap = dispatcher.runSync("calculatePurchasePrice", priceContext); + priceMap = runService('calculatePurchasePrice', priceContext); context.price = priceMap; } @@ -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 = [:]; @@ -160,7 +159,7 @@ if (product) { jsBuf.append("<script language=\"JavaScript\" type=\"text/javascript\">"); // make a list of variant sku with requireAmount - virtualVariantsRes = dispatcher.runSync("getAssociatedProducts", [productIdTo : productId, type : "ALTERNATIVE_PACKAGE", checkViewAllow : true, prodCatalogId : categoryId]); + virtualVariantsRes = runService('getAssociatedProducts', [productIdTo : productId, type : "ALTERNATIVE_PACKAGE", checkViewAllow : true, prodCatalogId : categoryId]); virtualVariants = virtualVariantsRes.assocProducts; // Format to apply the currency code to the variant price in the javascript if (productStore) { @@ -184,12 +183,12 @@ if (product) { priceContext.product = virtual; if (cart.isSalesOrder()) { // sales order: run the "calculateProductPrice" service - virtualPriceMap = dispatcher.runSync("calculateProductPrice", priceContext); + virtualPriceMap = runService('calculateProductPrice', priceContext); BigDecimal calculatedPrice = (BigDecimal)virtualPriceMap.get("price"); // Get the minimum quantity for variants if MINIMUM_ORDER_PRICE is set for variants. variantPriceList.add(virtualPriceMap); } else { - virtualPriceMap = dispatcher.runSync("calculatePurchasePrice", priceContext); + virtualPriceMap = runService('calculatePurchasePrice', priceContext); } variantPriceJS.append(" if (sku == \"" + virtual.productId + "\") return \"" + numberFormat.format(virtualPriceMap.basePrice) + "\"; "); } @@ -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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductUomDropDownOnly.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductUomDropDownOnly.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductUomDropDownOnly.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductUomDropDownOnly.groovy Mon Jan 5 08:50:30 2015 @@ -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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/QuickAdd.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/QuickAdd.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/QuickAdd.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/QuickAdd.groovy Mon Jan 5 08:50:30 2015 @@ -39,12 +39,12 @@ context.categoryId = categoryId; if (categoryId) { fields = [productCategoryId : categoryId, defaultViewSize : 10, limitView : false, prodCatalogId : currentCatalogId, checkViewAllow : true]; - result = dispatcher.runSync("getProductCategoryAndLimitedMembers", fields); + result = runService('getProductCategoryAndLimitedMembers', fields); if (result) { result.each { key, value -> context[key] = value; } } - productCategory = delegator.findOne("ProductCategory", ["productCategoryId" : categoryId], false); + productCategory = from("ProductCategory").where("productCategoryId", categoryId).queryOne(); context.productCategory = productCategory; } Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/lookup/LookupAssociatedProducts.groovy Mon Jan 5 08:50:30 2015 @@ -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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy Mon Jan 5 08:50:30 2015 @@ -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, null, "contactFromDate", "contactThruDate", true); -addresses = EntityUtil.filterByDate(addresses, null, "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, null, "contactFromDate", "contactThruDate", true); -phones = EntityUtil.filterByDate(phones, null, "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, null, "contactFromDate", "contactThruDate", true); -faxNumbers = EntityUtil.filterByDate(faxNumbers, null, "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, null, "contactFromDate", "contactThruDate", true); -emails = EntityUtil.filterByDate(emails, null, "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, null, "contactFromDate", "contactThruDate", true); -websiteUrls = EntityUtil.filterByDate(websiteUrls, null, "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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/FindOrders.groovy Mon Jan 5 08:50:30 2015 @@ -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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderDeliveryScheduleInfo.groovy Mon Jan 5 08:50:30 2015 @@ -23,17 +23,16 @@ 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 -checkMap = [orderId : orderId, userLogin : session.getAttribute("userLogin"), checkAction : "VIEW"]; -checkResult = dispatcher.runSync("checkSupplierRelatedOrderPermission", checkMap); +checkResult = runService('checkSupplierRelatedOrderPermission', [orderId : orderId, userLogin : session.getAttribute("userLogin"), checkAction : "VIEW"]); hasSupplierRelatedPermissionStr = checkResult.hasSupplierRelatedPermission; // Determine what the reuslt is, no result is FALSE Modified: ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderHistory.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderHistory.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderHistory.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderHistory.groovy Mon Jan 5 08:50:30 2015 @@ -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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderList.groovy Mon Jan 5 08:50:30 2015 @@ -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/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy?rev=1649482&r1=1649481&r2=1649482&view=diff ============================================================================== --- ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy (original) +++ ofbiz/branches/OFBIZ-5312-ofbiz-ecommerce-seo-2013-10-23/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderStats.groovy Mon Jan 5 08:50:30 2015 @@ -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(); |
Free forum by Nabble | Edit this page |