You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2009/11/19 13:31:00 UTC

svn commit: r882127 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl

Author: ashish
Date: Thu Nov 19 12:30:58 2009
New Revision: 882127

URL: http://svn.apache.org/viewvc?rev=882127&view=rev
Log:
Conditional check for billingAccount amount. If no account limit is set with party's billing account then 0.00 will be shown on checkout page. Thanks Akash for the patch.

Modified:
    ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl?rev=882127&r1=882126&r2=882127&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl Thu Nov 19 12:30:58 2009
@@ -52,7 +52,11 @@
                       <option value=""></option>
                         <#list billingAccountList as billingAccount>
                           <#assign availableAmount = billingAccount.accountBalance?double>
-                          <#assign accountLimit = billingAccount.accountLimit?double>
+                          <#if (billingAccount.accountLimit)?exists>
+                              <#assign accountLimit = billingAccount.accountLimit?double />
+                          <#else>
+                              <#assign accountLimit = 0.00 />
+                          </#if> 
                           <option value="${billingAccount.billingAccountId}" <#if billingAccount.billingAccountId == selectedBillingAccountId?default("")>selected</#if>>${billingAccount.description?default("")} [${billingAccount.billingAccountId}] Available: <@ofbizCurrency amount=availableAmount isoCode=billingAccount.accountCurrencyUomId/> Limit: <@ofbizCurrency amount=accountLimit isoCode=billingAccount.accountCurrencyUomId/></option>
                         </#list>
                     </select>



Re: svn commit: r882127 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl

Posted by Jacques Le Roux <ja...@les7arts.com>.
As a reminder (I know we had already a discussion about that)

It should be noted that OfbizCurrencyTransform.java uses UtilFormatOut.formatCurrency() which in turn relies on 
com.ibm.icu.text.NumberFormat.getCurrencyInstance(locale) to select the right format.
I guess in most cases it's ok. But I had recently a client who wanted to see only 1 decimals even if his currency is norammly 
displayed with 2. I don't know why, I asked he was sure and he was. As we all know the client is King so I did it.
That's why I made this change for formatting outside of  ofbizCurrency macro (it's the only place where 
UtilFormatOut.formatCurrency() is currently used. As we already said in the case ofbizCurrency macro its maximumFractionDigits 
parameter shoud be used.

HTH

Mmm... Now I begin to wonder if I should not replace all uses of UtilFormatOut.formatPrice() by UtilFormatOut.formatCurrency() BTW 
it's only in the POS component, except of an exotic use in Webtools to format cache seconds :o)

Jacques


