From c045d83fa0b3db5d2a882e0d59efa2a65808f520 Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Sat, 29 Mar 2014 18:42:06 +0000 Subject: [PATCH] A patch from Deepak Dixit for "ofbizCurrency transform does not honor the rounding passed in ofbizCurrency macro." https://issues.apache.org/jira/browse/OFBIZ-5591 ofbizCurrency transform does not honor the rounding passed in ofbizCurrency macro. OfbizCurrency transform always used the default rounding set in general.properties file. jleroux:I apply Deepak's patch, seems good to me. If someone thinks there might be a better solution, please reopen git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1583040 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java b/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java index a1b2414c4f..717dddad8f 100644 --- a/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java +++ b/framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java @@ -141,9 +141,11 @@ public class OfbizCurrencyTransform implements TemplateTransformModel { Delegator delegator = (Delegator) request.getAttribute("delegator"); // Get rounding from SystemProperty if (UtilValidate.isNotEmpty(delegator)) { - String roundingString = EntityUtilProperties.getPropertyValue("general.properties", "currency.rounding.default", "10", delegator); scaleEnabled = EntityUtilProperties.getPropertyValue("general.properties", "currency.scale.enabled", "N", delegator); - if (UtilValidate.isInteger(roundingString)) roundingNumber = Integer.parseInt(roundingString); + if (UtilValidate.isEmpty(roundingNumber)) { + String roundingString = EntityUtilProperties.getPropertyValue("general.properties", "currency.rounding.default", "10", delegator); + if (UtilValidate.isInteger(roundingString)) roundingNumber = Integer.parseInt(roundingString); + } } } if (roundingNumber == null) roundingNumber = 10;