3 # Copyright 2011, ByWater Solutions.
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 # find Koha's Perl modules
27 # test carefully before changing this
29 eval { require "$FindBin::Bin/../kohalib.pl" };
43 Usage: $0 --days DAYS [-h|--help]
44 --days DAYS (MANDATORY) anonymise patron history that is older than DAYS days.
45 -v --verbose gives a little more information
46 -h --help prints this help message, and exits, ignoring all
52 my ( $help, $days, $verbose );
57 'v|verbose' => \
$verbose,
65 print "The days parameter is mandatory.\n\n";
69 my ($year,$month,$day) = Today
();
70 my ($newyear,$newmonth,$newday) = Add_Delta_Days
($year,$month,$day,(-1)*$days);
71 my $formatdate = sprintf "%4d-%02d-%02d",$newyear,$newmonth,$newday;
72 $verbose and print "Checkouts before $formatdate will be anonymised.\n";
74 my ($rows, $err_history_not_deleted) = AnonymiseIssueHistory
($formatdate);
75 carp
"Anonymisation of reading history failed." if ($err_history_not_deleted);
76 $verbose and print "$rows checkouts anonymised.\n";