Bugzilla – Attachment 188344 Details for
Bug 13811
Add verbose option borrowers-force-messaging-defaults
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13811: Add verbose option and logging to borrowers-force-messaging-defaults script
Bug-13811-Add-verbose-option-and-logging-to-borrow.patch (text/plain), 3.07 KB, created by
Nick Clemens (kidclamp)
on 2025-10-23 12:07:19 UTC
(
hide
)
Description:
Bug 13811: Add verbose option and logging to borrowers-force-messaging-defaults script
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2025-10-23 12:07:19 UTC
Size:
3.07 KB
patch
obsolete
>From 5b6fc65e566fb7dd9c52acdad102ed5460738549 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 23 Oct 2025 11:45:51 +0000 >Subject: [PATCH] Bug 13811: Add verbose option and logging to > borrowers-force-messaging-defaults script > >--- > .../borrowers-force-messaging-defaults.pl | 26 ++++++++++++++++--- > 1 file changed, 22 insertions(+), 4 deletions(-) > >diff --git a/misc/maintenance/borrowers-force-messaging-defaults.pl b/misc/maintenance/borrowers-force-messaging-defaults.pl >index fcaf3feb8c5..5a65d9ed7d6 100755 >--- a/misc/maintenance/borrowers-force-messaging-defaults.pl >+++ b/misc/maintenance/borrowers-force-messaging-defaults.pl >@@ -22,6 +22,7 @@ use warnings; > > use Koha::Script; > use C4::Context; >+use C4::Log qw(cronlogaction); > use C4::Members::Messaging; > use Getopt::Long qw( GetOptions ); > use Pod::Usage qw( pod2usage ); >@@ -32,9 +33,10 @@ sub usage { > } > > sub force_borrower_messaging_defaults { >- my ( $doit, $since, $not_expired, $no_overwrite, $category, $branchcode, $message_name ) = @_; >+ my ( $doit, $since, $not_expired, $no_overwrite, $category, $branchcode, $message_name, $verbose ) = @_; > > print "Since: $since\n" if $since; >+ my $update_statement = $doit ? "Updating" : "Would have updated"; > > my $dbh = C4::Context->dbh; > $dbh->{AutoCommit} = 0; >@@ -58,7 +60,7 @@ WHERE 1|; > $sth->execute( $since || (), $category || (), $branchcode || () ); > my $cnt = 0; > while ( my ( $borrowernumber, $categorycode ) = $sth->fetchrow ) { >- print "$borrowernumber: $categorycode\n"; >+ print "$update_statement borrowernumber: $borrowernumber : category ($categorycode)\n" if $verbose; > next unless $doit; > my $options = { > borrowernumber => $borrowernumber, >@@ -72,7 +74,7 @@ WHERE 1|; > print "Total borrowers updated: $cnt\n" if $doit; > } > >-my ( $doit, $since, $help, $not_expired, $no_overwrite, $category, $branchcode, $message_name ); >+my ( $doit, $since, $help, $not_expired, $no_overwrite, $category, $branchcode, $message_name, $verbose ); > my $result = GetOptions( > 'doit' => \$doit, > 'since:s' => \$since, >@@ -82,11 +84,23 @@ my $result = GetOptions( > 'library:s' => \$branchcode, > 'message-name:s' => \$message_name, > 'help|h' => \$help, >+ 'verbose|v+' => \$verbose, > ); > >+my $command_line_options = join( " ", @ARGV ); >+ >+if ($doit) { >+ cronlogaction( { action => 'Run', info => $command_line_options } ); >+} else { >+ print "Running in dry-run mode, provide --doit to apply the changes\n"; >+} >+ > usage() if $help; > >-force_borrower_messaging_defaults( $doit, $since, $not_expired, $no_overwrite, $category, $branchcode, $message_name ); >+force_borrower_messaging_defaults( >+ $doit, $since, $not_expired, $no_overwrite, $category, $branchcode, $message_name, >+ $verbose >+); > > =head1 NAME > >@@ -120,6 +134,10 @@ use the options -not-expired or -no-overwrite to update a subset). > > Prints this help > >+=item B<--verbose> >+ >+Report on borrowers that will be updated >+ > =item B<--doit> > > Actually update the borrowers. >-- >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 13811
:
36749
|
36750
| 188344 |
188345
|
188346