Author: mor
Date: Tue May 19 11:35:30 2009 New Revision: 776275 URL: http://svn.apache.org/viewvc?rev=776275&view=rev Log: When inventory is found or returned for a Discontinued Item then update ProductCategoryMember so that this item is shown in front-end store. Slightly modified patch from Akash Jain, part of OFBIZ-2484 (https://issues.apache.org/jira/browse/OFBIZ-2484) Modified: 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 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=776275&r1=776274&r2=776275&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 Tue May 19 11:35:30 2009 @@ -1060,4 +1060,44 @@ </else> </if> </simple-method> + + <simple-method method-name="addProductsBackToCategory" short-description="When one or more product is received directly through receive inventory or refund return then add these product(s) back to category, if they does not have any active category"> + <if-not-empty field="parameters.inventoryItemId"> + <entity-one entity-name="InventoryItem" value-field="inventoryItem"/> + <entity-and entity-name="ProductCategoryMember" list="productCategoryMembers"> + <field-map field-name="productId" from-field="inventoryItem.productId"/> + <order-by field-name="-thruDate"/> + </entity-and> + <filter-list-by-date list="productCategoryMembers" to-list="pcms"/> + <if-empty field="pcms"> + <first-from-list list="productCategoryMembers" entry="pcm"/> + <clear-field field="pcm.thruDate"/> + <set-service-fields service-name="updateProductToCategory" map="pcm" to-map="updateProductToCategoryMap"/> + <call-service service-name="updateProductToCategory" in-map-name="updateProductToCategoryMap"/> + </if-empty> + <else> + <if-not-empty field="parameters.returnId"> + <entity-and entity-name="ReturnItem" list="returnItems"> + <field-map field-name="returnId" from-field="parameters.returnId"/> + <field-map field-name="returnTypeId" value="RTN_REFUND"/> + </entity-and> + <if-not-empty field="returnItems"> + <iterate list="returnItems" entry="returnItem"> + <entity-and entity-name="ProductCategoryMember" list="productCategoryMembers"> + <field-map field-name="productId" from-field="returnItem.productId"/> + <order-by field-name="-thruDate"/> + </entity-and> + <filter-list-by-date list="productCategoryMembers" to-list="pcms"/> + <if-empty field="pcms"> + <first-from-list list="productCategoryMembers" entry="pcm"/> + <clear-field field="pcm.thruDate"/> + <set-service-fields service-name="updateProductToCategory" map="pcm" to-map="updateProductToCategoryMap"/> + <call-service service-name="updateProductToCategory" in-map-name="updateProductToCategoryMap"/> + </if-empty> + </iterate> + </if-not-empty> + </if-not-empty> + </else> + </if-not-empty> + </simple-method> </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=776275&r1=776274&r2=776275&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/secas.xml (original) +++ ofbiz/trunk/applications/order/servicedef/secas.xml Tue May 19 11:35:30 2009 @@ -45,11 +45,13 @@ </eca> <eca service="receiveInventoryProduct" event="commit"> <condition field-name="facilityId" operator="is-not-empty"/> + <action service="addProductsBackToCategory" mode="sync"/> <action service="setUnitPriceAsLastPrice" mode="sync"/> </eca> <eca service="receiveInventoryProduct" event="commit"> <condition field-name="facilityId" operator="is-not-empty"/> <condition field-name="orderId" operator="is-not-empty"/> + <action service="addProductsBackToCategory" mode="sync"/> <action service="updatePoOnReceiveInventory" mode="sync"/> </eca> <eca service="changeOrderItemStatus" event="commit"> @@ -197,6 +199,7 @@ <eca service="updateReturnHeader" event="commit"> <condition field-name="statusId" operator="equals" value="RETURN_RECEIVED"/> <condition field-name="oldStatusId" operator="not-equals" value="RETURN_RECEIVED"/> + <action service="addProductsBackToCategory" mode="sync"/> <action service="processWaitReplacementReturn" mode="sync"/> <action service="processWaitReplacementReservedReturn" mode="sync"/> <action service="processRepairReplacementReturn" mode="sync"/> @@ -205,6 +208,7 @@ </eca> <eca service="updateReturnStatusFromReceipt" event="global-commit"> <condition field-name="returnHeaderStatus" operator="equals" value="RETURN_RECEIVED"/> + <action service="addProductsBackToCategory" mode="sync"/> <action service="processWaitReplacementReturn" mode="sync"/> <action service="processRepairReplacementReturn" mode="sync"/> <action service="processCreditReturn" 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=776275&r1=776274&r2=776275&view=diff ============================================================================== --- ofbiz/trunk/applications/order/servicedef/services_return.xml (original) +++ ofbiz/trunk/applications/order/servicedef/services_return.xml Tue May 19 11:35:30 2009 @@ -332,4 +332,11 @@ <attribute name="orderId" type="String" mode="IN" optional="false"/> <attribute name="originOrderId" type="String" mode="IN" optional="false"/> </service> + + <service name="addProductsBackToCategory" engine="simple" + location="component://order/script/org/ofbiz/order/order/OrderReturnServices.xml" invoke="addProductsBackToCategory"> + <description>Add product(s) back to category if it has no active category</description> + <attribute name="returnId" type="String" mode="IN" optional="true"/> + <attribute name="inventoryItemId" type="String" mode="IN" optional="true"/> + </service> </services> |
Free forum by Nabble | Edit this page |