diff --git a/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml b/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml index 4d43035207..7cea2d80a8 100644 --- a/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml +++ b/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml @@ -688,6 +688,7 @@ under the License. + diff --git a/applications/order/servicedef/services_return.xml b/applications/order/servicedef/services_return.xml index 79837038ca..8810368d9d 100644 --- a/applications/order/servicedef/services_return.xml +++ b/applications/order/servicedef/services_return.xml @@ -235,9 +235,10 @@ under the License. - Get the total amount of all returns for an order: orderTotal, returnTotal - totals so far. availableReturnTotal = orderTotal - returnTotal - adjustment. Used for checking if the return total has gone over the order total. + Get the total amount of all returns for an order: orderTotal, returnTotal - totals so far. availableReturnTotal = orderTotal - returnTotal - adjustment. Used for checking if the return total has gone over the order total. If countNewReturnItems is set to Boolean.TRUE then return items in the CREATED state will be counted. This should only be the case during quickRefundEntireOrder. + diff --git a/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java b/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java index 9b297529d9..e88440664a 100644 --- a/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java +++ b/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java @@ -102,7 +102,11 @@ public class OrderReturnServices { adj = new Double(0); } - double returnTotal = orh.getOrderReturnedTotal(false); + Boolean countNewReturnItems = (Boolean) context.get("countNewReturnItems"); + if (countNewReturnItems == null) { + countNewReturnItems = Boolean.FALSE; + } + double returnTotal = orh.getOrderReturnedTotal(countNewReturnItems.booleanValue()); double orderTotal = orh.getOrderGrandTotal(); double available = orderTotal - returnTotal - adj.doubleValue(); @@ -816,7 +820,7 @@ public class OrderReturnServices { } groupReturnItemsByOrder(returnItems, itemsByOrder, totalByOrder, delegator, returnId); - + // process each one by order Set itemSet = itemsByOrder.entrySet(); Iterator itemByOrderIt = itemSet.iterator(); @@ -1455,7 +1459,7 @@ public class OrderReturnServices { } } } - + // We may also have some order-level adjustments, so we need to go through each order again and add those as well if ((totalByOrder != null) && (totalByOrder.keySet() != null)) { Iterator orderIterator = totalByOrder.keySet().iterator();