Bugzilla – Attachment 12271 Details for
Bug 8420
tool statisticfines.pl(bz 6858) and hourly loan(bz5549)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch (for 3.8.X)
Bug-8420-tool-statisticfines.pl-bz-6858-and-hourly-l_v3_8.patch (text/plain), 3.00 KB, created by
Fridolin Somers
on 2012-09-17 11:06:29 UTC
(
hide
)
Description:
Proposed patch (for 3.8.X)
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2012-09-17 11:06:29 UTC
Size:
3.00 KB
patch
obsolete
>From 7d077fbea36fae26d28ef1153b1ece33ae0c1598 Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Mon, 17 Sep 2012 13:03:17 +0200 >Subject: [PATCH] Bug 8420: tool statisticfines.pl(bz 6858) and hourly > loan(bz5549) > >--- > misc/cronjobs/staticfines.pl | 23 ++++++++++++++++++----- > 1 file changed, 18 insertions(+), 5 deletions(-) > >diff --git a/misc/cronjobs/staticfines.pl b/misc/cronjobs/staticfines.pl >index 35264dc..b94ff2a 100755 >--- a/misc/cronjobs/staticfines.pl >+++ b/misc/cronjobs/staticfines.pl >@@ -45,6 +45,7 @@ use C4::Biblio; > use C4::Debug; # supplying $debug and $cgi_debug > use Getopt::Long; > use List::MoreUtils qw/none/; >+use Koha::DateUtils; > > my $help = 0; > my $verbose = 0; >@@ -122,12 +123,19 @@ INIT { > "Delimiter: '$delim'\n"; > } > $debug and (defined $borrowernumberlimit) and print "--borrower limitation: borrower $borrowernumberlimit\n"; >-my $data = (defined $borrowernumberlimit) ? checkoverdues($borrowernumberlimit) : Getoverdues(); >+my ($numOverdueItems, $data); >+if (defined $borrowernumberlimit) { >+ ($numOverdueItems, $data) = checkoverdues($borrowernumberlimit); >+} else { >+ $data = Getoverdues(); >+ $numOverdueItems = scalar @$data; >+} > my $overdueItemsCounted = 0; > my %calendars = (); > $today = C4::Dates->new(); > $today_iso = $today->output('iso'); >-$today_days = Date_to_Days( split( /-/, $today_iso ) ); >+my ($tyear, $tmonth, $tday) = split( /-/, $today_iso ); >+$today_days = Date_to_Days( $tyear, $tmonth, $tday ); > > for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { > my $datedue; >@@ -167,7 +175,7 @@ for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { > $calendars{$branchcode} = C4::Calendar->new( branchcode => $branchcode ); > } > $calendar = $calendars{$branchcode}; >- my $isHoliday = $calendar->isHoliday( split '/', $today->output('metric') ); >+ my $isHoliday = $calendar->isHoliday( $tday, $tmonth, $tyear ); > > # Reassing datedue_days if -delay specified in commandline > $bigdebug and warn "Using commandline supplied delay : $delay" if ($delay); >@@ -176,7 +184,13 @@ for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { > ( $datedue_days <= $today_days ) or next; # or it's not overdue, right? > > $overdueItemsCounted++; >- my ( $amount, $type, $daycounttotal, $daycount ) = CalcFine( $data->[$i], $borrower->{'categorycode'}, $branchcode, undef, undef, $datedue, $today ); >+ my ( $amount, $type, $unitcounttotal, $unitcount ) = CalcFine( >+ $data->[$i], >+ $borrower->{'categorycode'}, >+ $branchcode, >+ dt_from_string($datedue->output('iso')), >+ dt_from_string($today->output('iso')), >+ ); > > # Reassign fine's amount if specified in command-line > $amount = $catamounts{$borrower->{'categorycode'}} if (defined $catamounts{$borrower->{'categorycode'}}); >@@ -224,7 +238,6 @@ for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { > } > } > >-my $numOverdueItems = scalar(@$data); > if ($verbose) { > print <<EOM; > Fines assessment -- $today_iso >-- >1.7.9.5 >
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 8420
:
11838
|
11844
| 12271