https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44149

--- Comment #1 from Andrii Nugged <[email protected]> ---
Created attachment 211928
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211928&action=edit
Bug 44149: Fix the packaged last borrower anonymization cron

The packaged daily job invokes anonymize_last_borrowers.pl without
--confirm, although the script requires that option. When
AnonymizeLastBorrower is disabled, the script also reports an error
instead of treating the configured no-op as a successful run.

Pass --confirm in the packaged invocation and exit quietly with status
0 when the preference is disabled. Keep confirmation mandatory when
enabled. Report an error when the existing anonymization method returns
undef for an invalid AnonymousPatron, rather than reporting success.

The existing retention period and damaged/lost/withdrawn filters remain
unchanged. Enabling the preference now allows the packaged daily job to
perform its intended anonymization; disabling it remains the opt-out.

Follow-up to bug 23260; related disabled-cron discussion on bug 43314.

Test plan (use a disposable Koha test database):
Before applying the patch:
1. In the Koha shell, set AnonymizeLastBorrower to 0. Run
   perl misc/cronjobs/anonymize_last_borrowers.pl
   and repeat with --confirm. Both runs incorrectly print a preference
   error and exit 1 instead of silently succeeding.
2. Enable AnonymizeLastBorrower, set AnonymousPatron to an existing
   patron, and set AnonymizeLastBorrowerDays to 30. Prepare an ordinary
   last-borrower row older than 30 days, a recent row, and old rows for
   damaged, lost and withdrawn items.
3. Inspect debian/koha-core.koha-common.cron.daily: its anonymizer command
   lacks --confirm. Running the script with those arguments exits 1 and
   leaves the old eligible row unchanged.
4. Set AnonymousPatron to a non-existent patron number and run the script
   with --confirm. It incorrectly exits 0 without anonymizing anything.

Apply the patch.

After applying the patch:
1. Repeat step 1. Both runs are silent, exit 0, and leave data unchanged,
   including when AnonymousPatron is unset.
2. Restore the valid setup and fixtures from step 2. The packaged command
   now includes --confirm. Run the script with those arguments: it exits
   0 and changes only the eligible old row to AnonymousPatron. Recent,
   damaged, lost and withdrawn controls remain unchanged.
3. Repeat the command: a successful run with no remaining eligible rows
   must still exit 0. Running without --confirm must still exit 1.
4. Repeat step 4: the script now reports the invalid AnonymousPatron and
   exits 1. An empty AnonymousPatron must also remain an error.

Co-Authored-By: Loontik <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to