svn commit: r783749 - /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: r783749 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java

ashish-18
Author: ashish
Date: Thu Jun 11 12:57:05 2009
New Revision: 783749

URL: http://svn.apache.org/viewvc?rev=783749&view=rev
Log:
Applied patch from jira issue OFBIZ-2591 (Getting error while updating item from order view page.)
Thanks Arun Patidar for your contribution & to Ratnesh for discussing issue with Arun and reviewing it.

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=783749&r1=783748&r2=783749&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 Jun 11 12:57:05 2009
@@ -3834,15 +3834,20 @@
             throw new GeneralException(e.getMessage());
         }
 
+        // get the new orderItems, adjustments, shipping info, payments and order item atrributes from the cart
+        List<Map> modifiedItems = FastList.newInstance();
+        List toStore = new LinkedList();
+        List<GenericValue> toAddList = new ArrayList<GenericValue>();
+        toAddList.addAll(cart.makeAllAdjustments());
+        cart.clearAllPromotionAdjustments();
+        ProductPromoWorker.doPromotions(cart, dispatcher);
+
         // validate the payment methods
         Map validateResp = coh.validatePaymentMethods();
         if (ServiceUtil.isError(validateResp)) {
             throw new GeneralException(ServiceUtil.getErrorMessage(validateResp));
         }
 
-        // get the new orderItems, adjustments, shipping info, payments and order item atrributes from the cart
-        List<Map> modifiedItems = FastList.newInstance();
-        List toStore = new LinkedList();
         toStore.addAll(cart.makeOrderItems());
         toStore.addAll(cart.makeAllAdjustments());
         
@@ -3869,7 +3874,13 @@
             }
             toStore.removeAll(removeList);
         }
-        
+        for (GenericValue toAdd: (List<GenericValue>)toAddList) {
+            if ("OrderAdjustment".equals(toAdd.getEntityName())) {
+                if (toAdd.get("comments") != null && ((String)toAdd.get("comments")).startsWith("Added manually by") && ("PROMOTION_ADJUSTMENT".equals(toAdd.get("orderAdjustmentTypeId")))) {
+                    toStore.add(toAdd);
+                }
+            }
+        }
         // Creating objects for New Shipping and Handling Charges Adjustment and Sales Tax Adjustment
         toStore.addAll(cart.makeAllShipGroupInfos());
         toStore.addAll(cart.makeAllOrderPaymentInfos(dispatcher));