Author: sascharodekamp
Date: Thu Mar 29 07:28:30 2012
New Revision: 1306732
URL:
http://svn.apache.org/viewvc?rev=1306732&view=revLog:
runSubscriptionAutoReorders places duplicate orderIds (
https://issues.apache.org/jira/browse/OFBIZ-4762) A patch from Sebastian Leitner: The services "runSubscriptionAutoReorders" runs every midnight by default. It checks for expired subscriptions and places a new order to extend them. It fills up a cart from the previous order and places the order.
It also sets the orderId of the old order at the cart, which is used during creation of the new order. According to this, no new order can be placed because of duplicate-entry exceptions from the database.
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1306732&r1=1306731&r2=1306732&view=diff==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Mar 29 07:28:30 2012
@@ -5453,6 +5453,10 @@ public class OrderServices {
result = dispatcher.runSync("loadCartFromOrder", UtilMisc.toMap("orderId", subscription.get("orderId"), "userLogin", userLogin));
ShoppingCart cart = (ShoppingCart) result.get("shoppingCart");
+ // remove former orderId from cart (would cause duplicate entry).
+ // orderId is set by order-creation services (including store-specific prefixes, e.g.)
+ cart.setOrderId(null);
+
// only keep the orderitem with the related product.
List<ShoppingCartItem> cartItems = cart.items();
for(ShoppingCartItem shoppingCartItem : cartItems) {