From 27e6741ec8db0cbec8433b3205656860e30399ae 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 Content-Type: text/plain; charset=utf-8 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 --- 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 edbad11..8c4bb14 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.1.4