svn commit: r530341 - in /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: r530341 - in /ofbiz/trunk/applications/order: script/org/ofbiz/order/order/OrderReturnServices.xml servicedef/services_return.xml src/org/ofbiz/order/order/OrderReturnServices.java

lektran
Author: lektran
Date: Thu Apr 19 02:02:26 2007
New Revision: 530341

URL: http://svn.apache.org/viewvc?view=rev&rev=530341
Log:
Changed the getOrderAvailableReturnedTotal service to use BigDecimal
OFBIZ-880

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

Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml?view=diff&rev=530341&r1=530340&r2=530341
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml Thu Apr 19 02:02:26 2007
@@ -159,7 +159,7 @@
                     </call-service>
                     <log level="info" message="Available amount for return on order #${returnItem.orderId} is [${availableReturnTotal}] (orderTotal = [${orderTotal}] - returnTotal = [${returnTotal}]"/>
 
-                    <if-compare field-name="availableReturnTotal" operator="less" value="-0.01" type="Double">
+                    <if-compare field-name="availableReturnTotal" operator="less" value="-0.01" type="BigDecimal">
                         <add-error><fail-property resource="OrderErrorUiLabels" property="OrderReturnPriceCannotExceedTheOrderTotal"/></add-error>
                     </if-compare>
                     <check-errors/>
@@ -696,7 +696,7 @@
         <log level="info" message="OrderTotal [${orderTotal}] - ReturnTotal [${returnTotal}] = available Return Total [${availableReturnTotal}]"/>
 
         <!-- create a manual balance adjustment based on the difference between order total and return total -->
-        <if-compare field-name="availableReturnTotal" operator="not-equals" value="0.00" type="Double">
+        <if-compare field-name="availableReturnTotal" operator="not-equals" value="0.00" type="BigDecimal">
             <set value="Balance Adjustment" field="balanceItemCtx.description"/>
             <set value="RET_MAN_ADJ" field="balanceItemCtx.returnAdjustmentTypeId"/>
 

Modified: ofbiz/trunk/applications/order/servicedef/services_return.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_return.xml?view=diff&rev=530341&r1=530340&r2=530341
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services_return.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services_return.xml Thu Apr 19 02:02:26 2007
@@ -239,11 +239,11 @@
             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.  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="adjustment" type="BigDecimal" 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"/>
+        <attribute name="orderTotal" type="BigDecimal" mode="OUT" optional="false"/>
+        <attribute name="returnTotal" type="BigDecimal" mode="OUT" optional="false"/>
+        <attribute name="availableReturnTotal" type="BigDecimal" mode="OUT" optional="false"/>
     </service>
 
     <service name="refundBillingAccountPayment" engine="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?view=diff&rev=530341&r1=530340&r2=530341
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Thu Apr 19 02:02:26 2007
@@ -101,24 +101,24 @@
         }
 
         // an adjustment value to test
-        Double adj = (Double) context.get("adjustment");
+        BigDecimal adj = (BigDecimal) context.get("adjustment");
         if (adj == null) {
-            adj = new Double(0);
+            adj = ZERO;
         }
 
         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();
+        BigDecimal returnTotal = orh.getOrderReturnedTotalBd(countNewReturnItems.booleanValue());
+        BigDecimal orderTotal = orh.getOrderGrandTotalBd();
+        BigDecimal available = orderTotal.subtract(returnTotal).subtract(adj);
 
 
         Map result = ServiceUtil.returnSuccess();
-        result.put("availableReturnTotal", new Double(available));
-        result.put("orderTotal", new Double(orderTotal));
-        result.put("returnTotal", new Double(returnTotal));
+        result.put("availableReturnTotal", available);
+        result.put("orderTotal", orderTotal);
+        result.put("returnTotal", returnTotal);
         return result;
     }