Author: ashish
Date: Tue Jun 23 15:44:49 2009
New Revision: 787726

URL: http://svn.apache.org/viewvc?rev=787726&view=rev
Log:
Applied patch from jira issue OFBIZ-2654 (Found a small bug in replacement 
order refund process).
Thanks Mridul for your contribution.

Modified:
    
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java

Modified: 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=787726&r1=787725&r2=787726&view=diff
==============================================================================
--- 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
 (original)
+++ 
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
 Tue Jun 23 15:44:49 2009
@@ -1195,6 +1195,10 @@
                     orderHeader = delegator.findByPrimaryKey("OrderHeader", 
UtilMisc.toMap("orderId", orderId));
                     // sort these desending by maxAmount
                     orderPayPrefs = 
orderHeader.getRelated("OrderPaymentPreference", UtilMisc.toList("-maxAmount"));
+
+                    List exprs = 
UtilMisc.toList(EntityCondition.makeCondition("statusId", 
EntityOperator.EQUALS, "PAYMENT_SETTLED"), 
EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, 
"PAYMENT_RECEIVED"));
+                    orderPayPrefs = EntityUtil.filterByOr(orderPayPrefs, 
exprs);
+                    
                     // Check for replacement order
                     if (UtilValidate.isEmpty(orderPayPrefs)){
                         List<GenericValue> orderItemAssocs = 
delegator.findByAnd("OrderItemAssoc", UtilMisc.toMap("toOrderId", orderId, 
"orderItemAssocTypeId", "REPLACEMENT"));
@@ -1202,11 +1206,10 @@
                             String originalOrderId = 
EntityUtil.getFirst(orderItemAssocs).getString("orderId");
                             orderHeader = 
delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", 
originalOrderId));
                             orderPayPrefs = 
orderHeader.getRelated("OrderPaymentPreference", UtilMisc.toList("-maxAmount"));
+                            orderPayPrefs = 
EntityUtil.filterByOr(orderPayPrefs, exprs);
                             orderId = originalOrderId;
                         }
                     }
-                    List exprs = 
UtilMisc.toList(EntityCondition.makeCondition("statusId", 
EntityOperator.EQUALS, "PAYMENT_SETTLED"), 
EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, 
"PAYMENT_RECEIVED"));
-                    orderPayPrefs = EntityUtil.filterByOr(orderPayPrefs, 
exprs);
                 } catch (GenericEntityException e) {
                     Debug.logError(e, "Cannot get Order details for #" + 
orderId, module);
                     continue;


Reply via email to