summaryrefslogtreecommitdiffstats
path: root/enter_bug.cgi
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-04-22 20:02:17 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-04-22 20:02:17 +0200
commit271477d8c26794abd8310e2abb89b746204660af (patch)
treea4701a52f9ff1918e25a75e09267bfba0b063296 /enter_bug.cgi
parent3417cb73db6d2306a012d3c624e9bec92fa1a161 (diff)
downloadbugzilla-271477d8c26794abd8310e2abb89b746204660af.tar.gz
bugzilla-271477d8c26794abd8310e2abb89b746204660af.tar.xz
Bug 560009: Use firstidx from List::MoreUtils instead of lsearch
r=timello, a=mkanat
Diffstat (limited to 'enter_bug.cgi')
-rwxr-xr-xenter_bug.cgi11
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];