Bug 3784: Don't fail on opac-detail.pl with invalid biblionumber
authorFrédéric Demians <f.demians@tamil.fr>
Wed, 2 Dec 2009 15:04:49 +0000 (16:04 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Thu, 3 Dec 2009 21:00:09 +0000 (22:00 +0100)
opac/opac-detail.pl

index 0fec800..7febfa0 100755 (executable)
@@ -62,6 +62,10 @@ $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHo
 $template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
 
 my $record       = GetMarcBiblio($biblionumber);
+if ( ! $record ) {
+    print $query->redirect("/cgi-bin/koha/errors/404.pl");
+    exit;
+}
 $template->param( biblionumber => $biblionumber );
 # XSLT processing of some stuff
 if (C4::Context->preference("XSLTDetailsDisplay") ) {
@@ -82,10 +86,6 @@ if (C4::Context->preference('hidelostitems')) {
 }
 my $dat = &GetBiblioData($biblionumber);
 
-if (!$dat) {
-    print $query->redirect("/cgi-bin/koha/errors/404.pl");
-    exit;
-}
 my $itemtypes = GetItemTypes();
 # imageurl:
 my $itemtype = $dat->{'itemtype'};