From 47cae8b59a9d08cd89548d6c5fb550744ec313be Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 6 May 2025 21:53:35 +0000 Subject: [PATCH] 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 --- misc/cronjobs/anonymize_last_borrowers.pl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/misc/cronjobs/anonymize_last_borrowers.pl b/misc/cronjobs/anonymize_last_borrowers.pl index 06eef8601df..5e6b809c2fe 100755 --- a/misc/cronjobs/anonymize_last_borrowers.pl +++ b/misc/cronjobs/anonymize_last_borrowers.pl @@ -36,6 +36,7 @@ use C4::Log; sub usage { print STDERR < \$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(); -- 2.39.5