From 8d0e08fdf58b029b619d18a9600b8d6f1410a644 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 15 Oct 2018 14:01:14 +0200 Subject: [PATCH] Bug 21475: Fix crash on missing default itemtype Test plan: Enable ArticleRequests. Find book without itemtype (942c). Maybe you need this: update biblioitems set itemtype=NULL where biblionumber=[...] Goto opac detail for that book. No crash anymore? Signed-off-by: Marcel de Rooy Signed-off-by: Owen Leonard Signed-off-by: Julian Maurice Signed-off-by: Nick Clemens --- opac/opac-detail.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 6f10c6bde3..cc735ee152 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -758,9 +758,12 @@ my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($bib if( C4::Context->preference('ArticleRequests') ) { my $patron = $borrowernumber ? Koha::Patrons->find($borrowernumber) : undef; + my $itemtype = Koha::ItemTypes->find($biblio->itemtype); my $artreqpossible = $patron ? $biblio->can_article_request( $patron ) - : Koha::ItemTypes->find($biblio->itemtype)->may_article_request; + : $itemtype + ? $itemtype->may_article_request + : q{}; $template->param( artreqpossible => $artreqpossible ); } -- 2.39.5