"0.00" String

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

"0.00" String

Jacques Le Roux
Administrator
Hi,

I notice that we have number of "0.00" strings harcoded. I think we should introduce a parameter for that in Arithmetic properties
Something like default.decimals.string="0.00"
A client of mine (POS) wanted to use only 1 decimal and I had to harcode them, I'd like to generalize.

What do you think ?

Jacques

Reply | Threaded
Open this post in threaded view
|

Re: "0.00" String

Scott Gray-2
Hi Jacques,

I think it should be irrelevant whether a BigDecimal is initialized as  
0, 0.00 or 0.0000000 because all number should be rounded if needed  
before being presented in the UI anyway.  Assuming that it was  
currency that your Client wanted 1 decimal place for, wasn't the  
number going through some sort of currency formatting before being  
presented?

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 10/11/2009, at 10:10 AM, Jacques Le Roux wrote:

> Hi,
>
> I notice that we have number of "0.00" strings harcoded. I think we  
> should introduce a parameter for that in Arithmetic properties
> Something like default.decimals.string="0.00"
> A client of mine (POS) wanted to use only 1 decimal and I had to  
> harcode them, I'd like to generalize.
>
> What do you think ?
>
> Jacques
>


smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: "0.00" String

Jacques Le Roux
Administrator
Yes, I agree that's why I asked. However these strings are *intialized* to "0.00" or "'0.00" is a ternary ? default and, as they are
default, used if no formatted values replace them.
At least in POS
Receipt.java[472]
Operator.java[104]

But there are other similar cases outside of POS, look for "0.00"...

Jacques

From: "Scott Gray" <[hidden email]>

> Hi Jacques,
>
> I think it should be irrelevant whether a BigDecimal is initialized as  0, 0.00 or 0.0000000 because all number should be rounded
> if needed  before being presented in the UI anyway.  Assuming that it was  currency that your Client wanted 1 decimal place for,
> wasn't the  number going through some sort of currency formatting before being  presented?
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 10/11/2009, at 10:10 AM, Jacques Le Roux wrote:
>
>> Hi,
>>
>> I notice that we have number of "0.00" strings harcoded. I think we  should introduce a parameter for that in Arithmetic
>> properties
>> Something like default.decimals.string="0.00"
>> A client of mine (POS) wanted to use only 1 decimal and I had to  harcode them, I'd like to generalize.
>>
>> What do you think ?
>>
>> Jacques
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: "0.00" String

Scott Gray-2
Yes there may well be issues with formatting not being applied in  
various places but I think it is those which should be fixed rather  
than adding a property.  My preference for BigDecimal initialization  
would be to use BigDecimal.ZERO.

Regards
Scott

On 10/11/2009, at 10:30 AM, Jacques Le Roux wrote:

> Yes, I agree that's why I asked. However these strings are  
> *intialized* to "0.00" or "'0.00" is a ternary ? default and, as  
> they are default, used if no formatted values replace them.
> At least in POS
> Receipt.java[472]
> Operator.java[104]
>
> But there are other similar cases outside of POS, look for "0.00"...
>
> Jacques
>
> From: "Scott Gray" <[hidden email]>
>> Hi Jacques,
>>
>> I think it should be irrelevant whether a BigDecimal is initialized  
>> as  0, 0.00 or 0.0000000 because all number should be rounded if  
>> needed  before being presented in the UI anyway.  Assuming that it  
>> was  currency that your Client wanted 1 decimal place for, wasn't  
>> the  number going through some sort of currency formatting before  
>> being  presented?
>>
>> Regards
>> Scott
>>
>> HotWax Media
>> http://www.hotwaxmedia.com
>>
>> On 10/11/2009, at 10:10 AM, Jacques Le Roux wrote:
>>
>>> Hi,
>>>
>>> I notice that we have number of "0.00" strings harcoded. I think  
>>> we  should introduce a parameter for that in Arithmetic properties
>>> Something like default.decimals.string="0.00"
>>> A client of mine (POS) wanted to use only 1 decimal and I had to  
>>> harcode them, I'd like to generalize.
>>>
>>> What do you think ?
>>>
>>> Jacques
>>>
>>
>
>


smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: "0.00" String

Jacques Le Roux
Administrator
Scott,

It's a bit complicated for snippet like

// get the selected amount
String selectedAmountStr = "0.00";
if (paramMap.containsKey("ADD_AMOUNT")) {
    selectedAmountStr = (String) paramMap.remove("ADD_AMOUNT");
} else if (paramMap.containsKey("add_amount")) {
    selectedAmountStr = (String) paramMap.remove("add_amount");
}
in ShoppingCartEvents.java
Though there are only 9 cases like that (only Strings) at all in OFBiz, so yes maybe...

Jacques

From: "Scott Gray" <[hidden email]>

> Yes there may well be issues with formatting not being applied in  
> various places but I think it is those which should be fixed rather  
> than adding a property.  My preference for BigDecimal initialization  
> would be to use BigDecimal.ZERO.
>
> Regards
> Scott
>
> On 10/11/2009, at 10:30 AM, Jacques Le Roux wrote:
>
>> Yes, I agree that's why I asked. However these strings are  
>> *intialized* to "0.00" or "'0.00" is a ternary ? default and, as  
>> they are default, used if no formatted values replace them.
>> At least in POS
>> Receipt.java[472]
>> Operator.java[104]
>>
>> But there are other similar cases outside of POS, look for "0.00"...
>>
>> Jacques
>>
>> From: "Scott Gray" <[hidden email]>
>>> Hi Jacques,
>>>
>>> I think it should be irrelevant whether a BigDecimal is initialized  
>>> as  0, 0.00 or 0.0000000 because all number should be rounded if  
>>> needed  before being presented in the UI anyway.  Assuming that it  
>>> was  currency that your Client wanted 1 decimal place for, wasn't  
>>> the  number going through some sort of currency formatting before  
>>> being  presented?
>>>
>>> Regards
>>> Scott
>>>
>>> HotWax Media
>>> http://www.hotwaxmedia.com
>>>
>>> On 10/11/2009, at 10:10 AM, Jacques Le Roux wrote:
>>>
>>>> Hi,
>>>>
>>>> I notice that we have number of "0.00" strings harcoded. I think  
>>>> we  should introduce a parameter for that in Arithmetic properties
>>>> Something like default.decimals.string="0.00"
>>>> A client of mine (POS) wanted to use only 1 decimal and I had to  
>>>> harcode them, I'd like to generalize.
>>>>
>>>> What do you think ?
>>>>
>>>> Jacques
>>>>
>>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: "0.00" String

Scott Gray-2
See r834274

Regards
Scott

On 10/11/2009, at 11:47 AM, Jacques Le Roux wrote:

