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
This commit is contained in:
Si Chen
2008-03-03 17:17:50 +00:00
parent fed9cd86a9
commit ae030d4164
@@ -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));