Bug 29826: Manage call of Template Plugin Branches GetName() with null or empty branc...
authorFridolin Somers <fridolin.somers@biblibre.com>
Sat, 8 Jan 2022 01:34:49 +0000 (15:34 -1000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 4 Mar 2022 02:11:50 +0000 (16:11 -1000)
commit666ec454734c66844f8fbdef22bb2dd48075f235
treebac43b57cbd721694e93edc86062def92b1d090a
parent2c821535ef1736d670a8e19946209dc27447cfbc
Bug 29826: Manage call of Template Plugin Branches GetName() with null or empty branchcode

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 with $branchcode null or empty string.

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 <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/Template/Plugin/Branches.pm
t/db_dependent/Template/Plugin/Branches.t