You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2007/04/28 16:20:00 UTC

svn commit: r533347 - /ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java

Author: jacopoc
Date: Sat Apr 28 07:19:59 2007
New Revision: 533347

URL: http://svn.apache.org/viewvc?view=rev&rev=533347
Log:
Applied patch from Scott Gray in OFBIZ-937:
setMaximumFractionDigits should be called after setCurrency, otherwise setCurrency changes it back to the default for that currency

Modified:
    ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java

Modified: ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java?view=diff&rev=533347&r1=533346&r2=533347
==============================================================================
--- ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java (original)
+++ ofbiz/trunk/framework/base/src/base/org/ofbiz/base/util/UtilFormatOut.java Sat Apr 28 07:19:59 2007
@@ -78,13 +78,13 @@
     public static String formatCurrency(double price, String isoCode, Locale locale, int maximumFractionDigits) {
         //Debug.logInfo("formatting currency: " + price + ", isoCode: " + isoCode + ", locale: " + locale, module);
         com.ibm.icu.text.NumberFormat nf = com.ibm.icu.text.NumberFormat.getCurrencyInstance(locale);
-        if (maximumFractionDigits >= 0) {
-            nf.setMaximumFractionDigits(maximumFractionDigits);
-        }
         if (isoCode != null && isoCode.length() > 1) {
             nf.setCurrency(com.ibm.icu.util.Currency.getInstance(isoCode));
         } else {
             Debug.logWarning("No isoCode specified to format currency value:" + price, module);
+        }
+        if (maximumFractionDigits >= 0) {
+            nf.setMaximumFractionDigits(maximumFractionDigits);
         }
         return nf.format(price);
     }