From: "Jacques Le Roux" <ja...@les7arts.com>
> From: "Jacques Le Roux" <ja...@les7arts.com>
>> Thanks Akash,
>>
>> I did not apply your patch since, as you said, accountLimit is below formated using ofbizCurrency anyway and just above
>> ?double is used in <#assign accountLimit = billingAccount.accountLimit?double />
>> So it's ok there.
>>
>> Actually my demand was not really related to this commit but at large to "##0.00" in ftl files (there are 11 instances) which 
>> should
>> better use also ofbizCurrency... I think I will do later..
>>
>> Because at the moment my main concern is about UtilFormatOut.java[43-44]. I would like to use properties there.
>> Because prices are always related to a currency, I'd use currency.decimal.format for priceNumberFormat but as it's never used, I 
>> think we can remove
>> and I will introduce price.decimal.format=#,##0.00 in general.proprties to be used for priceDecimalFormat in UtilFormatOut.java
>>
>> I even wonder if we should not use only one string. I think I will write and commit changes shortly...
>
> Done in trunk at r884023 , R9.04 r884033
>
> Jacques
>
>> Jacques
>>
>> From: "Akash Jain" <ak...@hotwaxmedia.com>
>>> Hello Jacques,
>>>
>>> I have done R&D on "currency.decimal.format" and I came up the
>>> conclusion, it is used for deciding how many digit you want after decimal
>>>
>>> suppose,
>>>
>>> input = 1.0;
>>> currencyFormat = UtilProperties.getPropertyValue("general.properties",
>>> "currency.decimal.format", "##0.00");
>>> formatter = new DecimalFormat(currencyFormat);
>>> output = formatter.format(input);
>>> println("=========output======"+output);
>>>
>>> then,
>>>
>>> if value of property currency.decimal.format = ##0.00 in
>>> general.properties file then value of output = 1.00
>>> if value of property currency.decimal.format = ##0.000 in
>>> general.properties file then value of output = 1.000
>>> if value of property currency.decimal.format = ##0.0000 in
>>> general.properties file then value of output = 1.0000 and so on.
>>>
>>> But there following issues in using "currency.decimal.format" property
>>> for this commit:-
>>>
>>> (1) There is need to assign  (accountLimit = 0.00) value only, not
>>> matter  about digits after decimal.
>>> (2) In this case output will be "string" and in the next step there is
>>> used, <@ofbizCurrency
>>> amount=accountLimit isoCode=billingAccount.accountCurrencyUomId/> it
>>> will create problem
>>>
>>> I have attached a patch in which I have used BigDecimal.Zero instead of
>>> currency.decimal.format property.
>>>
>>> Waiting for your/others suggestions.
>>>
>>>
>>> Thanks and Regards
>>> --
>>> Akash Jain
>>>
>>>
>>> Jacques Le Roux wrote:
>>>> Hi Ashish,
>>>>
>>>> Sorry to be nit-picking, not a big deal, could it be possible to use
>>>> something Parameterized  ? Sometimes we do not want to see 2
>>>> decimals (but more or less, I was confronted to such a demand recently
>>>> : 1 decimals only)
>>>> BTW we have a bunch of "##0.00" in ftl files and they should better
>>>> use currency.decimal.format.
>>>>
>>>> Thanks
>>>>
>>>> Jacques
>>>>
>>>>> Author: ashish
>>>>> Date: Thu Nov 19 12:30:58 2009
>>>>> New Revision: 882127
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=882127&view=rev
>>>>> Log:
>>>>> Conditional check for billingAccount amount. If no account limit is
>>>>> set with party's billing account then 0.00 will be shown on
>>>>> checkout page. Thanks Akash for the patch.
>>>>>
>>>>> Modified:
>>>>>    ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>>>>
>>>>> Modified:
>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>>>> URL:
>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl?rev=882127&r1=882126&r2=882127&view=diff
>>>>>
>>>>> ==============================================================================
>>>>>
>>>>> --- 
>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>>>> (original)
>>>>> +++
>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>>>> Thu Nov 19 12:30:58 2009
>>>>> @@ -52,7 +52,11 @@
>>>>>                       <option value=""></option>
>>>>>                         <#list billingAccountList as billingAccount>
>>>>>                           <#assign availableAmount =
>>>>> billingAccount.accountBalance?double>
>>>>> -                          <#assign accountLimit =
>>>>> billingAccount.accountLimit?double>
>>>>> +                          <#if (billingAccount.accountLimit)?exists>
>>>>> +                              <#assign accountLimit =
>>>>> billingAccount.accountLimit?double />
>>>>> +                          <#else>
>>>>> +                              <#assign accountLimit = 0.00 />
>>>>> +                          </#if>
>>>>>                           <option
>>>>> value="${billingAccount.billingAccountId}" <#if
>>>>> billingAccount.billingAccountId ==
>>>>> selectedBillingAccountId?default("")>selected</#if>>${billingAccount.description?default("")}
>>>>> [${billingAccount.billingAccountId}]
>>>>> Available: <@ofbizCurrency amount=availableAmount
>>>>> isoCode=billingAccount.accountCurrencyUomId/> Limit: <@ofbizCurrency
>>>>> amount=accountLimit
>>>>> isoCode=billingAccount.accountCurrencyUomId/></option>
>>>>>                         </#list>
>>>>>                     </select>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> 



