Bug 29525: Make batch_anonymise.pl deal with holds
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 3 Jan 2022 18:08:27 +0000 (15:08 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 11 Feb 2022 00:44:22 +0000 (14:44 -1000)
commit2952550c8773611b117935197ee642be84aef3c3
tree52cf02471a8cf03721a95e39a91bdea96d483cee
parent67a48726b76b296a35707ceac3b2c32e880fc7db
Bug 29525: Make batch_anonymise.pl deal with holds

This patch makes the batch_anonymise.pl script handle holds too. It does
so by leveraging on the newly introduced method 'filter_by_anonymizable'
and also 'anonymize'.

To test:
1. Have a patron with two past holds.
2. Make sure they are a few days back:
   $ koha-mysql kohadev
   > UPDATE old_reserves SET timestamp=ADDDATE(NOW(), INTERVAL -4 DAY);
3. Run:
   $ kshell
  k$ perl misc/cronjobs/batch_anonymise.pl --days 2 -v
=> SUCCESS: You see something like:
Checkouts and holds before 2022-01-01 will be anonymised.
0 checkouts anonymised.
2 holds anonymised.
4. Repeat 3
=> SUCCESS: They are already anonymized. You see
Checkouts and holds before 2022-01-01 will be anonymised.
0 checkouts anonymised.
0 holds anonymised.
5. Sign off :-D

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
misc/cronjobs/batch_anonymise.pl