Bugzilla – Attachment 182156 Details for
Bug 30301
Add an option to specify the patron expiration notices as mandatory by patron category
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30301: Revert "Bug 32216: Add print notices to membership_expiry.pl"
Bug-30301-Revert-Bug-32216-Add-print-notices-to-me.patch (text/plain), 7.60 KB, created by
Matt Blenkinsop
on 2025-05-09 07:40:47 UTC
(
hide
)
Description:
Bug 30301: Revert "Bug 32216: Add print notices to membership_expiry.pl"
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2025-05-09 07:40:47 UTC
Size:
7.60 KB
patch
obsolete
>From 36ca318e3672fd9696df3ef12884dd971045cb87 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> >Date: Thu, 17 Apr 2025 15:37:20 +0100 >Subject: [PATCH] Bug 30301: Revert "Bug 32216: Add print notices to > membership_expiry.pl" > >This reverts commit 3040f46d5efc73454e6a1558891a65ae8b0ea2c0. > >Bug 30300 adds a patron messaging preference for the expiration notice and abstracts this logic into queue_notice >Bug 32216 removes this call to enable print notice functionality but this would be handled already by queue_notice based on the patron's messaging preferences >--- > misc/cronjobs/membership_expiry.pl | 130 ++++++----------------------- > 1 file changed, 26 insertions(+), 104 deletions(-) > >diff --git a/misc/cronjobs/membership_expiry.pl b/misc/cronjobs/membership_expiry.pl >index f1591413f41..89cbf868a35 100755 >--- a/misc/cronjobs/membership_expiry.pl >+++ b/misc/cronjobs/membership_expiry.pl >@@ -24,7 +24,7 @@ membership_expiry.pl - cron script to put membership expiry reminders into the m > > =head1 SYNOPSIS > >-./membership_expiry.pl -c [-v] [-n] [-p] [-branch CODE] [-before DAYS] [-after DAYS] [-where COND] [-renew] [-letter X] [-letter-renew Y] [-active|-inactive] >+./membership_expiry.pl -c [-v] [-n] [-branch CODE] [-before DAYS] [-after DAYS] [-where COND] [-renew] [-letter X] [-letter-renew Y] [-active|-inactive] > > or, in crontab: > >@@ -54,14 +54,9 @@ Verbose. Without this flag set, only fatal errors are reported. > > =item B<-n> > >-Do not send any notices. Membership expire notices that would have been sent to >+Do not send any email. Membership expire notices that would have been sent to > the patrons are printed to standard out. > >-=item B<-p> >- >-Force the generation of print notices, even if the borrower has an email address. >-Note that this flag cannot be used in combination with -n >- > =item B<-c> > > Confirm flag: Add this option. The script will only print a usage >@@ -137,10 +132,6 @@ In the event that the C<-n> flag is passed to this program, no emails > are sent. Instead, messages are sent on standard output from this > program. > >-When using the C<-p> flag, print notices are generated regardless of whether or >-not the borrower has an email address. This can be useful for libraries that >-prefer to deal with print notices. >- > Notices can contain variables enclosed in double angle brackets like > <<this>>. Those variables will be replaced with values > specific to the soon expiring members. >@@ -174,7 +165,6 @@ use Koha::Patrons; > # These are defaults for command line options. > my $confirm; # -c: Confirm that the user has read and configured this script. > my $nomail; # -n: No mail. Will not send any emails. >-my $forceprint; # -p: Force print notices, even if email is found > my $verbose = 0; # -v: verbose > my $help = 0; > my $man = 0; >@@ -196,7 +186,6 @@ GetOptions( > 'man' => \$man, > 'c' => \$confirm, > 'n' => \$nomail, >- 'p' => \$forceprint, > 'v' => \$verbose, > 'branch:s' => \$branch, > 'before:i' => \$before, >@@ -266,111 +255,44 @@ warn 'found ' . $upcoming_mem_expires->count . ' soon expiring members' > > # main loop > my ( $count_skipped, $count_renewed, $count_enqueued ) = ( 0, 0, 0 ); >-while ( my $recent = $upcoming_mem_expires->next ) { >- my $patron = Koha::Patrons->find( $recent->borrowernumber ); >- my $user_email = $patron->notice_email_address; >- my $from_address = $patron->library->from_email_address; >- >- if ( $active && !$patron->is_active( { months => $active } ) ) { >+while ( my $expiring_patron = $upcoming_mem_expires->next ) { >+ if ( $active && !$expiring_patron->is_active( { months => $active } ) ) { > $count_skipped++; > next; >- } elsif ( $inactive && $patron->is_active( { months => $inactive } ) ) { >+ } elsif ( $inactive && $expiring_patron->is_active( { months => $inactive } ) ) { > $count_skipped++; > next; > } > > my $which_notice; > if ($renew) { >- $patron->renew_account; >+ $expiring_patron->renew_account; > $which_notice = $letter_renew; > $count_renewed++; > } else { > $which_notice = $letter_expiry; > } > >- if ($user_email) { >- my $email_letter = C4::Letters::GetPreparedLetter( >- module => 'members', >- letter_code => $which_notice, >- branchcode => $patron->branchcode, >- lang => $patron->lang, >- tables => { >- borrowers => $patron->borrowernumber, >- branches => $patron->branchcode, >- }, >- message_transport_type => 'email', >- ); >- >- if ($nomail) { >- print $email_letter->{'content'} . "\n"; >- next; >- } >- >- if ($email_letter) { >- C4::Letters::EnqueueLetter( >- { >- letter => $email_letter, >- borrowernumber => $patron->borrowernumber, >- from_address => $from_address, >- message_transport_type => 'email', >- } >- ); >- } >- } >- >- if ( !$user_email || $forceprint ) { >- my $print_letter = C4::Letters::GetPreparedLetter( >- module => 'members', >- letter_code => $which_notice, >- branchcode => $patron->branchcode, >- lang => $patron->lang, >- tables => { >- borrowers => $patron->borrowernumber, >- branches => $patron->branchcode, >- }, >- message_transport_type => 'print', >- ); >- >- if ($nomail) { >- print $print_letter->{'content'} . "\n"; >- next; >- } >- >- if ($print_letter) { >- C4::Letters::EnqueueLetter( >- { >- letter => $print_letter, >- borrowernumber => $patron->borrowernumber, >- message_transport_type => 'print', >- } >- ); >- } >- } >- >- $count_enqueued++; >- >- if ( $patron->smsalertnumber ) { >- my $sms_letter = C4::Letters::GetPreparedLetter( >- module => 'members', >- letter_code => $which_notice, >- branchcode => $patron->branchcode, >- lang => $patron->lang, >- tables => { >- borrowers => $patron->borrowernumber, >- branches => $patron->branchcode, >- }, >- message_transport_type => 'sms', >- ); >- if ($sms_letter) { >- C4::Letters::EnqueueLetter( >- { >- letter => $sms_letter, >- borrowernumber => $patron->borrowernumber, >- message_transport_type => 'sms', >- } >- ); >- } >- } >+ my $from_address = $expiring_patron->library->from_email_address; >+ my $letter_params = { >+ module => 'members', >+ letter_code => $which_notice, >+ branchcode => $expiring_patron->branchcode, >+ lang => $expiring_patron->lang, >+ borrowernumber => $expiring_patron->borrowernumber, >+ tables => { >+ borrowers => $expiring_patron->borrowernumber, >+ branches => $expiring_patron->branchcode, >+ }, >+ }; >+ >+ my $sending_params = { >+ letter_params => $letter_params, >+ message_name => 'Patron_Expiry', >+ }; >+ >+ my $result = $expiring_patron->queue_notice($sending_params); >+ $count_enqueued++ if $result->{sent}; > } > > if ($verbose) { >-- >2.48.1
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 30301
:
175086
|
175087
|
175088
|
175089
|
175526
|
175527
|
175528
|
175529
|
181102
|
181103
|
181104
|
181105
|
181106
|
181107
|
181108
|
182152
|
182153
|
182154
|
182155
|
182156
|
182157
|
182158
|
182527
|
182529
|
182530
|
182531
|
182532
|
182533
|
182534
|
182535
|
182536
|
182537
|
182538