looks good. I'm not sure what's the difference between accounting and
default formats though? And why do we have Integer format?

I would probably limit the types of formatting to percentage and
currency and quantity. Between those three you probably have all cases
covered no?

On Fri, Apr 5, 2019 at 7:58 PM Nicolas Malin <[email protected]> wrote:
>
> Hello
>
> I would improve an idea present by Charles STELTZLEN on issue OFBIZ-7532 [1]
>
> Currently when you display a number you have different possibility to
> format it :
>   * by ftl with <@ofbizAmount>
>   * by widget with <display type="accounting-number"/>
>   * or everywhere with UtilFormatOut.formatDecimalNumber(number,
> template, locale)
>
> Main problem, we haven't a simple solution to homogenize display
> template number by purpose without check each case on source code.
> A example, if you display your invoice amount on 3 digits and your order
> amount on 6 digits, you can't use ofbizAmount or accounting-number so
> you do raw call :
>   * for invoice: UtilFormatOut.formatDecimalNumber(invoiceAmount,
> '##0.000', locale)
>   * for order: UtilFormatOut.formatDecimalNumber(invoiceAmount,
> '##0.000000', locale)
>
> on ftl
> ${Static["org.apache.ofbiz.base.util.UtilFormatOut"].formatDecimalNumber(invoiceAmount,
> '##0.000', locale)}
> on widget
>      <display description="${groovy:
> org.apache.ofbiz.base.util.UtilFormatOut.formatDecimalNumber(invoiceAmount,
> '##0.000', locale)}/>
>
> There is huge cases where we want different displaying template.
>
> For homogenize all I propose to introduce each format template on
> properties that would be use everywhere in ofbiz, example :
>
>       format.properties
>           invoice.format=##0.000
>           order.format=##0.000000
>
> on ftl
>       <@ofbizAmount amount=invoice.amount format='invoice'/>
> on widget
>       <display type="number" format-type="invoice"/>
>
> All displaying template pass through new util
> *UtilFormatOut.formatNumber* as generic function to works with a format
> type present on properties. With this idea, you can use on you specific
> source code your own format and override standard ofbiz format.
>
> I will suggest a patch on issue OFBIZ-7532 [1]
>
> I thinks it's important feature to help customization so if you have a
> suggest, your welcome :)
>
> Cheers,
> Nicolas
>
> [1] https://issues.apache.org/jira/browse/OFBIZ-7532
>
> --
> logoNrd <https://nereide.fr/>
>         Nicolas Malin
> The apache way <http://theapacheway.com/> : *Charity* Apache’s mission
> is providing software for the public good.
> [email protected]
> 8 rue des Déportés 37000 TOURS, 02 47 50 30 54
>
> Apache OFBiz <http://ofbiz.apache.org/>|The Apache Way
> <http://theapacheway.com/>|réseau LE <http://www.libre-entreprise.org/>

Reply via email to