Author: jacopoc
Date: Sat Dec 8 23:57:07 2007 New Revision: 602649 URL: http://svn.apache.org/viewvc?rev=602649&view=rev Log: Implemented new wrapper service and refactored the quick return creation to use it: in this way the creation of the return header and the creation of the items and adjustments are all in the same atomic transaction. No header is created if the creation of the items/adjustments fails. Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/order/OrderReturnServices.xml ofbiz/trunk/applications/order/servicedef/services_return.xml ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml 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=602649&r1=602648&r2=602649&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 Sat Dec 8 23:57:07 2007 @@ -794,6 +794,26 @@ <field-to-result field-name="returnId"/> </simple-method> + <simple-method method-name="createReturnAndItemOrAdjustment" short-description="If returnId is null, create a return; then create Return Item or Adjustment based on the parameters passed in"> + <if-empty field-name="parameters.returnId"> + <set-service-fields service-name="createReturnHeader" map-name="parameters" to-map-name="returnHeaderInMap"/> + <call-service service-name="createReturnHeader" in-map-name="returnHeaderInMap"> + <result-to-field result-name="returnId" field-name="returnId"/> + </call-service> + <check-errors/> + <set field="parameters.returnId" from-field="returnId"/> + <field-to-result field-name="returnId" result-name="returnId"/> + </if-empty> + <set-service-fields service-name="createReturnItemOrAdjustment" map-name="parameters" to-map-name="createReturnItemOrAdjustmentInMap"/> + <call-service service-name="createReturnItemOrAdjustment" in-map-name="createReturnItemOrAdjustmentInMap"> + <result-to-field result-name="returnAdjustmentId" field-name="returnAdjustmentId"/> + <result-to-field result-name="returnItemSeqId" field-name="returnItemSeqId"/> + </call-service> + <check-errors/> + <field-to-result field-name="returnAdjustmentId" result-name="returnAdjustmentId"/> + <field-to-result field-name="returnItemSeqId" result-name="returnItemSeqId"/> + </simple-method> + <simple-method method-name="createReturnItemBilling" short-description="Create a ReturnItemBilling"> <make-value entity-name="ReturnItemBilling" value-name="newEntity"/> <set-nonpk-fields map-name="parameters" value-name="newEntity"/> Modified: ofbiz/trunk/applications/order/servicedef/services_return.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services_return.xml?rev=602649&r1=602648&r2=602649&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/services_return.xml (original) +++ ofbiz/trunk/applications/order/servicedef/services_return.xml Sat Dec 8 23:57:07 2007 @@ -147,13 +147,23 @@ <description>Simple remove service</description> <auto-attributes entity-name="ReturnAdjustment" include="pk" mode="IN" optional="false"/> </service> + <service name="createReturnAndItemOrAdjustment" engine="simple" location="org/ofbiz/order/order/OrderReturnServices.xml" + invoke="createReturnAndItemOrAdjustment"> + <description>If returnId is null, create a return; then create Return Item or Adjustment based on the parameters passed in</description> + <auto-attributes mode="IN" include="nonpk" entity-name="ReturnHeader" optional="true"/> + <auto-attributes mode="IN" include="all" entity-name="ReturnAdjustment" optional="true"/> + <auto-attributes mode="IN" include="all" entity-name="ReturnItem" optional="true"/> + <attribute name="returnAdjustmentId" type="String" mode="OUT" optional="true"/> + <attribute name="returnItemSeqId" type="String" mode="OUT" optional="true"/> + <attribute name="returnId" type="String" mode="OUT" optional="true"/> + </service> <service name="createReturnItemOrAdjustment" engine="java" location="org.ofbiz.order.order.OrderReturnServices" invoke="createReturnItemOrAdjustment"> <description>create Return Item or Adjustment based on the parameters passed in</description> <auto-attributes mode="IN" include="all" entity-name="ReturnAdjustment" optional="true"/> <auto-attributes mode="IN" include="all" entity-name="ReturnItem" optional="true"/> <attribute name="returnAdjustmentId" type="String" mode="OUT" optional="true"/> - <attribute name="returnItemSeqId" type="String" mode="OUT" optional="true"/> + <attribute name="returnItemSeqId" type="String" mode="OUT" optional="true"/> </service> <service name="updateReturnItemOrAdjustment" engine="java" location="org.ofbiz.order.order.OrderReturnServices" invoke="updateReturnItemOrAdjustment"> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?rev=602649&r1=602648&r2=602649&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Sat Dec 8 23:57:07 2007 @@ -908,15 +908,9 @@ </request-map> <request-map uri="makeQuickReturn"> <security https="true" auth="true"/> - <event type="service" invoke="createReturnHeader"/> - <response name="success" type="request" value="setQuickReturnItems"/> - <response name="error" type="view" value="returnhead"/> - </request-map> - <request-map uri="setQuickReturnItems"> - <security https="true" auth="true" direct-request="false"/> - <event type="service-multi" invoke="createReturnItemOrAdjustment"/> + <event type="service-multi" invoke="createReturnAndItemOrAdjustment"/> <response name="success" type="view" value="returnitems"/> - <response name="error" type="view" value="returnhead"/> + <response name="error" type="view" value="orderview"/> </request-map> <request-map uri="quickRefundOrder"> <security https="true" auth="true"/> |
Free forum by Nabble | Edit this page |