You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2009/11/25 11:44:03 UTC

svn commit: r884023 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java framework/base/src/org/ofbiz/base/util/UtilFormatOut.java framework/common/config/general.properties

Author: jleroux
Date: Wed Nov 25 10:43:09 2009
New Revision: 884023

URL: http://svn.apache.org/viewvc?rev=884023&view=rev
Log:
Partially fix an issue I discussed with Akash on dev ML on how to format decimals in prices
* Mostly parameterize UtilFormatOut.formatPrice() from general.properties
* I removed unused currency.decimal.format calls in CheckOutEvents class
* Also removed unused priceNumberFormat in UtilFormatOut class

Still have to fix 11 harcoded  "##0.00" in ftl files using ofbizCurrency 

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java
    ofbiz/trunk/framework/common/config/general.properties

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=884023&r1=884022&r2=884023&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Wed Nov 25 10:43:09 2009
@@ -286,8 +286,6 @@
     public static Map getSelectedPaymentMethods(HttpServletRequest request) {
         ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("shoppingCart");
         //Locale locale = UtilHttp.getLocale(request);
-        String currencyFormat = UtilProperties.getPropertyValue("general.properties", "currency.decimal.format", "##0.00");
-        DecimalFormat formatter = new DecimalFormat(currencyFormat);
         Map selectedPaymentMethods = new HashMap();
         String[] paymentMethods = request.getParameterValues("checkOutPaymentId");
         String errMsg = null;
@@ -1071,8 +1069,6 @@
         if (UtilValidate.isNotEmpty(billingAccountId)) {
             // parse the amount to a decimal
             if (UtilValidate.isNotEmpty(billingAccountAmount)) {
-                String currencyFormat = UtilProperties.getPropertyValue("general.properties", "currency.decimal.format", "##0.00");
-                DecimalFormat formatter = new DecimalFormat(currencyFormat);
                 try {
                     billingAccountAmt = new BigDecimal(billingAccountAmount);
                 } catch (NumberFormatException e) {

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java?rev=884023&r1=884022&r2=884023&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilFormatOut.java Wed Nov 25 10:43:09 2009
@@ -39,9 +39,8 @@
         }
     }
 
-    // ------------------- price format handlers -------------------
-    static DecimalFormat priceDecimalFormat = new DecimalFormat("#,##0.00");
-    static DecimalFormat priceNumberFormat = new DecimalFormat("##0.00");
+    // ------------------- price format handlers -------------------    
+    static DecimalFormat priceDecimalFormat = new DecimalFormat(UtilProperties.getPropertyValue("general.properties", "currency.decimal.format", "#,##0.00"));
 
     /** Formats a Double representing a price into a string
      * @param price The price Double to be formatted

Modified: ofbiz/trunk/framework/common/config/general.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/general.properties?rev=884023&r1=884022&r2=884023&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/general.properties (original)
+++ ofbiz/trunk/framework/common/config/general.properties Wed Nov 25 10:43:09 2009
@@ -29,8 +29,8 @@
 # ID of the VisualTheme to use if there VISUAL_THEME UserPreference record for the current user supported values: FLAT_GREY and BIZZNESS_TIME and BLUELIGHT 
 VISUAL_THEME=BIZZNESS_TIME
 
-# -- the default decimal format for currency
-currency.decimal.format=##0.00
+# -- the default decimal format for currency (used in UtilFormatOut.java)
+currency.decimal.format=#,##0.00
 
 # -- Properties fallback locale. Change this setting with caution. If you
 #    start getting "resource not found" exceptions, then there are