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

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

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

jleroux@apache.org
Author: jleroux
Date: Thu Sep 24 07:02:17 2015
New Revision: 1705004

URL: http://svn.apache.org/viewvc?rev=1705004&view=rev
Log:
A patch from Oleg Andreyev for "Errors in ProductSummary.groovy" https://issues.apache.org/jira/browse/OFBIZ-6652

In all releases the code in ProductSummary.groovy tries to collect prices for variants. Doing so it use NumberFormat.format() to transform base price into string that is part of an embed JS snippet. In case purchase order this price is rather empty. Using null with formatting method cause error. You may see this error in the trunk if you starts PO and and try Browser Categories->Widgets->Small Widgets. This price should appear if you select Select Units of Measure for WG-1111 but currently this does not work.
I'm not sure these prices make sense for purchase orders but my goal was just fix ugly error message. Solution display N/A if price is not available.

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

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy?rev=1705004&r1=1705003&r2=1705004&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/ProductSummary.groovy Thu Sep 24 07:02:17 2015
@@ -190,7 +190,12 @@ if (product) {
                 } else {
                     virtualPriceMap = runService('calculatePurchasePrice', priceContext);
                 }
-                variantPriceJS.append("  if (sku == \"" + virtual.productId + "\") return \"" + numberFormat.format(virtualPriceMap.basePrice) + "\"; ");
+                if (virtualPriceMap.basePrice) {
+                    basePrice = numberFormat.format(virtualPriceMap.basePrice);
+                } else {
+                    basePrice = UtilProperties.getResourceBundleMap("CommonUiLabels", locale).get("CommonNA")
+                }
+                variantPriceJS.append("  if (sku == \"" + virtual.productId + "\") return \"" + basePrice + "\"; ");
             }
             variantPriceJS.append(" } ");