From 206852857cfc92e2108f9a3b98d447a36a36641f Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 10 Jan 2022 11:32:15 -0300 Subject: [PATCH] Bug 29843: Use in batch_anonymise.pl This patch makes the batch_anonymise.pl cronjob script use the newly introduced methods instead of the old ones. To test: 1. Try the tool => SUCCESS: No behavior change 2. Sign off :-D --- misc/cronjobs/batch_anonymise.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/misc/cronjobs/batch_anonymise.pl b/misc/cronjobs/batch_anonymise.pl index 5383578ef1..025e151309 100755 --- a/misc/cronjobs/batch_anonymise.pl +++ b/misc/cronjobs/batch_anonymise.pl @@ -25,8 +25,8 @@ use C4::Context; use C4::Log qw( cronlogaction ); use Koha::Database; +use Koha::Old::Checkouts; use Koha::Old::Holds; -use Koha::Patrons; use Date::Calc qw( Add_Delta_Days Today ); use Getopt::Long qw( GetOptions ); @@ -67,7 +67,11 @@ 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 and holds before $formatdate will be anonymised.\n"; -my $rows = Koha::Patrons->search_patrons_to_anonymise( { before => $formatdate } )->anonymise_issue_history( { before => $formatdate } ); +my $rows = Koha::Old::Checkouts + ->filter_by_anonymizable + ->filter_by_last_update( { days => $days } ) + ->anonymize; + $verbose and print int($rows) . " checkouts anonymised.\n"; $rows = Koha::Old::Holds -- 2.32.0