Re: svn commit: r882127 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl

Posted by Jacques Le Roux <ja...@les7arts.com>.
From: "Jacques Le Roux" <ja...@les7arts.com>
> Thanks Akash,
>
> I did not apply your patch since, as you said, accountLimit is below formated using ofbizCurrency anyway and just above
> ?double is used in <#assign accountLimit = billingAccount.accountLimit?double />
> So it's ok there.
>
> Actually my demand was not really related to this commit but at large to "##0.00" in ftl files (there are 11 instances) which 
> should
> better use also ofbizCurrency... I think I will do later..
>
> Because at the moment my main concern is about UtilFormatOut.java[43-44]. I would like to use properties there.
> Because prices are always related to a currency, I'd use currency.decimal.format for priceNumberFormat but as it's never used, I 
> think we can remove
> and I will introduce price.decimal.format=#,##0.00 in general.proprties to be used for priceDecimalFormat in UtilFormatOut.java
>
> I even wonder if we should not use only one string. I think I will write and commit changes shortly...

Done in trunk at r884023 , R9.04 r884033

Jacques

> Jacques
>
> From: "Akash Jain" <ak...@hotwaxmedia.com>
>> Hello Jacques,
>>
>> I have done R&D on "currency.decimal.format" and I came up the
>> conclusion, it is used for deciding how many digit you want after decimal
>>
>> suppose,
>>
>> input = 1.0;
>> currencyFormat = UtilProperties.getPropertyValue("general.properties",
>> "currency.decimal.format", "##0.00");
>> formatter = new DecimalFormat(currencyFormat);
>> output = formatter.format(input);
>> println("=========output======"+output);
>>
>> then,
>>
>> if value of property currency.decimal.format = ##0.00 in
>> general.properties file then value of output = 1.00
>> if value of property currency.decimal.format = ##0.000 in
>> general.properties file then value of output = 1.000
>> if value of property currency.decimal.format = ##0.0000 in
>> general.properties file then value of output = 1.0000 and so on.
>>
>> But there following issues in using "currency.decimal.format" property
>> for this commit:-
>>
>> (1) There is need to assign  (accountLimit = 0.00) value only, not
>> matter  about digits after decimal.
>> (2) In this case output will be "string" and in the next step there is
>> used, <@ofbizCurrency
>> amount=accountLimit isoCode=billingAccount.accountCurrencyUomId/> it
>> will create problem
>>
>> I have attached a patch in which I have used BigDecimal.Zero instead of
>> currency.decimal.format property.
>>
>> Waiting for your/others suggestions.
>>
>>
>> Thanks and Regards
>> --
>> Akash Jain
>>
>>
>> Jacques Le Roux wrote:
>>> Hi Ashish,
>>>
>>> Sorry to be nit-picking, not a big deal, could it be possible to use
>>> something Parameterized  ? Sometimes we do not want to see 2
>>> decimals (but more or less, I was confronted to such a demand recently
>>> : 1 decimals only)
>>> BTW we have a bunch of "##0.00" in ftl files and they should better
>>> use currency.decimal.format.
>>>
>>> Thanks
>>>
>>> Jacques
>>>
>>>> Author: ashish
>>>> Date: Thu Nov 19 12:30:58 2009
>>>> New Revision: 882127
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=882127&view=rev
>>>> Log:
>>>> Conditional check for billingAccount amount. If no account limit is
>>>> set with party's billing account then 0.00 will be shown on
>>>> checkout page. Thanks Akash for the patch.
>>>>
>>>> Modified:
>>>>    ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>>>
>>>> Modified:
>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>>> URL:
>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl?rev=882127&r1=882126&r2=882127&view=diff
>>>>
>>>> ==============================================================================
>>>>
>>>> --- 
>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>>> (original)
>>>> +++
>>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>>> Thu Nov 19 12:30:58 2009
>>>> @@ -52,7 +52,11 @@
>>>>                       <option value=""></option>
>>>>                         <#list billingAccountList as billingAccount>
>>>>                           <#assign availableAmount =
>>>> billingAccount.accountBalance?double>
>>>> -                          <#assign accountLimit =
>>>> billingAccount.accountLimit?double>
>>>> +                          <#if (billingAccount.accountLimit)?exists>
>>>> +                              <#assign accountLimit =
>>>> billingAccount.accountLimit?double />
>>>> +                          <#else>
>>>> +                              <#assign accountLimit = 0.00 />
>>>> +                          </#if>
>>>>                           <option
>>>> value="${billingAccount.billingAccountId}" <#if
>>>> billingAccount.billingAccountId ==
>>>> selectedBillingAccountId?default("")>selected</#if>>${billingAccount.description?default("")}
>>>> [${billingAccount.billingAccountId}]
>>>> Available: <@ofbizCurrency amount=availableAmount
>>>> isoCode=billingAccount.accountCurrencyUomId/> Limit: <@ofbizCurrency
>>>> amount=accountLimit
>>>> isoCode=billingAccount.accountCurrencyUomId/></option>
>>>>                         </#list>
>>>>                     </select>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
> 



