From 03f552e1c6aaa5ea4372006808485f2db2582524 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 --- 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 a4db89b61c..968fe96bb3 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.34.0