I've committed the changes in rev. 535415
As I mentioned above, someone with framework commit privileges needs to look
at the rounding of displayed currency. I've attached a patch with the
changes I think are needed. If it doesn't see any action in the short term
I'll throw it in the jira.
Regards
Scott
On 05/05/07, Scott Gray <[EMAIL PROTECTED]> wrote:
I had planned on working the patch in this weekend, I just need to clean
it up a bit.
One thing I need a framework guy to look at is the rounding currency
formatting in widgets and the freemarker transform, I think we need to set
the default to something like 10 decimal places instead of the currency's
default. That way any rounding problems aren't hidden by the display code
and it also allows us to display tax items to 3 decimal places (or whatever
the arithmetic.properties has set).
Also, salestax.calc.decimals is a bit of misnomer considering the best we
can do when storing intermediate tax is currency-precise at 3 decimal
places.
And yes I did get paid (tax free, for the moment at least) :-)
Regards
Scott
On 05/05/07, Jacopo Cappellato <[EMAIL PROTECTED]> wrote:
>
> Yes,
>
> and, Scott, did you get your 500$ ? :-)
>
> Jacopo
>
> David E Jones wrote:
> >
> > Scott,
> >
> > Did this ever make it into OFBiz? I only reviewed it briefly, but if
> it
> > is fixing this problem then it would be great to have it in the ofbiz
> > trunk.
> >
> > -David
> >
>
Index: framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
===================================================================
--- framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (revision 535400)
+++ framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (working copy)
@@ -1742,7 +1742,7 @@
}
try {
Double parsedRetVal = (Double) ObjectType.simpleTypeConvert(retVal, "Double", null, locale, false);
- retVal = UtilFormatOut.formatCurrency(parsedRetVal, isoCode, locale);
+ retVal = UtilFormatOut.formatCurrency(parsedRetVal, isoCode, locale, 10);
} catch (GeneralException e) {
String errMsg = "Error formatting currency value [" + retVal + "]: " + e.toString();
Debug.logError(e, errMsg, module);
Index: framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java
===================================================================
--- framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java (revision 535400)
+++ framework/webapp/src/org/ofbiz/webapp/ftl/OfbizCurrencyTransform.java (working copy)
@@ -115,12 +115,12 @@
BeanModel req = (BeanModel) env.getVariable("request");
if (req != null) {
HttpServletRequest request = (HttpServletRequest) req.getWrappedObject();
- out.write(UtilFormatOut.formatCurrency(amount, isoCode, UtilHttp.getLocale(request)));
+ out.write(UtilFormatOut.formatCurrency(amount, isoCode, UtilHttp.getLocale(request), 10));
} else {
- out.write(UtilFormatOut.formatCurrency(amount, isoCode, env.getLocale()));
+ out.write(UtilFormatOut.formatCurrency(amount, isoCode, env.getLocale(), 10));
}
} else {
- out.write(UtilFormatOut.formatCurrency(amount.doubleValue(), isoCode, new Locale(locale)));
+ out.write(UtilFormatOut.formatCurrency(amount.doubleValue(), isoCode, new Locale(locale), 10));
}
} catch (TemplateModelException e) {
throw new IOException(e.getMessage());