From 311eb45dbd343068dce41bb44dd8db9f8108cf7e Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Thu, 16 Mar 2006 05:51:34 +0000 Subject: Bug 330521: Remove @::legal_product, @::legal_components and @::legal_target_milestone - Patch by Frédéric Buclin r=mkanat a=justdave MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- editflagtypes.cgi | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'editflagtypes.cgi') diff --git a/editflagtypes.cgi b/editflagtypes.cgi index 1851e8b13..29a7467ad 100755 --- a/editflagtypes.cgi +++ b/editflagtypes.cgi @@ -38,6 +38,7 @@ use Bugzilla::Flag; use Bugzilla::FlagType; use Bugzilla::Group; use Bugzilla::Util; +use Bugzilla::Product; my $template = Bugzilla->template; my $vars = {}; @@ -49,9 +50,6 @@ $user->in_group('editcomponents') action => "edit", object => "flagtypes"}); -# Suppress "used only once" warnings. -use vars qw(@legal_product @legal_components %components); - my $cgi = Bugzilla->cgi; my $product_id; my $component_id; @@ -128,17 +126,18 @@ sub list { sub edit { $action eq 'enter' ? validateTargetType() : (my $id = validateID()); my $dbh = Bugzilla->dbh; - - # Get this installation's products and components. - GetVersionTable(); - - # products and components and the function used to modify the components - # menu when the products menu changes; used by the template to populate - # the menus and keep the components menu consistent with the products menu - $vars->{'products'} = \@::legal_product; - $vars->{'components'} = \@::legal_components; - $vars->{'components_by_product'} = \%::components; - + + my @products = Bugzilla::Product::get_all_products(); + # We require all unique component names. + my %components; + foreach my $product (@products) { + foreach my $component (@{$product->components}) { + $components{$component->name} = 1; + } + } + $vars->{'products'} = \@products; + $vars->{'components'} = [sort(keys %components)]; + $vars->{'last_action'} = $cgi->param('action'); if ($cgi->param('action') eq 'enter' || $cgi->param('action') eq 'copy') { $vars->{'action'} = "insert"; @@ -216,17 +215,21 @@ sub processCategoryChange { my %inclusions = clusion_array_to_hash(\@inclusions); my %exclusions = clusion_array_to_hash(\@exclusions); - # Get this installation's products and components. - GetVersionTable(); + my @products = Bugzilla::Product::get_all_products(); + # We require all unique component names. + my %components; + foreach my $product (@products) { + foreach my $component (@{$product->components}) { + $components{$component->name} = 1; + } + } + $vars->{'products'} = \@products; + $vars->{'components'} = [sort(keys %components)]; - # products and components; used by the template to populate the menus - # and keep the components menu consistent with the products menu - $vars->{'products'} = \@::legal_product; - $vars->{'components'} = \@::legal_components; - $vars->{'components_by_product'} = \%::components; my @groups = Bugzilla::Group::get_all_groups(); $vars->{'groups'} = \@groups; $vars->{'action'} = $cgi->param('action'); + my $type = {}; foreach my $key ($cgi->param()) { $type->{$key} = $cgi->param($key) } $type->{'inclusions'} = \%inclusions; -- cgit v1.2.3-24-g4f1b