Bugzilla – Attachment 187112 Details for
Bug 35700
Holds reminder cronjob --triggered switch does not work as intended if the day to send notice hits concurrent holidays
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35700: Holds reminder cronjob --triggered switch does not work as intended if the day to send notice hits concurrent holidays
Bug-35700-Holds-reminder-cronjob---triggered-switc.patch (text/plain), 4.98 KB, created by
Lisette Scheer
on 2025-09-30 16:17:29 UTC
(
hide
)
Description:
Bug 35700: Holds reminder cronjob --triggered switch does not work as intended if the day to send notice hits concurrent holidays
Filename:
MIME Type:
Creator:
Lisette Scheer
Created:
2025-09-30 16:17:29 UTC
Size:
4.98 KB
patch
obsolete
>From ce03afb755d632d627ae5a2b690517bf0bfd9b37 Mon Sep 17 00:00:00 2001 >From: Lisette Scheer <lisette@bywatersolutions.com> >Date: Tue, 30 Sep 2025 16:16:41 +0000 >Subject: [PATCH] Bug 35700: Holds reminder cronjob --triggered switch does not > work as intended if the day to send notice hits concurrent holidays > >If the holds reminder cronjob would send a reminder on a holiday,when holidays are taken into account, it also will send it on the subsequent holidays and the first open day. >This bugfix adds a check to the cron when --holidays is set to skip sending the notices for that library if today is a holiday. > >To Test: >Before applying: >1. Create a hold for a patron (I used patron 23529000035676 and 39999000000252) >2. Ensure your patron has an email address set and the hold reminder email selected. >3. Set the hold to waiting by checking it and confirming the hold. >4. In Tools->Calendar add a holiday to yesterday and a seperate holiday to today. >5. On the command line (the date should be set to 5 days ago for my commands to work and any dates adjusted accordingly) >koha-mysql kohadev >update reserves set waitingdate="2025-09-25" >exit >perl misc/cronjobs/holds/holds_reminder.pl -days 3 -t -v -holidays --date 2025-09-29 >6. Observe that 1 notice would have sent to your patron >7. On the command line >perl misc/cronjobs/holds/holds_reminder.pl -days 3 -t -v -holidays >8. Observe that 1 notice would have sent to your patron >9. On the command line >perl misc/cronjobs/holds/holds_reminder.pl -days 3 -t -v -holidays --date 2025-10-01 >10. Observe that 1 notice would have sent to your patron > >11. Apply patches >12. Repeat the last command from step 5 and step 7 >13. Observe that no notice should be sent for your patron >14. Repeat step 7 >15. Observe that a notice should be sent for your patron. >16. Run >perl misc/cronjobs/holds/holds_reminder.pl -days 5 -t -v >17. Confirm the notice should be sent for your patron >18. Sign off >i >--- > misc/cronjobs/holds/holds_reminder.pl | 21 +++++++++++++++++---- > 1 file changed, 17 insertions(+), 4 deletions(-) > >diff --git a/misc/cronjobs/holds/holds_reminder.pl b/misc/cronjobs/holds/holds_reminder.pl >index 6269301ee99..f661bb1da44 100755 >--- a/misc/cronjobs/holds/holds_reminder.pl >+++ b/misc/cronjobs/holds/holds_reminder.pl >@@ -31,6 +31,7 @@ use Koha::Libraries; > use Koha::Notice::Templates; > use Koha::Patrons; > use Koha::Script -cron; >+use Data::Dumper; > > =head1 NAME > >@@ -42,7 +43,7 @@ holds_reminder.pl > -lettercode <notice to send> > [ -c ][ -v ][ -library <branchcode> ][ -library <branchcode> ... ] > [ -days <number of days> ][ -mtt <transport type> ... ][ -holidays ] >- [ -date <YYYY-MM-DD> ] >+ [ -date <YYYY-MM-DD> ][ -o ] > > Options: > -help brief help message >@@ -58,6 +59,7 @@ holds_reminder.pl > populating this will force send even if patron has not chosen to receive hold notices > email and sms will fallback to print if borrower does not have an address/phone > -date Send notices as would have been sent on a specific date >+ - o --open Do not send the message on closed days > > =head1 OPTIONS > >@@ -120,6 +122,9 @@ If omitted the patron's messaging preferences for Hold notices will be used. > If supplied the notice types will be force sent even if patron has not selected hold notices > Email and SMS will fall back to print if there is no valid info in the patron's account > >+=item B<-o> | B<--open> >+ >+This option determines whether library holidays are skipped when sending the message. If so reminders should be sent the next open day. Must be used with holidays > > =back > >@@ -175,6 +180,7 @@ my $use_calendar = 0; > my $date_input; > my $opt_out = 0; > my @mtts; >+my $open = 0; > > my $command_line_options = join( " ", @ARGV ); > cronlogaction( { info => $command_line_options } ); >@@ -190,7 +196,8 @@ GetOptions( > 'library=s' => \@branchcodes, > 'date=s' => \$date_input, > 'holidays' => \$use_calendar, >- 'mtt=s' => \@mtts >+ 'mtt=s' => \@mtts, >+ 'open' => \$open > ); > pod2usage(1) if $help; > pod2usage( -verbose => 2 ) if $man; >@@ -243,9 +250,15 @@ foreach my $branchcode (@branchcodes) { #BEGIN BRANCH LOOP > # If respecting calendar get the correct waiting since date > my $waiting_date; > if ($use_calendar) { >+ my $today = $date_to_run; > my $calendar = Koha::Calendar->new( branchcode => $branchcode, days_mode => 'Calendar' ); >- my $duration = DateTime::Duration->new( days => -$days ); >- $waiting_date = $calendar->addDays( $date_to_run, $duration ); #Add negative of days >+ >+ #if today is a holiday skip sending the message >+ next if $calendar->is_holiday($today); >+ { >+ my $duration = DateTime::Duration->new( days => -$days ); >+ $waiting_date = $calendar->addDays( $date_to_run, $duration ); #Add negative of days >+ } > } else { > $waiting_date = $waiting_date_static; > } >-- >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 35700
:
187112
|
187113
|
187114
|
187115
|
187426
|
187482
|
187505