It would be useful to send most of the process_message_queue.pl script parameters to any plugin before_send_messages hooks. For example, the Twilio Voice plugin uses before_send_messages to send phone messages, but if the script is called with "-t email", it doesn't know and will make phone calls! If that info were passed in, the plugin could be made aware of it and only make calls if no "-t" or a "-t phone" were set in the parameters.
Created attachment 121452 [details] [review] Bug 28474: Pass process_message_queue.pl params to before_send_messages plugin hooks It would be useful to send most of the process_message_queue.pl script parameters to any plugin before_send_messages hooks. For example, the Twilio Voice plugin uses before_send_messages to send phone messages, but if the script is called with "-t email", it doesn't know and will make phone calls! If that info were passed in, the plugin could be made aware of it and only make calls if no "-t" or a "-t phone" were set in the parameters. Test Plan: 1) Apply this patch 2) Install Kitchen Sink plugin v2.2.0 or later https://github.com/bywatersolutions/dev-koha-plugin-kitchen-sink/releases/download/v2.2.0/dev-koha-plugin-kitchen-sink-2.2.0.kpz 3) Run misc/cronjobs/process_message_queue.pl with any or all non-email related paramters 4) Note the plugin output shows the parameters were passed to the plugin
Created attachment 126090 [details] [review] Bug 28474: Pass process_message_queue.pl params to before_send_messages plugin hooks It would be useful to send most of the process_message_queue.pl script parameters to any plugin before_send_messages hooks. For example, the Twilio Voice plugin uses before_send_messages to send phone messages, but if the script is called with "-t email", it doesn't know and will make phone calls! If that info were passed in, the plugin could be made aware of it and only make calls if no "-t" or a "-t phone" were set in the parameters. Test Plan: 1) Apply this patch 2) Install Kitchen Sink plugin v2.2.0 or later https://github.com/bywatersolutions/dev-koha-plugin-kitchen-sink/releases/download/v2.2.0/dev-koha-plugin-kitchen-sink-2.2.0.kpz 3) Run misc/cronjobs/process_message_queue.pl with any or all non-email related paramters 4) Note the plugin output shows the parameters were passed to the plugin Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
I got a little stuck here. I activated plugins and installed the kitchensink plugin from the link below. But I am not sure about the parameters to run the misc/cronjobs/process_message_queue.pl with and where in the plugin the output would show. If I click on "Run report" from the plugin management screen, the plugin dies: The method Koha::Patron::Categories->search_limited is not covered by tests! Run tool appears to work. Sending back to Kyle for clarification.
(In reply to Katrin Fischer from comment #3) > I got a little stuck here. > > I activated plugins and installed the kitchensink plugin from the link below. > > But I am not sure about the parameters to run the > misc/cronjobs/process_message_queue.pl with and where in the plugin the > output would show. > > If I click on "Run report" from the plugin management screen, the plugin > dies: > The method Koha::Patron::Categories->search_limited is not covered by tests! > > Run tool appears to work. > > Sending back to Kyle for clarification. Pass something parameter like "-t email" and you should see it in the plugin output. That error on the report side shouldn't affect it, but I'll take a look at that too!
> > Pass something parameter like "-t email" and you should see it in the plugin > output. That error on the report side shouldn't affect it, but I'll take a > look at that too! Sorry... what and where is the plugin output?
(In reply to Katrin Fischer from comment #5) > > > > Pass something parameter like "-t email" and you should see it in the plugin > > output. That error on the report side shouldn't affect it, but I'll take a > > look at that too! > > Sorry... what and where is the plugin output? if you run something like "./misc/cronjobs/process_message_queue.pl -t email" you should see some output from the script like: Plugin hook before_send_message called with the params: $VAR1 = { 'limit' => undef, 'letter_code' => undef, 'verbose' => undef, 'type' => 'email' }; on the command line
Created attachment 127199 [details] [review] Bug 28474: Pass process_message_queue.pl params to before_send_messages plugin hooks It would be useful to send most of the process_message_queue.pl script parameters to any plugin before_send_messages hooks. For example, the Twilio Voice plugin uses before_send_messages to send phone messages, but if the script is called with "-t email", it doesn't know and will make phone calls! If that info were passed in, the plugin could be made aware of it and only make calls if no "-t" or a "-t phone" were set in the parameters. Test Plan: 1) Apply this patch 2) Install Kitchen Sink plugin v2.2.0 or later https://github.com/bywatersolutions/dev-koha-plugin-kitchen-sink/releases/download/v2.2.0/dev-koha-plugin-kitchen-sink-2.2.0.kpz 3) Run misc/cronjobs/process_message_queue.pl with any or all non-email related paramters 4) Note the plugin output shows the parameters were passed to the plugin Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to master for 21.11, thanks to everybody involved!
Pushed to 21.05.x for 21.05.05
Backported for plugins compatibility.
Pushed to 20.11.x for 20.11.12 (Backported for plugins compatibility)
Not backported to oldoldstable (20.05.x). Feel free to ask if it's needed.