From 33b0a26a5bf32de1ffead556269d8f8e27289521 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 8 Dec 2017 14:57:15 -0300 Subject: [PATCH] Bug 19319: Only fetch the record if it exists We already know if the bibliographic record exists (404 redirect), we can avoid unecessary fetches Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens --- opac/opac-ISBDdetail.pl | 5 +++-- opac/opac-detail.pl | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 7898e80609..7af74104f3 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -71,8 +71,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( my $biblionumber = $query->param('biblionumber'); $biblionumber = int($biblionumber); -my $biblio = Koha::Biblios->find( $biblionumber ); - # get biblionumbers stored in the cart if(my $cart_list = $query->cookie("bib_list")){ my @cart_list = split(/\//, $cart_list); @@ -102,6 +100,9 @@ if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); exit; } + +my $biblio = Koha::Biblios->find( $biblionumber ); + my $framework = GetFrameworkCode( $biblionumber ); my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy', diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 29f371e152..2e4afdd0a4 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -78,7 +78,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0; $biblionumber = int($biblionumber); -my $biblio = Koha::Biblios->find( $biblionumber ); my @all_items = GetItemsInfo($biblionumber); my @hiddenitems; @@ -96,6 +95,8 @@ if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early exit; } + +my $biblio = Koha::Biblios->find( $biblionumber ); my $framework = &GetFrameworkCode( $biblionumber ); my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy', -- 2.39.5