Thanks Hans, much appreciated.

Regards
Scott

On 23/05/2011, at 8:34 PM, Hans Bakker wrote:

> Hi Scott, setting the default values as input parameters to the service
> is indeed a better solution. We will change it.
> 
> Regards,
> Hans
> 
> On Mon, 2011-05-23 at 20:06 +1200, Scott Gray wrote:
>> Hi Hans,
>> 
>> I'm not sure if this is the best approach because it changes the behavior of 
>> all conversions when you are really only intending to round currency 
>> conversions.  The default has essentially been changed from no rounding 
>> unless specified to always rounding to 2 decimal places unless a different 
>> rounding is provided.
>> 
>> IMO the code calling the service would be better to specify the rounding 
>> required for its case instead of imposing a default on every conversion.
>> 
>> Regards
>> Scott
>> 
>> On 23/05/2011, at 7:54 PM, [email protected] wrote:
>> 
>>> 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"/>
>>> 
>>> 
>> 
> 
> -- 
> Ofbiz on twitter: http://twitter.com/apache_ofbiz
> Myself on twitter: http://twitter.com/hansbak
> Antwebsystems.com: Quality services for competitive rates.
> 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to