summaryrefslogtreecommitdiffstats
path: root/editflagtypes.cgi
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2016-01-04 23:47:11 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2016-01-04 23:47:11 +0100
commitf709156da6e562a4466d45c9422ff0a111aaa7e0 (patch)
tree7c358b7cc4b280176447f16fad3462fff067a446 /editflagtypes.cgi
parent9f5a8a28783f66b15973ac3714d10d1c0fa05f6d (diff)
downloadbugzilla-f709156da6e562a4466d45c9422ff0a111aaa7e0.tar.gz
bugzilla-f709156da6e562a4466d45c9422ff0a111aaa7e0.tar.xz
Bug 1191706: When editing flag types, components do not match the selected product when classifications are enabled
r=dkl
Diffstat (limited to 'editflagtypes.cgi')
-rwxr-xr-xeditflagtypes.cgi23
1 files changed, 18 insertions, 5 deletions
diff --git a/editflagtypes.cgi b/editflagtypes.cgi
index d848d250a..d0b9443b5 100755
--- a/editflagtypes.cgi
+++ b/editflagtypes.cgi
@@ -436,17 +436,30 @@ sub get_products_and_components {
my @products;
if ($user->in_group('editcomponents')) {
- @products = Bugzilla::Product->get_all;
+ if (Bugzilla->params->{useclassification}) {
+ # We want products grouped by classifications.
+ @products = map { @{ $_->products } } Bugzilla::Classification->get_all;
+ }
+ else {
+ @products = Bugzilla::Product->get_all;
+ }
}
else {
@products = @{$user->get_products_by_permission('editcomponents')};
+
+ if (Bugzilla->params->{useclassification}) {
+ my %class;
+ push(@{$class{$_->classification_id}}, $_) foreach @products;
+
+ # Let's sort the list by classifications.
+ @products = ();
+ push(@products, @{$class{$_->id}}) foreach Bugzilla::Classification->get_all;
+ }
}
- # We require all unique component names.
+
my %components;
foreach my $product (@products) {
- foreach my $component (@{$product->components}) {
- $components{$component->name} = 1;
- }
+ $components{$_->name} = 1 foreach @{$product->components};
}
$vars->{'products'} = \@products;
$vars->{'components'} = [sort(keys %components)];