From 80bcbd798991eaa57bcc7b5ac8906b276fbed5bf Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 2 Dec 2013 09:30:13 +0100 Subject: [PATCH] Bug 11329: Check for MARC record existence in opac-showmarc Instead of just running as_formatted, check if GetMarcBiblio returned a reference. If you e.g. did not pass an id, return 404 instead of 500. Consistent with opac-export.pl Test plan: [1] Run opac-showmarc.pl with valid biblionumber in id parameter. [2] Remove id parameter from URL. You should get a 404 now. Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall Signed-off-by: Galen Charlton --- opac/opac-showmarc.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opac/opac-showmarc.pl b/opac/opac-showmarc.pl index 71fb804797..27ab61ca66 100755 --- a/opac/opac-showmarc.pl +++ b/opac/opac-showmarc.pl @@ -54,6 +54,10 @@ if ($importid) { else { $record =GetMarcBiblio($biblionumber); } +if(!ref $record) { + print $input->redirect("/cgi-bin/koha/errors/404.pl"); + exit; +} if ($view eq 'card' || $view eq 'html') { my $xmlrecord= $importid? $record->as_xml(): GetXmlBiblio($biblionumber); -- 2.39.5