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.