[Koha-patches] [PATCH] bug_7190: Do not reverse writeoffs when item is returned

Srdjan Jankovic srdjan at catalyst.net.nz
Tue Jan 24 04:48:18 CET 2012


---
 C4/Circulation.pm |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 0b5068c..2282d5c 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -1866,10 +1866,11 @@ sub _FixAccountForLostAndReturned {
     my $item_id        = @_ ? shift : $itemnumber;  # Send the barcode if you want that logged in the description
     my $dbh = C4::Context->dbh;
     # check for charge made for lost book
-    my $sth = $dbh->prepare("SELECT * FROM accountlines WHERE (itemnumber = ?) AND (accounttype='L' OR accounttype='Rep') ORDER BY date DESC");
+    my $sth = $dbh->prepare("SELECT * FROM accountlines WHERE itemnumber = ? AND accounttype IN ('L', 'Rep', 'W') ORDER BY date DESC");
     $sth->execute($itemnumber);
     my $data = $sth->fetchrow_hashref;
     $data or return;    # bail if there is nothing to do
+    $data->{accounttype} eq 'W' and return;    # Written off
 
     # writeoff this amount
     my $offset;
-- 
1.6.5



More information about the Koha-patches mailing list