Bug 15730 - 500 error on returns.pl if barcode doesn't exist

If a librarian enters a barcode that does not match an item in the
database, a 500 error will be displayed instead of the "No item with
barcode" message.

Test Plan:
1) Enter an invalid barcode on returns.pl
2) Note the 500 error
3) Apply this patch
4) Repeat setp 1
5) Note the "No item with barcode" message

Signed-off-by: Aleisha <aleishaamohia@hotmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
This commit is contained in:
Kyle Hall 2016-02-03 15:10:30 +00:00 committed by Brendan Gallagher
parent 0277c545b0
commit 27231db75d

View file

@ -266,7 +266,7 @@ if ($barcode) {
# Check if we should display a checkin message, based on the the item
# type of the checked in item
my $itemtype = Koha::ItemTypes->find( $biblio->{'itemtype'} );
if ( $itemtype->checkinmsg ) {
if ( $itemtype && $itemtype->checkinmsg ) {
$template->param(
checkinmsg => $itemtype->checkinmsg,
checkinmsgtype => $itemtype->checkinmsgtype,
@ -274,7 +274,7 @@ if ($barcode) {
}
# make sure return branch respects home branch circulation rules, default to homebranch
my $hbr = GetBranchItemRule($biblio->{'homebranch'}, $itemtype->itemtype)->{'returnbranch'} || "homebranch";
my $hbr = GetBranchItemRule($biblio->{'homebranch'}, $itemtype ? $itemtype->itemtype : undef )->{'returnbranch'} || "homebranch";
my $returnbranch = $biblio->{$hbr} ;
$template->param(