From d9cfae182f74cdd7bcc2c710881fb941bb06de09 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 20 Dec 2007 13:34:47 -0600 Subject: [PATCH] Fix to update onloan to 0 even if the item isnt out to a borrower Bug 1681 Signed-off-by: Joshua Ferraro --- C4/Circulation.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 6c9da55f6e..85e47b070c 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1186,16 +1186,16 @@ sub AddReturn { $iteminformation->{'holdingbranch'} = C4::Context->userenv->{'branch'}; } ModDateLastSeen( $iteminformation->{'itemnumber'} ); + my $sth = $dbh->prepare("UPDATE items SET onloan = NULL where itemnumber = ?"); + $sth->execute($iteminformation->{'itemnumber'}); + $sth->finish(); + my $record = GetMarcItem( $iteminformation->{'biblionumber'}, $iteminformation->{'itemnumber'} ); + my $frameworkcode = GetFrameworkCode( $iteminformation->{'biblionumber'} ); + ModItemInMarc( $record, $iteminformation->{'biblionumber'}, $iteminformation->{'itemnumber'}, $frameworkcode ); + if ($iteminformation->{borrowernumber}){ - my $sth = $dbh->prepare("UPDATE items SET onloan = NULL where itemnumber = ?"); - $sth->execute($iteminformation->{'itemnumber'}); - $sth->finish(); - my $record = GetMarcItem( $iteminformation->{'biblionumber'}, $iteminformation->{'itemnumber'} ); - my $frameworkcode = GetFrameworkCode( $iteminformation->{'biblionumber'} ); - ModItemInMarc( $record, $iteminformation->{'biblionumber'}, $iteminformation->{'itemnumber'}, $frameworkcode ); - } - ($borrower) = C4::Members::GetMemberDetails( $iteminformation->{borrowernumber}, 0 ); - + ($borrower) = C4::Members::GetMemberDetails( $iteminformation->{borrowernumber}, 0 ); + } # fix up the accounts..... if ( $iteminformation->{'itemlost'} ) { $messages->{'WasLost'} = 1; -- 2.39.5