From 5f8ee175e318cd8211afb75a76d4ad2d24e0631f Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Fri, 7 Jan 2022 15:34:49 -1000 Subject: [PATCH] Bug 29826: Remove warning in t/db_dependent/Template/Plugin/Branches.t Bug 26587 added a concatenation that sends a warning if var is undef : $ prove t/db_dependent/Template/Plugin/Branches.t Use of uninitialized value $branchcode in concatenation (.) or string at /kohadevbox/koha/Koha/Template/Plugin/Branches.pm line 35. This patch adds an early return empty string when GetName is called without $branchcode Test plan : 1) Run t/db_dependent/Template/Plugin/Branches.t without patch 2) Run with the patch to see warning disappear Signed-off-by: David Nind --- Koha/Template/Plugin/Branches.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index 8f82e0217a..82884de7c5 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -30,6 +30,7 @@ use Koha::Libraries; sub GetName { my ( $self, $branchcode ) = @_; + return q{} unless defined $branchcode; my $memory_cache = Koha::Cache::Memory::Lite->get_instance; my $cache_key = "Library_branchname:" . $branchcode; -- 2.30.2