Bugzilla – Attachment 173074 Details for
Bug 37869
Plugin hook before_send_messages not triggered for any messages sent without use of process_message_queue.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37869: Tidy code
Bug-37869-Tidy-code.patch (text/plain), 4.19 KB, created by
David Nind
on 2024-10-21 17:45:15 UTC
(
hide
)
Description:
Bug 37869: Tidy code
Filename:
MIME Type:
Creator:
David Nind
Created:
2024-10-21 17:45:15 UTC
Size:
4.19 KB
patch
obsolete
>From c507280b9e651969b7e5df837e74f4b1ea23ee0a Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 9 Sep 2024 10:32:52 -0400 >Subject: [PATCH] Bug 37869: Tidy code > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/Letters.pm | 5 +-- > misc/cronjobs/process_message_queue.pl | 59 +++++++++++++------------- > 2 files changed, 31 insertions(+), 33 deletions(-) > >diff --git a/C4/Letters.pm b/C4/Letters.pm >index 4fb28fdcce..ce8ffda7e1 100644 >--- a/C4/Letters.pm >+++ b/C4/Letters.pm >@@ -1027,11 +1027,10 @@ sub SendQueuedMessages { > }); > > if (@plugins) { >- foreach my $plugin ( @plugins ) { >+ foreach my $plugin (@plugins) { > try { > $plugin->before_send_messages($params); >- } >- catch { >+ } catch { > warn "$_"; > exit 1 if $params->{exit_on_plugin_failure}; > }; >diff --git a/misc/cronjobs/process_message_queue.pl b/misc/cronjobs/process_message_queue.pl >index 031b965fe4..ebaa7230f0 100755 >--- a/misc/cronjobs/process_message_queue.pl >+++ b/misc/cronjobs/process_message_queue.pl >@@ -21,34 +21,34 @@ use strict; > use warnings; > > use Koha::Script -cron; >-use C4::Letters qw( SendQueuedMessages ); >-use C4::Log qw( cronlogaction ); >+use C4::Letters qw( SendQueuedMessages ); >+use C4::Log qw( cronlogaction ); > use Getopt::Long qw( GetOptions ); >-use Try::Tiny qw( catch try ); >+use Try::Tiny qw( catch try ); > > my $username = undef; > my $password = undef; > my $limit = undef; >-my $method = 'LOGIN'; >-my $help = 0; >-my $verbose = 0; >+my $method = 'LOGIN'; >+my $help = 0; >+my $verbose = 0; > my $where; > my @type; > my @letter_code; > my $exit_on_plugin_failure = 0; > >-my $command_line_options = join(" ",@ARGV); >+my $command_line_options = join( " ", @ARGV ); > > GetOptions( >- 'u|username:s' => \$username, >- 'p|password:s' => \$password, >- 'l|limit:s' => \$limit, >- 'm|method:s' => \$method, >- 'h|help|?' => \$help, >- 'v|verbose' => \$verbose, >- 't|type:s' => \@type, >- 'c|code:s' => \@letter_code, >- 'w|where:s' => \$where, >+ 'u|username:s' => \$username, >+ 'p|password:s' => \$password, >+ 'l|limit:s' => \$limit, >+ 'm|method:s' => \$method, >+ 'h|help|?' => \$help, >+ 'v|verbose' => \$verbose, >+ 't|type:s' => \@type, >+ 'c|code:s' => \@letter_code, >+ 'w|where:s' => \$where, > 'e|exit-on-plugin-failure' => \$exit_on_plugin_failure, > ); > my $usage = << 'ENDUSAGE'; >@@ -74,36 +74,35 @@ ENDUSAGE > > die $usage if $help; > >-my $script_handler = Koha::Script->new({ script => $0 }); >+my $script_handler = Koha::Script->new( { script => $0 } ); > > try { > $script_handler->lock_exec; >-} >-catch { >+} catch { > my $message = "Skipping execution of $0 ($_)"; > print STDERR "$message\n" > if $verbose; >- cronlogaction({ info => $message }); >+ cronlogaction( { info => $message } ); > exit; > }; > >-cronlogaction({ info => $command_line_options }); >+cronlogaction( { info => $command_line_options } ); > > # Remove empty elements, see bug 37075 > @letter_code = grep { $_ ne q{} } @letter_code; > > C4::Letters::SendQueuedMessages( > { >- verbose => $verbose, >- username => $username, >- password => $password, >- method => $method, >- limit => $limit, >- type => \@type, >- letter_code => \@letter_code, >- where => $where, >+ verbose => $verbose, >+ username => $username, >+ password => $password, >+ method => $method, >+ limit => $limit, >+ type => \@type, >+ letter_code => \@letter_code, >+ where => $where, > exit_on_plugin_failure => $exit_on_plugin_failure, > } > ); > >-cronlogaction({ action => 'End', info => "COMPLETED" }); >+cronlogaction( { action => 'End', info => "COMPLETED" } ); >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37869
:
171217
|
171218
|
172323
|
172324
|
172325
|
173072
|
173073
|
173074
|
173429
|
173430
|
173431