[Bug 43500] New: Extract mark_returned and lift_overdue_restrictions from MarkIssueReturned
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43500 Bug ID: 43500 Summary: Extract mark_returned and lift_overdue_restrictions from MarkIssueReturned Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Circulation Assignee: koha-bugs@lists.koha-community.org Reporter: chloe.zermatten@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com Target Milestone: --- MarkIssueReturned currently completes two different tasks: - it completes the conversion of an issue into an old issue - it lifts overdue restrictions on a patron if AutoRemoveOverduesRestrictions is on In preparation for 39756, extract both tasks into two new separate methods: Koha::Checkout->mark_returned and Koha::Patron->lift_overdue_restrictions. This is because in the script 39756 will introduce, while the conversion to old_issue will happen once per issue, the intent is for the restriction lift logic to only run once per patron. I think it would be useful to decouple the two so that they can be called separately. -- 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=43500 Chloé Zermatten <chloe.zermatten@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chloe.zermatten@openfifth.c | |o.uk Status|NEW |ASSIGNED -- 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=43500 Chloé Zermatten <chloe.zermatten@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |39756 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39756 [Bug 39756] Long overdue cron configuration page -- 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=43500 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43500 Chloé Zermatten <chloe.zermatten@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |chloe.zermatten@openfifth.c |ity.org |o.uk -- 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=43500 --- Comment #1 from Chloé Zermatten <chloe.zermatten@openfifth.co.uk> --- Created attachment 206646 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206646&action=edit Bug 43500: refactor: extract mark_returned and lift_overdue_restrictions Add Koha::Checkout->mark_returned, archiving a checkout to old_issues: sets returndate, reassigns the checkout's accountlines to the archived row, deletes the issues row, clears items.onloan and records items.last_returned_by. checkin_library is a parameter rather than a C4::Context->userenv read, so cronjobs and other callers without a user environment can record the correct library, or none. Add Koha::Patron->lift_overdue_restrictions, holding the AutoRemoveOverduesRestrictions handling logic. Refactor to include a guard clause to avoid fetching overdues if no overdue restrictions exists. Minor: removes the unused my $rv variable declared in MarkIssueReturned Rewrite MarkIssueReturned from which both were extracted to call both. Test plan (check for regressions): 1) prove t/db_dependent/Koha/Checkout.t 2) prove t/db_dependent/Koha/Patron.t 3) prove t/db_dependent/Circulation/MarkIssueReturned.t 4) run misc/cronjobs/longoverdue.pl: a) Confirm the test patron's category has 'Overdue notice required' set to Yes, and set AutoRemoveOverduesRestrictions to when_no_overdue_causing_debarment. b) At admin/circulation_triggers.pl add a trigger with a letter (ODUE), a transport type, a delay of N days and 'Restricts checkouts' = Yes. A trigger with no letter never restricts, so the letter matters. c) Check out two items to the patron and backdate both due dates to N + 1 days overdue. d) perl misc/cronjobs/overdue_notices.pl -n Confirm the patron's Restrictions tab shows an OVERDUES restriction. e) perl misc/cronjobs/longoverdue.pl --lost <N>=1 --mark-returned --confirm -v Confirm both checkouts are archived to old_issues, items.onloan is cleared, itemlost is set, and the OVERDUES restriction is gone. f) Confirm old_issues.checkin_library is NULL for both rows. Koha::Script -cron sets a userenv with no branch, so this is unchanged by the patch. Assisted-by: Claude Opus 5 (Anthropic) Sponsored-by: Black Hills Library Consortium- http://www.rcgov.org/Library/ -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43500 --- Comment #2 from Chloé Zermatten <chloe.zermatten@openfifth.co.uk> --- Created attachment 206647 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206647&action=edit Bug 43500: test: lift_overdue_restrictions Assisted-by: Claude Opus 5 (Anthropic) Sponsored-by: Black Hills Library Consortium- http://www.rcgov.org/Library/ -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43500 --- Comment #3 from Chloé Zermatten <chloe.zermatten@openfifth.co.uk> --- Created attachment 206648 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206648&action=edit Bug 43500: fix: has_restricting_overdues emits warning The warning emitted by has_restricting_overdues would cause the lift_overdue_restrictions test to fail. Since the method uses order_by, next can't properly collapse rows to their parent overdue while iterating: the sequentiality that allowed that is broken, causing the warning (but no bug). Use as_list instead - this does not change behaviour but renders it explicit. Test plan: 1) run prove -t t/db_dependent/Koha/Patron.t 2) confirm no warning emitted causing test failures for lift_overdue_restrictions Assisted-by: Claude Opus 5 (Anthropic) Sponsored-by: Black Hills Library Consortium- http://www.rcgov.org/Library/ -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43500 --- Comment #4 from Chloé Zermatten <chloe.zermatten@openfifth.co.uk> --- Created attachment 206649 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206649&action=edit Bug 43500: test: mark_returned Assisted-by: Claude Opus 5 (Anthropic) Sponsored-by: Black Hills Library Consortium- http://www.rcgov.org/Library/ -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43500 Chloé Zermatten <chloe.zermatten@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org