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.
25 # find Koha's Perl modules
26 # test carefully before changing this
28 eval { require "$FindBin::Bin/../kohalib.pl" };
42 Usage: $0 --days DAYS [-h|--help]
43 --days DAYS (MANDATORY) anonymise patron history that is older than DAYS days.
44 -v --verbose gives a little more information
45 -h --help prints this help message, and exits, ignoring all
51 my ( $help, $days, $verbose );
56 'v|verbose' => \$verbose,
64 print "The days parameter is mandatory.\n\n";
68 my ($year,$month,$day) = Today();
69 my ($newyear,$newmonth,$newday) = Add_Delta_Days ($year,$month,$day,(-1)*$days);
70 my $formatdate = sprintf "%4d-%02d-%02d",$newyear,$newmonth,$newday;
71 $verbose and print "Checkouts before $formatdate will be anonymised.\n";
73 my $rows = AnonymiseIssueHistory($formatdate);
74 $verbose and print "$rows checkouts anonymised.\n";