https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10190 --- Comment #951 from Chloé Zermatten <chloe.zermatten@openfifth.co.uk> --- Created attachment 205322 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=205322&action=edit Bug 10190: (QA follow-up): fix: only remove restrict if no restricting overdues found Where a patron had multiple overdues that ought to cause debarment, it was found that removing one removed the restriction. This is because has_restricting_overdues() was looking up the ItemType object tied to the overdue issue, then passing it down to Koha::CirculationRules->get_effective_rules(). get_effective_rules(), however, expects an itemtype code. This resulted in false negatives: the patron was treated as having no restricting overdues left where they in fact did. Amend this by calling effective_itemtype() instead. Note on side effects: I think this also will activate the previously potentially dead dedup logic in has_restricting_overdues (eq had been used to compare obj instance to obj instance which had no effect (itemtype() runs a find() on each iteration), and is now used to compare itemtype code to itemtype code). Test plan (based on Pedro's comment number 949): 0) Pick a test opac patron, if using Henry from above remove the permissions 1) http://localhost:8081/cgi-bin/koha/admin/categories.pl, edit the test patron's category, confirm 'Overdue notice required' is set to 'Yes'. 2) Set syspref AutoRemoveOverduesRestrictions to when_no_overdue_causing_debarment. 3) http://localhost:8081/cgi-bin/koha/admin/circulation_triggers.pl, 'Add new trigger'. Leave 'Library' as 'All libraries' and 'Patron category' as 'All categories', set 'Item type' to 'Books'. For 'Letter' pick ODUE, check 'Email' under 'Transport type(s)', set delay to 5 days, for 'Restricts checkouts' select 'Yes', 'Submit'. 4) Check out barcodes 39999000019186 and 39999000007558 to the test patron (confirm both are itemtype 'Books'). Backdate both due dates 6+ days overdue. 5) perl misc/cronjobs/overdue_notices.pl -n — restricts the patron. 6) Check the patron's 'Restrictions' tab: confirm restricted. 7) Return barcode 39999000019186 only, leave 39999000007558 8) Check the patron's 'Restrictions' tab again. Notice they are still restricted (39999000007558 is still overdue). 9) Return barcode 39999000007558 also. 10) Check the patron's 'Restrictions' tab again. Notice the restriction is now removed (a hard refresh may be needed) as no restricting overdues are left. Assisted-by: Claude Opus 5 (Anthropic) Sponsored-by: Glasgow Colleges Library Group <https://library.cityofglasgowcollege.ac.uk> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.