Bug 35700 - Holds reminder cronjob --triggered switch does not work as intended if the day to send notice hits concurrent holidays
Summary: Holds reminder cronjob --triggered switch does not work as intended if the da...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: 23.11
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-04 10:45 UTC by Lari Strand
Modified: 2024-04-16 18:56 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lari Strand 2024-01-04 10:45:45 UTC
If the calendar has concurrent holidays, when holds_reminder.pl cronjob is being ran daily with the --triggered switch and the day the notice should be sent lands on a holiday which is repeated the following days, the cronjob sends holds reminders until the holiday period ends.

To reproduce:

Reserve an item, receive it at a branch where the reserve was made to.
Move the waitingdate and reservedate of the reserve to x days before the reserve was made in the database. 
Add holidays (single non-repeated days) to the calendar so that the first holiday lands on a date when the hold reminder should be sent.
Set up the cronjob to run so that the --days trigger matches the first added holiday using also the --triggered switch:

holds_reminder.pl -v --days x --triggered --holidays -c

for example. Check that the x:th day from the reserve's waitingdate is a holiday, and the date has following days set as holidays as well.

Notice that on the following day/days of the first sent reminder, the message is sent again. Same happens the following holidays.

It seems the notice is sent also if there is a repeated holiday following the first single day holiday the message was sent (like if saturdays and sundays were repeated holidays).

I guess this could be reproduced easier by moving your system date forward and running the cronscript again. I couldn't reproduce the same bug when moving back the waitingdate of the reserve to simulate a day had passed since the first message for some reason. Notice that modifying the holidays use a cache, so just making changes to the database is not enough for the cronscript to notice the changes made.
Comment 1 Esther Melander 2024-04-16 16:36:07 UTC
I have seen this behavior recently on a site, but it was occurring on a single holiday. The library is only closed on Sundays. The hold reminder notice was hitting and sending on the closed Sunday and sending a duplicate notice on the next open day, Monday. The calendars for the impacted branches had Sundays set as a holiday.

This is the cron configuration:

echo "running holds_reminder.pl at $(date +%Y%m%d":"%H":"%M":"%S)"                                                                                                                                                 
$KOHA_CRON_PATH/holds/holds_reminder.pl -holidays -t -days 3 --confirm                                                                                                                                             
echo "done running holds_reminder.pl at $(date +%Y%m%d":"%H":"%M":"%S)"