[ 
https://issues.apache.org/jira/browse/OFBIZ-3847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15281131#comment-15281131
 ] 

Paul Foxworthy commented on OFBIZ-3847:
---------------------------------------

Hi Gareth,

Thanks for your reporting this.

Even on a remove, the ECA should be able to look at the value being removed, so 
I wonder if the problem is that the caller isn't supplying a value when it 
should be. I'll look into that.

There is a general issue here that needs attention.

But in your specific example, doesn't InventoryItemDetail record changes in 
inventory numbers? So if you want to modify the availableToPromise for an 
InventoryItem, you would create a new InventoryItemDetail to record the fact 
that the change occurred. In other words, it should be rare to remove an 
InventoryItemDetail. If you ever do need to do it, it's probably to recover 
from some error in inventory tracking, and you don't necessarily want to 
automatically update the availableToPromise in the InventoryItem. If I'm right, 
you could change the operation to "create" only, and that would avoid the 
problem.

In general in OFBiz, things are expired rather than removed, so a remove ECA 
would be rare. I guess that's why this problem has been undetected all this 
time.

I'll investigate more during the next couple of days.

Thanks again

Paul Foxworthy

> Entity ECAs not triggered correctly when using Delegator.storeAll() method
> --------------------------------------------------------------------------
>
>                 Key: OFBIZ-3847
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-3847
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release Branch 10.04
>            Reporter: Martin Kreidenweis
>            Assignee: Paul Foxworthy
>             Fix For: Upcoming Branch
>
>         Attachments: GenericDelegator.java.diff, 
> OFBIZ-3847_Entity-ECAs-not-triggered-correctly.patch, 
> OFBIZ-3847_Entity-ECAs-not-triggered-correctly.patch
>
>
> The conditions don't work when updating (not creating) entities using the 
> Delegator.storeAll() method. E.g. the following condition does not work:
> {code}
> <eca entity="Product" operation="create-store" event="return">
>         <condition field-name="autoCreateKeywords" operator="not-equals" 
> value="N"/>
>         <action service="indexProductKeywords" mode="sync" 
> value-attr="productInstance"/>
> </eca>
> {code}
> The indexProductKeywords service is called anyway when the product is updated 
> and the autoCreateKeywords was "N" and stays "N". It works correctly for 
> newly created products. 
> The problem is in the method GenericDelegator.storeAll(), where unchanged 
> field values are not passed down to the store() method. The store method 
> calls the ECA engine, which does not receive the unchanged values at all and 
> thus cannot evaluate the EECA conditions correctly. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to