Re: svn commit: r882127 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl

Posted by Jacques Le Roux <ja...@les7arts.com>.
Thanks Akash,

I did not apply your patch since, as you said, accountLimit is below formated using ofbizCurrency anyway and just above
?double is used in <#assign accountLimit = billingAccount.accountLimit?double />
So it's ok there.

Actually my demand was not really related to this commit but at large to "##0.00" in ftl files (there are 11 instances) which should
better use also ofbizCurrency... I think I will do later..

Because at the moment my main concern is about UtilFormatOut.java[43-44]. I would like to use properties there.
Because prices are always related to a currency, I'd use currency.decimal.format for priceNumberFormat but as it's never used, I 
think we can remove
and I will introduce price.decimal.format=#,##0.00 in general.proprties to be used for priceDecimalFormat in UtilFormatOut.java

I even wonder if we should not use only one string. I think I will write and commit changes shortly...

Jacques

From: "Akash Jain" <ak...@hotwaxmedia.com>
> Hello Jacques,
>
> I have done R&D on "currency.decimal.format" and I came up the
> conclusion, it is used for deciding how many digit you want after decimal
>
> suppose,
>
> input = 1.0;
> currencyFormat = UtilProperties.getPropertyValue("general.properties",
> "currency.decimal.format", "##0.00");
> formatter = new DecimalFormat(currencyFormat);
> output = formatter.format(input);
> println("=========output======"+output);
>
> then,
>
> if value of property currency.decimal.format = ##0.00 in
> general.properties file then value of output = 1.00
> if value of property currency.decimal.format = ##0.000 in
> general.properties file then value of output = 1.000
> if value of property currency.decimal.format = ##0.0000 in
> general.properties file then value of output = 1.0000 and so on.
>
> But there following issues in using "currency.decimal.format" property
> for this commit:-
>
> (1) There is need to assign  (accountLimit = 0.00) value only, not
> matter  about digits after decimal.
> (2) In this case output will be "string" and in the next step there is
> used, <@ofbizCurrency
> amount=accountLimit isoCode=billingAccount.accountCurrencyUomId/> it
> will create problem
>
> I have attached a patch in which I have used BigDecimal.Zero instead of
> currency.decimal.format property.
>
> Waiting for your/others suggestions.
>
>
> Thanks and Regards
> --
> Akash Jain
>
>
> Jacques Le Roux wrote:
>> Hi Ashish,
>>
>> Sorry to be nit-picking, not a big deal, could it be possible to use
>> something Parameterized  ? Sometimes we do not want to see 2
>> decimals (but more or less, I was confronted to such a demand recently
>> : 1 decimals only)
>> BTW we have a bunch of "##0.00" in ftl files and they should better
>> use currency.decimal.format.
>>
>> Thanks
>>
>> Jacques
>>
>>> Author: ashish
>>> Date: Thu Nov 19 12:30:58 2009
>>> New Revision: 882127
>>>
>>> URL: http://svn.apache.org/viewvc?rev=882127&view=rev
>>> Log:
>>> Conditional check for billingAccount amount. If no account limit is
>>> set with party's billing account then 0.00 will be shown on
>>> checkout page. Thanks Akash for the patch.
>>>
>>> Modified:
>>>    ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>>
>>> Modified:
>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl?rev=882127&r1=882126&r2=882127&view=diff
>>>
>>> ==============================================================================
>>>
>>> --- 
>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>> (original)
>>> +++
>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>> Thu Nov 19 12:30:58 2009
>>> @@ -52,7 +52,11 @@
>>>                       <option value=""></option>
>>>                         <#list billingAccountList as billingAccount>
>>>                           <#assign availableAmount =
>>> billingAccount.accountBalance?double>
>>> -                          <#assign accountLimit =
>>> billingAccount.accountLimit?double>
>>> +                          <#if (billingAccount.accountLimit)?exists>
>>> +                              <#assign accountLimit =
>>> billingAccount.accountLimit?double />
>>> +                          <#else>
>>> +                              <#assign accountLimit = 0.00 />
>>> +                          </#if>
>>>                           <option
>>> value="${billingAccount.billingAccountId}" <#if
>>> billingAccount.billingAccountId ==
>>> selectedBillingAccountId?default("")>selected</#if>>${billingAccount.description?default("")}
>>> [${billingAccount.billingAccountId}]
>>> Available: <@ofbizCurrency amount=availableAmount
>>> isoCode=billingAccount.accountCurrencyUomId/> Limit: <@ofbizCurrency
>>> amount=accountLimit
>>> isoCode=billingAccount.accountCurrencyUomId/></option>
>>>                         </#list>
>>>                     </select>
>>>
>>>
>>
>>
>>
>
>



