https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44243 --- Comment #1 from babar junaid <babarjunaid1122@gmail.com> --- Created attachment 212473 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212473&action=edit Bug 44243: Do not anonymize or remove protected patrons automatically Bug 44243: Do not anonymize or remove protected patrons automatically 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) without looking at protected, and then deletes anonymized patrons (PatronRemovalDelay). A protected patron is therefore anonymized, loses its protection, and is deleted, by the same nightly run. - anonymize keeps the protected flag - search_anonymize_candidates leaves protected patrons out - search_anonymized leaves protected patrons out (deleting one would throw and roll back every other deletion of the run) Test plan: 1. prove t/db_dependent/Koha/Patrons.t The new subtest fails without the patch. 2. Set PatronAnonymizeDelay = 0 and PatronRemovalDelay = 0. 3. Create a patron with "Protected" = Yes, an expiry date in the past, and lock the account (login_attempts = -1). 4. perl misc/cronjobs/cleanup_database.pl --sessions --confirm -v "Anonymized 1 patrons", "Deleted 1 patrons": the protected patron is in deletedborrowers, anonymized, with protected = 0. 5. Apply the patch, repeat 3-4 with a new patron: "Anonymized 0 patrons", "Deleted 0 patrons"; the patron is unchanged. Sponsored-by: Koha Solutions -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.