fix(events): OrderFinalizeService вызывает зарегистрированные msOnBeforeMgrCreateOrder / msOnMgrCreateOrder#217
Open
fix(events): OrderFinalizeService вызывает зарегистрированные msOnBeforeMgrCreateOrder / msOnMgrCreateOrder#217
Conversation
…rder for finalize
OrderFinalizeService invoked msOnBeforeFinalizeOrder and msOnFinalizeOrder —
names that were never registered in _build/elements/events.php. Plugins couldn't
subscribe through the MODX UI because no modEvent rows existed for them.
Meanwhile the builder registers msOnBeforeMgrCreateOrder and msOnMgrCreateOrder
(intended as sibling of msOnSubmitOrder for the manager flow) that were never
fired. Point the service at those — no builder changes, plugins can attach
through the stock MODX Plugins → System events UI. Comments above each invoke
spell out that 'manager create' here means finalizing a draft into a real order.
Scope: finalize is called only from POST /api/mgr/orders/{id}/finalize
(manager route, msorder_save permission). No frontend/Web API caller exists —
grep over core/ and assets/ confirms.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OrderFinalizeServiceвызывалmsOnBeforeFinalizeOrderиmsOnFinalizeOrder— имена, которых не существует в_build/elements/events.php. После install/upgrade ни одногоmodEventс такими именами в системе не появлялось — подписать плагин через UI MODX было нельзя.Параллельно в билдере уже зарегистрированы подходящие по семантике
msOnBeforeMgrCreateOrderиmsOnMgrCreateOrder, но они нигде не вызывались.Что сделано
В
OrderFinalizeServiceзаменил дваinvokeEvent:msOnBeforeFinalizeOrdermsOnBeforeMgrCreateOrdermsOnFinalizeOrdermsOnMgrCreateOrderДобавил комментарии, что «manager create» здесь означает финализацию draft'а в готовый заказ (получает номер, меняется статус, уходят уведомления).
_build/elements/events.phpне трогается — имена в билдере сохраняются,Mgr-префикс однозначно указывает на админский флоу.Scope
OrderFinalizeService::finalize()вызывается только изPOST /api/mgr/orders/{id}/finalize(manager route, permissionmsorder_save). Никаких web-API или фронтовых путей — провереноgrep'ом поcore/иassets/.Test plan
msOnBeforeMgrCreateOrderиmsOnMgrCreateOrdermsOnBeforeMgrCreateOrder, выполнить finalize любого draft-заказа из админки — плагин должен сработатьmsOnMgrCreateOrder(срабатывает после смены статуса)