From 19d1171175aec384166e2aea74eed3147378bb1b Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 9 Apr 2021 07:39:49 +0000 Subject: [PATCH] Bug 20310: (follow-up) Check if biblio exists; 755 host_record.t In order to prevent an error like: Can't call method "host_record" on an undefined value at opac/opac-request-article.pl Also chmod's host_record.t to 755 (File must have the exec flag) Test plan: Change the URL so that the biblionumber does not exist. Signed-off-by: Marcel de Rooy Signed-off-by: Martin Renvoize --- opac/opac-request-article.pl | 4 ++++ t/db_dependent/Koha/Biblio/host_record.t | 0 2 files changed, 4 insertions(+) mode change 100644 => 100755 t/db_dependent/Koha/Biblio/host_record.t diff --git a/opac/opac-request-article.pl b/opac/opac-request-article.pl index 4291fd2571..eb50d8f0da 100755 --- a/opac/opac-request-article.pl +++ b/opac/opac-request-article.pl @@ -40,6 +40,10 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( my $action = $cgi->param('action') || q{}; my $biblionumber = $cgi->param('biblionumber'); my $biblio = Koha::Biblios->find($biblionumber); +if( !$biblio ) { + print $cgi->redirect("/cgi-bin/koha/errors/404.pl"); + exit; +} if ( $action eq 'create' ) { my $branchcode = $cgi->param('branchcode'); diff --git a/t/db_dependent/Koha/Biblio/host_record.t b/t/db_dependent/Koha/Biblio/host_record.t old mode 100644 new mode 100755 -- 2.20.1