[Koha-bugs] [Bug 30666] Holds reminder cronjob (holds_reminder.pl) uses DateTime::subtract wrong

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri May 13 11:54:39 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666

Marcel de Rooy <m.de.rooy at rijksmuseum.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #134565|0                           |1
        is obsolete|                            |

--- Comment #5 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
Created attachment 134959
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134959&action=edit
Bug 30666: Holds reminder cronjob (holds_reminder.pl) uses DataTime::subtract
wrong

In holds_reminder.pl, the script loops over all available branchcodes. For each
iteration of the loop, if not using the calendar, the script subtracts the days
parameter from the current date to get the waiting date threshold. The problem
is that this method alters the DateTime object in $date_to_run, so for each
iteration of the loop, the waiting date becomes farther and farther in the
past, when it should always be the same!

The solution is to either clone the "date to run" for each call to subtract, or
to move it out of the loop since it doesn't need to be recalculated each time.

Test Plan:
1) Become the koha user using koha-shell
2) Run DBIC_TRACE=1 misc/cronjobs/holds/holds_reminder.pl --days 7
3) Note in the queries that for each loop, the waiting date is different
4) Apply this patch
5) Run the command in step 2 again
6) Note the queries all now have the same waiting date threshold!

Signed-off-by: David Nind <david at davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list