Author: mor
Date: Thu Apr 30 09:26:24 2009 New Revision: 770128 URL: http://svn.apache.org/viewvc?rev=770128&view=rev Log: Added support for new return type "Wait Replacement Reserved". If a return is created using this return type then 1) If status of this return is changed to accepted then a replacement order is created in Hold status. 2) If status of this return is changed to recieved then this replacement order status is changed to approved. Applied slighlty modified patch from Deepesh Kapoor, part of OFBIZ-2376 (https://issues.apache.org/jira/browse/OFBIZ-2376) 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=770128&r1=770127&r2=770128&view=diff ============================================================================== --- ofbiz/trunk/applications/order/data/OrderTypeData.xml (original) +++ ofbiz/trunk/applications/order/data/OrderTypeData.xml Thu Apr 30 09:26:24 2009 @@ -327,6 +327,7 @@ <ReturnType sequenceId="03" returnTypeId="RTN_REPLACE" description="Wait Replacement"/> <ReturnType sequenceId="04" returnTypeId="RTN_CSREPLACE" description="Cross-Ship Replacement"/> <ReturnType sequenceId="05" returnTypeId="RTN_REPAIR_REPLACE" description="Repair Replacement"/> + <ReturnType sequenceId="06" returnTypeId="RTN_WAIT_REPLACE_RES" description="Wait Replacement Reserved"/> <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=770128&r1=770127&r2=770128&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 Thu Apr 30 09:26:24 2009 @@ -896,7 +896,29 @@ <set field="inMap.returnTypeId" value="RTN_REPAIR_REPLACE"/> <call-service service-name="processReplacementReturn" in-map-name="inMap"/> </simple-method> - + <simple-method method-name="processWaitReplacementReservedReturn" short-description="Process the replacements in a wait reserved return when the return is accepted and then received"> + <entity-one entity-name="ReturnHeader" value-field="returnHeader"/> + <if-compare field="returnHeader.statusId" operator="equals" value="RETURN_ACCEPTED"> + <set field="inMap.returnId" from-field="parameters.returnId"/> + <set field="inMap.returnTypeId" value="RTN_WAIT_REPLACE_RES"/> + <call-service service-name="processReplacementReturn" in-map-name="inMap"/> + </if-compare> + <if-compare field="returnHeader.statusId" operator="equals" value="RETURN_RECEIVED"> + <entity-and entity-name="ReturnItem" list="returnItems"> + <field-map field-name="returnId" from-field="returnHeader.returnId"/> + <field-map field-name="returnTypeId" value="RTN_WAIT_REPLACE_RES"/> + </entity-and> + <if-not-empty field="returnItems"> + <!-- Get the replacement order and update its status to Approved --> + <first-from-list list="returnItems" entry="returnItem"/> + <get-related-one relation-name="ReturnItemResponse" value-field="returnItem" to-value-field="returnItemResponse"/> + <set field="changeOrderStatusMap.statusId" value="ORDER_APPROVED"/> + <set field="changeOrderStatusMap.orderId" from-field="returnItemResponse.replacementOrderId"/> + <call-service service-name="changeOrderStatus" in-map-name="changeOrderStatusMap"/> + </if-not-empty> + </if-compare> + </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> <check-errors/> @@ -920,4 +942,4 @@ </else> </if-compare> </simple-method> -</simple-methods> +</simple-methods> \ No newline at end of file Modified: ofbiz/trunk/applications/order/servicedef/secas.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/secas.xml?rev=770128&r1=770127&r2=770128&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/secas.xml (original) +++ ofbiz/trunk/applications/order/servicedef/secas.xml Thu Apr 30 09:26:24 2009 @@ -185,6 +185,7 @@ <eca service="updateReturnHeader" event="commit"> <condition field-name="statusId" operator="equals" value="RETURN_ACCEPTED"/> <condition field-name="currentStatusId" operator="not-equals" value="RETURN_ACCEPTED"/> + <action service="processWaitReplacementReservedReturn" mode="sync"/> <action service="createShipmentAndItemsForReturn" mode="sync"/> <action service="processCrossShipReplacementReturn" mode="sync"/> <action service="createTrackingCodeOrderReturns" mode="sync" run-as-user="system"/> @@ -195,6 +196,7 @@ <condition field-name="statusId" operator="equals" value="RETURN_RECEIVED"/> <condition field-name="currentStatusId" operator="not-equals" value="RETURN_RECEIVED"/> <action service="processWaitReplacementReturn" mode="sync"/> + <action service="processWaitReplacementReservedReturn" mode="sync"/> <action service="processRepairReplacementReturn" mode="sync"/> <action service="processCreditReturn" mode="sync"/> <action service="processRefundReturn" mode="sync"/> Modified: ofbiz/trunk/applications/order/servicedef/services_return.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_return.xml?rev=770128&r1=770127&r2=770128&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/services_return.xml (original) +++ ofbiz/trunk/applications/order/servicedef/services_return.xml Thu Apr 30 09:26:24 2009 @@ -233,6 +233,11 @@ <description>Process the replacements in a wait return</description> <attribute name="returnId" type="String" mode="IN" optional="false"/> </service> + <service name="processWaitReplacementReservedReturn" engine="simple" auth="true" + location="component://order/script/org/ofbiz/order/order/OrderReturnServices.xml" invoke="processWaitReplacementReservedReturn"> + <description>Process the replacements in a wait reserved return when the return is accepted and then received</description> + <attribute name="returnId" type="String" mode="IN" optional="false"/> + </service> <service name="processCrossShipReplacementReturn" engine="simple" auth="true" location="component://order/script/org/ofbiz/order/order/OrderReturnServices.xml" invoke="processCrossShipReplacementReturn"> <description>Process the replacements in a cross-ship 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=770128&r1=770127&r2=770128&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 Thu Apr 30 09:26:24 2009 @@ -1739,7 +1739,20 @@ // since there is no payments required; order is ready for processing/shipment if (createdOrderId != null) { - OrderChangeHelper.approveOrder(dispatcher, userLogin, createdOrderId); + if ("RETURN_ACCEPTED".equals(returnHeader.get("statusId")) && "RTN_WAIT_REPLACE_RES".equals(returnTypeId)) { + Map serviceResult = null; + try { + serviceResult = dispatcher.runSync("changeOrderStatus", UtilMisc.toMap("orderId", createdOrderId, "statusId", "ORDER_HOLD", "userLogin", userLogin)); + } catch (GenericServiceException e) { + Debug.logError(e, "Service invocation error, status changes were not updated for order #" + createdOrderId, module); + return ServiceUtil.returnError(e.getMessage()); + } + if (ServiceUtil.isError(serviceResult)) { + return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); + } + } else { + OrderChangeHelper.approveOrder(dispatcher, userLogin, createdOrderId); + } // create a ReturnItemResponse and attach to each ReturnItem Map itemResponse = FastMap.newInstance(); |
Free forum by Nabble | Edit this page |