svn commit: r687723 - /ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r687723 - /ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java

bibryam
Author: bibryam
Date: Thu Aug 21 05:18:50 2008
New Revision: 687723

URL: http://svn.apache.org/viewvc?rev=687723&view=rev
Log:
Applied the patch from JIRA Issue # OFBIZ-1926 "ProductConfigWrapper.getPrice() price calculation for non mandatory options (non COMPONENT_PRICE type) not working correctly" reported by Ritesh Trivedi.

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java?rev=687723&r1=687722&r2=687723&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/config/ProductConfigWrapper.java Thu Aug 21 05:18:50 2008
@@ -545,6 +545,7 @@
                         "currencyUomId", currencyUomId, "productPricePurposeId", "COMPONENT_PRICE", "autoUserLogin", autoUserLogin);
                 Map priceMap = dispatcher.runSync("calculateProductPrice", fieldMap);
                 Double componentPrice = (Double) priceMap.get("price");
+                Boolean validPriceFound = (Boolean)priceMap.get("validPriceFound");
                 double mult = 1;
                 if (oneComponent.getDouble("quantity") != null) {
                     mult = oneComponent.getDouble("quantity").doubleValue();
@@ -552,7 +553,7 @@
                 if (mult == 0) {
                     mult = 1;
                 }
-                if (componentPrice != null) {
+                if (componentPrice != null && validPriceFound.booleanValue()) {
                     price = componentPrice.doubleValue();
                 } else {
                     fieldMap.put("productPricePurposeId", "PURCHASE");
@@ -597,6 +598,7 @@
                         "currencyUomId", pcw.currencyUomId, "productPricePurposeId", "COMPONENT_PRICE", "autoUserLogin", pcw.autoUserLogin);
                 Map priceMap = dispatcher.runSync("calculateProductPrice", fieldMap);
                 Double componentPrice = (Double) priceMap.get("price");
+                Boolean validPriceFound = (Boolean)priceMap.get("validPriceFound");                
                 double mult = 1;
                 if (oneComponent.getDouble("quantity") != null) {
                     mult = oneComponent.getDouble("quantity").doubleValue();
@@ -604,7 +606,7 @@
                 if (mult == 0) {
                     mult = 1;
                 }
-                if (componentPrice != null) {
+                if (componentPrice != null && validPriceFound.booleanValue()) {
                     price = componentPrice.doubleValue();
                 } else {
                     fieldMap.put("productPricePurposeId", "PURCHASE");