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" <akash.j...@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>









Reply via email to