[Koha-patches] [PATCH 5/5] Stopping an internal error being thrown if an invalid biblionumber is passed to detail.pl Redirects to the 404 page like it supposed to now instead

Chris Cormack chrisc at catalyst.net.nz
Tue Nov 17 04:36:46 CET 2009


---
 catalogue/detail.pl |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/catalogue/detail.pl b/catalogue/detail.pl
index 6c2afdc..5ec69a7 100755
--- a/catalogue/detail.pl
+++ b/catalogue/detail.pl
@@ -57,6 +57,11 @@ my $fw = GetFrameworkCode($biblionumber);
 my $marcflavour      = C4::Context->preference("marcflavour");
 my $record           = GetMarcBiblio($biblionumber);
 
+unless (defined($record)) {
+    print $query->redirect("/cgi-bin/koha/errors/404.pl");
+	exit;
+}
+
 # some useful variables for enhanced content;
 # in each case, we're grabbing the first value we find in
 # the record and normalizing it
@@ -72,10 +77,7 @@ $template->param(
     normalized_isbn => $isbn,
 );
 
-unless (defined($record)) {
-    print $query->redirect("/cgi-bin/koha/errors/404.pl");
-	exit;
-}
+
 
 my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
 my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
-- 
1.6.3.3




More information about the Koha-patches mailing list