From 3e7267633ef3aa446bb4f3500d2a19cace9e7bfa 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 Signed-off-by: Andrew Fuerste-Henry --- 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..786e847c34 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, timestamp_column_name => 'returndate' }) + ->anonymize; + $verbose and print int($rows) . " checkouts anonymised.\n"; $rows = Koha::Old::Holds -- 2.30.2