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/02/15 18:37:45 UTC

svn commit: r1070982 - /ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy

Author: jleroux
Date: Tue Feb 15 17:37:45 2011
New Revision: 1070982

URL: http://svn.apache.org/viewvc?rev=1070982&view=rev
Log:
A modified patch from Pierre TALLOTTE "Impossible to add a variant product in a purchase order" (https://issues.apache.org/jira/browse/OFBIZ-4166) - OFBIZ-4166

When we add a variant product in a purchase order, we get an error. This error occurs in ProductDetail.groovy because virtualPriceMap.basePrice is null in Purchase order case.

JLR: Pierre did the analysis and proposed a patch, I reviewed and finally use a patch of my own since Pierre's was not handling both cases (sales AND purchase)

Modified:
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductDetail.groovy

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=1070982&r1=1070981&r2=1070982&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 Tue Feb 15 17:37:45 2011
@@ -474,10 +474,11 @@ if (product) {
                                             }
                                         }
                                         variantPriceList.add(virtualPriceMap);
+                                        variantPriceJS.append("  if (sku == \"" + virtual.productId + "\") return \"" + numberFormat.format(virtualPriceMap.basePrice) + "\"; ");
                                     } else {
                                         virtualPriceMap = dispatcher.runSync("calculatePurchasePrice", priceContext);
+                                        variantPriceJS.append("  if (sku == \"" + virtual.productId + "\") return \"" + numberFormat.format(virtualPriceMap.price) + "\"; ");
                                     }
-                                    variantPriceJS.append("  if (sku == \"" + virtual.productId + "\") return \"" + numberFormat.format(virtualPriceMap.basePrice) + "\"; ");
                                 }
                                 
                             }
@@ -530,10 +531,11 @@ if (product) {
                         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 \"" + numberFormat.format(virtualPriceMap.basePrice) + "\"; ");
                     } else {
                         virtualPriceMap = dispatcher.runSync("calculatePurchasePrice", priceContext);
+                        variantPriceJS.append("  if (sku == \"" + virtual.productId + "\") return \"" + numberFormat.format(virtualPriceMap.price) + "\"; ");
                     }
-                    variantPriceJS.append("  if (sku == \"" + virtual.productId + "\") return \"" + numberFormat.format(virtualPriceMap.basePrice) + "\"; ");
                 }
                 variantPriceJS.append(" } ");