From 279ec88e970696fb29ca419da1032736ff327772 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" Date: Fri, 2 Jun 2006 23:02:52 +0000 Subject: [PATCH] =?UTF-8?q?Bug=20340116:=20Flag::FormToNewFlags()=20uses?= =?UTF-8?q?=20incorrect=20data=20-=20Patch=20by=20Fr=C3=A9d=C3=A9ric=20Buc?= =?UTF-8?q?lin=20=20r=3Dkiko=20a=3Dmyk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://10.0.0.236/trunk@198920 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/webtools/bugzilla/Bugzilla/Flag.pm | 4 +-- .../webtools/bugzilla/Bugzilla/FlagType.pm | 25 ++++++++----------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/mozilla/webtools/bugzilla/Bugzilla/Flag.pm b/mozilla/webtools/bugzilla/Bugzilla/Flag.pm index ef8ecd86735..8a319900329 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/Flag.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/Flag.pm @@ -716,8 +716,8 @@ sub FormToNewFlags { # Get a list of active flag types available for this target. my $flag_types = Bugzilla::FlagType::match( { 'target_type' => $target->{'type'}, - 'product_id' => $target->{'product_id'}, - 'component_id' => $target->{'component_id'}, + 'product_id' => $target->{'bug'}->{'product_id'}, + 'component_id' => $target->{'bug'}->{'component_id'}, 'is_active' => 1 }); my @flags; diff --git a/mozilla/webtools/bugzilla/Bugzilla/FlagType.pm b/mozilla/webtools/bugzilla/Bugzilla/FlagType.pm index c1dff6bd43e..572c4fad75b 100644 --- a/mozilla/webtools/bugzilla/Bugzilla/FlagType.pm +++ b/mozilla/webtools/bugzilla/Bugzilla/FlagType.pm @@ -528,26 +528,21 @@ sub sqlify_criteria { # Add inclusions to the query, which simply involves joining the table # by flag type ID and target product/component. - push(@$tables, "INNER JOIN flaginclusions ON " . - "flagtypes.id = flaginclusions.type_id"); - push(@criteria, "(flaginclusions.product_id = $product_id " . - " OR flaginclusions.product_id IS NULL)"); - push(@criteria, "(flaginclusions.component_id = $component_id " . - " OR flaginclusions.component_id IS NULL)"); + push(@$tables, "INNER JOIN flaginclusions AS i ON flagtypes.id = i.type_id"); + push(@criteria, "(i.product_id = $product_id OR i.product_id IS NULL)"); + push(@criteria, "(i.component_id = $component_id OR i.component_id IS NULL)"); # Add exclusions to the query, which is more complicated. First of all, # we do a LEFT JOIN so we don't miss flag types with no exclusions. # Then, as with inclusions, we join on flag type ID and target product/ # component. However, since we want flag types that *aren't* on the - # exclusions list, we add a WHERE criteria to use only records with - # NULL exclusion type, i.e. without any exclusions. - my $join_clause = "flagtypes.id = flagexclusions.type_id " . - "AND (flagexclusions.product_id = $product_id " . - "OR flagexclusions.product_id IS NULL) " . - "AND (flagexclusions.component_id = $component_id " . - "OR flagexclusions.component_id IS NULL)"; - push(@$tables, "LEFT JOIN flagexclusions ON ($join_clause)"); - push(@criteria, "flagexclusions.type_id IS NULL"); + # exclusions list, we add a WHERE criteria to use only records with + # NULL exclusion type, i.e. without any exclusions. + my $join_clause = "flagtypes.id = e.type_id " . + "AND (e.product_id = $product_id OR e.product_id IS NULL) " . + "AND (e.component_id = $component_id OR e.component_id IS NULL)"; + push(@$tables, "LEFT JOIN flagexclusions AS e ON ($join_clause)"); + push(@criteria, "e.type_id IS NULL"); } if ($criteria->{group}) { my $gid = $criteria->{group};