diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-04-22 11:02:17 -0700 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-04-22 11:02:17 -0700 |
commit | 271477d8c26794abd8310e2abb89b746204660af (patch) | |
tree | a4701a52f9ff1918e25a75e09267bfba0b063296 /enter_bug.cgi | |
parent | The maintainer of MIME::tools released a new version that now supports (diff) | |
download | bugzilla-271477d8c26794abd8310e2abb89b746204660af.tar.gz bugzilla-271477d8c26794abd8310e2abb89b746204660af.tar.bz2 bugzilla-271477d8c26794abd8310e2abb89b746204660af.zip |
Bug 560009: Use firstidx from List::MoreUtils instead of lsearch
r=timello, a=mkanat
Diffstat (limited to 'enter_bug.cgi')
-rwxr-xr-x | enter_bug.cgi | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/enter_bug.cgi b/enter_bug.cgi index efca5491d..9c6a1c6b4 100755 --- a/enter_bug.cgi +++ b/enter_bug.cgi @@ -508,14 +508,17 @@ else { # parameter. $vars->{'version'} = [map($_->name, @{$product->versions})]; +my $version_cookie = $cgi->cookie("VERSION-" . $product->name); + if ( ($cloned_bug_id) && ($product->name eq $cloned_bug->product ) ) { $default{'version'} = $cloned_bug->version; } elsif (formvalue('version')) { $default{'version'} = formvalue('version'); -} elsif (defined $cgi->cookie("VERSION-" . $product->name) && - lsearch($vars->{'version'}, $cgi->cookie("VERSION-" . $product->name)) != -1) { - $default{'version'} = $cgi->cookie("VERSION-" . $product->name); +} elsif (defined $version_cookie + and grep { $_ eq $version_cookie } @{ $vars->{'version'} }) +{ + $default{'version'} = $version_cookie; } else { $default{'version'} = $vars->{'version'}->[$#{$vars->{'version'}}]; } @@ -556,7 +559,7 @@ $vars->{'bug_status'} = \@status; # Otherwise, and only if the user has privs, set the default # to the first confirmed bug status on the list, if available. -if (formvalue('bug_status') && (lsearch(\@status, formvalue('bug_status')) >= 0)) { +if (formvalue('bug_status') && grep { $_ eq formvalue('bug_status') } @status) { $default{'bug_status'} = formvalue('bug_status'); } elsif (scalar @status == 1) { $default{'bug_status'} = $status[0]; |