From 7734949c73460ebad8a7a73473e4d925ad844b15 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 20 Dec 2017 19:10:44 -0300 Subject: [PATCH] Bug 19712: Fix test mode for delete_records_via_leader.pl Test plan: perl misc/cronjobs/delete_records_via_leader.pl => Should display a warning perl misc/cronjobs/delete_records_via_leader.pl --test => Should not display a warning and script should not apply changes perl misc/cronjobs/delete_records_via_leader.pl --confirm => Should not display a warning and script should apply changes --- misc/cronjobs/delete_records_via_leader.pl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/misc/cronjobs/delete_records_via_leader.pl b/misc/cronjobs/delete_records_via_leader.pl index b4d87810be..291ab6bedf 100755 --- a/misc/cronjobs/delete_records_via_leader.pl +++ b/misc/cronjobs/delete_records_via_leader.pl @@ -53,7 +53,14 @@ GetOptions( 'h|help' => \$help, ); -if ( $help || !$confirm ) { +pod2usage(q|--test and --confirm cannot be specified together|) if $test and $confirm; + +unless ( $confirm or $test ) { + warn "Running in test mode as --confirm is not passed\n"; + $test = 1; +} + +if ( $help ) { say qq{ delete_records_via_leader.pl - Attempt to delete any MARC records where the leader character 5 equals 'd' usage: delete_records_via_leader.pl --confirm --verbose [--test] -- 2.11.0