From fa48e204f21e72c82b557b1ac9e4ba5859b7226e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 5 Jul 2017 16:26:37 -0300 Subject: [PATCH] Bug 18260: Handle nonexistent biblionumber in imageviewer.pl Signed-off-by: Marcel de Rooy Signed-off-by: Jonathan Druart --- catalogue/imageviewer.pl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/catalogue/imageviewer.pl b/catalogue/imageviewer.pl index aa73e9dd1a..cca7304fb9 100755 --- a/catalogue/imageviewer.pl +++ b/catalogue/imageviewer.pl @@ -45,8 +45,7 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user( my $biblionumber = $query->param('biblionumber') || $query->param('bib'); my $imagenumber = $query->param('imagenumber'); my $biblio = Koha::Biblios->find( $biblionumber ); -my $itemcount = $biblio->items->count;; - +my $itemcount = $biblio ? $biblio->items->count : 0; my @items = GetItemsInfo($biblionumber); my $norequests = 1; @@ -110,7 +109,7 @@ my $count_deletedorders_using_biblio = scalar @deletedorders_using_biblio ; $template->param (countdeletedorders => $count_deletedorders_using_biblio); $biblio = Koha::Biblios->find( $biblionumber ); -my $holds = $biblio->holds; -$template->param( holdcount => $holds->count ); +my $hold_count = $biblio ? $biblio->holds->count : 0; +$template->param( holdcount => $hold_count ); output_html_with_http_headers $query, $cookie, $template->output; -- 2.39.5