svn commit: r1592978 - in /ofbiz/branches/release13.07: ./ applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java applications/product/config/catalog.properties applications/product/src/org/ofbiz/product/price/PriceServices.java

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

svn commit: r1592978 - in /ofbiz/branches/release13.07: ./ applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java applications/product/config/catalog.properties applications/product/src/org/ofbiz/product/price/PriceServices.java

jleroux@apache.org
Author: jleroux
Date: Wed May  7 11:46:08 2014
New Revision: 1592978

URL: http://svn.apache.org/r1592978
Log:
"Applied fix from trunk for revision: 1592977"
------------------------------------------------------------------------
r1592977 | jleroux | 2014-05-07 13:44:44 +0200 (mer. 07 mai 2014) | 4 lignes

Fixes a regression introduced by r1125215 "Add an automatic product price currency conversion which can be switched off in a properties file."
r1125215 broke the possibility to set a currency to a product store.
The automatic product price currency conversion should not be activated by default
Correctly formats changes done by r1125215 in PriceServices.java
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release13.07/   (props changed)
    ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
    ofbiz/branches/release13.07/applications/product/config/catalog.properties
    ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/price/PriceServices.java

Propchange: ofbiz/branches/release13.07/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1592977

Modified: ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=1592978&r1=1592977&r2=1592978&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original)
+++ ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Wed May  7 11:46:08 2014
@@ -1198,7 +1198,11 @@ public class ShoppingCartItem implements
                             }
                         }
                     }
-                    priceContext.put("currencyUomIdTo", cart.getCurrency());
+                    if ("true".equals(UtilProperties.getPropertyValue("catalog.properties", "convertProductPriceCurrency"))){
+                        priceContext.put("currencyUomIdTo", cart.getCurrency());
+                    } else {
+                        priceContext.put("currencyUomId", cart.getCurrency());
+                    }
                     priceContext.put("prodCatalogId", this.getProdCatalogId());
                     priceContext.put("webSiteId", cart.getWebSiteId());
                     priceContext.put("productStoreId", cart.getProductStoreId());

Modified: ofbiz/branches/release13.07/applications/product/config/catalog.properties
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/product/config/catalog.properties?rev=1592978&r1=1592977&r2=1592978&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/product/config/catalog.properties (original)
+++ ofbiz/branches/release13.07/applications/product/config/catalog.properties Wed May  7 11:46:08 2014
@@ -43,4 +43,4 @@ image.management.autoApproveImage=Y
 image.management.multipleApproval=N
 
 # Automatic product price currency conversion
-convertProductPriceCurrency=true
+convertProductPriceCurrency=false

Modified: ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/price/PriceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=1592978&r1=1592977&r2=1592978&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/price/PriceServices.java (original)
+++ ofbiz/branches/release13.07/applications/product/src/org/ofbiz/product/price/PriceServices.java Wed May  7 11:46:08 2014
@@ -524,9 +524,9 @@ public class PriceServices {
         }
 
         // Convert the value to the price currency, if required
-        if("true".equals(UtilProperties.getPropertyValue("catalog.properties", "convertProductPriceCurrency"))){
+        if ("true".equals(UtilProperties.getPropertyValue("catalog.properties", "convertProductPriceCurrency"))) {
             if (UtilValidate.isNotEmpty(currencyDefaultUomId) && UtilValidate.isNotEmpty(currencyUomIdTo) && !currencyDefaultUomId.equals(currencyUomIdTo)) {
-                if(UtilValidate.isNotEmpty(result)){
+                if (UtilValidate.isNotEmpty(result)) {
                     Map<String, Object> convertPriceMap = FastMap.newInstance();
                     for(Map.Entry<String, Object> entry : result.entrySet()) {
                         BigDecimal tempPrice = BigDecimal.ZERO;
@@ -547,22 +547,23 @@ public class PriceServices {
                         else if (entry.getKey() == "listPrice")
                             tempPrice = (BigDecimal) entry.getValue();
                         
-                        if(tempPrice != null && tempPrice != BigDecimal.ZERO){
+                        if (tempPrice != null && tempPrice != BigDecimal.ZERO) {
                             Map<String, Object> priceResults = FastMap.newInstance();
                             try {
-                                priceResults = dispatcher.runSync("convertUom", UtilMisc.<String, Object>toMap("uomId", currencyDefaultUomId, "uomIdTo", currencyUomIdTo, "originalValue", tempPrice , "defaultDecimalScale" , Long.valueOf(2) , "defaultRoundingMode" , "HalfUp"));
+                                priceResults = dispatcher.runSync("convertUom", UtilMisc.<String, Object> toMap("uomId", currencyDefaultUomId, "uomIdTo", currencyUomIdTo,
+                                        "originalValue", tempPrice, "defaultDecimalScale", Long.valueOf(2), "defaultRoundingMode", "HalfUp"));
                                 if (ServiceUtil.isError(priceResults) || (priceResults.get("convertedValue") == null)) {
-                                    Debug.logWarning("Unable to convert " + entry.getKey() + " for product  " + productId , module);
-                                }
+                                    Debug.logWarning("Unable to convert " + entry.getKey() + " for product  " + productId, module);
+                                }
                             } catch (GenericServiceException e) {
                                 Debug.logError(e, module);
                             }
                             convertPriceMap.put(entry.getKey(), priceResults.get("convertedValue"));
-                        }else{
+                        } else {
                             convertPriceMap.put(entry.getKey(), entry.getValue());
                         }
                     }
-                    if(UtilValidate.isNotEmpty(convertPriceMap)){
+                    if (UtilValidate.isNotEmpty(convertPriceMap)) {
                         convertPriceMap.put("currencyUsed", currencyUomIdTo);
                         result = convertPriceMap;
                     }