From 8c72eaaf86ee0d4d43e8d12b0f7b98992cd4d7a1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 28 Jun 2019 14:01:04 -0500 Subject: [PATCH] Bug 23225: Do not hide a biblio if there is no item This patch fixes a 404 redirect from the OPAC ISBD view if the bibliographic record does not have item attached. Signed-off-by: Luis F. Lopez Signed-off-by: Tomas Cohen Arazi Signed-off-by: Martin Renvoize (cherry picked from commit f317d384f657bb8341a1a641343e18ed9598240d) Signed-off-by: Fridolin Somers --- Koha/Biblio.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/Biblio.pm b/Koha/Biblio.pm index fae91cef33..f38a101e27 100644 --- a/Koha/Biblio.pm +++ b/Koha/Biblio.pm @@ -209,7 +209,11 @@ sub hidden_in_opac { my $rules = $params->{rules} // {}; - return !(any { !$_->hidden_in_opac({ rules => $rules }) } $self->items->as_list); + my @items = $self->items->as_list; + + return 0 unless @items; # Do not hide if there is no item + + return !(any { !$_->hidden_in_opac({ rules => $rules }) } @items); } =head3 article_request_type -- 2.39.5