You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by si...@apache.org on 2007/02/21 20:46:22 UTC

svn commit: r510168 - /ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml

Author: sichen
Date: Wed Feb 21 11:46:21 2007
New Revision: 510168

URL: http://svn.apache.org/viewvc?view=rev&rev=510168
Log:
update inventory transfer now checks for valid status change.  Thanks to Joe Eckard.  OFBIZ-727

Modified:
    ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml?view=diff&rev=510168&r1=510167&r2=510168
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml (original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/product/inventory/InventoryServices.xml Wed Feb 21 11:46:21 2007
@@ -590,11 +590,28 @@
         <create-value value-name="newEntity"/>
     </simple-method>
     <simple-method method-name="updateInventoryTransfer" short-description="Update an Inventory Transfer">
-        <check-permission permission="FACILITY" action="_UPDATE"><fail-message message="Security Error: to run updateInventoryTransfer you must have the FACILITY_UPDATE or FACILITY_ADMIN permission"/></check-permission>
+        <check-permission permission="FACILITY" action="_UPDATE">
+            <fail-message message="Security Error: to run updateInventoryTransfer you must have the FACILITY_UPDATE or FACILITY_ADMIN permission"/>
+        </check-permission>
         <check-errors/>
 
         <set from-field="parameters.inventoryTransferId" field="lookupPKMap.inventoryTransferId"/>
         <find-by-primary-key entity-name="InventoryTransfer" map-name="lookupPKMap" value-name="inventoryTransfer"/>
+
+        <if-not-empty field-name="parameters.statusId">
+            <if-compare-field field-name="parameters.statusId" operator="not-equals" to-field-name="inventoryTransfer.statusId">
+                <!-- make sure a StatusValidChange record exists, if not return error -->
+                <entity-one entity-name="StatusValidChange" value-name="checkStatusValidChange" auto-field-map="false">
+                    <field-map env-name="inventoryTransfer.statusId" field-name="statusId"/>
+                    <field-map env-name="parameters.statusId" field-name="statusIdTo"/>
+                </entity-one>
+                <if-empty field-name="checkStatusValidChange">
+                    <set value="ERROR: Changing the status from ${inventoryTransfer.statusId} to ${parameters.statusId} is not allowed." field="error_list[]"/>
+                </if-empty>
+                <check-errors/>
+            </if-compare-field>
+        </if-not-empty>
+
         <set-nonpk-fields map-name="parameters" value-name="inventoryTransfer"/>
         <store-value value-name="inventoryTransfer"/>
     </simple-method>