> Scott,
>
> It's a bit complicated for snippet like
>
> // get the selected amount
> String selectedAmountStr = "0.00";
> if (paramMap.containsKey("ADD_AMOUNT")) {
>   selectedAmountStr = (String) paramMap.remove("ADD_AMOUNT");
> } else if (paramMap.containsKey("add_amount")) {
>   selectedAmountStr = (String) paramMap.remove("add_amount");
> }
> in ShoppingCartEvents.java
> Though there are only 9 cases like that (only Strings) at all in  
> OFBiz, so yes maybe...
>
> Jacques
>
> From: "Scott Gray" <[hidden email]>
>> Yes there may well be issues with formatting not being applied in  
>> various places but I think it is those which should be fixed  
>> rather  than adding a property.  My preference for BigDecimal  
>> initialization  would be to use BigDecimal.ZERO.
>> Regards
>> Scott
>> On 10/11/2009, at 10:30 AM, Jacques Le Roux wrote:
>>> Yes, I agree that's why I asked. However these strings are  
>>> *intialized* to "0.00" or "'0.00" is a ternary ? default and, as  
>>> they are default, used if no formatted values replace them.
>>> At least in POS
>>> Receipt.java[472]
>>> Operator.java[104]
>>>
>>> But there are other similar cases outside of POS, look for "0.00"...
>>>
>>> Jacques
>>>
>>> From: "Scott Gray" <[hidden email]>
>>>> Hi Jacques,
>>>>
>>>> I think it should be irrelevant whether a BigDecimal is  
>>>> initialized  as  0, 0.00 or 0.0000000 because all number should  
>>>> be rounded if  needed  before being presented in the UI anyway.  
>>>> Assuming that it  was  currency that your Client wanted 1 decimal  
>>>> place for, wasn't  the  number going through some sort of  
>>>> currency formatting before  being  presented?
>>>>
>>>> Regards
>>>> Scott
>>>>
>>>> HotWax Media
>>>> http://www.hotwaxmedia.com
>>>>
>>>> On 10/11/2009, at 10:10 AM, Jacques Le Roux wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I notice that we have number of "0.00" strings harcoded. I  
>>>>> think  we  should introduce a parameter for that in Arithmetic  
>>>>> properties
>>>>> Something like default.decimals.string="0.00"
>>>>> A client of mine (POS) wanted to use only 1 decimal and I had  
>>>>> to   harcode them, I'd like to generalize.
>>>>>
>>>>> What do you think ?
>>>>>
>>>>> Jacques
>>>>>
>>>>
>>>
>>>
>>
>


smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: "0.00" String

Jacques Le Roux
Administrator
Thanks Scott,

It's not the same cases I have to deal with (it's only and alway strings), but I agree it's the way.
We should do this kind of thing for all other cases also (I will handle POS cases tomorrow)

Jacques

From: "Scott Gray" <[hidden email]>

> See r834274
>
> Regards
> Scott
>
> On 10/11/2009, at 11:47 AM, Jacques Le Roux wrote:
>
>> Scott,
>>
>> It's a bit complicated for snippet like
>>
>> // get the selected amount
>> String selectedAmountStr = "0.00";
>> if (paramMap.containsKey("ADD_AMOUNT")) {
>>   selectedAmountStr = (String) paramMap.remove("ADD_AMOUNT");
>> } else if (paramMap.containsKey("add_amount")) {
>>   selectedAmountStr = (String) paramMap.remove("add_amount");
>> }
>> in ShoppingCartEvents.java
>> Though there are only 9 cases like that (only Strings) at all in  
>> OFBiz, so yes maybe...
>>
>> Jacques
>>
>> From: "Scott Gray" <[hidden email]>
>>> Yes there may well be issues with formatting not being applied in  
>>> various places but I think it is those which should be fixed  
>>> rather  than adding a property.  My preference for BigDecimal  
>>> initialization  would be to use BigDecimal.ZERO.
>>> Regards
>>> Scott
>>> On 10/11/2009, at 10:30 AM, Jacques Le Roux wrote:
>>>> Yes, I agree that's why I asked. However these strings are  
>>>> *intialized* to "0.00" or "'0.00" is a ternary ? default and, as  
>>>> they are default, used if no formatted values replace them.
>>>> At least in POS
>>>> Receipt.java[472]
>>>> Operator.java[104]
>>>>
>>>> But there are other similar cases outside of POS, look for "0.00"...
>>>>
>>>> Jacques
>>>>
>>>> From: "Scott Gray" <[hidden email]>
>>>>> Hi Jacques,
>>>>>
>>>>> I think it should be irrelevant whether a BigDecimal is  
>>>>> initialized  as  0, 0.00 or 0.0000000 because all number should  
>>>>> be rounded if  needed  before being presented in the UI anyway.  
>>>>> Assuming that it  was  currency that your Client wanted 1 decimal  
>>>>> place for, wasn't  the  number going through some sort of  
>>>>> currency formatting before  being  presented?
>>>>>
>>>>> Regards
>>>>> Scott
>>>>>
>>>>> HotWax Media
>>>>> http://www.hotwaxmedia.com
>>>>>
>>>>> On 10/11/2009, at 10:10 AM, Jacques Le Roux wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I notice that we have number of "0.00" strings harcoded. I  
>>>>>> think  we  should introduce a parameter for that in Arithmetic  
>>>>>> properties
>>>>>> Something like default.decimals.string="0.00"
>>>>>> A client of mine (POS) wanted to use only 1 decimal and I had  
>>>>>> to   harcode them, I'd like to generalize.
>>>>>>
>>>>>> What do you think ?
>>>>>>
>>>>>> Jacques
>>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: "0.00" String

