/[Apache-SVN]
ViewVC logotype

Revision 1864832


Jump to revision: Previous Next
Author: nmalin
Date: Fri Aug 9 20:37:11 2019 UTC (4 years, 8 months ago)
Changed paths: 17
Log Message:
Implemented: Homogenize displaying number with multiple format
(OFBIZ-7532)

To display a number we had different possibilities :
 * on ftl use the template <@ofbizAmount and <@ofbizCurrency
 * by java call a function UtilFormatOut.formatAmount, UtilFormatOut.formatPrice, UtilFormatOut.formatQuantity, etc..
 * by form widget, use <display type=accounting-number for accounting but nothing for other

To simplify and homogenize all, I implemented a number type purpose :
   * default: display a number by default, use when no purpose is present
   * quantity: display a number as a quantity
   * amount: display a number as an amount (like price without currency)
   * spelled: litteral displaying for a number (use on <@ofbizAmount ftl only before)
   * percentage: display a number as a percentage
   * accounting: diplay a number for accounting specific

Each purpose can be associate to a number for displaying it :
   * on ftl <@ofbizNumber number=value format=purpose/>
   * on java UtilFormatOut.formatNumber(value, purpose, delegator, locale)
   * on form widget <display type=number format=purpose/>

The format use by a purpose is define on framework/common/config/number.properties with the template
    .displaying.format = ##0.00

With this, you can surchage a configuration, create your own purpose or surchage only one through entity SystemProperty.

Concerning the backware compatibility: 
 * For the ftl the template <@ofbizAmount is now a link to '<@ofbizNumber format=amount'
 * For java all previous function call UtilFormatOut.formatNumber with the matching purpose
 * For form xml accounting-number is managed as an exection

Last point, display a currency is different that a number, so I didn't refactoring some code for this case (only move properties from general to number for centralize de configuration on the same file)

Thanks Charles Steltzlen to start the refactoring

Changed paths

Path Details
Directoryofbiz/ofbiz-framework/trunk/applications/accounting/config/arithmetic.properties modified , text changed
Directoryofbiz/ofbiz-framework/trunk/applications/order/template/order/EditOrderItems.ftl modified , text changed
Directoryofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/FieldLookupForms.xml modified , text changed
Directoryofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/OrderEntryForms.xml modified , text changed
Directoryofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/QuoteForms.xml modified , text changed
Directoryofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/ReportForms.xml modified , text changed
Directoryofbiz/ofbiz-framework/trunk/applications/order/widget/ordermgr/RequirementForms.xml modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/common/config/general.properties modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/common/config/number.properties added
Directoryofbiz/ofbiz-framework/trunk/framework/webapp/config/freemarkerTransforms.properties modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizAmountTransform.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizCurrencyTransform.java modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizNumberTransform.java added
Directoryofbiz/ofbiz-framework/trunk/framework/webtools/widget/MiscForms.xml modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/widget/dtd/widget-form.xsd modified , text changed
Directoryofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26