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 <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2017-12-08 14:57:15 -03:00 committed by Chris Cormack
parent e18d96abab
commit 8e7e2e52c2
2 changed files with 5 additions and 3 deletions

View File

@ -70,8 +70,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);
@ -99,6 +97,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',

View File

@ -72,7 +72,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;
@ -90,6 +89,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',