Author: bibryam
Date: Tue Jun 24 04:31:02 2008 New Revision: 671137 URL: http://svn.apache.org/viewvc?rev=671137&view=rev Log: Added a service for canceling Item Issuances and Shipment plans when a sales shipment is cancelled. This should fix the bug described in OFBIZ-1766 "problem with creating a shipment after a canceled shipment on the Input status". Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml ofbiz/trunk/applications/product/servicedef/secas_shipment.xml ofbiz/trunk/applications/product/servicedef/services_shipment.xml Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml?rev=671137&r1=671136&r2=671137&view=diff ============================================================================== --- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml (original) +++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/issuance/IssuanceServices.xml Tue Jun 24 04:31:02 2008 @@ -445,11 +445,15 @@ <entity-one entity-name="ItemIssuance" value-name="itemIssuance"/> <get-related-one value-name="itemIssuance" relation-name="OrderHeader" to-value-name="orderHeader"/> <get-related-one value-name="itemIssuance" relation-name="InventoryItem" to-value-name="inventoryItem"/> + <get-related-one value-name="itemIssuance" relation-name="Shipment" to-value-name="shipment"/> - <!-- issuance can be canceled only if the sales shipment is not packed --> - <set from-field="itemIssuance.shipmentId" field="shipmentId"/> - <call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="org/ofbiz/shipment/shipment/ShipmentServices.xml"/> - <check-errors/> + <!-- issuance can be canceled only if the sales shipment is not packed --> + + <if-compare field="shipment.statusId" operator="not-equals" value="SHIPMENT_CANCELLED"> + <set from-field="itemIssuance.shipmentId" field="shipmentId"/> + <call-simple-method method-name="checkCanChangeShipmentStatusPacked" xml-resource="org/ofbiz/shipment/shipment/ShipmentServices.xml"/> + <check-errors/> + </if-compare> <!-- make sure the order is of orderTypeId: SALES_ORDER --> <if-compare field="orderHeader.orderTypeId" operator="not-equals" value="SALES_ORDER"> @@ -470,8 +474,12 @@ </if-empty> <!-- make sure specified cancel Quantity is not less than or equal to 0 --> - <if-compare field="toCancelQuantity" operator="less-equals" value="0" type="Double"> - <add-error><fail-message message="Not cancelling ItemIssuance [${parameters.itemIssuanceId}] because the quantity to cancel [${toCancelQuantity}] is less than or equal to 0 "/></add-error> + <if-compare field="toCancelQuantity" operator="less" value="0" type="Double"> + <add-error><fail-message message="Not cancelling ItemIssuance [${parameters.itemIssuanceId}] because the quantity to cancel [${toCancelQuantity}] is less than 0 "/></add-error> + </if-compare> + + <if-compare field="toCancelQuantity" operator="equals" value="0" type="Double"> + <return response-code="success"/> </if-compare> <!-- make sure specified quantity is not greater than issued quantity left --> Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml?rev=671137&r1=671136&r2=671137&view=diff ============================================================================== --- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml (original) +++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml Tue Jun 24 04:31:02 2008 @@ -1929,6 +1929,30 @@ <field-to-result field-name="remainingQuantity"/> </simple-method> + <simple-method method-name="checkCancelItemIssuanceAndOrderShipmentFromShipment" short-description="Check Shipment Items and Cancel Item Issuance and Order Shipment"> + <set value="Cancel Item Issuance and Order Shipment from a Sales Shipment" field="operationName"/> + <check-permission permission="FACILITY" action="_UPDATE"> + <fail-message message="Security Error: to run ${operationName} you must have the FACILITY_UPDATE or FACILITY_ADMIN permission"/> + </check-permission> + + <entity-and entity-name="OrderShipment" list-name="orderShipmentList"> + <field-map field-name="shipmentId" env-name="parameters.shipmentId"/> + </entity-and> + <iterate entry-name="orderShipment" list-name="orderShipmentList"> + <clear-field field-name="deleteOrderShipmentMap"/> + <set-service-fields service-name="deleteOrderShipment" map-name="orderShipment" to-map-name="deleteOrderShipmentMap"/> + <call-service service-name="deleteOrderShipment" in-map-name="deleteOrderShipmentMap"/> + </iterate> + + <log level="info" message="Cancelling Item Issuances for shimpentId: ${parameters.shipmentId}"/> + <entity-one entity-name="Shipment" value-name="shipment"/> + <get-related value-name="shipment" relation-name="ItemIssuance" list-name="issuances"/> + <iterate list-name="issuances" entry-name="issuance"> + <set from-field="issuance.itemIssuanceId" field="inputMap.itemIssuanceId"/> + <call-service service-name="cancelOrderItemIssuanceFromSalesShipment" in-map-name="inputMap"/> + </iterate> + </simple-method> + <!-- QuantityBreak services --> <!-- create a new QuantityBreak --> <simple-method method-name="createQuantityBreak" short-description="Create a QuoteAttribute"> Modified: ofbiz/trunk/applications/product/servicedef/secas_shipment.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/secas_shipment.xml?rev=671137&r1=671136&r2=671137&view=diff ============================================================================== --- ofbiz/trunk/applications/product/servicedef/secas_shipment.xml (original) +++ ofbiz/trunk/applications/product/servicedef/secas_shipment.xml Tue Jun 24 04:31:02 2008 @@ -20,6 +20,13 @@ <service-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/service-eca.xsd"> + <!-- if a SALES_SHIPMENT is SHIPMENT_CANCELLED, cancel ItemIssuance and OrderShipment --> + <eca service="updateShipment" event="commit"> + <condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/> + <condition field-name="shipmentTypeId" operator="equals" value="SALES_SHIPMENT"/> + <condition field-name="statusId" operator="equals" value="SHIPMENT_CANCELLED"/> + <action service="checkCancelItemIssuanceAndOrderShipmentFromShipment" mode="sync"/> + </eca> <!-- if new statusId of a SALES_SHIPMENT is SHIPMENT_PACKED, create invoice --> <eca service="updateShipment" event="commit"> <condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/> Modified: ofbiz/trunk/applications/product/servicedef/services_shipment.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_shipment.xml?rev=671137&r1=671136&r2=671137&view=diff ============================================================================== --- ofbiz/trunk/applications/product/servicedef/services_shipment.xml (original) +++ ofbiz/trunk/applications/product/servicedef/services_shipment.xml Tue Jun 24 04:31:02 2008 @@ -175,6 +175,11 @@ </description> <attribute name="shipmentId" type="String" mode="IN" optional="false"/> </service> + <service name="checkCancelItemIssuanceAndOrderShipmentFromShipment" engine="simple" + location="org/ofbiz/shipment/shipment/ShipmentServices.xml" invoke="checkCancelItemIssuanceAndOrderShipmentFromShipment" auth="true"> + <description>Check Shipment Items and cancel Item Issuance and Order Shipment</description> + <attribute name="shipmentId" type="String" mode="IN" optional="false"/> + </service> <service name="quickDropShipOrder" engine="simple" location="org/ofbiz/shipment/shipment/ShipmentServices.xml" invoke="quickDropShipOrder" auth="true"> <description>Creates a drop shipment for a ship group and calls updateShipment twice in succession to set |
Free forum by Nabble | Edit this page |