[Bug 30947] New: Simplify date handling in CanbookBeIssued
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 Bug ID: 30947 Summary: Simplify date handling in CanbookBeIssued Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Circulation Assignee: joonas.kylmala@iki.fi Reporter: joonas.kylmala@iki.fi QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com C4::Circulation::CanbookBeIssued does some unnecessary stuff with dates, opening bug to get rid of that extra code and make it simpler and more efficient :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 Joonas Kylmälä <joonas.kylmala@iki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 --- Comment #1 from Joonas Kylmälä <joonas.kylmala@iki.fi> --- Created attachment 135959 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135959&action=edit Bug 30947: Add test for Illrequest checkout with custom due date To test: 1) prove t/db_dependent/Illrequests.t -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 --- Comment #2 from Joonas Kylmälä <joonas.kylmala@iki.fi> --- Created attachment 135960 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=135960&action=edit Bug 30947: Simplify CanBookBeIssued date handling 1) This removes support for passing string dates to CanBookBeIssued. The function didn't publicly even document support for string dates, only DateTime objects. 2) We get a $duedate always at least from CalcDateDue so having $issuingimpossible{INVALID_DATE} = output_pref($duedate); was unneccesary and thus removed. 3) The check "duedate cannot be before now" was needlessly complex: if the due date really cannot be before now we should check seconds too and warn the librarian! Thus the truncation to minutes can be dropped safely. To test: 1) prove t/db_dependent/Circulation.t 2) prove t/db_dependent/Illrequests.t 3) Enable OnSiteCheckouts and disable SpecifyDueDate syspref. Create on-site checkout for any patron and verify the due date is your current date at 23:59, you can check the exact minute with sql:
select * from issues
-- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 Joonas Kylmälä <joonas.kylmala@iki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nick@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 Nick Clemens <nick@bywatersolutions.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=30947 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #135959|0 |1 is obsolete| | Attachment #135960|0 |1 is obsolete| | --- Comment #3 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 136092 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=136092&action=edit Bug 30947: Add test for Illrequest checkout with custom due date To test: 1) prove t/db_dependent/Illrequests.t Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 --- Comment #4 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 136093 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=136093&action=edit Bug 30947: Simplify CanBookBeIssued date handling 1) This removes support for passing string dates to CanBookBeIssued. The function didn't publicly even document support for string dates, only DateTime objects. 2) We get a $duedate always at least from CalcDateDue so having $issuingimpossible{INVALID_DATE} = output_pref($duedate); was unneccesary and thus removed. 3) The check "duedate cannot be before now" was needlessly complex: if the due date really cannot be before now we should check seconds too and warn the librarian! Thus the truncation to minutes can be dropped safely. To test: 1) prove t/db_dependent/Circulation.t 2) prove t/db_dependent/Illrequests.t 3) Enable OnSiteCheckouts and disable SpecifyDueDate syspref. Create on-site checkout for any patron and verify the due date is your current date at 23:59, you can check the exact minute with sql:
select * from issues
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #136092|0 |1 is obsolete| | --- Comment #5 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 136158 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=136158&action=edit Bug 30947: Add test for Illrequest checkout with custom due date To test: 1) prove t/db_dependent/Illrequests.t Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #136093|0 |1 is obsolete| | --- Comment #6 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 136159 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=136159&action=edit Bug 30947: Simplify CanBookBeIssued date handling 1) This removes support for passing string dates to CanBookBeIssued. The function didn't publicly even document support for string dates, only DateTime objects. 2) We get a $duedate always at least from CalcDateDue so having $issuingimpossible{INVALID_DATE} = output_pref($duedate); was unneccesary and thus removed. 3) The check "duedate cannot be before now" was needlessly complex: if the due date really cannot be before now we should check seconds too and warn the librarian! Thus the truncation to minutes can be dropped safely. To test: 1) prove t/db_dependent/Circulation.t 2) prove t/db_dependent/Illrequests.t 3) Enable OnSiteCheckouts and disable SpecifyDueDate syspref. Create on-site checkout for any patron and verify the due date is your current date at 23:59, you can check the exact minute with sql:
select * from issues
Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com Status|Signed Off |Passed QA --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- QA scripts are happy and tests all pass. This is a nice simplification and improvement.. great work. Passing QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 --- Comment #8 from Joonas Kylmälä <joonas.kylmala@iki.fi> --- Created attachment 136329 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=136329&action=edit Bug 30947: (follow-up) Remove unnecessary object cloning CalcDateDue() works on its own copy of the $startdate parameter so the cloning in the calling end is not necessary. Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 --- Comment #9 from Joonas Kylmälä <joonas.kylmala@iki.fi> --- We were doing a copy of the $now DateTime object unnecessarily so added a trivial follow-up for that. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |22.11.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 --- Comment #10 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 22.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30947 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com --- Comment #11 from Lucas Gass <lucas@bywatersolutions.com> --- Not going to backport this enhancement to 22.05.x unless requested -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org