Re: svn commit: r882127 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl

Posted by Jacques Le Roux <ja...@les7arts.com>.
Sorry Akash,

I ran out of time and was not able to answer you yet. Hopefully I will do it tomorrow...

Thanks

Jacques

From: "Akash Jain" <ak...@hotwaxmedia.com>
> Hello Jacques,
>
> I have done R&D on "currency.decimal.format" and I came up the
> conclusion, it is used for deciding how many digit you want after decimal
>
> suppose,
>
> input = 1.0;
> currencyFormat = UtilProperties.getPropertyValue("general.properties",
> "currency.decimal.format", "##0.00");
> formatter = new DecimalFormat(currencyFormat);
> output = formatter.format(input);
> println("=========output======"+output);
>
> then,
>
> if value of property currency.decimal.format = ##0.00 in
> general.properties file then value of output = 1.00
> if value of property currency.decimal.format = ##0.000 in
> general.properties file then value of output = 1.000
> if value of property currency.decimal.format = ##0.0000 in
> general.properties file then value of output = 1.0000 and so on.
>
> But there following issues in using "currency.decimal.format" property
> for this commit:-
>
> (1) There is need to assign  (accountLimit = 0.00) value only, not
> matter  about digits after decimal.
> (2) In this case output will be "string" and in the next step there is
> used, <@ofbizCurrency
> amount=accountLimit isoCode=billingAccount.accountCurrencyUomId/> it
> will create problem
>
> I have attached a patch in which I have used BigDecimal.Zero instead of
> currency.decimal.format property.
>
> Waiting for your/others suggestions.
>
>
> Thanks and Regards
> --
> Akash Jain
>
>
> Jacques Le Roux wrote:
>> Hi Ashish,
>>
>> Sorry to be nit-picking, not a big deal, could it be possible to use
>> something Parameterized  ? Sometimes we do not want to see 2
>> decimals (but more or less, I was confronted to such a demand recently
>> : 1 decimals only)
>> BTW we have a bunch of "##0.00" in ftl files and they should better
>> use currency.decimal.format.
>>
>> Thanks
>>
>> Jacques
>>
>>> Author: ashish
>>> Date: Thu Nov 19 12:30:58 2009
>>> New Revision: 882127
>>>
>>> URL: http://svn.apache.org/viewvc?rev=882127&view=rev
>>> Log:
>>> Conditional check for billingAccount amount. If no account limit is
>>> set with party's billing account then 0.00 will be shown on
>>> checkout page. Thanks Akash for the patch.
>>>
>>> Modified:
>>>    ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>>
>>> Modified:
>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>> URL:
>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl?rev=882127&r1=882126&r2=882127&view=diff
>>>
>>> ==============================================================================
>>>
>>> --- 
>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>> (original)
>>> +++
>>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>> Thu Nov 19 12:30:58 2009
>>> @@ -52,7 +52,11 @@
>>>                       <option value=""></option>
>>>                         <#list billingAccountList as billingAccount>
>>>                           <#assign availableAmount =
>>> billingAccount.accountBalance?double>
>>> -                          <#assign accountLimit =
>>> billingAccount.accountLimit?double>
>>> +                          <#if (billingAccount.accountLimit)?exists>
>>> +                              <#assign accountLimit =
>>> billingAccount.accountLimit?double />
>>> +                          <#else>
>>> +                              <#assign accountLimit = 0.00 />
>>> +                          </#if>
>>>                           <option
>>> value="${billingAccount.billingAccountId}" <#if
>>> billingAccount.billingAccountId ==
>>> selectedBillingAccountId?default("")>selected</#if>>${billingAccount.description?default("")}
>>> [${billingAccount.billingAccountId}]
>>> Available: <@ofbizCurrency amount=availableAmount
>>> isoCode=billingAccount.accountCurrencyUomId/> Limit: <@ofbizCurrency
>>> amount=accountLimit
>>> isoCode=billingAccount.accountCurrencyUomId/></option>
>>>                         </#list>
>>>                     </select>
>>>
>>>
>>
>>
>>
>
> 



