From b18d979f636b88fb672bac34bdda34584065d36d 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 Content-Type: text/plain; charset=utf-8 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 --- 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 730f60283d..65448a03b7 100755 --- a/opac/opac-request-article.pl +++ b/opac/opac-request-article.pl @@ -41,6 +41,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.11.0