From 5078cc6f5c83532287ba9d07d0e215f56441308e Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 15 Nov 2018 10:17:17 +0100 Subject: [PATCH] Bug 21842: test Koha::ItemType in defined in transfers to receive Like Bug 19194 calls on $itemtype->value must test the object is defined. This patch fixes circ/transferstoreceive.pl Test plan : 1) Define system preference item-level_itypes on "specific item" 2) Define in framework a subfield of items field : mapped on items.itype and not mandatory 3) Create an item without value on this subfield 4) Create a transfers to receive on this item 5) Go to Circulation > Transfers to receive 6) Without patch you get the error : Can't call method "description" on an undefined value 7) With patch you see the itemtype description --- circ/transferstoreceive.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circ/transferstoreceive.pl b/circ/transferstoreceive.pl index a727dda165..e6f4745982 100755 --- a/circ/transferstoreceive.pl +++ b/circ/transferstoreceive.pl @@ -95,7 +95,7 @@ while ( my $library = $libraries->next ) { my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype ); $getransf{'datetransfer'} = $num->{'datesent'}; - $getransf{'itemtype'} = $itemtype->description; # FIXME Should not it be translated_description? + $getransf{'itemtype'} = defined $itemtype ? $itemtype->description : q{}; # FIXME Should not it be translated_description? %getransf = ( %getransf, title => $biblio->title, -- 2.17.1