Commit ed449a9
committed
Fix setState() silent failure causing state/status desynchronization
When setState() cannot find a matching state in the $possibleStates
array (from STATE_TRANSITION_MATRIX), it now falls back to a direct
lookup in sales_order_status_state for the given status, preferring
the default state mapping. This prevents the order state from being
permanently stuck at its previous value (typically pending_payment)
while the status advances through the order lifecycle.
The fallback query uses addOrder('is_default', 'DESC') to prefer
the default state when a status maps to multiple states, and
setPageSize(1) to limit the SQL query at the database level.
Uses getOrderContext() for consistent logging with the rest of the
module.
Fixes #32881 parent 11cda6a commit ed449a9
1 file changed
Lines changed: 28 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
| 496 | + | |
| 497 | + | |
497 | 498 | | |
498 | 499 | | |
499 | 500 | | |
500 | 501 | | |
501 | 502 | | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
502 | 529 | | |
503 | 530 | | |
504 | 531 | | |
| |||
0 commit comments