From 6e5fb1395c8310c0b80306ef8ae455e0c4a74218 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joonas=20Kylm=C3=A4l=C3=A4?= Date: Tue, 15 Sep 2020 19:39:07 +0300 Subject: [PATCH] Bug 20447: (follow-up) Prevent internal server error with Attach item feature If one tried to use the "Edit -> Attach item" feature in biblio detail.pl page then the following error would come if the item was not attached to any holdings record: "DBIC result _type isn't of the _type Holding" This fix prevents the error by skipping the creation of Holding object if the result set is empty. --- Koha/Item.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/Item.pm b/Koha/Item.pm index 7f3d2badca..4a50d0a59e 100644 --- a/Koha/Item.pm +++ b/Koha/Item.pm @@ -379,6 +379,7 @@ Return the holdings record of this item sub holding { my ( $self ) = @_; my $holding_rs = $self->_result->holding; + return unless $holding_rs; return Koha::Holding->_new_from_dbic( $holding_rs ); } -- 2.25.1