From 89c0a28167787a1a157c33961901f5e2eb175d3f Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 27 Mar 2024 12:19:34 +0000 Subject: [PATCH] Bug 36438: Check object for calling metadata Content-Type: text/plain; charset=utf-8 Resolve: Can't call method "metadata" on an undefined value at catalogue/MARCdetail.pl line 93 The proceeding lines check for $record and respond appropriately. Test plan: Call catalogue/MARCdetail.pl with an unexisting biblionumber. Signed-off-by: Marcel de Rooy --- catalogue/MARCdetail.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/catalogue/MARCdetail.pl b/catalogue/MARCdetail.pl index 3f5e03a090..0b7f470b22 100755 --- a/catalogue/MARCdetail.pl +++ b/catalogue/MARCdetail.pl @@ -90,7 +90,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( ); my $biblio_object = Koha::Biblios->find( $biblionumber ); # FIXME Should replace $biblio -my $record = $biblio_object->metadata->record({ embed_items => 1 }); +my $record; +$record = $biblio_object->metadata->record({ embed_items => 1 }) if $biblio_object; if ( not defined $record ) { # biblionumber invalid -> report and exit -- 2.30.2