From 54bdcaef66ef6b121918b8922020a50d1d0177c8 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 6 Nov 2023 13:11:49 +0000 Subject: [PATCH] Bug 35266: Fix biblio check in opac-MARCdetail We should check before retrieving metadata. Test plan; Try /cgi-bin/koha/opac-MARCdetail?biblionumber=X Replace X by a not-existing biblionumber. Verify that you get a 404 error page. Signed-off-by: Marcel de Rooy Signed-off-by: David Nind JD amended patch: Use ternary op Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- opac/opac-MARCdetail.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 9b85bbbe1e..0829341d73 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -92,8 +92,8 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my $patron = Koha::Patrons->find($loggedinuser); my $biblio = Koha::Biblios->find($biblionumber); -my $record = $biblio->metadata->record; +my $record = $biblio ? $biblio->metadata->record : undef; if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); exit; -- 2.39.5