svn commit: r478417 - in /incubator/ofbiz/trunk/applications/order: script/org/ofbiz/order/order/OrderReturnServices.xml servicedef/services_return.xml src/org/ofbiz/order/order/OrderReturnServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r478417 - in /incubator/ofbiz/trunk/applications/order: script/org/ofbiz/order/order/OrderReturnServices.xml servicedef/services_return.xml src/org/ofbiz/order/order/OrderReturnServices.java

sichen
Author: sichen
Date: Wed Nov 22 17:08:05 2006
New Revision: 478417

URL: http://svn.apache.org/viewvc?view=rev&rev=478417
Log:
introduced a new parameter countNewReturnItems to getOrderAvailableReturnedTotal which controls whether newly created return items are counted, so that quick refund order works again

Modified:
    incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml
    incubator/ofbiz/trunk/applications/order/servicedef/services_return.xml
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java

Modified: incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml?view=diff&rev=478417&r1=478416&r2=478417
==============================================================================
--- incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml (original)
+++ incubator/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml Wed Nov 22 17:08:05 2006
@@ -688,6 +688,7 @@
             </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"/>

Modified: incubator/ofbiz/trunk/applications/order/servicedef/services_return.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/servicedef/services_return.xml?view=diff&rev=478417&r1=478416&r2=478417
==============================================================================
--- incubator/ofbiz/trunk/applications/order/servicedef/services_return.xml (original)
+++ incubator/ofbiz/trunk/applications/order/servicedef/services_return.xml Wed Nov 22 17:08:05 2006
@@ -235,9 +235,10 @@
 
     <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"/>

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?view=diff&rev=478417&r1=478416&r2=478417
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Wed Nov 22 17:08:05 2006
@@ -102,7 +102,11 @@
             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 @@
             }                                    
 
             groupReturnItemsByOrder(returnItems, itemsByOrder, totalByOrder, delegator, returnId);
-
+            
             // process each one by order
             Set itemSet = itemsByOrder.entrySet();
             Iterator itemByOrderIt = itemSet.iterator();
@@ -1455,7 +1459,7 @@
                 }
             }
         }
-
+        
         // 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();