From ae030d4164dfb6d363ca596dc275223773e78b99 Mon Sep 17 00:00:00 2001 From: Si Chen Date: Mon, 3 Mar 2008 17:17:50 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@633182 13f79535-47bb-0310-9956-ffa450edef68 --- .../order/src/org/ofbiz/order/order/OrderServices.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/applications/order/src/org/ofbiz/order/order/OrderServices.java b/applications/order/src/org/ofbiz/order/order/OrderServices.java index aef96e721a..c8b0acaa84 100644 --- a/applications/order/src/org/ofbiz/order/order/OrderServices.java +++ b/applications/order/src/org/ofbiz/order/order/OrderServices.java @@ -4259,11 +4259,12 @@ public class OrderServices { } 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));