Bug 23260: Add a confirm flag
To test the confirm flag: 1. Run perl misc/cronjobs/batch_anonymise.pl --days 1 2. Notice the warning about needing a confirm flag 3. Run perl misc/cronjobs/batch_anonymise.pl --days 1 --confirm 4. The script runs Signed-off-by: Peter Moore <peter@mrcpl.org> Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
ecfd85ebb8
commit
7eda8d23fa
|
|
@ -36,6 +36,7 @@ use C4::Log;
|
|||
sub usage {
|
||||
print STDERR <<USAGE;
|
||||
Usage: $0 [-h|--help]
|
||||
-c --confirm required to actually perform the anonymization
|
||||
-v --verbose gives a little more information
|
||||
-h --help prints this help message, and exits, ignoring all
|
||||
other options
|
||||
|
|
@ -44,11 +45,12 @@ USAGE
|
|||
exit $_[0];
|
||||
}
|
||||
|
||||
my ( $help, $verbose );
|
||||
my ( $help, $verbose, $confirm );
|
||||
|
||||
GetOptions(
|
||||
'h|help' => \$help,
|
||||
'v|verbose' => \$verbose,
|
||||
'c|confirm' => \$confirm,
|
||||
) || usage(1);
|
||||
|
||||
if ($help) {
|
||||
|
|
@ -62,6 +64,12 @@ if ( !$pref ) {
|
|||
usage(1);
|
||||
}
|
||||
|
||||
unless ($confirm) {
|
||||
print STDERR "You must use the --confirm flag to run this script.\n";
|
||||
print STDERR "Add --confirm to actually perform the anonymization.\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cronlogaction();
|
||||
|
||||
my $rows = Koha::Patrons->anonymize_last_borrowers();
|
||||
|
|
|
|||
Loading…
Reference in New Issue