Bug 24183

Summary: Introduce `before_send_messages` hook
Product: Koha Reporter: Martin Renvoize <martin.renvoize>
Component: Plugin architectureAssignee: Martin Renvoize <martin.renvoize>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: 1joynelson, katrin.fischer, kyle, lucas, nick
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This patch adds a new `plugin hook` to allow pre-processing of the message queue prior to sending messages.
Version(s) released in:
20.05.00, 19.11.06
Bug Depends on:    
Bug Blocks: 28221, 28474    
Attachments: Bug 24183: Add before_send_messages hook
Bug 24183: Add before_send_messages hook
Bug 24183: (RM follow-up) Remove re-introduced UseKohaPlugins

Description Martin Renvoize 2019-12-05 17:41:58 UTC
It would be beneficial to have a hook inside process_message_queue.pl to allow plugins the option of taking pre-processing actions on the messages in the message queue before they are sent.

An example of where this would be beneficial is the Recalls plugin, where currently one has take serverside actions to configure additional cronjobs as part of setting the plugin up.
Comment 1 Martin Renvoize 2019-12-05 17:45:55 UTC
Created attachment 96048 [details] [review]
Bug 24183: Add before_send_messages hook

This patch adds a simple hook to the process_message_queue cronjob
to allow plugins to pre-process messages in the messaging queue before
they are sent.
Comment 2 Katrin Fischer 2020-03-28 15:51:49 UTC
Can you add a test plan for this?
Comment 3 Martin Renvoize 2020-03-30 06:13:18 UTC
I'd forgotten I'd written this.. but it's still just as relevant now..

Good question on requiring a test plan.  Short of writing a plugin that utilizes it I'm really not sure how one can test this :( Ill try to come up with something.
Comment 4 Kyle M Hall 2020-03-30 10:58:10 UTC
Created attachment 102079 [details] [review]
Bug 24183: Add before_send_messages hook

This patch adds a simple hook to the process_message_queue cronjob
to allow plugins to pre-process messages in the messaging queue before
they are sent.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 5 Kyle M Hall 2020-03-30 10:59:32 UTC
Trivial and safe plugin hook implementation following the existing standard paradigm. Passing QA directly.
Comment 6 Katrin Fischer 2020-03-30 15:36:33 UTC
I am ok with this - little nudges work sometimes!
Comment 7 Martin Renvoize 2020-04-06 09:58:09 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 8 Martin Renvoize 2020-04-22 11:26:03 UTC
Created attachment 103463 [details] [review]
Bug 24183: (RM follow-up) Remove re-introduced UseKohaPlugins

We removed UseKohaPlugins in bug 20415 but incidentally added a
reference to it bug 24183. This patch corrects that error.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 9 Martin Renvoize 2020-04-22 11:26:20 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 10 Joy Nelson 2020-04-29 15:00:49 UTC
feature not backported to 19.11.x
Comment 11 Joy Nelson 2020-04-29 15:45:43 UTC
per request, backported to 19.11.x branch for 19.11.06
Comment 12 Katrin Fischer 2020-04-30 21:45:44 UTC
I've added documentation to https://wiki.koha-community.org/wiki/Koha_Plugin_Hooks#Implemented_hooks - can you please check if it's correct?
Comment 13 Martin Renvoize 2020-05-07 06:33:56 UTC
Perfect, thanks Katrin.
Comment 14 Lucas Gass 2020-05-11 20:55:05 UTC
New feature won't be backported to 19.05.x