ilscipio/scipio-erp

View on GitHub
applications/product/entitydef/eecas.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is subject to the terms and conditions defined in the
files 'LICENSE' and 'NOTICE', which are part of this source
code package.
-->

<entity-eca xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entity-eca.xsd">
    <!-- Product Keyword Indexing ECAs -->
    <eca entity="Product" operation="create" event="return">
        <condition field-name="autoCreateKeywords" operator="not-equals" value="N"/>
        <action service="indexProductKeywords" mode="sync" value-attr="productInstance"/>
    </eca>
    <eca entity="Product" operation="store" event="return">
        <condition field-name="autoCreateKeywords" operator="not-equals" value="N"/>
        <action service="indexProductKeywords" mode="sync"/>
    </eca>
    <eca entity="GoodIdentification" operation="create-store" event="return">
        <action service="indexProductKeywords" mode="sync"/>
    </eca>
    <eca entity="ProductAttribute" operation="create-store" event="return">
        <action service="indexProductKeywords" mode="sync"/>
    </eca>
    <eca entity="ProductFeatureAppl" operation="create-store" event="return">
        <action service="indexProductKeywords" mode="sync"/>
    </eca>
    <eca entity="ProductContent" operation="create-store" event="return">
        <action service="indexProductKeywords" mode="sync"/>
    </eca>

    <!-- inventory related ECAs -->
    <eca entity="InventoryItem" operation="create-store" event="return">
        <condition field-name="productId" operator="is-not-empty"/>
        <condition field-name="availableToPromiseTotal" operator="is-not-empty"/>
        <condition field-name="availableToPromiseTotal" operator="less-equals" value="0" type="BigDecimal"/>
        <action service="checkProductInventoryDiscontinuation" mode="async"/>
    </eca>
    <!-- update the totals for serialized inventory items -->
    <eca entity="InventoryItem" operation="create-store" event="return">
        <action service="updateSerializedInventoryTotals" mode="sync"/>
    </eca>
    <!-- Just in case an InventoryItem is ever created with ATP/QOH values, catch and handle that -->
    <eca entity="InventoryItem" operation="create" event="return">
        <action service="createInventoryItemCheckSetAtpQoh" mode="sync"/>
    </eca>
    <!-- Create the initial status record -->
    <eca entity="InventoryItem" operation="create" event="return">
        <condition field-name="statusId" operator="is-not-empty"/>
        <action service="createInventoryItemStatus" mode="sync"/>
    </eca>
    <!-- The InventoryItemDetail entity should never be updated/stored or deleted/removed, but we'll catch those too anyway... -->
    <eca entity="InventoryItemDetail" operation="create-store-remove" event="return">
        <action service="updateInventoryItemFromDetail" mode="sync"/>
    </eca>
    <eca entity="InventoryItemDetail" operation="create-store-remove" event="return">
        <or>
            <condition field-name="availableToPromiseDiff" operator="not-equals" value="0" type="BigDecimal"/>
            <condition field-name="quantityOnHandDiff" operator="not-equals" value="0" type="BigDecimal"/>
        </or>
        <action service="setLastInventoryCount" mode="sync" value-attr="inventoryItemDetail"/><!-- SCIPIO: inventoryItemDetail -->
    </eca>
    <!-- If the Picklist status is Cancelled then cancel all the PicklistItems -->
    <eca entity="Picklist" operation="create-store" event="return">
        <condition field-name="statusId" operator="equals" value="PICKLIST_CANCELLED"/>
        <action service="cancelPicklistAndItems" mode="async"/>
    </eca>

    <!-- Product GroupOrder ECAs -->
    <eca entity="ProductGroupOrder" operation="create" event="return">
        <action service="createJobForProductGroupOrder" mode="sync"/>
    </eca>

    <eca entity="ProductImageOpRequest" operation="create" event="return">
        <set field-name="deleteReq" value="true"/>
        <action service="productImageOpRequest" mode="sync" value-attr="opReq"/>
    </eca>
</entity-eca>