Author: jleroux
Date: Mon Oct 24 08:39:46 2011
New Revision: 1188042
URL:
http://svn.apache.org/viewvc?rev=1188042&view=revLog:
A patch from Leon "Append order item overrides the exist one if the last order item is "canceled""
https://issues.apache.org/jira/browse/OFBIZ-4470Set the correct nextItemSeq of shopping cart. It the "next" item sequence id, not the miximal item sequence id.
The problem occured after OFBIZ-4485 patch was applied (see the third change: make order item sequence id more compact and truely "sequential").
Also with and empty order (order without any valid items or all order items cancelled), then the problem will also occur if all the order items have been cancelled and the new order item is appended after that.
In the code level, if the nextItemSeq is set to the sequence id of last order item but not the true "next" one, then in ShoppingCart.makeOrderItems method, the problem will occur if the cart does not contain any exist order items (all cart items's orderItemSeqId are null):
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=1188042&r1=1188041&r2=1188042&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 Mon Oct 24 08:39:46 2011
@@ -615,7 +615,7 @@ public class ShoppingCartServices {
// set the item seq in the cart
if (nextItemSeq > 0) {
try {
- cart.setNextItemSeq(nextItemSeq);
+ cart.setNextItemSeq(nextItemSeq+1);
} catch (GeneralException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
@@ -930,7 +930,7 @@ public class ShoppingCartServices {
// set the item seq in the cart
if (nextItemSeq > 0) {
try {
- cart.setNextItemSeq(nextItemSeq);
+ cart.setNextItemSeq(nextItemSeq+1);
} catch (GeneralException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
@@ -1077,7 +1077,7 @@ public class ShoppingCartServices {
// set the item seq in the cart
if (nextItemSeq > 0) {
try {
- cart.setNextItemSeq(nextItemSeq);
+ cart.setNextItemSeq(nextItemSeq+1);
} catch (GeneralException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());