[Bug 43804] New: Add after_edifact_action plugin hook for processed EDIFACT messages
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43804 Bug ID: 43804 Summary: Add after_edifact_action plugin hook for processed EDIFACT messages Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Target Milestone: --- Koha has plugin hooks around bibliographic, item, hold, circulation and account actions, but nothing that lets a plugin react once an EDIFACT message has been processed. Plugins can currently only take over invoice processing (edifact_process_invoice) or alter order sending (edifact_order). Plugins that need to act after a QUOTE, INVOICE or ORDRSP has been processed have to poll edifact_messages for new or recently changed rows. That is racy against the next edi_cron.pl run, and it does not work for invoices processed manually from the staff interface. Typical uses: finance reconciliation, exporting to external systems, alerting, extracting data Koha does not handle itself (e.g. invoice service charges), and post-processing records created from a quote. This patch adds after_edifact_action, following the existing after_*_action pattern (after_biblio_action, after_item_action, ...): after_edifact_action( { action => 'process', payload => { message => $row, message_id => $id, message_type => 'QUOTE' | 'INVOICE' | 'ORDRSP', }, } ) It is called from process_quote, process_invoice and process_ordrsp in Koha::EDI once processing has finished, so it fires for both edi_cron.pl and manual processing. For quotes it fires after any auto-orders are created. For invoices it also fires when a vendor plugin processes the invoice itself via edifact_process_invoice. Test plan: 1. Apply the patch 2. prove t/db_dependent/Koha/Plugins/Edifact_hooks.t => Tests pass 3. Revert the Koha/EDI.pm change and run the test again => It fails 4. prove t/db_dependent/Koha/EDI.t => Tests pass -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43804 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 207939 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=207939&action=edit Bug 43804: Add after_edifact_action plugin hook Add an after_edifact_action hook, fired once an EDIFACT message (QUOTE, INVOICE or ORDRSP) has been processed. It follows the existing after_*_action convention (after_biblio_action, after_item_action, ...): after_edifact_action( { action => 'process', payload => { message, message_id, message_type }, } ) The hook is fired from Koha::EDI::process_quote, process_invoice and process_ordrsp rather than from edi_cron.pl, so it also covers invoices processed manually from the staff interface and does not depend on how the messages were triggered. For quotes it fires after any auto-orders have been created, and for invoices it also fires when a vendor plugin handles the invoice via edifact_process_invoice. This lets plugins run post-EDI workflows (finance reconciliation, exports, alerting, adjusting records created from a quote) against the exact message that was processed without re-querying for 'new' messages. Test plan: 1. Apply the patch 2. prove t/db_dependent/Koha/Plugins/Edifact_hooks.t 3. Confirm the test fails without the Koha/EDI.pm change 4. prove t/db_dependent/Koha/EDI.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43804 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43804 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |kyle@bywatersolutions.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43804 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Initiative type|--- |Feature -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43804 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |41852 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41852 [Bug 41852] Modernize EDI support in Koha -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43804 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |41087 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41087 [Bug 41087] EDI Retry: Add Rollback and Reprocess actions for EDIFACT messages -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org