svn commit: r585742 - /ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java

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

svn commit: r585742 - /ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java

sichen
Author: sichen
Date: Wed Oct 17 15:43:25 2007
New Revision: 585742

URL: http://svn.apache.org/viewvc?rev=585742&view=rev
Log:
Cancel inventory transfer will now check inventoryTransferId first and actually set the cancelled status at the end

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java?rev=585742&r1=585741&r2=585742&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java Wed Oct 17 15:43:25 2007
@@ -285,6 +285,9 @@
         try {
             inventoryTransfer = delegator.findByPrimaryKey("InventoryTransfer",
                     UtilMisc.toMap("inventoryTransferId", inventoryTransferId));
+            if (UtilValidate.isEmpty(inventoryTransfer)) {
+                return ServiceUtil.returnError("Inventory transfer [" + inventoryTransferId + "] not found");
+            }
             inventoryItem = inventoryTransfer.getRelatedOne("InventoryItem");
         } catch (GenericEntityException e) {
             return ServiceUtil.returnError("Inventory Item/Transfer lookup problem [" + e.getMessage() + "]");
@@ -321,7 +324,17 @@
                 return ServiceUtil.returnError("Inventory item store problem in cancel inventory transfer: [" + e.getMessage() + "]");
             }
         }
-                                
+
+        // set the inventory transfer record to complete
+        inventoryTransfer.set("statusId", "IXF_CANCELLED");
+
+        // store the entities
+        try {
+            inventoryTransfer.store();
+        } catch (GenericEntityException e) {
+            return ServiceUtil.returnError("Inventory store problem [" + e.getMessage() + "]");
+        }
+
         return ServiceUtil.returnSuccess();
     }