Permalink
Please
sign in to comment.
Browse files
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 git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1864832 13f79535-47bb-0310-9956-ffa450edef68
- Loading branch information
Showing
with
332 additions
and 279 deletions.
- +0 −3 applications/accounting/config/arithmetic.properties
- +1 −1 applications/order/template/order/EditOrderItems.ftl
- +1 −1 applications/order/widget/ordermgr/FieldLookupForms.xml
- +4 −4 applications/order/widget/ordermgr/OrderEntryForms.xml
- +10 −10 applications/order/widget/ordermgr/QuoteForms.xml
- +17 −17 applications/order/widget/ordermgr/ReportForms.xml
- +8 −8 applications/order/widget/ordermgr/RequirementForms.xml
- +68 −108 framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java
- +0 −12 framework/common/config/general.properties
- +32 −0 framework/common/config/number.properties
- +1 −0 framework/webapp/config/freemarkerTransforms.properties
- +8 −109 framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizAmountTransform.java
- +2 −2 framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizCurrencyTransform.java
- +140 −0 framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/OfbizNumberTransform.java
- +9 −0 framework/webtools/widget/MiscForms.xml
- +12 −0 framework/widget/dtd/widget-form.xsd
- +19 −4 framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormField.java

Oops, something went wrong.
0 comments on commit
4a511be