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

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue May 3 13:00:30 CEST 2022


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

Kyle M Hall <kyle at bywatersolutions.com> changed:

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

--- Comment #2 from Kyle M Hall <kyle at bywatersolutions.com> ---
Created attachment 134505
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134505&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!

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


More information about the Koha-bugs mailing list