From e3d0bc24c97ed35653130cdc55f0da3271d958e9 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 Signed-off-by: Jonathan Druart --- 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.39.5