Bug 24183 - Introduce `before_send_messages` hook
Summary: Introduce `before_send_messages` hook
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Plugin architecture (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Martin Renvoize (ashimema)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 28221 28474
  Show dependency treegraph
 
Reported: 2019-12-05 17:41 UTC by Martin Renvoize (ashimema)
Modified: 2021-11-11 01:50 UTC (History)
4 users (show)

See Also:
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
Circulation function:


Attachments
Bug 24183: Add before_send_messages hook (1.44 KB, patch)
2019-12-05 17:45 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 24183: Add before_send_messages hook (1.32 KB, patch)
2020-03-30 10:58 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 24183: (RM follow-up) Remove re-introduced UseKohaPlugins (1.04 KB, patch)
2020-04-22 11:26 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 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 (ashimema) 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 (ashimema) 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 (khall) 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 (khall) 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 (ashimema) 2020-04-06 09:58:09 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 8 Martin Renvoize (ashimema) 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 (ashimema) 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 (ashimema) 2020-05-07 06:33:56 UTC
Perfect, thanks Katrin.
Comment 14 Lucas Gass (lukeg) 2020-05-11 20:55:05 UTC
New feature won't be backported to 19.05.x