From ffa86e29b5d97aa02985700aaaf25432cc9464e8 Mon Sep 17 00:00:00 2001 From: Colin Campbell Date: Mon, 31 Jan 2011 18:09:40 +0000 Subject: [PATCH] Bug 2505: Suppress some warnings emitted by members-home.pl an undefined value in branch and the undef selected can generate a large amount of warning noise Signed-off-by: Chris Cormack --- members/members-home.pl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/members/members-home.pl b/members/members-home.pl index 964fdb7442..830800e0ab 100755 --- a/members/members-home.pl +++ b/members/members-home.pl @@ -31,6 +31,8 @@ my $query = new CGI; my $branch = $query->param('branchcode'); my $template_name; +$branch = q{} unless defined $branch; + my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "members/member.tmpl", query => $query, @@ -42,13 +44,12 @@ my ($template, $loggedinuser, $cookie) my $branches = GetBranches; my @branchloop; -foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) { - my $selected = 1 if $branches->{$_}->{branchcode} eq $branch; - my %row = ( value => $_, - selected => $selected, +foreach (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %{$branches}) { + push @branchloop, { + value => $_, + selected => ($branches->{$_}->{branchcode} eq $branch), branchname => $branches->{$_}->{branchname}, - ); - push @branchloop, \%row; + }; } my @categories; -- 2.39.5