https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44243 Bug ID: 44243 Summary: cleanup_database.pl anonymizes and then deletes protected patrons Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Patrons Assignee: koha-bugs@lists.koha-community.org Reporter: babarjunaid1122@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com Target Milestone: --- A patron marked "Protected" cannot be deleted from the staff interface, but the nightly cleanup still removes it. Koha::Patron->anonymize clears every column it does not skip, and protected is not skipped: it is a NOT NULL integer, so it is set to 0. cleanup_database.pl anonymizes expired, locked patrons (PatronAnonymizeDelay, Koha::Patrons->search_anonymize_candidates) without looking at protected, then deletes anonymized patrons (PatronRemovalDelay, search_anonymized). So a protected patron is anonymized, loses its protection, and is deleted by the same run. To reproduce (main): 1. PatronAnonymizeDelay = 0, PatronRemovalDelay = 0. 2. A patron with Protected = Yes, an expiry date in the past, and the account locked (login_attempts = -1). 3. perl misc/cronjobs/cleanup_database.pl --sessions --confirm -v Anonymized 1 patrons Deleted 1 patrons 4. The patron is in deletedborrowers: surname randomized, protected = 0, anonymized = 1. Expected: a protected patron is neither anonymized nor deleted automatically, and anonymizing a patron does not clear the flag. Reproduced on main (c8e8025). -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.