Bugzilla – Attachment 51554 Details for
Bug 15538
Use Koha::Logger in longoverdue.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
bug_15538: Koha::Logger in longoverdue.pl
bug15538-KohaLogger-in-longoverduepl.patch (text/plain), 4.29 KB, created by
Srdjan Jankovic
on 2016-05-17 00:33:48 UTC
(
hide
)
Description:
bug_15538: Koha::Logger in longoverdue.pl
Filename:
MIME Type:
Creator:
Srdjan Jankovic
Created:
2016-05-17 00:33:48 UTC
Size:
4.29 KB
patch
obsolete
>From 652652dcdcfaf62903ba97a9dffdf8f3ddb4423c Mon Sep 17 00:00:00 2001 >From: Srdjan <srdjan@catalyst.net.nz> >Date: Tue, 9 Dec 2014 20:32:31 +1300 >Subject: [PATCH] bug_15538: Koha::Logger in longoverdue.pl > >* Removed --verbose option and replaved verbose prints with > $logger->info() >--- > 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 a0907a2..34ab1d0 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::Patrons; >+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->info( >+ 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::Patrons->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->info( >+ 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); >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15538
:
46470
| 51554