From cc316db0b1c35594e81a93daec0d16fcc2aee2cb 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 Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart --- 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 58680fb3d7..07df6ac83b 100644 --- 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.39.5