Author: jleroux
Date: Fri Dec  5 07:18:11 2014
New Revision: 1643172

URL: http://svn.apache.org/viewvc?rev=1643172&view=rev
Log:
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

Modified:
    
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java

Modified: 
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java?rev=1643172&r1=1643171&r2=1643172&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
 (original)
+++ 
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
 Fri Dec  5 07:18:11 2014
@@ -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<GenericValue> 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<GenericValue> 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);


Reply via email to