Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-4501

Incorrect use of eca for create/updateShipment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Abandoned
    • Release Branch 11.04, Trunk, Upcoming Branch
    • None
    • product
    • None
    • Bug Crush Event - 21/2/2015

    Description

      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>
      

      Attachments

        1. OFBIZ-4501-ModifiedCreateUpdateShipmentService.patch
          27 kB
          Kiran Gawde
        2. OFBIZ-4501-ShipmentServiceXml.patch
          22 kB
          Kiran Gawde
        3. OFBIZ-4501-ModifiedCreateUpdateShipmentService.patch
          5 kB
          Kiran Gawde
        4. OFBIZ-4501-ShipmentServiceXml.patch
          22 kB
          Kiran Gawde
        5. OFBIZ-4501-ShipmentServiceXml.patch
          23 kB
          Kiran Gawde

        Activity

          People

            jleroux Jacques Le Roux
            kiran_gawde Kiran Gawde
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: