You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Kiran Gawde (Commented) (JIRA)" <ji...@apache.org> on 2011/11/03 06:37:32 UTC

[jira] [Commented] (OFBIZ-4501) Incorrect use of eca for create/updateShipment

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

Kiran Gawde commented on OFBIZ-4501:
------------------------------------

Hello Friends, 

Any ETA on getting this integrated on 11.04 branch? I already have this fix in my vendor branch, so I am not dependent. But in case, there are any questions or suggestions, I can alter the code while the change is fresh in mind. Also, it would avoid future merge issues.

Cheers,
Kiran
                
> Incorrect use of eca for create/updateShipment
> ----------------------------------------------
>
>                 Key: OFBIZ-4501
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4501
>             Project: OFBiz
>          Issue Type: Bug
>          Components: product
>    Affects Versions: Release Branch 11.04, SVN trunk
>            Reporter: Kiran Gawde
>         Attachments: OFBIZ-4501-ModifiedCreateUpdateShipmentService.patch, OFBIZ-4501-ModifiedCreateUpdateShipmentService.patch, OFBIZ-4501-ShipmentServiceXml.patch, OFBIZ-4501-ShipmentServiceXml.patch, OFBIZ-4501-ShipmentServiceXml.patch
>
>
> createShipment service doesn't populate the facility and order info into shipment. Instead it is handled by eca rules. This is wrong. ECA rules should be used to update other objects or cause other actions and not update the object that is being committed. This makes it difficult to traverse the code. Can also cause bugs that are difficult troubleshoot. e.g: In this case, facilities are populated in shipment by method setShipmentSettingsFromPrimaryOrder, but eca rule checking for originFacilityId gets executed before it is populated. Following eca rules should be removed and instead the code should be added to create/updateshipment methods.
>     <!-- 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>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira