From 1bf5450514b73122dbcc4d19abdbf6fccf3aeef5 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 15 Nov 2018 09:53:13 +0100 Subject: [PATCH] Bug 21842: test Koha::ItemType in defined in patron summary print Like Bug 19194 calls on $itemtype->value must test the object is defined. This patch fixes members/summary-print.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) Go on a patron page 5) Checkout this item 6) Click on "Print" > "Print summary" 7) Without patch you get the error : Can't call method "description" on an undefined value 8) With patch you see the itemtype description --- members/summary-print.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/members/summary-print.pl b/members/summary-print.pl index 352b49755e..52d9993c81 100755 --- a/members/summary-print.pl +++ b/members/summary-print.pl @@ -94,7 +94,7 @@ sub build_issue_data { GetIssuingCharges( $checkout->{itemnumber}, $borrowernumber ); $itemtype = Koha::ItemTypes->find( $itemtype ); - $checkout->{itemtype_description} = $itemtype->description; #FIXME Should not it be translated_description + $checkout->{itemtype_description} = defined $itemtype ? $itemtype->description : q{}; #FIXME Should not it be translated_description $checkout->{charge} = sprintf( "%.2f", $charge ); # TODO Should be done in the template using Price -- 2.17.1