From 6b092f0e2784c3ea82f48fe8a6660d54a3fe6119 Mon Sep 17 00:00:00 2001 From: Srdjan Jankovic Date: Tue, 31 Jan 2012 15:36:44 +1300 Subject: [PATCH] bug_7190: Do not reverse writeoffs when item is returned Signed-off-by: Nicole C. Engard Signed-off-by: Paul Poulain --- C4/Circulation.pm | 3 ++- koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt | 2 ++ members/paycollect.pl | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 0b5068c71f..2bf5d519a0 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, accountno 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; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt index 08ee90949e..0682aea844 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt @@ -94,6 +94,7 @@ function moneyFormat(textObj) {
+ @@ -148,6 +149,7 @@ function moneyFormat(textObj) { + diff --git a/members/paycollect.pl b/members/paycollect.pl index e05a5a662b..a126e01948 100755 --- a/members/paycollect.pl +++ b/members/paycollect.pl @@ -67,6 +67,7 @@ if ( $individual || $writeoff ) { my $amount = $input->param('amount'); my $amountoutstanding = $input->param('amountoutstanding'); $accountno = $input->param('accountno'); + my $itemnumber = $input->param('itemnumber'); my $description = $input->param('description'); my $title = $input->param('title'); my $notify_id = $input->param('notify_id'); @@ -78,6 +79,7 @@ if ( $individual || $writeoff ) { amount => $amount, amountoutstanding => $amountoutstanding, title => $title, + itemnumber => $itemnumber, description => $description, notify_id => $notify_id, notify_level => $notify_level, -- 2.39.5