Bugzilla – Attachment 134984 Details for
Bug 30751
Print autorenewal notice to console when running in verbose.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30751: Add notice printing to automatic_renewals.pl
Bug-30751-Add-notice-printing-to-automaticrenewals.patch (text/plain), 4.95 KB, created by
Lucas Gass (lukeg)
on 2022-05-13 16:53:39 UTC
(
hide
)
Description:
Bug 30751: Add notice printing to automatic_renewals.pl
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2022-05-13 16:53:39 UTC
Size:
4.95 KB
patch
obsolete
>From 24ae1e02e9f86fa5c9c58e43917be37cbb9b1ff3 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 13 May 2022 16:15:33 +0100 >Subject: [PATCH] Bug 30751: Add notice printing to automatic_renewals.pl > >This patch adds notice preview to the automatic_renewals.pl script. > >Test plan >1) Setup automtic renewals and add some checkouts with autorenewal > enabled >2) Run the automatic_renewals.pl script with verbose mode. (without > confirm if your testing and don't want to actually send notice or > perform the renewals) >3) Confirm that you no get notices printed at the end of the output > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > misc/cronjobs/automatic_renewals.pl | 89 +++++++++++++++++++---------- > 1 file changed, 60 insertions(+), 29 deletions(-) > >diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl >index 1af18c70f5..6a594ed148 100755 >--- a/misc/cronjobs/automatic_renewals.pl >+++ b/misc/cronjobs/automatic_renewals.pl >@@ -215,7 +215,7 @@ while ( my $auto_renew = $auto_renews->next ) { > > } > >-if ( $send_notices && $confirm ) { >+if ( $send_notices && ( $confirm || $verbose ) ) { > for my $borrowernumber ( keys %report ) { > my $patron = Koha::Patrons->find($borrowernumber); > for my $issue ( @{ $report{$borrowernumber} } ) { >@@ -232,32 +232,52 @@ if ( $send_notices && $confirm ) { > lang => $patron->lang, > ); > >- my $library = Koha::Libraries->find( $patron->branchcode ); >- my $admin_email_address = $library->from_email_address; >+ if ($verbose) { >+ say "Would send the following notice to borrowernumber: " >+ . $patron->borrowernumber; > >- C4::Letters::EnqueueLetter( >- { letter => $letter, >- borrowernumber => $borrowernumber, >- message_transport_type => 'email', >- from_address => $admin_email_address, >- } >- ); >+ print $letter->{content}; >+ } >+ >+ if ($confirm) { >+ my $library = Koha::Libraries->find( $patron->branchcode ); >+ my $admin_email_address = $library->from_email_address; >+ >+ C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $borrowernumber, >+ message_transport_type => 'email', >+ from_address => $admin_email_address, >+ } >+ ); >+ } > } > } > > if ($digest_per_branch) { >- while (my ($branchcode, $digests) = each %$renew_digest) { >- send_digests({ >- digests => $digests, >- branchcode => $branchcode, >- letter_code => 'AUTO_RENEWALS_DGST', >- }); >+ while ( my ( $branchcode, $digests ) = each %$renew_digest ) { >+ send_digests( >+ { >+ digests => $digests, >+ branchcode => $branchcode, >+ letter_code => 'AUTO_RENEWALS_DGST', >+ confirm => $confirm, >+ verbose => $verbose >+ } >+ ); > } >- } else { >- send_digests({ >- digests => $renew_digest, >- letter_code => 'AUTO_RENEWALS_DGST', >- }); >+ } >+ else { >+ send_digests( >+ { >+ digests => $renew_digest, >+ letter_code => 'AUTO_RENEWALS_DGST', >+ confirm => $confirm, >+ verbose => $verbose >+ >+ } >+ ); > } > } > >@@ -331,14 +351,25 @@ sub send_digests { > ); > > if ($letter) { >- C4::Letters::EnqueueLetter( >- { >- letter => $letter, >- borrowernumber => $borrowernumber, >- from_address => $from_address, >- message_transport_type => $transport >- } >- ); >+ >+ if ($params->{verbose}) { >+ say "Would send the following digest notice to borrowernumber: " >+ . $patron->borrowernumber; >+ >+ print $letter->{content}; >+ } >+ >+ if ($params->{confirm}) { >+ >+ C4::Letters::EnqueueLetter( >+ { >+ letter => $letter, >+ borrowernumber => $borrowernumber, >+ from_address => $from_address, >+ message_transport_type => $transport >+ } >+ ); >+ } > } > else { > warn >-- >2.30.2
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 30751
:
134980
| 134984