@@ -, +, @@ $ koha-mysql kohadev > UPDATE old_reserves SET timestamp=ADDDATE(NOW(), INTERVAL -4 DAY); $ kshell k$ perl misc/cronjobs/batch_anonymise.pl --days 2 -v --- misc/cronjobs/batch_anonymise.pl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/misc/cronjobs/batch_anonymise.pl +++ a/misc/cronjobs/batch_anonymise.pl @@ -22,6 +22,7 @@ use warnings; use Koha::Script -cron; use C4::Context; +use Koha::DateUtils qw(dt_from_string); use Koha::Patrons; use Date::Calc qw( Add_Delta_Days Today ); use Getopt::Long qw( GetOptions ); @@ -61,9 +62,12 @@ cronlogaction(); my ($year,$month,$day) = Today(); my ($newyear,$newmonth,$newday) = Add_Delta_Days ($year,$month,$day,(-1)*$days); my $formatdate = sprintf "%4d-%02d-%02d",$newyear,$newmonth,$newday; -$verbose and print "Checkouts before $formatdate will be anonymised.\n"; +$verbose and print "Checkouts and holds before $formatdate will be anonymised.\n"; my $rows = Koha::Patrons->search_patrons_to_anonymise( { before => $formatdate } )->anonymise_issue_history( { before => $formatdate } ); $verbose and print int($rows) . " checkouts anonymised.\n"; +$rows = Koha::Old::Holds->filter_by_anonymizable({ before => dt_from_string()->subtract( days => $days ) })->anonymize; +$verbose and print int($rows) . " holds anonymised.\n"; + exit(0); --