You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by sa...@apache.org on 2012/03/29 09:26:37 UTC

svn commit: r1306731 - /ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/order/OrderServices.java

Author: sascharodekamp
Date: Thu Mar 29 07:26:37 2012
New Revision: 1306731

URL: http://svn.apache.org/viewvc?rev=1306731&view=rev
Log:
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/branches/release11.04/applications/order/src/org/ofbiz/order/order/OrderServices.java

Modified: ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1306731&r1=1306730&r2=1306731&view=diff
==============================================================================
--- ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/order/OrderServices.java Thu Mar 29 07:26:37 2012
@@ -5447,6 +5447,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();
                     Iterator<ShoppingCartItem> ci = cartItems.iterator();