Author: jleroux
Date: Fri Mar 23 20:51:42 2012 New Revision: 1304591 URL: http://svn.apache.org/viewvc?rev=1304591&view=rev Log: "Applied fix from trunk for revision: 1304589 " ------------------------------------------------------------------------ r1304589 | jleroux | 2012-03-23 21:47:20 +0100 (ven., 23 mars 2012) | 3 lines A patch from Kiran Gawde "Category Detail, Out of Stock check doesn't take into account Marketing Package and multiple facilities" https://issues.apache.org/jira/browse/OFBIZ-4525 ------------------------------------------------------------------------ Modified: ofbiz/branches/release11.04/ (props changed) ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy Propchange: ofbiz/branches/release11.04/ ------------------------------------------------------------------------------ Merged /ofbiz/trunk:r1304589 Modified: ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy?rev=1304591&r1=1304590&r2=1304591&view=diff ============================================================================== --- ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy (original) +++ ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/CategoryDetail.groovy Fri Mar 23 20:51:42 2012 @@ -24,6 +24,8 @@ import org.ofbiz.base.util.*; import org.ofbiz.entity.*; +import org.ofbiz.entity.condition.*; +import org.ofbiz.entity.util.*; import org.ofbiz.service.*; import org.ofbiz.product.catalog.*; import org.ofbiz.product.category.CategoryContentWrapper; @@ -68,10 +70,27 @@ if(productStore) { if("N".equals(productStore.showOutOfStockProducts)) { productsInStock = []; productCategoryMembers.each { productCategoryMember -> - productFacility = delegator.findOne("ProductFacility", [productId : productCategoryMember.productId, facilityId : productStore.inventoryFacilityId], true); - if(productFacility) { - if(productFacility.lastInventoryCount >= 1) { + product = delegator.findByPrimaryKeyCache("Product", [productId : productCategoryMember.productId]); + boolean isMarketingPackage = EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG"); + context.isMarketingPackage = (isMarketingPackage? "true": "false"); + if (isMarketingPackage) { + resultOutput = dispatcher.runSync("getMktgPackagesAvailable", [productId : productCategoryMember.productId]); + availableInventory = resultOutput.availableToPromiseTotal; + if(availableInventory>0) productsInStock.add(productCategoryMember); + } else { + facilities = delegator.findList("ProductFacility", EntityCondition.makeCondition([productId : productCategoryMember.productId]), null, null, null, false); + availableInventory = 0.0; + if(facilities) { + facilities.each { facility -> + lastInventoryCount = facility.lastInventoryCount; + if (lastInventoryCount != null) { + availableInventory += lastInventoryCount; + } + } + if (availableInventory > 0) { + productsInStock.add(productCategoryMember); + } } } } |
Free forum by Nabble | Edit this page |