From 02275b8205f2c78d6754582b0278fe22524b8c1e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 5 Feb 2020 16:03:42 +0100 Subject: [PATCH] Bug 24526: Replace commit with confirm Usually commit takes a value Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- misc/cronjobs/automatic_renewals.pl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/misc/cronjobs/automatic_renewals.pl b/misc/cronjobs/automatic_renewals.pl index 76f43d882a..b612eef0c7 100755 --- a/misc/cronjobs/automatic_renewals.pl +++ b/misc/cronjobs/automatic_renewals.pl @@ -48,7 +48,7 @@ Note that this option does not support digest yet. Print report to standard out. -=item B<--commit> +=item B<--confirm> Without this parameter no changes will be made @@ -69,12 +69,12 @@ use Koha::Checkouts; use Koha::Libraries; use Koha::Patrons; -my ( $help, $send_notices, $verbose, $commit ); +my ( $help, $send_notices, $verbose, $confirm ); GetOptions( 'h|help' => \$help, 'send-notices' => \$send_notices, 'v|verbose' => \$verbose, - 'c|commit' => \$commit, + 'c|confirm' => \$confirm, ) || pod2usage(1); pod2usage(0) if $help; @@ -83,17 +83,17 @@ cronlogaction(); my $auto_renews = Koha::Checkouts->search({ auto_renew => 1 }); my %report; -print "Test run only\n" unless $commit; +print "Test run only\n" unless $confirm; while ( my $auto_renew = $auto_renews->next ) { # CanBookBeRenewed returns 'auto_renew' when the renewal should be done by this script my ( $ok, $error ) = CanBookBeRenewed( $auto_renew->borrowernumber, $auto_renew->itemnumber ); if ( $error eq 'auto_renew' ) { if ($verbose) { - say sprintf "Issue id: %s for borrower: %s and item: %s ". ( $commit ? 'will' : 'would') . " be renewed.", + say sprintf "Issue id: %s for borrower: %s and item: %s ". ( $confirm ? 'will' : 'would') . " be renewed.", $auto_renew->issue_id, $auto_renew->borrowernumber, $auto_renew->itemnumber; } - if ($commit){ + if ($confirm){ my $date_due = AddRenewal( $auto_renew->borrowernumber, $auto_renew->itemnumber, $auto_renew->branchcode ); $auto_renew->auto_renew_error(undef)->store; } @@ -108,11 +108,11 @@ while ( my $auto_renew = $auto_renews->next ) { or $error eq 'auto_too_soon' or $error eq 'item_denied_renewal' ) { if ( $verbose ) { - say sprintf "Issue id: %s for borrower: %s and item: %s ". ( $commit ? 'will' : 'would') . " not be renewed. (%s)", + say sprintf "Issue id: %s for borrower: %s and item: %s ". ( $confirm ? 'will' : 'would') . " not be renewed. (%s)", $auto_renew->issue_id, $auto_renew->borrowernumber, $auto_renew->itemnumber, $error; } if ( not $auto_renew->auto_renew_error or $error ne $auto_renew->auto_renew_error ) { - $auto_renew->auto_renew_error($error)->store if $commit; + $auto_renew->auto_renew_error($error)->store if $confirm; push @{ $report{ $auto_renew->borrowernumber } }, $auto_renew if $error ne 'auto_too_soon'; # Do not notify if it's too soon } @@ -145,7 +145,7 @@ if ( $send_notices ) { message_transport_type => 'email', from_address => $admin_email_address, } - ) if $commit; + ) if $confirm; } } } -- 2.39.5