svn commit: r1290890 - in /ofbiz/trunk/applications/product: entitydef/eecas.xml script/org/ofbiz/shipment/picklist/PicklistServices.xml servicedef/services_picklist.xml

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

svn commit: r1290890 - in /ofbiz/trunk/applications/product: entitydef/eecas.xml script/org/ofbiz/shipment/picklist/PicklistServices.xml servicedef/services_picklist.xml

jleroux@apache.org
Author: jleroux
Date: Sat Feb 18 22:06:51 2012
New Revision: 1290890

URL: http://svn.apache.org/viewvc?rev=1290890&view=rev
Log:
A patch from Ankit Jain "If Picklist is Cancelled than all the PicklistItem related to that PicklistId should also get Cancel." https://issues.apache.org/jira/browse/OFBIZ-4690

If we cancel a picklist from Manage Picklist screen then this ECA will fire and cancel all the PicklistItem.

Modified:
    ofbiz/trunk/applications/product/entitydef/eecas.xml
    ofbiz/trunk/applications/product/script/org/ofbiz/shipment/picklist/PicklistServices.xml
    ofbiz/trunk/applications/product/servicedef/services_picklist.xml

Modified: ofbiz/trunk/applications/product/entitydef/eecas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/entitydef/eecas.xml?rev=1290890&r1=1290889&r2=1290890&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/entitydef/eecas.xml (original)
+++ ofbiz/trunk/applications/product/entitydef/eecas.xml Sat Feb 18 22:06:51 2012
@@ -70,6 +70,11 @@ under the License.
         <condition field-name="availableToPromiseDiff" operator="not-equals" value="0" type="BigDecimal"/>
         <action service="setLastInventoryCount" mode="sync"/>
     </eca>
+    <!-- If the Picklist status is Cancelled then cancel all the PicklistItems -->
+    <eca entity="Picklist" operation="create-store" event="return">
+        <condition field-name="statusId" operator="equals" value="PICKLIST_CANCELLED"/>
+        <action service="cancelPicklistAndItems" mode="async"/>
+    </eca>
 
     <!-- Product GroupOrder ECAs -->
     <eca entity="ProductGroupOrder" operation="create" event="return">

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=1290890&r1=1290889&r2=1290890&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 Sat Feb 18 22:06:51 2012
@@ -1672,4 +1672,23 @@ under the License.
         </else>
         </if-compare>
     </simple-method>
+
+    <simple-method method-name="cancelPicklistAndItems" short-description="If Picklist is Cancelled then cancel all the PicklistItem">
+        <entity-and entity-name="PicklistBin" list="picklistBinList">
+            <field-map field-name="picklistId" from-field="parameters.picklistId"/>
+        </entity-and>
+        <if-not-empty field="picklistBinList">
+            <iterate entry="picklistBin" list="picklistBinList">
+                <entity-and entity-name="PicklistItem" list="itemList">
+                    <field-map field-name="picklistBinId" from-field="picklistBin.picklistBinId"/>
+                </entity-and>
+                <if-not-empty field="itemList">
+                    <iterate entry="item" list="itemList">
+                        <set field="item.itemStatusId" value="PICKITEM_CANCELLED"/>
+                        <store-value value-field="item"/>
+                    </iterate>
+                </if-not-empty>
+            </iterate>
+        </if-not-empty>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/product/servicedef/services_picklist.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_picklist.xml?rev=1290890&r1=1290889&r2=1290890&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_picklist.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_picklist.xml Sat Feb 18 22:06:51 2012
@@ -179,6 +179,11 @@ under the License.
         <auto-attributes include="pk" mode="IN" optional="false"/>
         <auto-attributes include="nonpk" mode="IN" optional="false"/>
     </service>
+    <service name="cancelPicklistAndItems" engine="simple"
+            location="component://product/script/org/ofbiz/shipment/picklist/PicklistServices.xml" invoke="cancelPicklistAndItems" auth="true">
+        <description>If Picklist is Cancelled then cancel all the PicklistItems.</description>
+        <attribute name="picklistId" type="String" mode="IN"/>
+    </service>
 
     <!-- PicklistRole -->
     <service name="createPicklistRole" default-entity-name="PicklistRole" engine="simple"