Re: svn commit: r882127 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl

Posted by Akash Jain <ak...@hotwaxmedia.com>.
Hello Jacques,

I have done R&D on "currency.decimal.format" and I came up the 
conclusion, it is used for deciding how many digit you want after decimal

suppose,

input = 1.0;
currencyFormat = UtilProperties.getPropertyValue("general.properties", 
"currency.decimal.format", "##0.00");
formatter = new DecimalFormat(currencyFormat);
output = formatter.format(input);
println("=========output======"+output);

then,

if value of property currency.decimal.format = ##0.00 in 
general.properties file then value of output = 1.00
if value of property currency.decimal.format = ##0.000 in 
general.properties file then value of output = 1.000
if value of property currency.decimal.format = ##0.0000 in 
general.properties file then value of output = 1.0000 and so on.

But there following issues in using "currency.decimal.format" property 
for this commit:-

(1) There is need to assign  (accountLimit = 0.00) value only, not 
matter  about digits after decimal.
(2) In this case output will be "string" and in the next step there is 
used, <@ofbizCurrency
amount=accountLimit isoCode=billingAccount.accountCurrencyUomId/> it 
will create problem

I have attached a patch in which I have used BigDecimal.Zero instead of  
currency.decimal.format property.

Waiting for your/others suggestions.


Thanks and Regards
--
Akash Jain


