[Bug 44189] New: Batch patron anonymization ignores the selected library and anonymizes every library's checkout history
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44189 Bug ID: 44189 Summary: Batch patron anonymization ignores the selected library and anonymizes every library's checkout history Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Tools Assignee: koha-bugs@lists.koha-community.org Reporter: babarjunaid1122@gmail.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- Tools > Batch patron deletion and anonymization lets you choose a library (Select a library). Step 2 counts the histories it will anonymize for that library only: Koha::Patrons->search_patrons_to_anonymise({ before => ..., library => $branch }) filters on old_issues.branchcode. With IndependentBranches on and a staff member who is not a superlibrarian, it also limits itself to the staff member's own library when All libraries is chosen. Step 3, which does the work, ignores both. tools/cleanborrowers.pl runs Koha::Old::Checkouts->filter_by_anonymizable->filter_by_last_update(...)->anonymize with no library at all, so every anonymizable checkout returned before the date is anonymized, at every library. The page then reports a total that does not match the count step 2 showed. This cannot be undone: the other libraries lose their patrons' reading history, and with IndependentBranches a staff member who may only manage one library changes the data of all of them. To reproduce: 1. Set AnonymousPatron to an existing patron. 2. Take a patron whose privacy is not 'Forever' (e.g. Default) and give them two returned checkouts before today: one checked out at library A (old_issues.branchcode = A), one at library B. 3. Tools > Batch patron deletion and anonymization, Select a library = A. 4. Tick 'Anonymize checkout history older than' and give tomorrow's date. Next. 5. Step 2 says the history of 1 patron at A will be anonymized. Finish. 6. Both checkouts are now on the anonymous patron, the one made at B included. Expected: only the checkout made at library A is anonymized. Seen on Koha 26.05.02 and reproduced on main. -- 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=44189 --- Comment #1 from babar junaid <babarjunaid1122@gmail.com> --- Created attachment 212179 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212179&action=edit Bug 44189: Anonymize only the selected library's checkout history Bug 44189: Anonymize only the selected library's checkout history Batch patron deletion and anonymization counted the histories to anonymize at the selected library (search_patrons_to_anonymise with library), but step 3 anonymized with no library at all, so every library's checkouts returned before the date were anonymized. Under IndependentBranches a staff member who is not a superlibrarian did the same with "All libraries", although step 2 counted only their own. Step 3 now passes the same library to filter_by_anonymizable, which takes an optional library parameter. Test plan: 1. prove t/db_dependent/Koha/Old/Checkouts.t The new subtest fails without the patch. 2. Set AnonymousPatron to an existing patron. 3. Take a patron whose privacy is not "Forever" and give them two returned checkouts dated before today: one with old_issues.branchcode = CPL, one with old_issues.branchcode = MPL. 4. Tools > Batch patron deletion and anonymization, Select a library = Centerville (CPL). Tick "Anonymize checkout history older than", tomorrow's date. Next. 5. Step 2 says the history of 1 patron at Centerville will be anonymized. Finish. 6. Without the patch: both checkouts now belong to the anonymous patron. With the patch: only the CPL checkout does; the MPL one is untouched. 7. Repeat with All libraries: both are anonymized. Sponsored-by: Koha Solutions -- 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=44189 babar junaid <babarjunaid1122@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |babarjunaid1122@gmail.com |ity.org | Status|NEW |Needs Signoff -- 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=44189 John Vinke <jvinke@austinseminary.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- Comma delimited| |Koha Solutions list of Sponsors| | Status|Needs Signoff |Signed Off Sponsorship status|--- |Sponsored -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44189 John Vinke <jvinke@austinseminary.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #212179|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44189 --- Comment #2 from John Vinke <jvinke@austinseminary.edu> --- Created attachment 212432 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212432&action=edit Bug 44189: Anonymize only the selected library's checkout history Batch patron deletion and anonymization counted the histories to anonymize at the selected library (search_patrons_to_anonymise with library), but step 3 anonymized with no library at all, so every library's checkouts returned before the date were anonymized. Under IndependentBranches a staff member who is not a superlibrarian did the same with "All libraries", although step 2 counted only their own. Step 3 now passes the same library to filter_by_anonymizable, which takes an optional library parameter. Test plan: 1. prove t/db_dependent/Koha/Old/Checkouts.t The new subtest fails without the patch. 2. Set AnonymousPatron to an existing patron. 3. Take a patron whose privacy is not "Forever" and give them two returned checkouts dated before today: one with old_issues.branchcode = CPL, one with old_issues.branchcode = MPL. 4. Tools > Batch patron deletion and anonymization, Select a library = Centerville (CPL). Tick "Anonymize checkout history older than", tomorrow's date. Next. 5. Step 2 says the history of 1 patron at Centerville will be anonymized. Finish. 6. Without the patch: both checkouts now belong to the anonymous patron. With the patch: only the CPL checkout does; the MPL one is untouched. 7. Repeat with All libraries: both are anonymized. Sponsored-by: Koha Solutions Signed-off-by: John Vinke <jvinke@austinseminary.edu> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org