Jacques Le Roux
Administrator
OK, with Scott's help it's all fixed

Jacques

From: "Jacques Le Roux" <[hidden email]>

> Thanks Scott,
>
> It's not the same cases I have to deal with (it's only and alway strings), but I agree it's the way.
> We should do this kind of thing for all other cases also (I will handle POS cases tomorrow)
>
> Jacques
>
> From: "Scott Gray" <[hidden email]>
>> See r834274
>>
>> Regards
>> Scott
>>
>> On 10/11/2009, at 11:47 AM, Jacques Le Roux wrote:
>>
>>> Scott,
>>>
>>> It's a bit complicated for snippet like
>>>
>>> // get the selected amount
>>> String selectedAmountStr = "0.00";
>>> if (paramMap.containsKey("ADD_AMOUNT")) {
>>>   selectedAmountStr = (String) paramMap.remove("ADD_AMOUNT");
>>> } else if (paramMap.containsKey("add_amount")) {
>>>   selectedAmountStr = (String) paramMap.remove("add_amount");
>>> }
>>> in ShoppingCartEvents.java
>>> Though there are only 9 cases like that (only Strings) at all in  
>>> OFBiz, so yes maybe...
>>>
>>> Jacques
>>>
>>> From: "Scott Gray" <[hidden email]>
>>>> Yes there may well be issues with formatting not being applied in  
>>>> various places but I think it is those which should be fixed  
>>>> rather  than adding a property.  My preference for BigDecimal  
>>>> initialization  would be to use BigDecimal.ZERO.
>>>> Regards
>>>> Scott
>>>> On 10/11/2009, at 10:30 AM, Jacques Le Roux wrote:
>>>>> Yes, I agree that's why I asked. However these strings are  
>>>>> *intialized* to "0.00" or "'0.00" is a ternary ? default and, as  
>>>>> they are default, used if no formatted values replace them.
>>>>> At least in POS
>>>>> Receipt.java[472]
>>>>> Operator.java[104]
>>>>>
>>>>> But there are other similar cases outside of POS, look for "0.00"...
>>>>>
>>>>> Jacques
>>>>>
>>>>> From: "Scott Gray" <[hidden email]>
>>>>>> Hi Jacques,
>>>>>>
>>>>>> I think it should be irrelevant whether a BigDecimal is  
>>>>>> initialized  as  0, 0.00 or 0.0000000 because all number should  
>>>>>> be rounded if  needed  before being presented in the UI anyway.  
>>>>>> Assuming that it  was  currency that your Client wanted 1 decimal  
>>>>>> place for, wasn't  the  number going through some sort of  
>>>>>> currency formatting before  being  presented?
>>>>>>
>>>>>> Regards
>>>>>> Scott
>>>>>>
>>>>>> HotWax Media
>>>>>> http://www.hotwaxmedia.com
>>>>>>
>>>>>> On 10/11/2009, at 10:10 AM, Jacques Le Roux wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I notice that we have number of "0.00" strings harcoded. I  
>>>>>>> think  we  should introduce a parameter for that in Arithmetic  
>>>>>>> properties
>>>>>>> Something like default.decimals.string="0.00"
>>>>>>> A client of mine (POS) wanted to use only 1 decimal and I had  
>>>>>>> to   harcode them, I'd like to generalize.
>>>>>>>
>>>>>>> What do you think ?
>>>>>>>
>>>>>>> Jacques
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>