From 875f4552be8a5ec33546a1b48a38316c05b77ef1 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Sat, 22 Dec 2007 19:25:33 -0600 Subject: [PATCH] circ: do not crash when 'returning' item that was not issued When attempting to return an item that was not actually on loan, would crash because GetItemIssue did not return biblionumber in hash. Add call to get biblionumber directly. Signed-off-by: Joshua Ferraro --- C4/Circulation.pm | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 85e47b070c..117e0d04ce 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1137,6 +1137,7 @@ sub AddReturn { # get information on item my $iteminformation = GetItemIssue( GetItemnumberFromBarcode($barcode)); + my $biblio = GetBiblioFromItemNumber($iteminformation->{'itemnumber'}); unless ($iteminformation->{'itemnumber'} ) { $messages->{'BadBarcode'} = $barcode; $doreturn = 0; @@ -1189,9 +1190,9 @@ sub AddReturn { 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 ); + my $record = GetMarcItem( $biblio->{'biblionumber'}, $iteminformation->{'itemnumber'} ); + my $frameworkcode = GetFrameworkCode( $biblio->{'biblionumber'} ); + ModItemInMarc( $record, $biblio->{'biblionumber'}, $iteminformation->{'itemnumber'}, $frameworkcode ); if ($iteminformation->{borrowernumber}){ ($borrower) = C4::Members::GetMemberDetails( $iteminformation->{borrowernumber}, 0 ); -- 2.39.2