Files
ofbiz-framework/applications/order/widget/ordermgr/OrderEntryForms.xml
T
Nicolas Malin 4a511be1cc 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
2019-08-09 20:37:11 +00:00

229 lines
13 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://ofbiz.apache.org/Widget-Form" xsi:schemaLocation="http://ofbiz.apache.org/Widget-Form http://ofbiz.apache.org/dtds/widget-form.xsd">
<form name="FindRequirements" type="single" target="RequirementsForSupplier" title=""
default-title-style="tableheadtext">
<field name="showList"><hidden value="Y"/></field>
<field name="requirementId"><text-find/></field>
<field name="partyId" title="${uiLabelMap.PartySupplier}"><lookup target-form-name="LookupPartyName"/></field>
<field name="productId" title="${uiLabelMap.ProductProductId}"><lookup target-form-name="LookupProduct"/></field>
<field name="requirementByDate"><date-find type="date"/></field>
<field name="submitButton" title="${uiLabelMap.CommonFind}" widget-style="smallSubmit"><submit button-type="button"/></field>
</form>
<form name="RequirementsList" type="multi" use-row-submit="true" target="addRequirementsToCart" title="" list-name="requirementsForSupplier"
default-title-style="tableheadtext"
paginate-target="RequirementsForSupplier">
<actions>
<service service-name="prepareFind" result-map="resultConditions">
<field-map field-name="inputFields" from-field="requestParameters"/>
<field-map field-name="entityName" from-field="entityName"/>
</service>
<service service-name="getRequirementsForSupplier" result-map="result" result-map-list="requirementsForSupplier">
<!--<field-map field-name="orderByList" from-field="resultConditions.orderByList"/>-->
<field-map field-name="requirementConditions" from-field="resultConditions.entityConditionList"/>
<field-map field-name="partyId" from-field="parameters.partyId"/>
</service>
</actions>
<field name="requirementId"><display/></field>
<field name="productId"><hidden value="${productId}"/></field>
<field name="productId">
<display-entity entity-name="Product" key-field-name="productId" description="${productId} - ${internalName}"/>
</field>
<field name="requiredByDate"><display/></field>
<field name="quantity"><text/></field>
<field name="_rowSubmit" title="${uiLabelMap.CommonSelect}"><check/></field>
<field name="submitButton" widget-style="smallSubmit"><submit/></field>
</form>
<form name="FindQuotes" target="FindQuoteForCart" title="" type="single"
header-row-style="header-row" default-table-style="basic-table">
<auto-fields-entity entity-name="Quote" default-field-type="find"/>
<field name="quoteId" title="${uiLabelMap.OrderOrderQuoteId}"></field>
<field name="quoteTypeId" title="${uiLabelMap.OrderOrderQuoteTypeId}">
<drop-down allow-empty="true">
<entity-options entity-name="QuoteType" key-field-name="quoteTypeId"/>
</drop-down>
</field>
<field name="partyId" title="${uiLabelMap.PartyPartyId}">
<lookup target-form-name="LookupPartyName"/>
</field>
<field name="issueDate" title="${uiLabelMap.OrderOrderQuoteIssueDate}"></field>
<field name="statusId"><hidden/></field>
<field name="currencyUomId"><hidden/></field>
<field name="validFromDate"><hidden/></field>
<field name="validThruDate"><hidden/></field>
<field name="description"><hidden/></field>
<field name="submitButton" title="${uiLabelMap.CommonFind}" widget-style="smallSubmit">
<submit button-type="button"/>
</field>
</form>
<form name="ListQuotes" list-name="listIt" target="" title="" type="list"
default-title-style="tableheadtext"
paginate-target="FindQuoteForCart">
<actions>
<set field="entityName" value="Quote"/>
<service service-name="performFind" result-map="result" result-map-list="listIt">
<field-map field-name="inputFields" from-field="requestParameters"/>
<field-map field-name="entityName" from-field="entityName"/>
<field-map field-name="viewIndex" from-field="viewIndex"/>
<field-map field-name="viewSize" from-field="viewSize"/>
</service>
</actions>
<auto-fields-entity entity-name="Quote" default-field-type="display"/>
<field name="quoteId" title="${uiLabelMap.OrderOrderQuoteId}" widget-style="buttontext">
<hyperlink description="${quoteId}" target="loadCartFromQuote" also-hidden="false">
<parameter param-name="quoteId"/>
</hyperlink>
</field>
<field name="quoteTypeId" title="${uiLabelMap.OrderOrderQuoteTypeId}">
<display-entity entity-name="QuoteType"/>
</field>
<field name="partyId" title="${uiLabelMap.PartyPartyId}"></field>
<field name="description" title="${uiLabelMap.CommonDescription}"></field>
<field name="issueDate" title="${uiLabelMap.OrderOrderQuoteIssueDate}"></field>
<field name="validFromDate" title="${uiLabelMap.CommonValidFromDate}"></field>
<field name="validThruDate" title="${uiLabelMap.CommonValidThruDate}"></field>
<field name="statusId"><hidden/></field>
<field name="currencyUomId"><hidden/></field>
</form>
<form name="ViewShoppingLists" type="list" list-name="customershoppinglists" target=""
default-title-style="tableheadtext">
<field name="listName" title="${uiLabelMap.PageTitleShoppingList}"><display/></field>
<field name="shoppingListTypeId" title="${uiLabelMap.OrderListType}">
<display-entity entity-name="ShoppingListType"/>
</field>
<field name="description" title="${uiLabelMap.CommonDescription}"><display/></field>
<field name="addFromList" title=" " widget-style="buttontext">
<hyperlink description="${uiLabelMap.OrderToAddSelectedItemsToShoppingList}" target="addFromShoppingList" also-hidden="false">
<parameter param-name="shoppingListId"/>
</hyperlink>
</field>
<field name="addAllFromList" title=" " widget-style="buttontext">
<hyperlink description="${uiLabelMap.OrderQuickAdd}" target="addAllFromShoppingList" also-hidden="false">
<parameter param-name="shoppingListId"/>
</hyperlink>
</field>
</form>
<form name="AddFromShoppingList" type="list" list-name="shoppinglistitems" target=""
default-title-style="tableheadtext">
<auto-fields-entity entity-name="ShoppingListItem" default-field-type="display"/>
<field name="productId" title="${uiLabelMap.ProductProduct}">
<display-entity entity-name="Product" description="${productId} - ${description}"/>
</field>
<field name="addToCart" title=" " widget-style="buttontext">
<hyperlink description="${uiLabelMap.CommonAdd} ${quantity} ${uiLabelMap.OrderAddQntToOrder}" target="additem" also-hidden="false">
<parameter param-name="shoppingListId"/>
<parameter param-name="shoppingListItemSeqId"/>
<parameter param-name="add_product_id" from-field="productId"/>
<parameter param-name="quantity"/>
<parameter param-name="configId"/>
</hyperlink>
</field>
</form>
<form name="AddFromShoppingListAll" type="single" target="">
<field name="addAllFromList" title=" " widget-style="buttontext">
<hyperlink description="${uiLabelMap.OrderQuickAdd}" target="addAllFromShoppingList" also-hidden="false">
<parameter param-name="shoppingListId"/>
</hyperlink>
</field>
<field name="returnToOrderEntry" title=" " widget-style="buttontext">
<hyperlink description="${uiLabelMap.OrderOrderReturn}" target="orderentry" also-hidden="false"/>
</field>
</form>
<form name="LookupBulkAddProducts" type="multi" use-row-submit="true" list-name="productList" title="" target="BulkAddProducts"
odd-row-style="alternate-row" default-table-style="basic-table hover-bar" paginate-target="LookupBulkAddProducts">
<row-actions>
<entity-one entity-name="Product" value-field="product" auto-field-map="true"/>
<set field=""/>
<set field="hasAmount" value="${groovy:product.getString('requireAmount')?:'N'}"/>
</row-actions>
<field name="productId" title="${uiLabelMap.ProductProductId}" widget-style="buttontext">
<hyperlink description="${productId}" target="/catalog/control/EditProductInventoryItems" target-type="inter-app">
<parameter param-name="productId"/>
</hyperlink>
</field>
<field name="brandName" title="${uiLabelMap.ProductBrandName}"><display/></field>
<field name="internalName"><display/></field>
<field name="quantity" title="${uiLabelMap.OrderQuantity}">
<text size="5" maxlength="10"/>
</field>
<field use-when="${groovy: 'Y'.equals(context.hasAmount)}" name="amount" title="${uiLabelMap.OrderAmount}" >
<text size="5" maxlength="10"/>
</field>
<field use-when="${groovy: 'N'.equals(context.hasAmount)}" name="amount" title="${uiLabelMap.OrderAmount}" widget-style="disabled">
<text size="5" maxlength="10" disabled="true"/>
</field>
<field name="itemDesiredDeliveryDate" title="${uiLabelMap.OrderDesiredDeliveryDate}">
<date-time/>
</field>
<field name="submitButton" title="${uiLabelMap.OrderAddToOrder}" widget-style="smallSubmit">
<submit/>
</field>
</form>
<form name="LookupBulkAddSupplierProducts" type="multi" use-row-submit="true" list-name="productList" title="" target="BulkAddProducts"
odd-row-style="alternate-row" default-table-style="basic-table hover-bar" paginate-target="LookupBulkAddSupplierProducts" view-size="5">
<field name="productId" widget-style="buttontext">
<hyperlink description="${productId}" target="/catalog/control/EditProductInventoryItems" target-type="inter-app">
<parameter param-name="productId"/>
</hyperlink>
</field>
<field name="supplierProductId"><display/></field>
<field name="supplierProductName"><display/></field>
<field name="internalName"><display/></field>
<field name="lastPrice"><display type="number" format="amount"/></field>
<field name="minimumOrderQuantity"><display type="number" format="quantity"/></field>
<field name="minimumStock"><display type="number" format="quantity"/></field>
<field name="qohAtp" title="${uiLabelMap.ProductAtpQoh}"><display/></field>
<field name="quantityOnOrder"><display type="number" format="quantity"/></field>
<field name="quantity" title="${uiLabelMap.OrderQuantity}">
<text size="5" maxlength="10"/>
</field>
<field name="itemDesiredDeliveryDate" title="${uiLabelMap.OrderDesiredDeliveryDate}">
<date-time/>
</field>
<field name="submitButton" title="${uiLabelMap.OrderAddToOrder}" widget-style="smallSubmit">
<submit/>
</field>
</form>
<form name="LookupAssociatedProducts" type="multi" use-row-submit="true" list-name="productList" title="" target="BulkAddProducts"
paginate-target="LookupAssociatedProducts" default-title-style="tableheadtext" default-widget-style="inputBox">
<field name="productId" title="${uiLabelMap.ProductProductId}" widget-style="buttontext">
<hyperlink description="${productId}" target="/catalog/control/EditProductInventoryItems?productId=${productId}" target-type="inter-app"/>
</field>
<field name="brandName" title="${uiLabelMap.ProductBrandName}"><display/></field>
<field name="internalName"><display/></field>
<field name="quantity" title="${uiLabelMap.OrderQuantity}">
<text size="5" maxlength="10"/>
</field>
<field name="amount" title="${uiLabelMap.OrderAmount}">
<text size="5" maxlength="10"/>
</field>
<field name="itemDesiredDeliveryDate" title="${uiLabelMap.OrderDesiredDeliveryDate}">
<date-time/>
</field>
<field name="submitButton" title="${uiLabelMap.OrderAddToOrder}" widget-style="smallSubmit">
<submit/>
</field>
</form>
</forms>