Bug 37181: Add --confirm option to pseudonymize_statistics.pl
To test: 1 - Perform some transactions 2 - Enable Pseudonymization 3 - perl misc/maintenance/pseudonymize_statistics.pl -v 4 - Confirm test run an nothing changed 5 - perl misc/maintenance/pseudonymize_statistics.pl -v -c 6 - Confirm statistics are pseudonymized Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Amend: tidied the changes [tcohen] Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
5e9b914352
commit
444f3d8bad
1 changed files with 11 additions and 2 deletions
|
@ -26,12 +26,13 @@ use Koha::PseudonymizedTransactions;
|
|||
|
||||
use C4::Context;
|
||||
|
||||
my ( $help, $verbose, $before );
|
||||
my ( $help, $verbose, $before, $confirm );
|
||||
my $result = GetOptions(
|
||||
'h|help' => \$help,
|
||||
'v|verbose' => \$verbose,
|
||||
'b|before:s' => \$before,
|
||||
) || pod2usage(1);
|
||||
'c|confirm' => \$confirm,
|
||||
) || pod2usage(0);
|
||||
|
||||
if ($help) {
|
||||
pod2usage(0);
|
||||
|
@ -60,6 +61,10 @@ if ( $statistics->count && $existing_pseudo_stats ) {
|
|||
exit unless uc($continue) eq 'Y';
|
||||
}
|
||||
|
||||
if ( !$confirm ) {
|
||||
print $statistics->count() . " statistics would have been pseudonymized\n" if $verbose;
|
||||
exit 1;
|
||||
}
|
||||
|
||||
while ( my $statistic = $statistics->next ) {
|
||||
$statistic->pseudonymize();
|
||||
|
@ -94,6 +99,10 @@ Verbose mode.
|
|||
|
||||
This option allows for specifying a date to pseudonmyize before. Useful if you have enabled pseudonymization and want to pseudonymize transactions before that date. If not passed all statistics before current time will be pseudonymized.
|
||||
|
||||
=item B<-c|--confirm>
|
||||
|
||||
Without this parameter the script will be run in test mode and no changes will be made.
|
||||
|
||||
=back
|
||||
|
||||
=head1 AUTHOR
|
||||
|
|
Loading…
Reference in a new issue