From da166cf5faddf0485e951da7a7d8bfc320f411b8 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 22 Jan 2018 13:04:33 +0100 Subject: [PATCH] Bug 20060: Resolve uninitialized warn from Koha::Template::Plugin::Branches The warn comes from undefined C4::Context->userenv->{branch}. Can be triggered by calling mainpage.pl when being logged out in staff. Signed-off-by: Marcel de Rooy Signed-off-by: Mark Tompsett Signed-off-by: Katrin Fischer --- Koha/Template/Plugin/Branches.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index edbad11b02..8c4bb14d74 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -66,7 +66,7 @@ sub all { for my $l ( @$libraries ) { if ( defined $selected and $l->{branchcode} eq $selected - or not defined $selected and C4::Context->userenv and $l->{branchcode} eq C4::Context->userenv->{branch} + or not defined $selected and C4::Context->userenv and $l->{branchcode} eq ( C4::Context->userenv->{branch} // q{} ) ) { $l->{selected} = 1; } -- 2.14.1