From 88a1b417775bcff7aaee8e9e3fefe2720bcf2cc8 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 3 Nov 2023 17:11:51 +0000 Subject: [PATCH] Bug 29002: (follow-up) Make CanBook more resilient This patch adds a check for biblio existance prior to method resolution failure in Koha::Template::Plugin::Biblio. This fixes a failure case in unit tests. --- Koha/Template/Plugin/Biblio.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/Template/Plugin/Biblio.pm b/Koha/Template/Plugin/Biblio.pm index fb1193065f1..79c7284292f 100644 --- a/Koha/Template/Plugin/Biblio.pm +++ b/Koha/Template/Plugin/Biblio.pm @@ -72,6 +72,7 @@ sub CanBook { my ( $self, $biblionumber ) = @_; my $biblio = Koha::Biblios->find($biblionumber); + return 0 unless $biblio; return $biblio->bookable_items->count ? 1 : 0; } -- 2.41.0