Bug 35148

Summary: before_send_messages plugin hook does not pass the --where option
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: Plugin architectureAssignee: Kyle M Hall (khall) <kyle>
Status: CLOSED FIXED QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, martin.renvoize
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.05,22.11.12
Circulation function:
Bug Depends on: 28474    
Bug Blocks:    
Attachments: Bug 35148: before_send_messages plugin hook does not pass the --where option
Bug 35148: before_send_messages plugin hook does not pass the --where option

Description Kyle M Hall (khall) 2023-10-25 13:34:23 UTC
The before_send_messages plugin hook currently sends all the non-smtp related options with the exception of the --where option. This should be added.
Comment 1 Kyle M Hall (khall) 2023-10-25 13:43:41 UTC
Created attachment 157801 [details] [review]
Bug 35148: before_send_messages plugin hook does not pass the --where option

The before_send_messages plugin hook currently sends all the non-smtp related options with the exception of the --where option. This should be added.

Test Plan:
1) Install the latest version of the kitchen sink plugin (
   https://github.com/bywatersolutions/dev-koha-plugin-kitchen-sink/releases
   )
2) Apply this patch
3) Run process_message_queue.pl with a --where option
4) Run the command: ./misc/cronjobs/process_message_queue.pl --where "letter_code='test'"
5) Note the output looks like:
Plugin hook before_send_message called with the params: $VAR1 = {
          'verbose' => 0,
          'where' => 'letter_code=\'test\'',
          'letter_code' => [],
          'type' => [],
          'limit' => undef
        };
Comment 2 Martin Renvoize (ashimema) 2023-10-25 13:55:58 UTC
Created attachment 157802 [details] [review]
Bug 35148: before_send_messages plugin hook does not pass the --where option

The before_send_messages plugin hook currently sends all the non-smtp related options with the exception of the --where option. This should be added.

Test Plan:
1) Install the latest version of the kitchen sink plugin (
   https://github.com/bywatersolutions/dev-koha-plugin-kitchen-sink/releases
   )
2) Apply this patch
3) Run process_message_queue.pl with a --where option
4) Run the command: ./misc/cronjobs/process_message_queue.pl --where "letter_code='test'"
5) Note the output looks like:
Plugin hook before_send_message called with the params: $VAR1 = {
          'verbose' => 0,
          'where' => 'letter_code=\'test\'',
          'letter_code' => [],
          'type' => [],
          'limit' => undef
        };

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Martin Renvoize (ashimema) 2023-10-25 13:57:05 UTC
This is a tiny chance and makes perfect sense.. Must admit, I expected to see the hook within C4::Letters::SendQueuedMessages as opposed to in the cron script... but that's nothing to do with this patch.

Going straight for a PQA :)
Comment 4 Tomás Cohen Arazi (tcohen) 2023-10-25 14:10:11 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 5 Fridolin Somers 2023-10-26 08:26:37 UTC
Pushed to 23.05.x for 23.05.05
Comment 6 Matt Blenkinsop 2023-11-13 15:11:42 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x