aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2016-01-04 23:51:02 +0100
committerFrédéric Buclin <LpSolit@gmail.com>2016-01-04 23:51:02 +0100
commit04004a62e2f190d6cfb3bd6965e9054125b56c47 (patch)
tree234c294322e9a63174a462d430d7f2e1e5e74200 /editflagtypes.cgi
parentBug 1235395 - whine.pl broken due to a missing generate_email() routine (diff)
downloadbugzilla-04004a62e2f190d6cfb3bd6965e9054125b56c47.tar.gz
bugzilla-04004a62e2f190d6cfb3bd6965e9054125b56c47.tar.bz2
bugzilla-04004a62e2f190d6cfb3bd6965e9054125b56c47.zip
Bug 1191706: When editing flag types, components do not match the selected product when classifications are enabled
r/a=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)];