[Koha-patches] [PATCH] Bug 5857: longoverdue.pl needs a quiet mode for batch runs

Ian Walls ian.walls at bywatersolutions.com
Tue Mar 29 03:06:18 CEST 2011


From: ruth at bywatersolutions.com <ruth at bywatersolutions.com>

This patch creates a --quiet flag for longoverdue that will squelch
the summary at the end of the run.  It also silences an unnecessary
warn in C4/Acounts.pm

Signed-off-by: Ian Walls <ian.walls at bywatersolutions.com>
---
 C4/Accounts.pm               |    2 +-
 misc/cronjobs/longoverdue.pl |   11 +++++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/C4/Accounts.pm b/C4/Accounts.pm
index d73fc2e..c54f7f9 100644
--- a/C4/Accounts.pm
+++ b/C4/Accounts.pm
@@ -316,7 +316,7 @@ sub chargelostitem{
         # FIXME: Log this ?
         }
         #FIXME : Should probably have a way to distinguish this from an item that really was returned.
-        warn " $issues->{'borrowernumber'}  /  $itemnumber ";
+        #warn " $issues->{'borrowernumber'}  /  $itemnumber ";
         C4::Circulation::MarkIssueReturned($issues->{borrowernumber},$itemnumber);
 	#  Shouldn't MarkIssueReturned do this?
         C4::Items::ModItem({ onloan => undef }, undef, $itemnumber);
diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl
index 5fb1ec2..651b9d2 100755
--- a/misc/cronjobs/longoverdue.pl
+++ b/misc/cronjobs/longoverdue.pl
@@ -39,7 +39,7 @@ use C4::Accounts;
 use Getopt::Long;
 
 my  $lost;  #  key=lost value,  value=num days.
-my ($charge, $verbose, $confirm);
+my ($charge, $verbose, $confirm, $quiet);
 my $endrange = 366;  # FIXME hardcoded - don't deal with anything overdue by more than this num days.
 
 GetOptions( 
@@ -47,6 +47,7 @@ GetOptions(
     'c|charge=s' => \$charge,
     'confirm'    => \$confirm,
     'verbose'    => \$verbose,
+    'quiet'      => \$quiet,
 );
 
 my $usage = << 'ENDUSAGE';
@@ -184,6 +185,8 @@ sub summarize ($$) {
     }
 }
 
-print "\n### LONGOVERDUE SUMMARY ###";
-summarize (\@report, 1);
-print "\nTOTAL: $total items\n";
+if (!$quiet){
+    print "\n### LONGOVERDUE SUMMARY ###";
+    summarize (\@report, 1);
+    print "\nTOTAL: $total items\n";
+}
-- 
1.5.6.5



More information about the Koha-patches mailing list