Thanks David! I'm thinking the UEL obsoletes <calculate>. What do you think?
-Adrian --- On Sun, 12/14/08, David E Jones <david.jo...@hotwaxmedia.com> wrote: > From: David E Jones <david.jo...@hotwaxmedia.com> > Subject: Re: svn commit: r726377 - in /ofbiz/trunk: > applications/accounting/script/org/ofbiz/accounting/invoice/ > applications/accounting/webapp/accounting/invoice/ > applications/order/script/org/ofbiz/order/order/ > applications/party/webapp/partymgr/communication/ ap... > To: dev@ofbiz.apache.org > Date: Sunday, December 14, 2008, 1:35 AM > Looks very cool Adrian. > > -David > > > On Dec 13, 2008, at 10:50 PM, adri...@apache.org wrote: > > > Author: adrianc > > Date: Sat Dec 13 21:50:29 2008 > > New Revision: 726377 > > > > URL: > http://svn.apache.org/viewvc?rev=726377&view=rev > > Log: > > A smattering of Unified Expression Language > conversions in mini language and screen widgets. This commit > is intended to demonstrate UEL capabilities. > > > > Modified: > > > ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml > > > ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml > > > ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml > > > ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml > > > ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml > > > ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml > > > ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml > > > > Modified: > ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml > > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?rev=726377&r1=726376&r2=726377&view=diff > > > ============================================================================== > > --- > ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml > (original) > > +++ > ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml > Sat Dec 13 21:50:29 2008 > > @@ -93,13 +93,9 @@ > > </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 @@ > > </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> > > > > > > Modified: > ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml > > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml?rev=726377&r1=726376&r2=726377&view=diff > > > ============================================================================== > > --- > ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml > (original) > > +++ > ofbiz/trunk/applications/accounting/webapp/accounting/invoice/InvoiceForms.xml > Sat Dec 13 21:50:29 2008 > > @@ -78,7 +78,7 @@ > > <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> > > > > Modified: > ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml > > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml?rev=726377&r1=726376&r2=726377&view=diff > > > ============================================================================== > > --- > ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml > (original) > > +++ > ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderServices.xml > Sat Dec 13 21:50:29 2008 > > @@ -513,8 +513,7 @@ > > </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> > > > > > > Modified: > ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml > > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml?rev=726377&r1=726376&r2=726377&view=diff > > > ============================================================================== > > --- > ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml > (original) > > +++ > ofbiz/trunk/applications/party/webapp/partymgr/communication/CommForms.xml > Sat Dec 13 21:50:29 2008 > > @@ -640,7 +640,7 @@ > > > > 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 /> > > > > Modified: > ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml > > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml?rev=726377&r1=726376&r2=726377&view=diff > > > ============================================================================== > > --- > ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml > (original) > > +++ > ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductServices.xml > Sat Dec 13 21:50:29 2008 > > @@ -436,11 +436,7 @@ > > <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> > > > > Modified: > ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml > > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml?rev=726377&r1=726376&r2=726377&view=diff > > > ============================================================================== > > --- > ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml > (original) > > +++ > ofbiz/trunk/applications/workeffort/script/org/ofbiz/workeffort/workeffort/WorkEffortSimpleServices.xml > Sat Dec 13 21:50:29 2008 > > @@ -159,10 +159,7 @@ > > <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> > > > > Modified: > ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml > > URL: > http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml?rev=726377&r1=726376&r2=726377&view=diff > > > ============================================================================== > > --- > ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml > (original) > > +++ > ofbiz/trunk/specialpurpose/mypage/widget/MyPageScreens.xml > Sat Dec 13 21:50:29 2008 > > @@ -55,7 +55,7 @@ > > <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("fromDate").toString().substring(0,10)} > ${uiLabelMap.CommonTo} > ${bsh:timesheet.get("thruDate").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 @@ > > </screenlet> > > </widgets> > > <fail-widgets> > > - <screenlet > title="${uiLabelMap.PageTitleCurrentTimesheet} > ${uiLabelMap.CommonNbr} ${timesheet.timesheetId} > ${uiLabelMap.ProjectMgrWeek}: ${weekNumber} > ${uiLabelMap.CommonFrom} > ${bsh:timesheet.get("fromDate").toString().substring(0,10)} > ${uiLabelMap.CommonTo} > ${bsh:timesheet.get("thruDate").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> > > > >