https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44149 Bug ID: 44149 Summary: Packaged last-borrower anonymization cron omits --confirm and fails when disabled Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Command-line Utilities Assignee: nugged@gmail.com Reporter: nugged@gmail.com QA Contact: testopia@bugs.koha-community.org CC: jake.deery@openfifth.co.uk, robin@catalyst.net.nz Depends on: 23260 Target Milestone: --- The packaged daily cron invokes anonymize_last_borrowers.pl without --confirm, although that option is required when AnonymizeLastBorrower is enabled. Consequently the scheduled invocation exits with an error instead of performing the configured anonymization. When AnonymizeLastBorrower is disabled, the script also prints an error and exits 1. A deliberately disabled feature should be a quiet, successful no-op. This behavior was reported on Bug 23260 comments 248-249 and Bug 43314 comments 7-9, but the current main still contains both problems. There is also a related false-success case: a non-empty AnonymousPatron that does not identify an existing patron makes the existing method return undef, but the script ignores that result and exits 0. Steps to reproduce on a disposable Koha test database: 1. Set AnonymizeLastBorrower to 0. 2. Run perl misc/cronjobs/anonymize_last_borrowers.pl, first without --confirm and then with --confirm. Record stdout, stderr and exit status. 3. Enable AnonymizeLastBorrower, configure a valid AnonymousPatron and AnonymizeLastBorrowerDays, and prepare an eligible old last-borrower row. 4. Run the script using the arguments from debian/koha-core.koha-common.cron.daily. That entry lacks --confirm. 5. Set AnonymousPatron to a non-existent patron number and run the script with --confirm. Expected result: Disabled runs are silent, exit 0 and leave data unchanged. The packaged command includes --confirm and anonymizes eligible rows when enabled and correctly configured. Invalid or missing AnonymousPatron and enabled runs without confirmation remain errors. Actual result: Disabled runs print an error and exit 1. The packaged enabled invocation fails for missing --confirm. A non-empty invalid AnonymousPatron instead silently exits 0 without performing the operation. Proposed fix: Add --confirm to the packaged daily entry, quietly succeed when the feature is disabled, and treat the anonymization method's undef result as an error. Preserve the existing retention period, item filters and confirmation requirement. A defined zero-row result remains successful. This is a follow-up to Bug 23260: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23260 Related discussion, without a runtime fix, is on Bug 43314: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43314 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23260 [Bug 23260] Anonymize (remove) patron data from items_last_borrower -- You are receiving this mail because: You are watching all bug changes.