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

mor-2
Author: mor
Date: Wed May 13 12:30:20 2009
New Revision: 774291

URL: http://svn.apache.org/viewvc?rev=774291&view=rev
Log:
New return type "Refund Immediately" which trigger refunds on when return is accepted.
Patch from Deepesh Kapoor, part of OFBIZ-2429 (https://issues.apache.org/jira/browse/OFBIZ-2429)

Modified:
    ofbiz/trunk/applications/order/data/OrderTypeData.xml
    ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml
    ofbiz/trunk/applications/order/servicedef/secas.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/data/OrderTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/data/OrderTypeData.xml?rev=774291&r1=774290&r2=774291&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/data/OrderTypeData.xml (original)
+++ ofbiz/trunk/applications/order/data/OrderTypeData.xml Wed May 13 12:30:20 2009
@@ -330,6 +330,7 @@
     <ReturnType sequenceId="05" returnTypeId="RTN_REPAIR_REPLACE" description="Repair Replacement"/>
     <ReturnType sequenceId="06" returnTypeId="RTN_WAIT_REPLACE_RES" description="Wait Replacement Reserved"/>
     <ReturnType sequenceId="07" returnTypeId="RTN_REPLACE_IMMEDIAT" description="Replace Immediately"/>
+    <ReturnType sequenceId="08" returnTypeId="RTN_REFUND_IMMEDIATE" description="Refund immediately"/>
 
     <WorkReqFulfType description="Implements" workReqFulfTypeId="WRF_IMPLEMENTS"/>
     <WorkReqFulfType description="Fixes" workReqFulfTypeId="WRF_FIXES"/>

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?rev=774291&r1=774290&r2=774291&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml (original)
+++ ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml Wed May 13 12:30:20 2009
@@ -936,6 +936,16 @@
         <set field="inMap.returnTypeId" value="RTN_REPLACE_IMMEDIAT"/>
         <call-service service-name="processReplacementReturn" in-map-name="inMap"/>
     </simple-method>
+    <simple-method method-name="processRefundOnlyReturn" short-description="Process the refund in a return">
+        <set field="inMap.returnId" from-field="parameters.returnId"/>
+        <set field="inMap.returnTypeId" value="RTN_REFUND"/>
+        <call-service service-name="processRefundReturn" in-map-name="inMap"/>
+    </simple-method>
+    <simple-method method-name="processRefundImmediatelyReturn" short-description="Process the Immediate refund in a return">
+        <set field="inMap.returnId" from-field="parameters.returnId"/>
+        <set field="inMap.returnTypeId" value="RTN_REFUND_IMMEDIATE"/>
+        <call-service service-name="processRefundReturn" in-map-name="inMap"/>
+    </simple-method>
 
     <simple-method method-name="createReturnItemShipment" short-description="Create a ReturnItemShipment">
         <check-permission permission="ORDERMGR" action="_CREATE"><fail-property resource="OrderErrorUiLabels" property="OrderSecurityErrorToRunCreateReturnItemShipment"/></check-permission>

Modified: ofbiz/trunk/applications/order/servicedef/secas.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas.xml?rev=774291&r1=774290&r2=774291&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/secas.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/secas.xml Wed May 13 12:30:20 2009
@@ -191,6 +191,7 @@
         <action service="processCrossShipReplacementReturn" mode="sync"/>
         <action service="createTrackingCodeOrderReturns" mode="sync" run-as-user="system"/>
         <action service="sendReturnAcceptNotification" mode="async" persist="true"/>
+        <action service="processRefundImmediatelyReturn" mode="sync"/>
     </eca>
 
     <eca service="updateReturnHeader" event="commit">
@@ -200,14 +201,14 @@
         <action service="processWaitReplacementReservedReturn" mode="sync"/>
         <action service="processRepairReplacementReturn" mode="sync"/>
         <action service="processCreditReturn" mode="sync"/>
-        <action service="processRefundReturn" mode="sync"/>
+        <action service="processRefundOnlyReturn" mode="sync"/>
     </eca>
     <eca service="updateReturnStatusFromReceipt" event="global-commit">
         <condition field-name="returnHeaderStatus" operator="equals" value="RETURN_RECEIVED"/>
         <action service="processWaitReplacementReturn" mode="sync"/>
         <action service="processRepairReplacementReturn" mode="sync"/>
         <action service="processCreditReturn" mode="sync"/>
-        <action service="processRefundReturn" mode="sync"/>
+        <action service="processRefundOnlyReturn" mode="sync"/>
     </eca>
 
     <eca service="updateReturnHeader" event="commit">

Modified: ofbiz/trunk/applications/order/servicedef/services_return.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_return.xml?rev=774291&r1=774290&r2=774291&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services_return.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services_return.xml Wed May 13 12:30:20 2009
@@ -220,6 +220,7 @@
             location="org.ofbiz.order.order.OrderReturnServices" invoke="processRefundReturn">
         <description>Process the refunds in a return</description>
         <attribute name="returnId" type="String" mode="IN" optional="false"/>
+        <attribute name="returnTypeId" type="String" mode="IN" optional="false"/>
     </service>
     <service name="processReplacementReturn" engine="java" auth="true"
             location="org.ofbiz.order.order.OrderReturnServices" invoke="processReplacementReturn">
@@ -252,6 +253,16 @@
         <description>Process the replacements in a Immediate Return</description>
         <attribute name="returnId" type="String" mode="IN" optional="false"/>
     </service>
+    <service name="processRefundOnlyReturn" engine="simple"  auth="true"
+            location="component://order/script/org/ofbiz/order/order/OrderReturnServices.xml" invoke="processRefundOnlyReturn">
+        <description>Process the Refund in a return</description>    
+        <attribute name="returnId" type="String" mode="IN" optional="false"/>
+    </service>
+    <service name="processRefundImmediatelyReturn" engine="simple"  auth="true"
+            location="component://order/script/org/ofbiz/order/order/OrderReturnServices.xml" invoke="processRefundImmediatelyReturn">
+        <description>Process the Immediate Refund in a return</description>    
+        <attribute name="returnId" type="String" mode="IN" optional="false"/>
+    </service>
     <service name="processSubscriptionReturn" engine="java" auth="true"
             location="org.ofbiz.order.order.OrderReturnServices" invoke="processSubscriptionReturn">
         <description>Process subscription changes from a return</description>

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=774291&r1=774290&r2=774291&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 Wed May 13 12:30:20 2009
@@ -853,6 +853,7 @@
         GenericDelegator delegator = dctx.getDelegator();
         LocalDispatcher dispatcher = dctx.getDispatcher();
         String returnId = (String) context.get("returnId");
+        String returnTypeId = (String) context.get("returnTypeId");
         GenericValue userLogin = (GenericValue) context.get("userLogin");
         Locale locale = (Locale) context.get("locale");
 
@@ -861,14 +862,14 @@
         try {
             returnHeader = delegator.findByPrimaryKey("ReturnHeader", UtilMisc.toMap("returnId", returnId));
             if (returnHeader != null) {
-                returnItems = returnHeader.getRelatedByAnd("ReturnItem", UtilMisc.toMap("returnTypeId", "RTN_REFUND"));
+                returnItems = returnHeader.getRelatedByAnd("ReturnItem", UtilMisc.toMap("returnTypeId", returnTypeId));
             }
         } catch (GenericEntityException e) {
             Debug.logError(e, "Problems looking up return information", module);
             return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderErrorGettingReturnHeaderItemInformation", locale));
         }
 
-        BigDecimal adjustments = getReturnAdjustmentTotal(delegator, UtilMisc.toMap("returnId", returnId, "returnTypeId", "RTN_REFUND"));
+        BigDecimal adjustments = getReturnAdjustmentTotal(delegator, UtilMisc.toMap("returnId", returnId, "returnTypeId", returnTypeId));
 
         if (returnHeader != null && ((returnItems != null && returnItems.size() > 0) || adjustments.compareTo(ZERO) > 0)) {
             Map itemsByOrder = new HashMap();
@@ -886,7 +887,7 @@
                 return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
             }
 
-            groupReturnItemsByOrder(returnItems, itemsByOrder, totalByOrder, delegator, returnId, "RTN_REFUND");
+            groupReturnItemsByOrder(returnItems, itemsByOrder, totalByOrder, delegator, returnId, returnTypeId);
 
             // process each one by order
             Set itemSet = itemsByOrder.entrySet();