From a2d45b1cb4a65ba29f3047fa34ae75fad3a4144b Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 19 Apr 2019 06:49:48 +0000 Subject: [PATCH] Bug 22735: Resolve internal server error on missing item type Trivial fix, similar to opac-detail, applied to ISBD and MARC detail. Test plan: Enable ArticleRequests pref. Make sure you have a biblio with no item type in 942c. (Perhaps you need to make 942c not mandatory temporarily and save a biblio record without this field being filled.) If you are logged in, log out. Go to MARC or ISBD detail page. No crash anymore? Signed-off-by: Marcel de Rooy Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens (cherry picked from commit b78bd2faec703bb7d7c750dbc1070ba2449f29a9) Signed-off-by: Martin Renvoize (cherry picked from commit b99fbdd8fc85beb989a51142bb531673748bc344) Signed-off-by: Lucas Gass --- opac/opac-ISBDdetail.pl | 10 ++++++++++ opac/opac-MARCdetail.pl | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 40e9b71f4c..fe97386aed 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -217,4 +217,14 @@ if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ $template->param('OPACSearchForTitleIn' => $search_for_title); } +if( C4::Context->preference('ArticleRequests') ) { + my $itemtype = Koha::ItemTypes->find($biblio->itemtype); + my $artreqpossible = $patron + ? $biblio->can_article_request( $patron ) + : $itemtype + ? $itemtype->may_article_request + : q{}; + $template->param( artreqpossible => $artreqpossible ); +} + output_html_with_http_headers $query, $cookie, $template->output; diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index ebb78a2982..f668ddc96f 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -349,6 +349,16 @@ if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ $template->param('OPACSearchForTitleIn' => $search_for_title); } +if( C4::Context->preference('ArticleRequests') ) { + my $itemtype = Koha::ItemTypes->find($biblio->itemtype); + my $artreqpossible = $patron + ? $biblio->can_article_request( $patron ) + : $itemtype + ? $itemtype->may_article_request + : q{}; + $template->param( artreqpossible => $artreqpossible ); +} + $template->param( item_loop => \@item_loop, item_header_loop => \@item_header_loop, -- 2.39.5