From 420f6e07e2df392019d68f487402bc33b7620987 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 13 Jun 2018 07:40:19 +0300 Subject: [PATCH] Bug 20927: moredetail.pl crash on nonexistent biblionumber moredetail.pl crashes when trying to view a nonexistent biblionumber. The case should be handled like it is done in detail.pl. Signed-off-by: Pasi Kallinen --- catalogue/moredetail.pl | 8 ++++++++ .../prog/en/modules/catalogue/moredetail.tt | 20 ++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/catalogue/moredetail.pl b/catalogue/moredetail.pl index 3d6bd4ab6c..a2fa89ca0f 100755 --- a/catalogue/moredetail.pl +++ b/catalogue/moredetail.pl @@ -99,6 +99,14 @@ for my $itm (@all_items) { my $record=GetMarcBiblio({ biblionumber => $biblionumber }); +if ( not defined $record ) { + # biblionumber invalid -> report and exit + $template->param( unknownbiblionumber => 1, + biblionumber => $biblionumber ); + output_html_with_http_headers $query, $cookie, $template->output; + exit; +} + my $hostrecords; # adding items linked via host biblios my @hostitems = GetHostItemsInfo($record); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt index b1a261fa26..f27e63c8ec 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/moredetail.tt @@ -3,7 +3,13 @@ [% USE Branches %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] -Koha › Catalog › Item details for [% title | html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield | html %][% END %] +Koha › Catalog › + [% IF ( unknownbiblionumber ) %] + Unknown record + [% ELSE %] + Item details for [% title | html %] [% FOREACH subtitl IN subtitle %] [% subtitl.subfield | html %][% END %] + [% END %] + [% INCLUDE 'doc-head-close.inc' %] @@ -12,10 +18,19 @@ [% INCLUDE 'header.inc' %] [% INCLUDE 'cat-search.inc' %] - +
+[% IF ( unknownbiblionumber ) %] +
The record you requested does not exist ([% biblionumber %]).
+[% ELSE %]
@@ -286,4 +301,5 @@ browser.show(); [% END %] +[% END %] [% INCLUDE 'intranet-bottom.inc' %] -- 2.11.0