From d320ac0ee8de76512a87f5cbcf08350ae4ecc652 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Fri, 6 May 2005 02:20:44 +0000 Subject: Bug 288663: The inclusion and exclusion lists behave incorrectly when a product or a component is called "Any" - Patch by Frédéric Buclin r=myk a=myk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/FlagType.pm | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'Bugzilla/FlagType.pm') diff --git a/Bugzilla/FlagType.pm b/Bugzilla/FlagType.pm index 6b4c31c7f..d07bb0b65 100644 --- a/Bugzilla/FlagType.pm +++ b/Bugzilla/FlagType.pm @@ -184,7 +184,9 @@ sub get_exclusions { =item C -Someone please document this +Return a hash of product/component IDs and names +associated with the flagtype: +$clusions{'product_name:component_name'} = "product_ID:component_ID" =back @@ -192,23 +194,29 @@ Someone please document this sub get_clusions { my ($id, $type) = @_; - - &::PushGlobalSQLState(); - &::SendSQL("SELECT products.name, components.name " . - "FROM flagtypes, flag${type}clusions " . - "LEFT OUTER JOIN products ON flag${type}clusions.product_id = products.id " . - "LEFT OUTER JOIN components ON flag${type}clusions.component_id = components.id " . - "WHERE flagtypes.id = $id AND flag${type}clusions.type_id = flagtypes.id"); - my @clusions = (); - while (&::MoreSQLData()) { - my ($product, $component) = &::FetchSQLData(); - $product ||= "Any"; - $component ||= "Any"; - push(@clusions, "$product:$component"); + my $dbh = Bugzilla->dbh; + + my $list = + $dbh->selectall_arrayref("SELECT products.id, products.name, " . + " components.id, components.name " . + "FROM flagtypes, flag${type}clusions " . + "LEFT OUTER JOIN products " . + " ON flag${type}clusions.product_id = products.id " . + "LEFT OUTER JOIN components " . + " ON flag${type}clusions.component_id = components.id " . + "WHERE flagtypes.id = ? " . + " AND flag${type}clusions.type_id = flagtypes.id", + undef, $id); + my %clusions; + foreach my $data (@$list) { + my ($product_id, $product_name, $component_id, $component_name) = @$data; + $product_id ||= 0; + $product_name ||= "__Any__"; + $component_id ||= 0; + $component_name ||= "__Any__"; + $clusions{"$product_name:$component_name"} = "$product_id:$component_id"; } - &::PopGlobalSQLState(); - - return \@clusions; + return \%clusions; } =pod -- cgit v1.2.3-24-g4f1b