svn commit: r1057519 - /ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1057519 - /ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml

jleroux@apache.org
Author: jleroux
Date: Tue Jan 11 08:28:57 2011
New Revision: 1057519

URL: http://svn.apache.org/viewvc?rev=1057519&view=rev
Log:
A patch from Paul Foxworthy "findOrdersToPickMove: EntityListIterator not closed if no Picklist generated" (https://issues.apache.org/jira/browse/OFBIZ-4105) - OFBIZ-4105

Go to ordermgr/control/orderview for an order that doesn't have stock ready for picking.
Click on Prink Pick Sheet
You'll get a Pick Sheet PDF with the message "Order not ready for picking, needs stock move"
Look at logs, you'll see an EntityListIterator was created and never closed, so a warning message was logged when the finalize was executed.

The problem is in the findOrdersToPickMove simple method in
applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml .

There's a <use-iterator/> for the OrderHeaderAndItemFacilityLocation entity.
After the entity-condition element, there's an <if> element, and the iterator is only used when the "if" condition is false, i.e. the <else> part is executed.
My fix is simply to move the <entity-condition>, complete with <use-iterator>, within the <else> element so the condition is evaluated and the iterator created only when the iterator will be used.

Modified:
    ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml?rev=1057519&r1=1057518&r2=1057519&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml Tue Jan 11 08:28:57 2011
@@ -103,18 +103,6 @@ under the License.
                 <condition-expr field-name="orderId" from-field="orderHeader.orderId"/>
             </entity-count>
 
-            <entity-condition entity-name="OrderHeaderAndItemFacilityLocation" list="OrderHeaderAndItemFacilityLocationList" distinct="true">
-                <condition-list combine="and">
-                    <condition-expr field-name="orderId" from-field="orderHeader.orderId"/>
-                    <condition-list combine="or">
-                        <condition-expr field-name="locationTypeEnumId" operator="equals" value="FLT_PICKLOC"/>
-                        <condition-expr field-name="locationTypeEnumId" operator="equals" from-field="nullField"/>
-                    </condition-list>
-                </condition-list>
-                <select-field field-name="shipmentMethodTypeId"/>
-                <select-field field-name="areaId"/>
-                <use-iterator/>
-            </entity-condition>
             <set field="groupName"/>
             <set field="groupName1"/> <!-- Group by Shipping Method -->
             <set field="groupName2"/> <!-- Group by Warehouse Area -->
@@ -133,6 +121,18 @@ under the License.
                     <set field="groupName" from-field="orderHeader.orderId"/>
                 </then>
             <else>
+                <entity-condition entity-name="OrderHeaderAndItemFacilityLocation" list="OrderHeaderAndItemFacilityLocationList" distinct="true">
+                    <condition-list combine="and">
+                        <condition-expr field-name="orderId" from-field="orderHeader.orderId"/>
+                        <condition-list combine="or">
+                            <condition-expr field-name="locationTypeEnumId" operator="equals" value="FLT_PICKLOC"/>
+                            <condition-expr field-name="locationTypeEnumId" operator="equals" from-field="nullField"/>
+                        </condition-list>
+                    </condition-list>
+                    <select-field field-name="shipmentMethodTypeId"/>
+                    <select-field field-name="areaId"/>
+                    <use-iterator/>
+                </entity-condition>
                 <iterate list="OrderHeaderAndItemFacilityLocationList" entry="orderHeaderAndItemFacilityLocation">
                 <!-- set groupName for order according to the options selected by the user -->