[OFBiz] SVN: r6527 - trunk/applications/order/script/org/ofbiz/order/order

sichen@svn.ofbiz.org sichen at svn.ofbiz.org
Wed Jan 18 18:35:50 CST 2006


Author: sichen
Date: 2006-01-18 18:35:43 -0600 (Wed, 18 Jan 2006)
New Revision: 6527

Modified:
   trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml
Log:
Changed quick refund to use the productTypeId to lookup returnItemTypeId for PRODUCT_ORDER_ITEMs.  Patch from Mu Jinsong.

Modified: trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml
===================================================================
--- trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml	2006-01-18 22:40:05 UTC (rev 6526)
+++ trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml	2006-01-19 00:35:43 UTC (rev 6527)
@@ -510,17 +510,33 @@
             </calculate>
 
             <!-- get the matching return item type from the order item type -->
-            <!-- TODO: ask David/Andy why the returnItemMapKeys does not have orderItemtypeIds? should we actually be looking through productTypeIds
-                to find returnItemTypeIds? -->
+
             <set from-field="orderItem.orderItemTypeId" field="orderItemTypeId"/>
-            <entity-one entity-name="ReturnItemTypeMap" value-name="returnItemTypeMapping">
-            	<field-map env-name="orderItemTypeId" field-name="returnItemMapKey"/>
-            </entity-one>
+            <if-compare field-name="orderItemTypeId" value="PRODUCT_ORDER_ITEM" operator="equals">
+            <!-- Check if orderItemTypeId equals PRODUCT_ORDER_ITEM, if so, use ProductType and ReturnItemTypeMap to get ReturnItemType-->
+                <entity-one entity-name="Product" value-name="product">
+                    <field-map field-name="productId" env-name="orderItem.productId"/>
+                    <select-field field-name="productTypeId"/>
+                </entity-one>
+                <entity-one entity-name="ReturnItemTypeMap" value-name="returnItemTypeMapping">
+            	    <field-map env-name="product.productTypeId" field-name="returnItemMapKey"/>
+                </entity-one>
+            <else>
+            <!-- if not, try the ReturnItemTypeMap, but this may not actually work, so log a warning -->
+                <log level="warning" message="Trying to find returnItemtype from ReturnItemTypeMap with orderItemtypeId [${orderItem.orderItemTypeId}] for order item [${orderItem}]"/> 
+                <entity-one entity-name="ReturnItemTypeMap" value-name="returnItemTypeMapping">
+                   <field-map env-name="orderItemTypeId" field-name="returnItemMapKey"/>
+                </entity-one>
+            </else>
+            </if-compare>
+
             <if-empty field-name="returnItemTypeId" map-name="returnItemTypeMapping" >
-            	<log level="warning" message="No matching return item type map found for order item: [${orderItem}]"/>
+                <add-error><fail-message message="No matching return item type map found for order item: [${orderItem}]"/></add-error>
+                <check-errors/>
+            <else>
+                <set from-field="returnItemTypeMapping.returnItemTypeId" field="newItemCtx.returnItemTypeId"/>
+            </else>
             </if-empty>
-            
-            <set from-field="returnItemTypeMapping.returnItemTypeId" field="newItemCtx.returnItemTypeId"/>
 
             <!-- create the return item -->
             <call-service service-name="createReturnItem" in-map-name="newItemCtx" include-user-login="true"/>



More information about the Svn mailing list