* Removed --verbose option and replaved verbose prints with $logger->debug() --- misc/cronjobs/longoverdue.pl | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/misc/cronjobs/longoverdue.pl b/misc/cronjobs/longoverdue.pl index b73d31f..985edb5 100755 --- a/misc/cronjobs/longoverdue.pl +++ b/misc/cronjobs/longoverdue.pl @@ -40,9 +40,10 @@ use Getopt::Long; use C4::Log; use Pod::Usage; use Koha::Borrowers; +use Koha::Logger; my $lost; # key=lost value, value=num days. -my ($charge, $verbose, $confirm, $quiet); +my ($charge, $confirm, $quiet); my $endrange = 366; my $mark_returned = 0; my $borrower_category = []; @@ -55,7 +56,6 @@ GetOptions( 'lost=s%' => \$lost, 'c|charge=s' => \$charge, 'confirm' => \$confirm, - 'v|verbose' => \$verbose, 'quiet' => \$quiet, 'maxdays=s' => \$endrange, 'mark-returned' => \$mark_returned, @@ -95,7 +95,7 @@ if ( $list_categories ) { =head1 SYNOPSIS longoverdue.pl [ --help | -h | --man | --list-categories ] - longoverdue.pl --lost | -l DAYS=LOST_CODE [ --charge | -c CHARGE_CODE ] [ --verbose | -v ] [ --quiet ] + longoverdue.pl --lost | -l DAYS=LOST_CODE [ --charge | -c CHARGE_CODE ] [ --quiet ] [ --maxdays MAX_DAYS ] [ --mark-returned ] [ --category BORROWER_CATEGORY ] ... [ --skip-category BORROWER_CATEGORY ] ... [ --commit ] @@ -123,10 +123,6 @@ This option takes the form of n=lv, where n is num days overdue, and lv is the l This specifies what lost value triggers Koha to charge the account for the lost item. Replacement costs are not charged if this is not specified. -=item B<--verbose | -v> - -verbose. - =item B<--confirm> confirm. without this option, the script will report the number of affected items and return without modifying any records. @@ -194,6 +190,8 @@ near-term release, so this script is not intended to have a long lifetime. =cut +my $logger = Koha::Logger->get({category => 'longoverdue'}); + # FIXME: We need three pieces of data to operate: # ~ lower bound (number of days), # ~ upper bound (number of days), @@ -223,7 +221,6 @@ if ( ! defined($charge) ) { } } unless ($confirm) { - $verbose = 1; # If you're not running it for real, then the whole point is the print output. print "### TEST MODE -- NO ACTIONS TAKEN ###\n"; } @@ -294,10 +291,10 @@ foreach my $startrange (sort keys %$lost) { if( my $lostvalue = $lost->{$startrange} ) { my ($date1) = bounds($startrange); my ($date2) = bounds( $endrange); - # print "\nRange ", ++$i, "\nDue $startrange - $endrange days ago ($date2 to $date1), lost => $lostvalue\n" if($verbose); - $verbose and - printf "\nRange %s\nDue %3s - %3s days ago (%s to %s), lost => %s\n", ++$i, - $startrange, $endrange, $date2, $date1, $lostvalue; + $logger->debug( + sprintf "\nRange %s\nDue %3s - %3s days ago (%s to %s), lost => %s", + ++$i, $startrange, $endrange, $date2, $date1, $lostvalue + ); $sth_items->execute($startrange, $endrange, $lostvalue); $count=0; ITEM: while (my $row=$sth_items->fetchrow_hashref) { @@ -305,7 +302,10 @@ foreach my $startrange (sort keys %$lost) { my $category = uc Koha::Borrowers->find( $row->{borrowernumber} )->categorycode(); next ITEM unless ( $category_to_process{ $category } ); } - printf ("Due %s: item %5s from borrower %5s to lost: %s\n", $row->{date_due}, $row->{itemnumber}, $row->{borrowernumber}, $lostvalue) if($verbose); + $logger->debug( + sprintf "Due %s: item %5s from borrower %5s to lost: %s", + $row->{date_due}, $row->{itemnumber}, $row->{borrowernumber}, $lostvalue + ); if($confirm) { ModItem({ itemlost => $lostvalue }, $row->{'biblionumber'}, $row->{'itemnumber'}); LostItem($row->{'itemnumber'}, $mark_returned) if( $charge && $charge eq $lostvalue); -- 1.9.1 _______________________________________________ Koha-patches mailing list Koha-patches@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/