Bugzilla – Attachment 32295 Details for
Bug 13018
Static fine should apply only once for a given borrower
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13018 : Static fine should be charged only once
Bug-13018--Static-fine-should-be-charged-only-once.patch (text/plain), 2.51 KB, created by
Chris Cormack
on 2014-10-14 11:34:40 UTC
(
hide
)
Description:
Bug 13018 : Static fine should be charged only once
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2014-10-14 11:34:40 UTC
Size:
2.51 KB
patch
obsolete
>From 3d917e8ed07fffad22a7482ef77759d4e79f3ccf Mon Sep 17 00:00:00 2001 >From: Sophie Meynieux <sophie.meynieux@biblibre.com> >Date: Wed, 1 Oct 2014 14:16:48 +0200 >Subject: [PATCH] Bug 13018 : Static fine should be charged only once > >Test plan (see Bug 6858 for using staticfine.pl) : > >For a user (of a given category and library) with several overdues, launch the script : > >staticfines.pl --category CAT,AMOUNT --library LIB --delay DELAY > >Then, check that the user has been charged of AMOUNT if the due date of the most late item plus the delay is *before* today. > >One day later, re-execute the script with the same parameters and check that the fine has not been charged twice. > >Without patch, the fine is charged twice, with patch the user already charged is skipped (see output in debug mode) > >Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> >--- > C4/Overdues.pm | 11 +++++++++-- > misc/cronjobs/staticfines.pl | 2 +- > 2 files changed, 10 insertions(+), 3 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 31314d6..185584f 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -655,9 +655,16 @@ sub GetFine { > my $dbh = C4::Context->dbh(); > my $query = q|SELECT sum(amountoutstanding) as fineamount FROM accountlines > where accounttype like 'F%' >- AND amountoutstanding > 0 AND itemnumber = ? AND borrowernumber=?|; >+ AND amountoutstanding > 0 AND borrowernumber=?|; >+ my @query_param; >+ push @query_param, $borrowernumber; >+ if (defined $itemnum ) >+ { >+ $query .= " AND itemnumber=?"; >+ push @query_param, $itemnum; >+ } > my $sth = $dbh->prepare($query); >- $sth->execute( $itemnum, $borrowernumber ); >+ $sth->execute( @query_param ); > my $fine = $sth->fetchrow_hashref(); > if ($fine->{fineamount}) { > return $fine->{fineamount}; >diff --git a/misc/cronjobs/staticfines.pl b/misc/cronjobs/staticfines.pl >index 0d819a5..2520fc5 100755 >--- a/misc/cronjobs/staticfines.pl >+++ b/misc/cronjobs/staticfines.pl >@@ -196,7 +196,7 @@ for ( my $i = 0 ; $i < scalar(@$data) ; $i++ ) { > $amount = $catamounts{$borrower->{'categorycode'}} if (defined $catamounts{$borrower->{'categorycode'}}); > > # We check if there is already a fine for the given borrower >- my $fine = GetFine($data->[$i]->{'borrowernumber'}); >+ my $fine = GetFine(undef, $data->[$i]->{'borrowernumber'}); > if ($fine > 0) { > $debug and warn "There is already a fine for borrower " . $data->[$i]->{'borrowernumber'} . ". Nothing to do here. Skipping this borrower"; > next; >-- >1.9.1
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 13018
:
31967
|
32295
|
32425