Author: sichen
Date: Mon Mar  3 09:17:50 2008
New Revision: 633182

URL: http://svn.apache.org/viewvc?rev=633182&view=rev
Log:
Fix for issue in the cancelRemainingPurchaseOrderItems (used by the 
completePurchaseOrder service) where the code was getting short-circuited for 
items which were *not* being cancelled, so that approved items weren't being 
set to completed when they should have been.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java

Modified: 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=633182&r1=633181&r2=633182&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java 
(original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java 
Mon Mar  3 09:17:50 2008
@@ -4259,11 +4259,12 @@
                 }
                 
                 double quantityToCancel = orderItemQuantity - 
orderItemCancelQuantity - receivedQuantity;
-                if (quantityToCancel <= 0) continue;
-                
+                if (quantityToCancel > 0) {
                 Map cancelOrderItemResult = 
dispatcher.runSync("cancelOrderItem", UtilMisc.toMap("orderId", orderId, 
"orderItemSeqId", orderItem.get("orderItemSeqId"), "cancelQuantity", new 
Double(quantityToCancel), "userLogin", userLogin));
                 if (ServiceUtil.isError(cancelOrderItemResult)) return 
cancelOrderItemResult;       
-                
+                }
+
+                // If there's nothing to cancel, the item should be set to 
completed, if it isn't already
                 orderItem.refresh();
                 if ("ITEM_APPROVED".equals(orderItem.getString("statusId"))) {
                     Map changeOrderItemStatusResult = 
dispatcher.runSync("changeOrderItemStatus", UtilMisc.toMap("orderId", orderId, 
"orderItemSeqId", orderItem.get("orderItemSeqId"), "statusId", 
"ITEM_COMPLETED", "userLogin", userLogin));


Reply via email to