> Author: hansbak
> Date: Mon May 23 07:54:32 2011
> New Revision: 1126364
>
> URL:
http://svn.apache.org/viewvc?rev=1126364&view=rev> Log:
> add general.properties setting for default rounding and precision in convertUom service
>
> Modified:
> ofbiz/trunk/framework/common/config/general.properties
> ofbiz/trunk/framework/common/script/org/ofbiz/common/CommonServices.xml
>
> Modified: ofbiz/trunk/framework/common/config/general.properties
> URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/general.properties?rev=1126364&r1=1126363&r2=1126364&view=diff> ==============================================================================
> --- ofbiz/trunk/framework/common/config/general.properties (original)
> +++ ofbiz/trunk/framework/common/config/general.properties Mon May 23 07:54:32 2011
> @@ -32,6 +32,10 @@ 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=1126364&r1=1126363&r2=1126364&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 07:54:32 2011
> @@ -149,8 +149,15 @@ under the License.
>
> <!-- round result, if UomConversion[Dated] so specifies -->
> <set field="roundingMode" from-field="uomConversion.roundingMode"/>
> - <if-not-empty field="uomConversion.roundingMode">
> - <calculate field="roundedValue" type="BigDecimal" decimal-scale="${uomConversion.decimalScale}" rounding-mode="${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>
> + <if-not-empty field="roundingMode">
> + <calculate field="roundedValue" type="BigDecimal" decimal-scale="${decimalScale}" rounding-mode="${roundingMode}">
> <calcop operator="get" field="convertedValue"/>
> </calculate>
> <set field="convertedValue" from-field="roundedValue"/>
>
>