Author: jleroux
Date: Wed May 22 21:31:55 2013
New Revision: 1485434

URL: http://svn.apache.org/r1485434
Log:
"Applied fix from trunk for revision: 1485432  " 
------------------------------------------------------------------------
r1485432 | jleroux | 2013-05-22 23:29:02 +0200 (mer., 22 mai 2013) | 7 lines

A sligthly modified patch from Jonatan Soto for 
"ConcurrentModificationException when cancelling an order" 
https://issues.apache.org/jira/browse/OFBIZ-5194

After the order gets cancelled, there is a loop in OrderView.groovy@122 that 
removes promotional order line items retrieved from the OrderReadHelper class 
when cancelled. This is what makes the ConcurrentModificationException to be 
thrown.

For further details, check out the following thread at the dev mailing list: 
http://ofbiz.markmail.org/message/vmm65cmbf5hkmqm6?page=2

jleroux: I simply put a comment and removed the useless temporary 
orderItemListFiltered variable
------------------------------------------------------------------------


Modified:
    ofbiz/branches/release11.04/   (props changed)
    
ofbiz/branches/release11.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml
    
ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy

Propchange: ofbiz/branches/release11.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1485432

Modified: 
ofbiz/branches/release11.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml?rev=1485434&r1=1485433&r2=1485434&view=diff
==============================================================================
--- 
ofbiz/branches/release11.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml
 (original)
+++ 
ofbiz/branches/release11.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentMethodServices.xml
 Wed May 22 21:31:55 2013
@@ -46,6 +46,7 @@ under the License.
         <!-- find all CreditCard and EftAccount instances that use the current 
oldContactMechId and update them
             through the updateCreditCard or updateEftAccount services to use 
the new contactMechId -->
         <set field="lookupMap.contactMechId" 
from-field="parameters.oldContactMechId"/>
+        <now-timestamp field="now"/> 
 
         <find-by-and entity-name="CreditCard" map="lookupMap" 
list="creditCards"/>
         <iterate entry="creditCard" list="creditCards">

Modified: 
ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1485434&r1=1485433&r2=1485434&view=diff
==============================================================================
--- 
ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
 (original)
+++ 
ofbiz/branches/release11.04/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
 Wed May 22 21:31:55 2013
@@ -114,15 +114,11 @@ if (orderHeader) {
     grandTotal = OrderReadHelper.getOrderGrandTotal(orderItems, 
orderAdjustments);
     context.grandTotal = grandTotal;
 
-    canceledPromoOrderItem = [:];
     orderItemList = orderReadHelper.getOrderItems();
-    orderItemList.each { orderItem ->
-        if("Y".equals(orderItem.get("isPromo")) && 
"ITEM_CANCELLED".equals(orderItem.get("statusId"))) {
-            canceledPromoOrderItem = orderItem;
-        }
-        orderItemList.remove(canceledPromoOrderItem);
+    // Retrieve all non-promo items that aren't cancelled
+    context.orderItemList = orderReadHelper.getOrderItems().findAll { item ->
+        (item.isPromo == null || item.isPromo == 'N')  && 
!(item.statusId.equals('ITEM_CANCELLED'))
     }
-    context.orderItemList = orderItemList;
 
     shippingAddress = orderReadHelper.getShippingAddress();
     context.shippingAddress = shippingAddress;


Reply via email to