View | Details | Raw Unified | Return to bug 29525
Collapse All | Expand All

(-)a/misc/cronjobs/batch_anonymise.pl (-2 / +5 lines)
Lines 22-27 use warnings; Link Here
22
22
23
use Koha::Script -cron;
23
use Koha::Script -cron;
24
use C4::Context;
24
use C4::Context;
25
use Koha::DateUtils qw(dt_from_string);
25
use Koha::Patrons;
26
use Koha::Patrons;
26
use Date::Calc qw( Add_Delta_Days Today );
27
use Date::Calc qw( Add_Delta_Days Today );
27
use Getopt::Long qw( GetOptions );
28
use Getopt::Long qw( GetOptions );
Lines 61-69 cronlogaction(); Link Here
61
my ($year,$month,$day) = Today();
62
my ($year,$month,$day) = Today();
62
my ($newyear,$newmonth,$newday) = Add_Delta_Days ($year,$month,$day,(-1)*$days);
63
my ($newyear,$newmonth,$newday) = Add_Delta_Days ($year,$month,$day,(-1)*$days);
63
my $formatdate = sprintf "%4d-%02d-%02d",$newyear,$newmonth,$newday;
64
my $formatdate = sprintf "%4d-%02d-%02d",$newyear,$newmonth,$newday;
64
$verbose and print "Checkouts before $formatdate will be anonymised.\n";
65
$verbose and print "Checkouts and holds before $formatdate will be anonymised.\n";
65
66
66
my $rows = Koha::Patrons->search_patrons_to_anonymise( { before => $formatdate } )->anonymise_issue_history( { before => $formatdate } );
67
my $rows = Koha::Patrons->search_patrons_to_anonymise( { before => $formatdate } )->anonymise_issue_history( { before => $formatdate } );
67
$verbose and print int($rows) . " checkouts anonymised.\n";
68
$verbose and print int($rows) . " checkouts anonymised.\n";
68
69
70
$rows = Koha::Old::Holds->filter_by_anonymizable({ before => dt_from_string()->subtract( days => $days ) })->anonymize;
71
$verbose and print int($rows) . " holds anonymised.\n";
72
69
exit(0);
73
exit(0);
70
- 

Return to bug 29525