A smattering of Unified Expression Language conversions in mini language and screen widgets. This commit is intended to demonstrate UEL capabilities.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@726377 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian Crum
2008-12-14 05:50:29 +00:00
parent ad0147d45b
commit c19fccfd14
7 changed files with 11 additions and 24 deletions
@@ -93,13 +93,9 @@ under the License.
</if-empty>
<store-value value-name="partyAcctgPreference"/>
<!-- get the current year string for prefix, etc; simple 4 digit year date string -->
<call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="toDateString" ret-field-name="curYearString">
<field field-name="partyAcctgPreference.lastInvoiceRestartDate" type="java.util.Date"/>
<string value="yyyy"/>
</call-class-method>
<set value="${curYearString}-${partyAcctgPreference.lastInvoiceNumber}" field="invoiceIdTemp"/>
<!-- get the current year string for prefix, etc; simple 4 digit year date string (using system defaults) -->
<set field="curYearString" value="${str:toString(date:year(partyAcctgPreference.lastInvoiceRestartDate, util:defaultTimeZone(), util:defaultLocale()))}"/>
<set field="invoiceIdTemp" value="${curYearString}-${str:toString(partyAcctgPreference.lastInvoiceNumber)}"/>
</then>
</else-if>
<else>
@@ -118,8 +114,7 @@ under the License.
</if>
<!-- use invoiceIdTemp along with the invoiceIdPrefix to create the real ID -->
<!-- The ${bsh:invoiceIdTemp.toString();} bypasses localization of Long->String conversion -->
<set field="invoiceId" value="${partyAcctgPreference.invoiceIdPrefix}${bsh:invoiceIdTemp.toString();}"/>
<set field="invoiceId" value="${partyAcctgPreference.invoiceIdPrefix}${str:toString(invoiceIdTemp)}"/>
<field-to-result field-name="invoiceId" result-name="invoiceId"/>
</simple-method>
@@ -78,7 +78,7 @@ under the License.
<field name="description"><display/></field>
<field name="partyIdFrom"><display description="${partyNameResultFrom.fullName} [${partyIdFrom}]"/></field>
<field name="partyIdTo" parameter-name="partyId"><display description="${partyNameResultTo.fullName} [${partyId}]"/></field>
<field name="invoiceDate"><display description="${bsh:invoiceDate.toString().substring(0,10)}"/></field>
<field name="invoiceDate"><display description="${date:dateStr(invoiceDate)}"/></field>
<field name="total" widget-area-style="align-text"><display type="currency" currency="${currencyUomId}"/></field>
<field name="amountToApply" widget-area-style="align-text"><display type="currency" currency="${currencyUomId}"/></field>
</form>
@@ -513,8 +513,7 @@ under the License.
</if-not-empty>
<!-- use orderIdTemp along with the orderIdPrefix to create the real ID -->
<!-- The ${bsh:orderIdTemp.toString();} bypasses localization of Long->String conversion -->
<set field="orderId" value="${productStore.orderNumberPrefix}${partyAcctgPreference.orderIdPrefix}${bsh:orderIdTemp.toString();}"/>
<set field="orderId" value="${productStore.orderNumberPrefix}${partyAcctgPreference.orderIdPrefix}${str:toString(orderIdTemp)}"/>
<field-to-result field-name="orderId" result-name="orderId"/>
</simple-method>
@@ -640,7 +640,7 @@ under the License.
target="ViewCommunicationEvent?communicationEventId=${communicationEventId}" />
</field>
<field name="entryDate">
<display description="${bsh:entryDate.toString().substring(0,16)}" />
<display description="${date:dateTimeStr(entryDate, timeZone, locale)}" />
</field>
<field name="note" widget-area-style="fieldWidth200">
<display />
@@ -436,11 +436,7 @@ under the License.
<set from-field="parameters.quantity" field="productCalculatedInfo.totalQuantityOrdered"/>
<create-value value-name="productCalculatedInfo"/>
<else>
<calculate field-name="productCalculatedInfo.totalQuantityOrdered" type="Double">
<calcop field-name="productCalculatedInfo.totalQuantityOrdered" operator="add">
<calcop field-name="parameters.quantity" operator="get"></calcop>
</calcop>
</calculate>
<set field="productCalculatedInfo.totalQuantityOrdered" value="${productCalculatedInfo.totalQuantityOrdered + parameters.quantity}"/>
<store-value value-name="productCalculatedInfo"/>
</else>
</if-empty>
@@ -159,10 +159,7 @@ under the License.
<set from-field="nowTimestamp" field="lookedUpValue.lastModifiedDate"/>
<set from-field="userLogin.userLoginId" field="lookedUpValue.lastModifiedByUserLogin"/>
<if-not-empty field="lookedUpValue.revisionNumber">
<calculate field-name="lookedUpValue.revisionNumber" type="Long">
<calcop operator="get" field-name="lookedUpValue.revisionNumber"/>
<number value="1"/>
</calculate>
<set field="lookedUpValue.revisionNumber" value="${lookedUpValue.revisionNumber + 1}"/>
<else>
<set field="lookedUpValue.revisionNumber" value="1" type="Long"/>
</else>
@@ -55,7 +55,7 @@ under the License.
<if-has-permission permission="PROJECTMGR" action="_VIEW"/>
</condition>
<widgets>
<screenlet title="${uiLabelMap.PageTitleCurrentTimesheet} ${uiLabelMap.CommonNbr} ${timesheet.timesheetId} ${uiLabelMap.ProjectMgrWeek}: ${weekNumber} ${uiLabelMap.CommonFrom} ${bsh:timesheet.get(&quot;fromDate&quot;).toString().substring(0,10)} ${uiLabelMap.CommonTo} ${bsh:timesheet.get(&quot;thruDate&quot;).toString().substring(0,10)}"
<screenlet title="${uiLabelMap.PageTitleCurrentTimesheet} ${uiLabelMap.CommonNbr} ${timesheet.timesheetId} ${uiLabelMap.ProjectMgrWeek}: ${date:week(timesheet.fromDate, timeZone, locale)} ${uiLabelMap.CommonFrom} ${date:dateStr(timesheet.fromDate, timeZone, locale)} ${uiLabelMap.CommonTo} ${date:dateStr(timesheet.thruDate, timeZone, locale)}"
navigation-menu-name="MyTimesheetMenu" collapsible="true" name="timesheet">
<include-menu name="MyTimesheetMenu" location="component://mypage/widget/MyPageMenus.xml"/>
<section>
@@ -72,7 +72,7 @@ under the License.
</screenlet>
</widgets>
<fail-widgets>
<screenlet title="${uiLabelMap.PageTitleCurrentTimesheet} ${uiLabelMap.CommonNbr} ${timesheet.timesheetId} ${uiLabelMap.ProjectMgrWeek}: ${weekNumber} ${uiLabelMap.CommonFrom} ${bsh:timesheet.get(&quot;fromDate&quot;).toString().substring(0,10)} ${uiLabelMap.CommonTo} ${bsh:timesheet.get(&quot;thruDate&quot;).toString().substring(0,10)}"
<screenlet title="${uiLabelMap.PageTitleCurrentTimesheet} ${uiLabelMap.CommonNbr} ${timesheet.timesheetId} ${uiLabelMap.ProjectMgrWeek}: ${date:week(timesheet.fromDate, timeZone, locale)} ${uiLabelMap.CommonFrom} ${date:dateStr(timesheet.fromDate, timeZone, locale)} ${uiLabelMap.CommonTo} ${date:dateStr(timesheet.thruDate, timeZone, locale)}"
collapsible="true" name="timesheet">
<section>
<condition>