Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
We are currently applying blindly shipment transitions, without actually checking whether the transition we're applying is "allowed".
Following the fix from #3083407: Fire intended events when invoking a specific transition, if a transition was previously not allowed, the state was updated, but the event was skipped.
Perhaps the right fix should live in State machine that should ensure only allowed transitions are applied, but in the meantime, it still doesn't hurt for commerce_shipping to properly check that as well.
Comment | File | Size | Author |
---|---|---|---|
#4 | 3083407-4.patch | 3.81 KB | jsacksick |
#2 | 3219843-2.patch | 3.24 KB | jsacksick |
Comments
Comment #2
jsacksick CreditAttribution: jsacksick at Centarro commentedThere's an OrderWorkflowTest, that currently tests the interaction between order and shipping workflows.
We should probably expand the tests there, but at least the tests should still ensure that the expected transition is applied.
Comment #4
jsacksick CreditAttribution: jsacksick at Centarro commented$shipment->getState()->getTransitions() already returns the list of allowed transitions, so there's no need to make the more complex than it should be...
Tests failures are unrelated, will open another issue for that.
Comment #6
jsacksick CreditAttribution: jsacksick at Centarro commentedCommitted!