Files
ofbiz-framework/applications/product/servicedef/secas_shipment.xml
T
Vikas Mayur 4acae79c8f Payment capture is now triggered when invoice status is moved to Ready status. This event is removed from createInvoiceForOrder service. This work in following manner.
(Modified notes from Jacopo on dev list)
a) if ProductStore.autoApproveInvoice = Y then the invoice will be automatically moved to the ready status, this will trigger the capturePaymentsByInvoice service 
   and everything will work as now.
b) if ProductStore.autoApproveInvoice = N then the invoice will stay in the in-process status and payments will not be captured.

Redesigned the ECA rules as

updateShipment --> PICKED: trigger createInvoicesFromShipment (invoice in status IN PROCESS is created)
ProductStore.autoApproveInvoice = Y: calls setInvoiceStatus to move the invoice status to READY. setInvoiceStatus trigger capturePaymentsByInvoice.
updateShipment --> PACKED: trigger createInvoicesFromShipment and setInvoicesToReadyFromShipment. The former creates invoice(s) for missing ones and the latter moves the 
status of invoice to READY using setInvoiceStatus service. The setInvoiceStatus trigger capturePaymentsByInvoice.

Patch applied from OFBIZ-2740 (https://issues.apache.org/jira/browse/OFBIZ-2740)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@795809 13f79535-47bb-0310-9956-ffa450edef68
2009-07-20 12:59:57 +00:00

171 lines
9.5 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<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_PICKED, create invoice -->
<eca service="updateShipment" event="commit">
<condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
<condition field-name="statusId" operator="equals" value="SHIPMENT_PICKED"/>
<condition field-name="shipmentTypeId" operator="equals" value="SALES_SHIPMENT"/>
<action service="createInvoicesFromShipment" mode="sync" run-as-user="system"/>
</eca>
<eca service="updateShipment" event="commit">
<condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
<condition field-name="statusId" operator="equals" value="SHIPMENT_PACKED"/>
<condition field-name="shipmentTypeId" operator="equals" value="SALES_SHIPMENT"/>
<action service="createInvoicesFromShipment" mode="sync" run-as-user="system"/>
<action service="setInvoicesToReadyFromShipment" mode="sync" run-as-user="system"/>
</eca>
<eca service="updateShipment" event="commit">
<condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
<condition field-name="statusId" operator="equals" value="SHIPMENT_SHIPPED"/>
<condition field-name="shipmentTypeId" operator="equals" value="SALES_SHIPMENT"/>
<action service="sendShipmentCompleteNotification" mode="async" persist="true"/>
</eca>
<!-- if new statusId of a PURCHASE_SHIPMENT is PURCH_SHIP_RECEIVED, create invoice -->
<eca service="updateShipment" event="commit">
<condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
<condition field-name="statusId" operator="equals" value="PURCH_SHIP_RECEIVED"/>
<condition field-name="shipmentTypeId" operator="equals" value="PURCHASE_SHIPMENT"/>
<action service="balanceItemIssuancesForShipment" mode="sync"/>
<action service="createInvoicesFromShipment" mode="sync" run-as-user="system"/>
</eca>
<!-- if new statusId of a DROP_SHIPMENT is PURCH_SHIP_SHIPPED, create purchase invoice -->
<eca service="updateShipment" event="commit">
<condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
<condition field-name="statusId" operator="equals" value="PURCH_SHIP_SHIPPED"/>
<condition field-name="shipmentTypeId" operator="equals" value="DROP_SHIPMENT"/>
<action service="createInvoicesFromShipment" mode="sync" run-as-user="system"/>
</eca>
<!-- if new statusId of a DROP_SHIPMENT is PURCH_SHIP_RECEIVED, create sales invoice -->
<eca service="updateShipment" event="commit">
<condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
<condition field-name="statusId" operator="equals" value="PURCH_SHIP_RECEIVED"/>
<condition field-name="shipmentTypeId" operator="equals" value="DROP_SHIPMENT"/>
<action service="createSalesInvoicesFromDropShipment" mode="sync" run-as-user="system"/>
</eca>
<!-- if new statusId of a SALES_RETURN is PURCH_SHIP_RECEIVED, create a return invoice.
Note that PURCH_SHIP_RECEIVED now means any received shipment. We determine the
type of shipment by the shipmentTypeId. -->
<eca service="updateShipment" event="commit">
<condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
<condition field-name="statusId" operator="equals" value="PURCH_SHIP_RECEIVED"/>
<condition field-name="shipmentTypeId" operator="equals" value="SALES_RETURN"/>
<action service="createInvoicesFromReturnShipment" mode="sync" run-as-user="system"/>
</eca>
<!-- if new status of a PURCHASE_RETURN is SHIPMENT_SHIPPED, create a return invoice -->
<eca service="updateShipment" event="commit">
<condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
<condition field-name="statusId" operator="equals" value="SHIPMENT_SHIPPED"/>
<condition field-name="shipmentTypeId" operator="equals" value="PURCHASE_RETURN"/>
<action service="createInvoicesFromReturnShipment" mode="sync" run-as-user="system"/>
</eca>
<!-- if new statusId is SHIPMENT_SCHEDULED, send notification -->
<eca service="createShipment" event="commit">
<condition field-name="statusId" operator="equals" value="SHIPMENT_SCHEDULED"/>
<action service="sendShipmentScheduledNotification" mode="async"/>
</eca>
<eca service="updateShipment" event="commit">
<condition-field field-name="statusId" operator="not-equals" to-field-name="oldStatusId"/>
<condition field-name="statusId" operator="equals" value="SHIPMENT_SCHEDULED"/>
<action service="sendShipmentScheduledNotification" mode="async"/>
</eca>
<!-- if new originFacilityId or destinationFacilityId, get settings from facilities -->
<eca service="createShipment" event="commit">
<condition field-name="originFacilityId" operator="is-not-empty"/>
<action service="setShipmentSettingsFromFacilities" mode="sync"/>
</eca>
<eca service="createShipment" event="commit">
<condition field-name="destinationFacilityId" operator="is-not-empty"/>
<action service="setShipmentSettingsFromFacilities" mode="sync"/>
</eca>
<eca service="updateShipment" event="commit">
<condition-field field-name="originFacilityId" operator="not-equals" to-field-name="oldOriginFacilityId"/>
<condition field-name="originFacilityId" operator="is-not-empty"/>
<action service="setShipmentSettingsFromFacilities" mode="sync"/>
</eca>
<eca service="updateShipment" event="commit">
<condition-field field-name="destinationFacilityId" operator="not-equals" to-field-name="oldDestinationFacilityId"/>
<condition field-name="destinationFacilityId" operator="is-not-empty"/>
<action service="setShipmentSettingsFromFacilities" mode="sync"/>
</eca>
<!-- if new primaryOrderId, get settings from order -->
<eca service="createShipment" event="commit">
<condition field-name="primaryOrderId" operator="is-not-empty"/>
<action service="setShipmentSettingsFromPrimaryOrder" mode="sync"/>
</eca>
<eca service="updateShipment" event="commit">
<condition-field field-name="primaryOrderId" operator="not-equals" to-field-name="oldPrimaryOrderId"/>
<condition field-name="primaryOrderId" operator="is-not-empty"/>
<action service="setShipmentSettingsFromPrimaryOrder" mode="sync"/>
</eca>
<eca service="createShipmentReceipt" event="commit">
<condition field-name="returnId" operator="is-not-empty"/>
<action service="checkDecomposeInventoryItem" mode="sync"/>
<action service="updateReturnStatusFromReceipt" mode="sync" run-as-user="system"/>
</eca>
<eca service="createShipmentReceipt" event="commit">
<condition field-name="orderId" operator="is-not-empty"/>
<action service="updateOrderStatusFromReceipt" mode="sync" run-as-user="system"/>
</eca>
<eca service="createShipmentReceipt" event="commit">
<condition field-name="shipmentId" operator="is-not-empty"/>
<action service="checkDecomposeInventoryItem" mode="sync"/>
<action service="updatePurchaseShipmentFromReceipt" mode="sync"/>
</eca>
<eca service="createShipmentPackageContent" event="in-validate">
<condition field-name="shipmentPackageSeqId" operator="equals" value="New"/>
<action service="createShipmentPackage" mode="sync"/>
</eca>
<!-- picking ecas -->
<eca service="updatePicklistItem" event="commit">
<condition-field field-name="itemStatusId" operator="not-equals" to-field-name="oldItemStatusId"/>
<action service="checkPicklistBinItemStatuses" mode="sync"/>
</eca>
<!-- packing ecas -->
<eca service="packBulkItems" event="commit">
<condition field-name="nextPackageSeq" operator="equals" value="0"/>
<action service="setNextPackageSeq" mode="sync"/>
</eca>
</service-eca>