Author: sichen
Date: Wed Oct 17 15:44:00 2007
New Revision: 585743
URL:
http://svn.apache.org/viewvc?rev=585743&view=revLog:
Cancel inventory transfer will now check inventoryTransferId first and actually set the cancelled status at the end
Modified:
ofbiz/branches/release4.0/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
Modified: ofbiz/branches/release4.0/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java?rev=585743&r1=585742&r2=585743&view=diff==============================================================================
--- ofbiz/branches/release4.0/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java (original)
+++ ofbiz/branches/release4.0/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java Wed Oct 17 15:44:00 2007
@@ -293,6 +293,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() + "]");
@@ -329,7 +332,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();
}