summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunil Joshi <joshi_sunil@in.com>2012-12-02 20:27:52 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2012-12-02 20:27:52 +0100
commit9bb5f10229bba8599de3e762511b03f32febc0d1 (patch)
tree9da61f82252049e79591755300c6445c89d39a41
parentd8835285194163b3f2c99997668705daa40d2dd4 (diff)
downloadbugzilla-9bb5f10229bba8599de3e762511b03f32febc0d1.tar.gz
bugzilla-9bb5f10229bba8599de3e762511b03f32febc0d1.tar.xz
Bug 443306: Unused fields should not show up in boolean charts
r/a=LpSolit
-rwxr-xr-xquery.cgi16
1 files changed, 15 insertions, 1 deletions
diff --git a/query.cgi b/query.cgi
index b62f77b53..9c53e2151 100755
--- a/query.cgi
+++ b/query.cgi
@@ -206,13 +206,27 @@ $vars->{'resolution'} = Bugzilla::Field->new({name => 'resolution'})->legal_valu
# Boolean charts
my @fields = @{ Bugzilla->fields({ obsolete => 0 }) };
+my %exclude_fields = ();
+
# If we're not in the time-tracking group, exclude time-tracking fields.
if (!$user->is_timetracker) {
foreach my $tt_field (TIMETRACKING_FIELDS) {
- @fields = grep($_->name ne $tt_field, @fields);
+ $exclude_fields{$tt_field} = 1;
}
}
+# Exclude fields turned off by params
+my %param_controlled_fields = ('useqacontact' => 'qa_contact',
+ 'usetargetmilestone' => 'target_milestone',
+ 'useclassification' => 'classification',
+ 'usestatuswhiteboard' => 'status_whiteboard');
+
+while (my ($param, $field) = each %param_controlled_fields) {
+ $exclude_fields{$field} = 1 unless Bugzilla->params->{$param};
+}
+
+@fields = grep(!$exclude_fields{$_->name}, @fields);
+
@fields = sort {lc($a->description) cmp lc($b->description)} @fields;
unshift(@fields, { name => "noop", description => "---" });
$vars->{'fields'} = \@fields;