@@ -, +, @@ with null or empty branchcode --- Koha/Template/Plugin/Branches.pm | 2 ++ t/db_dependent/Template/Plugin/Branches.t | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) --- a/Koha/Template/Plugin/Branches.pm +++ a/Koha/Template/Plugin/Branches.pm @@ -30,6 +30,8 @@ use Koha::Libraries; sub GetName { my ( $self, $branchcode ) = @_; + return q{} unless defined $branchcode; + return q{} if $branchcode eq q{}; my $memory_cache = Koha::Cache::Memory::Lite->get_instance; my $cache_key = "Library_branchname:" . $branchcode; --- a/t/db_dependent/Template/Plugin/Branches.t +++ a/t/db_dependent/Template/Plugin/Branches.t @@ -38,7 +38,7 @@ my $builder = t::lib::TestBuilder->new; subtest 'all() tests' => sub { - plan tests => 18; + plan tests => 19; $schema->storage->txn_begin; @@ -68,6 +68,9 @@ subtest 'all() tests' => sub { $name = $plugin->GetName(undef); is($name, '', 'received empty string as name of NULL/undefined library code'); + $name = $plugin->GetName(q{}); + is($name, '', 'received empty string as name of empty string library code'); + is($plugin->GetLoggedInBranchcode(), '', 'no active library code if there is no active user session'); is($plugin->GetLoggedInBranchname(), '', 'no active library name if there is no active user session'); --