svn commit: r1126412 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/product/price/ framework/common/config/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/

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

svn commit: r1126412 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/shoppingcart/ applications/product/src/org/ofbiz/product/price/ framework/common/config/ framework/common/script/org/ofbiz/common/ framework/common/servicedef/

hansbak-2
Author: hansbak
Date: Mon May 23 09:51:44 2011
New Revision: 1126412

URL: http://svn.apache.org/viewvc?rev=1126412&view=rev
Log:
update of rev1126364 after a comment from scott

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
    ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
    ofbiz/trunk/framework/common/config/general.properties
    ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
    ofbiz/trunk/framework/common/servicedef/services.xml

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=1126412&r1=1126411&r2=1126412&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Mon May 23 09:51:44 2011
@@ -1110,7 +1110,6 @@ public class ShoppingCartItem implements
         if (_product != null && isModifiedPrice == false) {
             try {
                 Map<String, Object> priceContext = FastMap.newInstance();
-                priceContext.put("currencyUomIdTo", cart.getCurrency());
 
                 String partyId = cart.getPartyId();
                 if (partyId != null) {
@@ -1132,6 +1131,7 @@ public class ShoppingCartItem implements
                 priceContext.put("amount", this.getSelectedAmount());
                 
                 if (cart.getOrderType().equals("PURCHASE_ORDER")) {
+                    priceContext.put("currencyUomId", cart.getCurrency());
                     Map<String, Object> priceResult = dispatcher.runSync("calculatePurchasePrice", priceContext);
                     if (ServiceUtil.isError(priceResult)) {
                         throw new CartItemModifyException("There was an error while calculating the price: " + ServiceUtil.getErrorMessage(priceResult));
@@ -1168,6 +1168,7 @@ public class ShoppingCartItem implements
                             }
                         }
                     }
+                    priceContext.put("currencyUomIdTo", cart.getCurrency());
                     priceContext.put("prodCatalogId", this.getProdCatalogId());
                     priceContext.put("webSiteId", cart.getWebSiteId());
                     priceContext.put("productStoreId", cart.getProductStoreId());

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=1126412&r1=1126411&r2=1126412&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 Mon May 23 09:51:44 2011
@@ -691,7 +691,7 @@ public class PriceServices {
                         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));
+                                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);
                                 }

Modified: ofbiz/trunk/framework/common/config/general.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/general.properties?rev=1126412&r1=1126411&r2=1126412&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/general.properties (original)
+++ ofbiz/trunk/framework/common/config/general.properties Mon May 23 09:51:44 2011
@@ -32,10 +32,6 @@ VISUAL_THEME=TOMAHAWK
 # -- the default decimal format for currency (used in UtilFormatOut.java)
 currency.decimal.format=#,##0.00
 
-# Setting decimal precision and rounding method in ConversionUom service when these fields are not filled (Used in currency conversion of sales product price)
-convertUom.decimals = 2
-convertUom.rounding = HalfUp
-
 # -- Properties fallback locale. Change this setting with caution. If you
 #    start getting "resource not found" exceptions, then there are
 #    properties missing in the locale you specified. This property does not

Modified: ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml?rev=1126412&r1=1126411&r2=1126412&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml (original)
+++ ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml Mon May 23 09:51:44 2011
@@ -148,14 +148,8 @@ under the License.
             </if-not-empty>  <!-- custom conversion? -->
 
             <!-- round result, if UomConversion[Dated] so specifies -->
-            <set field="roundingMode" from-field="uomConversion.roundingMode"/>
-            <set field="decimalScale" from-field="uomConversion.decimalScale"/>
-            <if-empty field="roundingMode">
-                <property-to-field resource="general" property="convertUom.decimals" field="roundingMode"/>
-                <if-empty field="decimalScale">
-                    <property-to-field resource="general" property="convertUom.rounding" field="decimalScale"/>
-                </if-empty>
-            </if-empty>
+            <set field="roundingMode" from-field="uomConversion.roundingMode" default-value="${parameters.defaultRoundingMode}"/>
+            <set field="decimalScale" from-field="uomConversion.decimalScale" default-value="${parameters.defaultDecimalScale}"/>
             <if-not-empty field="roundingMode">
                 <calculate field="roundedValue" type="BigDecimal" decimal-scale="${decimalScale}" rounding-mode="${roundingMode}">
                     <calcop operator="get" field="convertedValue"/>

Modified: ofbiz/trunk/framework/common/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services.xml?rev=1126412&r1=1126411&r2=1126412&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/servicedef/services.xml (original)
+++ ofbiz/trunk/framework/common/servicedef/services.xml Mon May 23 09:51:44 2011
@@ -324,6 +324,8 @@ under the License.
         <attribute name="conversionParameters" mode="IN" type="Map" optional="true"/>
         <attribute name="purposeEnumId" mode="IN" type="String" optional="true"/>
         <attribute name="convertedValue" mode="OUT" type="BigDecimal" optional="true"/>
+        <attribute name="defaultDecimalScale" mode="IN" type="Long" optional="true"/>
+        <attribute name="defaultRoundingMode" mode="IN" type="String" optional="true"/>
     </service>
     <service name="convertUomCustom" default-entity-name="UomConversion" engine="simple"
             location="component://common/script/org/ofbiz/common/CommonServices.xml" invoke="convertUomCustom" auth="false">