introduced a new parameter countNewReturnItems to getOrderAvailableReturnedTotal which controls whether newly created return items are counted, so that quick refund order works again
git-svn-id: https://svn.apache.org/repos/asf/incubator/ofbiz/trunk@478417 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -688,6 +688,7 @@ under the License.
|
||||
</if-compare>
|
||||
</iterate>
|
||||
<set field="orderAvailableCtx.orderId" from-field="orderHeader.orderId"/>
|
||||
<set field="orderAvailableCtx.countNewReturnItems" value="true" type="Boolean"/> <!-- very important: if this is not set, getOrderAvailableReturnedTotal would not count the return items we just created -->
|
||||
<call-service service-name="getOrderAvailableReturnedTotal" in-map-name="orderAvailableCtx">
|
||||
<result-to-field result-name="availableReturnTotal" field-name="availableReturnTotal"/>
|
||||
<result-to-field result-name="returnTotal" field-name="returnTotal"/>
|
||||
|
||||
@@ -235,9 +235,10 @@ under the License.
|
||||
|
||||
<service name="getOrderAvailableReturnedTotal" engine="java"
|
||||
location="org.ofbiz.order.order.OrderReturnServices" invoke="getOrderAvailableReturnedTotal">
|
||||
<description>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.</description>
|
||||
<description>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.</description>
|
||||
<attribute name="orderId" type="String" mode="IN" optional="false"/>
|
||||
<attribute name="adjustment" type="Double" mode="IN" optional="true"/>
|
||||
<attribute name="countNewReturnItems" type="Boolean" mode="IN" optional="true"/>
|
||||
<attribute name="orderTotal" type="Double" mode="OUT" optional="false"/>
|
||||
<attribute name="returnTotal" type="Double" mode="OUT" optional="false"/>
|
||||
<attribute name="availableReturnTotal" type="Double" mode="OUT" optional="false"/>
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user