Bugzilla – Attachment 175529 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: Update cronjob to check for mandatory notice
Bug-30301-Update-cronjob-to-check-for-mandatory-no.patch (text/plain), 3.86 KB, created by
Andrew Fuerste-Henry
on 2024-12-16 16:40:35 UTC
(
hide
)
Description:
Bug 30301: Update cronjob to check for mandatory notice
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2024-12-16 16:40:35 UTC
Size:
3.86 KB
patch
obsolete
>From d23e3bb00de9bdae22e4c8564752cb6816ff3b80 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Tue, 3 Dec 2024 16:51:46 +0000 >Subject: [PATCH] Bug 30301: Update cronjob to check for mandatory notice > >The patches on this bug add the ability for staff members to set the patron expiry notice as mandatory at the category level. When set, the cronjob will automatically send an expiry notice regardless of existing messaging preferences. If it is turned off, the old messaging preferences will still be in place and actioned > >Test plan: >1) Apply patch and run updatedatabase >2) In system preferences set MembershipExpiryDaysNotice to 5 >3) Choose a patron and edit their expiry date to today's date, ensuring they have a primary email set >4) Create a MEMBERSHIP_EXPIRY notice (content of the notice is irrelevant, just needs to exist) >5) Run perl misc/cronjobs/membership_expiry.pl -c -v -before 10 -after 10 >6) Check the patron's messages, there should be no expiry notice queued >7) Set the patron's category 'enforce expiry notice' field to Yes >8) Repeat step 5, there should be a notice queued >9) Set that patron's primary contact method to primary email and run step 5 again >10) There should be a notice queued for an email >11) Set the category level enforce expiry notice back to No >12) Choose a second patron and set an email address, expiry date to today and set the patron expiry messaging preference for that patron to 'email' >13) Repeat step 5 - this time only one notice should be queued on the second patron, no new notice should queue for the first >14) Re-set the category level option to Yes >15) Repeat step 5 - this time both patron's should have notices queued >16) Unset the category level option again, the behaviour should be the same as step 13 >17) Set the category level option back to Yes and check the patron messaign preferences menus in both the OPAC and Staff client - the patron expiry option should not be visible while the cateogry level enforcement is set to Yes > >Signed-off-by: Hanna Leiker <tech.hanna@salinapublic.org> >--- > Koha/Patron.pm | 4 ++++ > misc/cronjobs/membership_expiry.pl | 8 ++++++++ > 2 files changed, 12 insertions(+) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index d2bf6f0596..ea50a23987 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -2658,6 +2658,10 @@ sub queue_notice { > @message_transports = @{$params->{message_transports}}; > } > return unless defined $letter_code; >+ if ( $params->{expiry_notice_mandatory} ) { >+ push( @message_transports, $params->{primary_contact_method} || 'print' ) if scalar(@message_transports) == 0; >+ } >+ > $letter_params->{letter_code} = $letter_code; > my $print_sent = 0; > my %return; >diff --git a/misc/cronjobs/membership_expiry.pl b/misc/cronjobs/membership_expiry.pl >index 50e213d962..37f8b71cd5 100755 >--- a/misc/cronjobs/membership_expiry.pl >+++ b/misc/cronjobs/membership_expiry.pl >@@ -244,6 +244,8 @@ my $upcoming_mem_expires = Koha::Patrons->search_upcoming_membership_expires( > after => $after, > } > ); >+my @mandatory_expiry_notice_categories = >+ map { $_->categorycode } Koha::Patron::Categories->search( { 'me.enforce_expiry_notice' => 1 } )->as_list; > > my $where_literal = join ' AND ', @where; > $upcoming_mem_expires = $upcoming_mem_expires->search( \$where_literal ) if @where; >@@ -290,6 +292,12 @@ while ( my $expiring_patron = $upcoming_mem_expires->next ) { > message_name => 'Patron_Expiry', > }; > >+ my $is_notice_mandatory = grep( $expiring_patron->categorycode, @mandatory_expiry_notice_categories ); >+ if ($is_notice_mandatory) { >+ $sending_params->{expiry_notice_mandatory} = 1; >+ $sending_params->{primary_contact_method} = $expiring_patron->primary_contact_method; >+ } >+ > my $result = $expiring_patron->queue_notice($sending_params); > $count_enqueued++ if $result->{sent}; > } >-- >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 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