From 69ff3a91a5d1f06e7c7754627dd1bb625478a34d Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 9 Oct 2020 16:13:00 +0100 Subject: [PATCH] Bug 26648: Prevent explosion on missin item The item accessor in Koha::Old::Checkouts could explode given a checkout where the item had been deleted. To test 1/ Edit the issueslip notice to output some item details from the borrowers old checkouts [% FOREACH old_checkout IN borrower.old_checkouts %] [% IF old_checkout.item %] [% old_checkout.item.price %] [% END %] [% END %] 2/ Delete the item associated with an old checkout for a test patron 3/ Print the issueslip for the patron 4/ Note a server side error is triggered 5/ Apply the patch 6/ Print the slip again and note the price details for old checkouts are now displayed 7/ Signoff --- Koha/Old/Checkout.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/Old/Checkout.pm b/Koha/Old/Checkout.pm index 9dbc58e3a8..b3e3bc24cc 100644 --- a/Koha/Old/Checkout.pm +++ b/Koha/Old/Checkout.pm @@ -40,6 +40,7 @@ Return the checked out item sub item { my ( $self ) = @_; my $item_rs = $self->_result->item; + return unless $item_rs; return Koha::Item->_new_from_dbic( $item_rs ); } -- 2.20.1