From 71454b4263f6e883f7e6246de06291531a7d5757 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 15 Jul 2016 10:18:13 -0300 Subject: [PATCH] Bug 2389: Add --test switch to overdue_notices.pl This patch adds the --test option switch to the overdue_notices.pl script so it can be ran without doing any actual action. To test: - Have a patron with overdue items (simulate a checkout for a past date. Note it implies that the circ rules are defined so the patron is overdue) - Run: $ sudo koha-shell kohadev koha-dev$ misc/cronjobs/overdue_notices.pl --test => SUCCESS: The script is ran but the patron isn't debarred and no notice messages are queued. Signed-off-by: Chris Cormack Signed-off-by: Barton Chittenden Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall --- misc/cronjobs/overdue_notices.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/misc/cronjobs/overdue_notices.pl b/misc/cronjobs/overdue_notices.pl index 050882df89..0b9d62365a 100755 --- a/misc/cronjobs/overdue_notices.pl +++ b/misc/cronjobs/overdue_notices.pl @@ -281,6 +281,7 @@ my $man = 0; my $verbose = 0; my $nomail = 0; my $MAX = 90; +my $test_mode = 0; my @branchcodes; # Branch(es) passed as parameter my @emails_to_use; # Emails to use for messaging my @emails; # Emails given in command-line parameters @@ -307,6 +308,7 @@ GetOptions( 'itemscontent=s' => \$itemscontent, 'list-all' => \$listall, 't|triggered' => \$triggered, + 'test' => \$test_mode, 'date=s' => \$date_input, 'borcat=s' => \@myborcat, 'borcatout=s' => \@myborcatout, @@ -315,7 +317,7 @@ GetOptions( pod2usage(1) if $help; pod2usage( -verbose => 2 ) if $man; -cronlogaction(); +cronlogaction() unless $test_mode; if ( defined $csvfilename && $csvfilename =~ /^-/ ) { warn qq(using "$csvfilename" as filename, that seems odd); @@ -600,7 +602,7 @@ END_SQL type => 'OVERDUES', comment => "OVERDUES_PROCESS " . output_pref( dt_from_string() ), } - ); + ) unless $test_mode; $verbose and warn "debarring $borr\n"; } my @params = ($borrowernumber); @@ -757,7 +759,7 @@ END_SQL from_address => $admin_email_address, to_address => join(',', @emails_to_use), } - ); + ) unless $test_mode; # A print notice should be sent only once per overdue level. # Without this check, a print could be sent twice or more if the library checks sms and email and print and the patron has no email or sms number. $print_sent = 1 if $effective_mtt eq 'print'; -- 2.39.5