Should we not rewrite it "correctly" and backport to 9.04 ?

Jacques

From: "Adrian Crum" <[email protected]>
Just a final note on this...

The expression

totalsMap[receipt.orderItemSeqId]

is the preferred syntax because it is UEL compliant. The expression

totalsMap.${receipt.orderItemSeqId}

works the same, but it is technically a nested expression (which is not UEL compliant) and it results in two expression expansions. That is because of how the OFBiz framework stores l-value expressions internally:

${totalsMap.${receipt.orderItemSeqId}}

-Adrian



Adrian Crum wrote:
Jacopo,

totalsMap.${receipt.orderItemSeqId}

should work on revision 764992 or later. If not, try

totalsMap[receipt.orderItemSeqId]

A good explanation can be found in section 1.5 and 1.6 of the UEL syntax 
documentation.

-Adrian


Jacopo Cappellato wrote:
Hi Adrian,

could you please review the following change I did? Is it the correct way to fix this issue? Do you think we should search for similar patterns in the system and fix them?

Thanks,

Jacopo

Begin forwarded message:

From: [email protected]
Date: April 20, 2009 4:19:28 PM GMT+02:00
To: [email protected]
Subject: svn commit: r766704 - 
/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderSimpleMethods.xml
Reply-To: [email protected]

Author: jacopoc
Date: Mon Apr 20 14:19:28 2009
New Revision: 766704

URL: http://svn.apache.org/viewvc?rev=766704&view=rev
Log:
Fixed code that was not working (I think) after recent implementation of UEL.

Modified:
   
ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderSimpleMethods.xml

Modified: 
ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderSimpleMethods.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderSimpleMethods.xml?rev=766704&r1=766703&r2=766704&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderSimpleMethods.xml (original)
+++ 
ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderSimpleMethods.xml
 Mon Apr 20 14:19:28 2009
@@ -85,11 +85,11 @@
            <field-map field-name="orderId" from-field="parameters.orderId"/>
        </entity-and>
        <iterate list="shipmentReceipts" entry="receipt">
-            <if-empty field="totalsMap.${receipt.orderItemSeqId}">
-                <set field="totalsMap.${receipt.orderItemSeqId}" value="0" 
type="BigDecimal"/>
+            <if-empty field="totalsMap.receipt.orderItemSeqId">
+                <set field="totalsMap.receipt.orderItemSeqId" value="0" 
type="BigDecimal"/>
            </if-empty>
-            <calculate field="totalsMap.${receipt.orderItemSeqId}">
-                <calcop field="totalsMap.${receipt.orderItemSeqId}" 
operator="add">
+            <calculate field="totalsMap.receipt.orderItemSeqId">
+                <calcop field="totalsMap.receipt.orderItemSeqId" 
operator="add">
                    <calcop field="receipt.quantityAccepted" operator="get"/>
                    <calcop field="receipt.quantityRejected" operator="get"/>
                </calcop>
@@ -98,7 +98,7 @@
            <set from-field="receipt.orderItemSeqId" 
field="newLookupMap.orderItemSeqId"/>
            <find-by-primary-key entity-name="OrderItem" map="newLookupMap" 
value-field="orderItem"/>
            <if-compare field="orderItem.statusId" operator="not-equals" 
value="ITEM_COMPLETED">
- <if-compare-field field="orderItem.quantity" to-field="totalsMap.${receipt.orderItemSeqId}" operator="less-equals" type="BigDecimal"> + <if-compare-field field="orderItem.quantity" to-field="totalsMap.receipt.orderItemSeqId" operator="less-equals" type="BigDecimal">
                    <!-- update the status for the item -->
                    <set field="orderItem.statusId" value="ITEM_COMPLETED"/>
                    <store-value value-field="orderItem"/>







Reply via email to