From d8f36cac89e6e054e884cbf54fbe130ec7424f9e Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Tue, 30 May 2006 00:24:53 +0000 Subject: Bug 337054: Remove get_component_id() and get_component_name() from globals.pl - Patch by Frédéric Buclin r=mkanat a=myk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- request.cgi | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'request.cgi') diff --git a/request.cgi b/request.cgi index 5563f32f7..5f90b87cb 100755 --- a/request.cgi +++ b/request.cgi @@ -19,6 +19,7 @@ # Rights Reserved. # # Contributor(s): Myk Melez +# Frédéric Buclin ################################################################################ # Script Initialization @@ -33,6 +34,8 @@ use Bugzilla; use Bugzilla::Flag; use Bugzilla::FlagType; use Bugzilla::User; +use Bugzilla::Product; +use Bugzilla::Component; # Make sure the user is logged in. my $user = Bugzilla->login(); @@ -174,23 +177,17 @@ sub queue { # Filter results by exact product or component. if (defined $cgi->param('product') && $cgi->param('product') ne "") { - my $product_id = get_product_id($cgi->param('product')); - if ($product_id) { - push(@criteria, "bugs.product_id = $product_id"); - push(@excluded_columns, 'product') unless $cgi->param('do_union'); - if (defined $cgi->param('component') && $cgi->param('component') ne "") { - my $component_id = get_component_id($product_id, $cgi->param('component')); - if ($component_id) { - push(@criteria, "bugs.component_id = $component_id"); - push(@excluded_columns, 'component') unless $cgi->param('do_union'); - } - else { ThrowUserError("component_not_valid", { 'product' => $cgi->param('product'), - 'name' => $cgi->param('component') }) } - } + my $product = Bugzilla::Product::check_product(scalar $cgi->param('product')); + push(@criteria, "bugs.product_id = " . $product->id); + push(@excluded_columns, 'product') unless $cgi->param('do_union'); + if (defined $cgi->param('component') && $cgi->param('component') ne "") { + my $component = + Bugzilla::Component::check_component($product, scalar $cgi->param('component')); + push(@criteria, "bugs.component_id = " . $component->id); + push(@excluded_columns, 'component') unless $cgi->param('do_union'); } - else { ThrowUserError("product_doesnt_exist", { 'product' => $cgi->param('product') }) } } - + # Filter results by flag types. my $form_type = $cgi->param('type'); if (defined $form_type && !grep($form_type eq $_, ("", "all"))) { -- cgit v1.2.3-24-g4f1b