svn commit: r1034636 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1034636 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java

jonesde
Author: jonesde
Date: Sat Nov 13 03:22:30 2010
New Revision: 1034636

URL: http://svn.apache.org/viewvc?rev=1034636&view=rev
Log:
Fixed bug that caused certain adjustments, like manual discounts for example, to duplicate whenever a cart is resaved to the db

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=1034636&r1=1034635&r2=1034636&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 Sat Nov 13 03:22:30 2010
@@ -3860,7 +3860,7 @@ public class OrderServices {
             }
         }
 
-        // get the new orderItems, adjustments, shipping info, payments and order item atrributes from the cart
+        // get the new orderItems, adjustments, shipping info, payments and order item attributes from the cart
         List<Map> modifiedItems = FastList.newInstance();
         List toStore = new LinkedList();
         List<GenericValue> toAddList = new ArrayList<GenericValue>();
@@ -3959,7 +3959,10 @@ public class OrderServices {
                 if (UtilValidate.isEmpty(valueObj.get("orderItemSeqId"))) {
                     valueObj.set("orderItemSeqId", DataModelConstants.SEQ_ID_NA);
                 }
-                valueObj.set("orderAdjustmentId", delegator.getNextSeqId("OrderAdjustment"));
+                // in order to avoid duplicate adjustments don't set orderAdjustmentId (which is the pk) if there is already one
+                if (UtilValidate.isEmpty(valueObj.getString("orderAdjustmentId"))) {
+                    valueObj.set("orderAdjustmentId", delegator.getNextSeqId("OrderAdjustment"));
+                }
                 valueObj.set("createdDate", UtilDateTime.nowTimestamp());
                 valueObj.set("createdByUserLogin", userLogin.getString("userLoginId"));
             } else if ("OrderPaymentPreference".equals(valueObj.getEntityName())) {