From f1acf164b9a0aa0fb5168fb0820f4566873232ab Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 9 Apr 2021 11:45:03 -0400 Subject: [PATCH] Bug 27049: (QA follow-up) Add short params, replace warn with say Signed-off-by: Kyle M Hall --- misc/cronjobs/writeoff_debts.pl | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/misc/cronjobs/writeoff_debts.pl b/misc/cronjobs/writeoff_debts.pl index da64f010a4..ae2ee9c0de 100755 --- a/misc/cronjobs/writeoff_debts.pl +++ b/misc/cronjobs/writeoff_debts.pl @@ -1,6 +1,7 @@ #!/usr/bin/perl use Modern::Perl; +use feature 'say'; use Getopt::Long; use Pod::Usage; @@ -12,12 +13,12 @@ use Koha::Script -cron; my ( $help, $verbose, @type, $added, $file, $confirm ); GetOptions( - 'h|help' => \$help, - 'v|verbose' => \$verbose, - 'type:s' => \@type, - 'added_before:s' => \$added, - 'f|file:s' => \$file, - 'c|confirm' => \$confirm, + 'h|help' => \$help, + 'v|verbose+' => \$verbose, + 't|type:s' => \@type, + 'ab|added_before:s' => \$added, + 'f|file:s' => \$file, + 'c|confirm' => \$confirm, ); @type = split( /,/, join( ',', @type ) ); @@ -58,10 +59,10 @@ if ( $verbose ) { } while ( my $line = $lines->next ) { - warn "Skipping " . $line->accountlines_id . "; Not a debt" and next - if $line->is_credit; - warn "Skipping " . $line->accountlines_id . "; Is a PAYOUT" and next - if $line->debit_type_code eq 'PAYOUT'; + say "Skipping " . $line->accountlines_id . "; Not a debt" and next + if $line->is_credit && $verbose > 1; + say "Skipping " . $line->accountlines_id . "; Is a PAYOUT" and next + if $line->debit_type_code eq 'PAYOUT' && $verbose > 1; if ($confirm) { $line->_result->result_source->schema->txn_do( @@ -107,10 +108,10 @@ while ( my $line = $lines->next ) { if ($verbose) { if ($confirm) { - print "Accountline " . $line->accountlines_id . " written off\n"; + say "Accountline " . $line->accountlines_id . " written off"; } else { - print "Accountline " . $line->accountlines_id . " will be written off\n"; + say "Accountline " . $line->accountlines_id . " will be written off"; } } } -- 2.24.3 (Apple Git-128)