Author: diveshdutta
Date: Sat Jun 20 11:35:00 2015
New Revision: 1686566
URL:
http://svn.apache.org/r1686566Log:
[OFBIZ-6520] When CalculateProductPrice service is called and currency is not passed in IN parameter then, this service picks up default currency from general.properties file which is hard coded to USA. But if some one changes the currency of store, code to return product price does not work. So code should look at ProductStore's defaultCurrencyUomId field first and if that is not set up then code should look for default currency set in general.properties file. This way code to fetch product price will be more database driven. So changing the code accordingly.
Modified:
ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=1686566&r1=1686565&r2=1686566&view=diff==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java Sat Jun 20 11:35:00 2015
@@ -146,7 +146,11 @@ public class PriceServices {
String currencyDefaultUomId = (String) context.get("currencyUomId");
String currencyUomIdTo = (String) context.get("currencyUomIdTo");
if (UtilValidate.isEmpty(currencyDefaultUomId)) {
+ if (UtilValidate.isNotEmpty(productStore) && UtilValidate.isNotEmpty(productStore.getString("defaultCurrencyUomId"))) {
+ currencyDefaultUomId = productStore.getString("defaultCurrencyUomId");
+ } else {
currencyDefaultUomId = EntityUtilProperties.getPropertyValue("general", "currency.uom.id.default", "USD", delegator);
+ }
}
// productPricePurposeId is null assume "PURCHASE", which is equivalent to what prices were before the purpose concept