From 470da48af8e4ebbb5c3f89386a2c3be8a9d12c6d 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. Signed-off-by: Tomas Cohen Arazi --- 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 fb1193065f..79c7284292 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.39.5