Author: ashish
Date: Sat Nov 15 05:28:30 2014
New Revision: 1639835
URL: http://svn.apache.org/r1639835
Log:
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/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1639835&r1=1639834&r2=1639835&view=diff
==============================================================================
---
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
(original)
+++
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
Sat Nov 15 05:28: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/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=1639835&r1=1639834&r2=1639835&view=diff
==============================================================================
---
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
(original)
+++
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
Sat Nov 15 05:28:30 2014
@@ -806,6 +806,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;
}
@@ -879,6 +883,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());