Author: jleroux
Date: Sat Nov 15 21:10:30 2014
New Revision: 1639917

URL: http://svn.apache.org/r1639917
Log:
"Applied fix from trunk for revision: 1639835" 
------------------------------------------------------------------------
r1639835 | ashish | 2014-11-15 06:28:30 +0100 (sam. 15 nov. 2014) | 2 lignes

Applied patch from jira issue - OFBIZ-5416 - Sales order cart items already 
assigned to ship groups are incorrectly able to be modified to 
quantities/prices that break the ProductStoreShipmentMeth rules.
Thanks Christian for reporting the issue and Thanks Arun for providing the 
patch. 
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release13.07/   (props changed)
    
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
    
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java

Propchange: ofbiz/branches/release13.07/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1639835

Modified: 
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1639917&r1=1639916&r2=1639917&view=diff
==============================================================================
--- 
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
 (original)
+++ 
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
 Sat Nov 15 21:10:30 2014
@@ -645,7 +645,12 @@ public class ShoppingCartEvents {
         if (UtilValidate.isNotEmpty(itemId)) {
             request.setAttribute("itemId", itemId);
         }
-
+        for (int shipGroupIndex = 0; shipGroupIndex < cart.getShipGroupSize(); 
shipGroupIndex++) {
+            String shipContactMechId = 
cart.getShippingContactMechId(shipGroupIndex);
+            if (UtilValidate.isNotEmpty(shipContactMechId)) {
+                cart.setShipmentMethodTypeId(shipGroupIndex, null);
+            }
+        }
         // Determine where to send the browser
         if (controlDirective.equals(ERROR)) {
             return "error";

Modified: 
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=1639917&r1=1639916&r2=1639917&view=diff
==============================================================================
--- 
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
 (original)
+++ 
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
 Sat Nov 15 21:10:30 2014
@@ -805,6 +805,10 @@ public class ShoppingCartHelper {
                                         }
                                     } else {
                                         BigDecimal minQuantity = 
ShoppingCart.getMinimumOrderQuantity(delegator, item.getBasePrice(), 
item.getProductId());
+                                        oldQuantity = item.getQuantity();
+                                        if (oldQuantity.compareTo(quantity) != 
0) {
+                                            
cart.setShipmentMethodTypeId(index, null);
+                                        }
                                         if (quantity.compareTo(minQuantity) < 
0) {
                                             quantity = minQuantity;
                                         }
@@ -878,6 +882,7 @@ public class ShoppingCartHelper {
                 Debug.logInfo("Removing item index: " + itemIndex, module);
             try {
                 this.cart.removeCartItem(itemIndex, dispatcher);
+                cart.setShipmentMethodTypeId(itemIndex, null);
             } catch (CartItemModifyException e) {
                 result = ServiceUtil.returnError(new ArrayList<String>());
                 errorMsgs.add(e.getMessage());


Reply via email to