Author: jleroux
Date: Wed Sep 18 10:49:54 2013
New Revision: 1524361

URL: http://svn.apache.org/r1524361
Log:
A slightly modified patch from Leon for "ConcurrentModificationException when 
cancelling an order" https://issues.apache.org/jira/browse/OFBIZ-5194

Leon:
Thanks for resolve this bug. But it introduce a small flaw: all cancelled items 
is filtered out from order item list.

The filter condition before this patch is : 
("Y".equals(orderItem.get("isPromo")) && 
"ITEM_CANCELLED".equals(orderItem.get("statusId"))); – means filter out the 
item that is promo "AND" cancelled.
That of patch is : ! ((item.isPromo == null || item.isPromo == 'N') && 
!(item.statusId.equals('ITEM_CANCELLED'))) – means filter outer the item that 
is promo "OR" cancelled.

Theses two is not equivalent. After this patch, all cancelled items are filter 
out, no matter it's promo or not.


jleroux:

What we had before the change:
 get cancelled promo items
 remove them from the list of items
So we got all items but cancelled promo items

What we have now:
Get non-promo items AND non-cancelled items (or as said Scott "get all 
non-promo items that aren't cancelled")

What you suggest:
Get non-promo items OR non-cancelled items (if re-phrase what you suggest: get 
all non-promo items and add to them all the non-cancelled ones, so including 
the non-cancelled promo ones)

Your sentence "After this patch, all cancelled items are filter out, no matter 
it's promo or not." is almost right. Because we not only miss the cancelled 
non-promo but also the promo not cancelled

To re-prhase myself: Currently we miss the promo items which are not cancelled 
and the non-promo items which are cancelled

Pfew... the exclusive reasoning is here quite easier than the inclusive one!

I removed the useless parentheses around the cancelled proposition

Modified:
    
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy

Modified: 
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1524361&r1=1524360&r2=1524361&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
 (original)
+++ 
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
 Wed Sep 18 10:49:54 2013
@@ -120,7 +120,7 @@ if (orderHeader) {
     orderItemList = orderReadHelper.getOrderItems();
     // 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'))
+        (item.isPromo == null || item.isPromo == 'N')  || 
!item.statusId.equals('ITEM_CANCELLED')
     }
 
     shippingAddress = orderReadHelper.getShippingAddress();


Reply via email to