From 7a5e61e9167c5fc320ae6baaad50e19a40b096a9 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 27 Jul 2015 11:16:56 -0400 Subject: [PATCH] Bug 14598: (QA followup) Don't die on bad barcode Content-Type: text/plain; charset=utf-8 Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi Signed-off-by: Marcel de Rooy --- C4/Circulation.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index fb34b53..1abecce 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1849,17 +1849,17 @@ sub AddReturn { my $stat_type = 'return'; # get information on item - my $item = GetItem( undef, $barcode ) - or die "GetItem( undef, $barcode ) failed"; + my $item = GetItem( undef, $barcode ); + unless ($item) { + return ( 0, { BadBarcode => $barcode } ); # no barcode means no item or borrower. bail out. + } + my $itemnumber = $item->{ itemnumber }; my $biblio = GetBiblioData( $item->{ biblionumber } ); my $itemtype = ( C4::Context->preference("item-level_itypes") ) ? $item->{ itype } : $biblio->{ itemtype }; - unless ($itemnumber) { - return (0, { BadBarcode => $barcode }); # no barcode means no item or borrower. bail out. - } my $issue = GetItemIssue($itemnumber); if ($issue and $issue->{borrowernumber}) { $borrower = C4::Members::GetMemberDetails($issue->{borrowernumber}) -- 1.7.10.4