[Bug 30666] New: Holds reminder cronjob (holds_reminder.pl) uses DataTime::subtract wrong
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Bug ID: 30666 Summary: Holds reminder cronjob (holds_reminder.pl) uses DataTime::subtract wrong Change sponsored?: --- Product: Koha Version: 21.05 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: kyle@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz 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. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 --- Comment #1 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 134494 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134494&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 /usr/share/koha/bin/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. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |kyle@bywatersolutions.com |ity.org | Severity|enhancement |normal -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |30667 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30667 [Bug 30667] Holds reminder cronjob (holds_reminder.pl) never uses default letter template -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #134494|0 |1 is obsolete| | --- Comment #2 from Kyle M Hall <kyle@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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #134505|0 |1 is obsolete| | --- Comment #3 from David Nind <david@davidnind.com> --- Created attachment 134565 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=134565&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@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | CC| |m.de.rooy@rijksmuseum.nl --- Comment #4 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- QA: looking here -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|Holds reminder cronjob |Holds reminder cronjob |(holds_reminder.pl) uses |(holds_reminder.pl) uses |DataTime::subtract wrong |DateTime::subtract wrong -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #134565|0 |1 is obsolete| | --- Comment #5 from Marcel de Rooy <m.de.rooy@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@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |22.05.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 --- Comment #6 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to master for 22.05, thanks to everybody involved 🦄 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Bug 30666 depends on bug 30667, which changed state. Bug 30667 Summary: Holds reminder cronjob (holds_reminder.pl) never uses default letter template https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30667 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to stable |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Rebecca Coert <rcoert@arlingtonva.us> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rcoert@arlingtonva.us -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30666 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rel_21_11_candidate CC| |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org