You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2011/11/14 23:33:21 UTC

svn commit: r1201943 - in /ofbiz/branches/release11.04: ./ applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy

Author: jleroux
Date: Mon Nov 14 22:33:21 2011
New Revision: 1201943

URL: http://svn.apache.org/viewvc?rev=1201943&view=rev
Log:
"Applied fix from trunk for revision: 1201941" 
------------------------------------------------------------------------
r1201941 | jleroux | 2011-11-14 23:31:28 +0100 (lun., 14 nov. 2011) | 3 lines

A patch from Kiran Gawde https://issues.apache.org/jira/browse/OFBIZ-4526 "ProductDetail page inStock check doesn't take into account Marketing Package"

With http://localhost:8080/ecommerce/gizmo-basket-GZ-BASKET-p, for testing, set requireInventory="Y" for store. You will see 'Out of stock' for marketing package without the fix.
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release11.04/   (props changed)
    ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy

Propchange: ofbiz/branches/release11.04/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Nov 14 22:33:21 2011
@@ -2,4 +2,4 @@
 /ofbiz/branches/dojo1.4:951708-952957
 /ofbiz/branches/jquery:952958-1044489
 /ofbiz/branches/multitenant20100310:921280-927264
-/ofbiz/trunk:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1133353,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139346,1139385,1139504,1139521,1140358,1140362,1140375,1140469,1144537,1144791,1153073,1153768,1158124,1158126,1158608,1159080,1163036,1163093,1163533,1165130,1166591,1167116,1167314,1167480,1167501,1167510,1167517,1167606,1172213,1172243,1174964,1175130,1175135,1175143,1177128,1178175,1178199,1180398,1181878,1182259,1182310,1182731,1182858,1183651,1184906,1184996,1184999,1185179,1187515,1187528,1187933,1187944,1188042,1188564,1189592,1189601,1190134,1194958,1196778,1199276,1199450,1200207,1201110,1201125
+/ofbiz/trunk:1100197,1100880,1104423,1131144,1131396,1132496,1132749,1133353,1134990,1135199,1135686,1135929,1137201,1137433,1137435,1138463,1138485,1139346,1139385,1139504,1139521,1140358,1140362,1140375,1140469,1144537,1144791,1153073,1153768,1158124,1158126,1158608,1159080,1163036,1163093,1163533,1165130,1166591,1167116,1167314,1167480,1167501,1167510,1167517,1167606,1172213,1172243,1174964,1175130,1175135,1175143,1177128,1178175,1178199,1180398,1181878,1182259,1182310,1182731,1182858,1183651,1184906,1184996,1184999,1185179,1187515,1187528,1187933,1187944,1188042,1188564,1189592,1189601,1190134,1194958,1196778,1199276,1199450,1200207,1201110,1201125,1201941

Modified: ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy?rev=1201943&r1=1201942&r2=1201943&view=diff
==============================================================================
--- ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy (original)
+++ ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy Mon Nov 14 22:33:21 2011
@@ -91,6 +91,10 @@ if (product) {
     productId = product.productId;
     context.product_id = productId;
     productTypeId = product.productTypeId;
+
+    boolean isMarketingPackage = EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.productTypeId, "parentTypeId", "MARKETING_PKG");
+    context.isMarketingPackage = (isMarketingPackage? "true": "false");
+
     featureTypes = [:];
     featureOrder = [];
 
@@ -548,14 +552,21 @@ if (product) {
         }
     }
 
-    //get last inventory count from product facility for the product
-    facilities = delegator.findList("ProductFacility", EntityCondition.makeCondition([productId : product.productId]), null, null, null, false);
     availableInventory = 0.0;
-    if(facilities) {
-        facilities.each { facility ->
-            lastInventoryCount = facility.lastInventoryCount;
-            if (lastInventoryCount != null && availableInventory.compareTo(lastInventoryCount) != 0) {
-                availableInventory += lastInventoryCount;
+
+    // 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]);
+        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)
+        if(facilities) {
+            facilities.each { facility ->
+                lastInventoryCount = facility.lastInventoryCount;
+                if (lastInventoryCount != null) {
+                    availableInventory += lastInventoryCount;
+                }
             }
         }
     }