Jacques Le Roux wrote:
> Hi Ashish,
>
> Sorry to be nit-picking, not a big deal, could it be possible to use 
> something Parameterized  ? Sometimes we do not want to see 2
> decimals (but more or less, I was confronted to such a demand recently 
> : 1 decimals only)
> BTW we have a bunch of "##0.00" in ftl files and they should better 
> use currency.decimal.format.
>
> Thanks
>
> Jacques
>
>> Author: ashish
>> Date: Thu Nov 19 12:30:58 2009
>> New Revision: 882127
>>
>> URL: http://svn.apache.org/viewvc?rev=882127&view=rev
>> Log:
>> Conditional check for billingAccount amount. If no account limit is 
>> set with party's billing account then 0.00 will be shown on
>> checkout page. Thanks Akash for the patch.
>>
>> Modified:
>>    ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>>
>> Modified: 
>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl?rev=882127&r1=882126&r2=882127&view=diff 
>>
>> ============================================================================== 
>>
>> --- 
>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl 
>> (original)
>> +++ 
>> ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl 
>> Thu Nov 19 12:30:58 2009
>> @@ -52,7 +52,11 @@
>>                       <option value=""></option>
>>                         <#list billingAccountList as billingAccount>
>>                           <#assign availableAmount = 
>> billingAccount.accountBalance?double>
>> -                          <#assign accountLimit = 
>> billingAccount.accountLimit?double>
>> +                          <#if (billingAccount.accountLimit)?exists>
>> +                              <#assign accountLimit = 
>> billingAccount.accountLimit?double />
>> +                          <#else>
>> +                              <#assign accountLimit = 0.00 />
>> +                          </#if>
>>                           <option 
>> value="${billingAccount.billingAccountId}" <#if 
>> billingAccount.billingAccountId ==
>> selectedBillingAccountId?default("")>selected</#if>>${billingAccount.description?default("")} 
>> [${billingAccount.billingAccountId}]
>> Available: <@ofbizCurrency amount=availableAmount 
>> isoCode=billingAccount.accountCurrencyUomId/> Limit: <@ofbizCurrency
>> amount=accountLimit 
>> isoCode=billingAccount.accountCurrencyUomId/></option>
>>                         </#list>
>>                     </select>
>>
>>
>
>
>


Re: svn commit: r882127 - /ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl

Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi Ashish,

Sorry to be nit-picking, not a big deal, could it be possible to use something Parameterized  ? Sometimes we do not want to see 2
decimals (but more or less, I was confronted to such a demand recently : 1 decimals only)
BTW we have a bunch of "##0.00" in ftl files and they should better use currency.decimal.format.

Thanks

Jacques

> Author: ashish
> Date: Thu Nov 19 12:30:58 2009
> New Revision: 882127
>
> URL: http://svn.apache.org/viewvc?rev=882127&view=rev
> Log:
> Conditional check for billingAccount amount. If no account limit is set with party's billing account then 0.00 will be shown on
> checkout page. Thanks Akash for the patch.
>
> Modified:
>    ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
>
> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl?rev=882127&r1=882126&r2=882127&view=diff
> ==============================================================================
> --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl (original)
> +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/billsettings.ftl Thu Nov 19 12:30:58 2009
> @@ -52,7 +52,11 @@
>                       <option value=""></option>
>                         <#list billingAccountList as billingAccount>
>                           <#assign availableAmount = billingAccount.accountBalance?double>
> -                          <#assign accountLimit = billingAccount.accountLimit?double>
> +                          <#if (billingAccount.accountLimit)?exists>
> +                              <#assign accountLimit = billingAccount.accountLimit?double />
> +                          <#else>
> +                              <#assign accountLimit = 0.00 />
> +                          </#if>
>                           <option value="${billingAccount.billingAccountId}" <#if billingAccount.billingAccountId ==
> selectedBillingAccountId?default("")>selected</#if>>${billingAccount.description?default("")} [${billingAccount.billingAccountId}]
> Available: <@ofbizCurrency amount=availableAmount isoCode=billingAccount.accountCurrencyUomId/> Limit: <@ofbizCurrency
> amount=accountLimit isoCode=billingAccount.accountCurrencyUomId/></option>
>                         </#list>
>                     </select>
>
>