[Bug 44243] New: cleanup_database.pl anonymizes and then deletes protected patrons
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.
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.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44243 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.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org