From a9822ceefb563a54420f13b2395b8c1359833778 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Sat, 25 Oct 2008 04:14:56 +0000 Subject: Bug 458436: Allow standard global select fields to control visibility of custom fields Patch By Max Kanat-Alexander r=bbaetz, a=mkanat --- editvalues.cgi | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) (limited to 'editvalues.cgi') diff --git a/editvalues.cgi b/editvalues.cgi index 85d4c9761..338245284 100755 --- a/editvalues.cgi +++ b/editvalues.cgi @@ -29,18 +29,6 @@ use Bugzilla::Token; use Bugzilla::Field; use Bugzilla::Field::Choice; -# List of different tables that contain the changeable field values -# (the old "enums.") Keep them in alphabetical order by their -# English name from field-descs.html.tmpl. -# Format: Array of valid field names. -my @valid_fields = ('op_sys', 'rep_platform', 'priority', 'bug_severity', - 'bug_status', 'resolution'); - -# Add custom select fields. -my @custom_fields = Bugzilla->get_fields( - {custom => 1, type => [FIELD_TYPE_SINGLE_SELECT, FIELD_TYPE_MULTI_SELECT]}); -push(@valid_fields, map { $_->name } @custom_fields); - ############### # Subroutines # ############### @@ -87,8 +75,7 @@ my $token = $cgi->param('token'); # field = '' -> Show nice list of fields # if (!$cgi->param('field')) { - # Convert @valid_fields into the format that select-field wants. - my @field_list = map({ name => $_ }, @valid_fields); + my @field_list = Bugzilla->get_fields({ is_select => 1 }); $vars->{'fields'} = \@field_list; $template->process("admin/fieldvalues/select-field.html.tmpl", $vars) @@ -98,7 +85,7 @@ if (!$cgi->param('field')) { # At this point, the field must be defined. my $field = Bugzilla::Field->check($cgi->param('field')); -if (!grep($_ eq $field->name, @valid_fields)) { +if (!$field->is_select) { ThrowUserError('fieldname_invalid', { field => $field }); } $vars->{'field'} = $field; -- cgit v1.2.3-24-g4f1b