[Koha-patches] [PATCH] Bug 3784, handling invalid biblionumbers better in opac-detail.pl

Chris Cormack chrisc at catalyst.net.nz
Fri Nov 20 02:11:49 CET 2009


If xslt was on, an internal server would be thrown if called with an
invalid biblionumber, it now redirects to a 404 page instead.

Next step fix the 404 page to send the right headers.
---
 opac/opac-detail.pl |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index c3b104b..9462567 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -68,6 +68,11 @@ my $record       = GetMarcBiblio($biblionumber);
 $template->param( biblionumber => $biblionumber );
 # XSLT processing of some stuff
 if (C4::Context->preference("XSLTDetailsDisplay") ) {
+    unless ($record){
+	# If we don't have a record, get the hell out, or we will internal server error
+	print $query->redirect("/cgi-bin/koha/errors/404.pl");	
+	exit;
+    }
     $template->param(
         'XSLTBloc' => XSLTParse4Display($biblionumber, $record, 'Detail') );
 }
-- 
1.6.3.3




More information about the Koha-patches mailing list