Bugzilla – Attachment 11838 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
Bug-8420-tool-statisticfines.pl-and-hourly-loan.patch (text/plain), 2.98 KB, created by
Fridolin Somers
on 2012-08-27 07:58:06 UTC
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2012-08-27 07:58:06 UTC
Size:
2.98 KB
patch
obsolete
>From bce97376425d6bae6a4d07644b6ab7084d19e710 Mon Sep 17 00:00:00 2001 >From: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >Date: Mon, 27 Aug 2012 09:43:04 +0200 >Subject: [PATCH] Bug 8420: tool statisticfines.pl and hourly loan > >--- > 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 098fae6..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, $unitcounttotal, $unitcount ) = 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