Bugzilla – Attachment 36931 Details for
Bug 13841
Returns via backdating or SIP2 can create new fines with an amount outstanding of 0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13841 - Returns via backdating or SIP2 can create new fines with an amount outstanding of 0
Bug-13841---Returns-via-backdating-or-SIP2-can-cre.patch (text/plain), 3.41 KB, created by
Kyle M Hall (khall)
on 2015-03-16 14:18:38 UTC
(
hide
)
Description:
Bug 13841 - Returns via backdating or SIP2 can create new fines with an amount outstanding of 0
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-03-16 14:18:38 UTC
Size:
3.41 KB
patch
obsolete
>From 4c5daf4ed0ed6073ebe74ff2405d43dc60d40c9a Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 16 Mar 2015 10:16:40 -0400 >Subject: [PATCH] Bug 13841 - Returns via backdating or SIP2 can create new fines with an amount outstanding of 0 > >Due to the way AddReturn and UpdateFine work, if you pass in a return >date to AddReturn, and that item has a calculated fine of 0, Koha will >insert the 0 amount fine into accountlines. > >This is good behavior when we want to update an existing fine, but bad >behavior if there was no fine to begin with! > >Test Plan: >1) Apply the unit test patch >2) prove t/db_dependent/Circulation.t >3) Note the test fails >4) Apply this patch >5) prove t/db_dependent/Circulation.t >6) Note the test passes >--- > C4/Overdues.pm | 41 ++++++++++++++++++----------------------- > 1 files changed, 18 insertions(+), 23 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 1797923..ed8968d 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -580,29 +580,24 @@ sub UpdateFine { > # print "no update needed $data->{'amount'}" > } > } else { >- my $sth4 = $dbh->prepare( >- "SELECT title FROM biblio LEFT JOIN items ON biblio.biblionumber=items.biblionumber WHERE items.itemnumber=?" >- ); >- $sth4->execute($itemnum); >- my $title = $sth4->fetchrow; >- >-# # print "not in account"; >-# my $sth3 = $dbh->prepare("Select max(accountno) from accountlines"); >-# $sth3->execute; >-# >-# # FIXME - Make $accountno a scalar. >-# my @accountno = $sth3->fetchrow_array; >-# $sth3->finish; >-# $accountno[0]++; >-# begin transaction >- my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber); >- my $desc = ($type ? "$type " : '') . "$title $due"; # FIXEDME, avoid whitespace prefix on empty $type >- my $query = "INSERT INTO accountlines >- (borrowernumber,itemnumber,date,amount,description,accounttype,amountoutstanding,lastincrement,accountno) >- VALUES (?,?,now(),?,?,'FU',?,?,?)"; >- my $sth2 = $dbh->prepare($query); >- $debug and print STDERR "UpdateFine query: $query\nw/ args: $borrowernumber, $itemnum, $amount, $desc, $amount, $amount, $nextaccntno\n"; >- $sth2->execute($borrowernumber, $itemnum, $amount, $desc, $amount, $amount, $nextaccntno); >+ if ( $amount ) { # Don't add new fines with an amount of 0 >+ my $sth4 = $dbh->prepare( >+ "SELECT title FROM biblio LEFT JOIN items ON biblio.biblionumber=items.biblionumber WHERE items.itemnumber=?" >+ ); >+ $sth4->execute($itemnum); >+ my $title = $sth4->fetchrow; >+ >+ my $nextaccntno = C4::Accounts::getnextacctno($borrowernumber); >+ >+ my $desc = ( $type ? "$type " : '' ) . "$title $due"; # FIXEDME, avoid whitespace prefix on empty $type >+ >+ my $query = "INSERT INTO accountlines >+ (borrowernumber,itemnumber,date,amount,description,accounttype,amountoutstanding,lastincrement,accountno) >+ VALUES (?,?,now(),?,?,'FU',?,?,?)"; >+ my $sth2 = $dbh->prepare($query); >+ $debug and print STDERR "UpdateFine query: $query\nw/ args: $borrowernumber, $itemnum, $amount, $desc, $amount, $amount, $nextaccntno\n"; >+ $sth2->execute( $borrowernumber, $itemnum, $amount, $desc, $amount, $amount, $nextaccntno ); >+ } > } > # logging action > &logaction( >-- >1.7.2.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 13841
:
36930
|
36931
|
36964
|
36965
|
37085
|
37086