From 95ed642439094dc0cc4287c3363b0b7de9dbd26b Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Fri, 5 Dec 2014 07:18:11 +0000 Subject: [PATCH] Fix a bug introduced with OFBIZ-5761. This appeared only in a custom project when using the underlying services. Then after creating a new ship group with createOrderItemShipGroup, when appending and item with appendOrderItem the OISGAs (OrderItemShipGroupAssoc) where duplicated git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1643172 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/ofbiz/order/shoppingcart/ShoppingCartServices.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java index 490b102385..d584aa98af 100644 --- a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java +++ b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java @@ -338,7 +338,6 @@ public class ShoppingCartServices { cartShipInfo.setVendorPartyId(orderItemShipGroup.getString("vendorPartyId")); cartShipInfo.setShipGroupSeqId(orderItemShipGroup.getString("shipGroupSeqId")); cartShipInfo.shipTaxAdj.addAll(orh.getOrderHeaderAdjustmentsTax(orderItemShipGroup.getString("shipGroupSeqId"))); - cart.setShipGroupSeqId(newShipInfoIndex - 1, orderItemShipGroup.getString("shipGroupSeqId")); } List orderItems = orh.getOrderItems(); @@ -596,13 +595,13 @@ public class ShoppingCartServices { "] to ship group with index [" + itemIndex + "]; group quantity is [" + shipGroupQty + "] item quantity is [" + (cartItem != null ? cartItem.getQuantity() : "no cart item") + "] cartShipGroupIndex is [" + cartShipGroupIndex + "], csi.shipItemInfo.size(): " + - csi.shipItemInfo.size(), module); + (cartShipGroupIndex < 0 ? 0 : csi.shipItemInfo.size()), module); } else { cart.setItemShipGroupQty(itemIndex, shipGroupQty, cartShipGroupIndex); } List shipGroupItemAdjustments = EntityUtil.filterByAnd(orderItemAdjustments, UtilMisc.toMap("shipGroupSeqId", cartShipGroupIndexStr)); - if (cartItem == null) { + if (cartItem == null || cartShipGroupIndex < 0) { Debug.logWarning("In loadCartFromOrder could not find cart item for itemIndex=" + itemIndex + ", for orderId=" + orderId, module); } else { CartShipItemInfo cartShipItemInfo = csi.getShipItemInfo(cartItem);