aboutsummaryrefslogtreecommitdiffstats
path: root/buglist.cgi
diff options
context:
space:
mode:
authorSimon Green <sgreen@redhat.com>2014-09-02 10:26:42 +1000
committerSimon Green <sgreen@redhat.com>2014-09-02 10:26:42 +1000
commite0fbbde652bd6ff8112399fc7d7bc96f19e92994 (patch)
tree3c295243c252e7675fcf9a1df53f7fc1f3ed5d5e /buglist.cgi
parent92b5ff149bb0ff364e88f14b588f160dc9866cca (diff)
downloadbugs-e0fbbde652bd6ff8112399fc7d7bc96f19e92994.tar
bugs-e0fbbde652bd6ff8112399fc7d7bc96f19e92994.tar.gz
bugs-e0fbbde652bd6ff8112399fc7d7bc96f19e92994.tar.bz2
bugs-e0fbbde652bd6ff8112399fc7d7bc96f19e92994.tar.xz
bugs-e0fbbde652bd6ff8112399fc7d7bc96f19e92994.zip
Bug 281791 - Add ability to change flags in "change several bugs at once"
r=glob, a=sgreen
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-xbuglist.cgi39
1 files changed, 38 insertions, 1 deletions
diff --git a/buglist.cgi b/buglist.cgi
index eeea3bdf5..5106f8dc2 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -510,6 +510,37 @@ if (grep('relevance', @displaycolumns) && !$fulltext) {
@displaycolumns = grep($_ ne 'relevance', @displaycolumns);
}
+sub _get_common_flag_types {
+ my $component_ids = shift;
+
+ # Get all the different components in the bug list
+ my $components = Bugzilla::Component->new_from_list($component_ids);
+ my %flag_types;
+ my @flag_types_ids;
+ foreach my $component (@$components) {
+ foreach my $flag_type (@{$component->flag_types->{'bug'}}) {
+ push @flag_types_ids, $flag_type->id;
+ $flag_types{$flag_type->id} = $flag_type;
+ }
+ }
+
+ # We only want flags that appear in all components
+ my %common_flag_types;
+ foreach my $id (keys %flag_types) {
+ my $flag_type_count = scalar grep { $_ == $id } @flag_types_ids;
+ $common_flag_types{$id} = $flag_types{$id}
+ if $flag_type_count == scalar @$components;
+ }
+
+ # We only show flags that a user has request or set rights on
+ my @show_flag_types
+ = grep { $user->can_request_flag($_) || $user->can_set_flag($_) }
+ values %common_flag_types;
+ my $any_flags_requesteeble =
+ grep($_->is_requesteeble, @show_flag_types);
+
+ return(\@show_flag_types, $any_flags_requesteeble);
+}
################################################################################
# Select Column Determination
@@ -551,6 +582,7 @@ foreach my $col (@displaycolumns) {
# has for modifying the bugs.
if ($dotweak) {
push(@selectcolumns, "bug_status") if !grep($_ eq 'bug_status', @selectcolumns);
+ push(@selectcolumns, "component_id") if !grep($_ eq 'component_id', @selectcolumns);
}
if ($format->{'extension'} eq 'ics') {
@@ -753,9 +785,10 @@ my $time_info = { 'estimated_time' => 0,
'time_present' => ($estimated_time || $remaining_time ||
$actual_time || $percentage_complete),
};
-
+
my $bugowners = {};
my $bugproducts = {};
+my $bugcomponentids = {};
my $bugcomponents = {};
my $bugstatuses = {};
my @bugidlist;
@@ -789,6 +822,7 @@ foreach my $row (@$data) {
# Record the assignee, product, and status in the big hashes of those things.
$bugowners->{$bug->{'assigned_to'}} = 1 if $bug->{'assigned_to'};
$bugproducts->{$bug->{'product'}} = 1 if $bug->{'product'};
+ $bugcomponentids->{$bug->{'component_id'}} = 1 if $bug->{'component_id'};
$bugcomponents->{$bug->{'component'}} = 1 if $bug->{'component'};
$bugstatuses->{$bug->{'bug_status'}} = 1 if $bug->{'bug_status'};
@@ -956,6 +990,9 @@ if ($dotweak && scalar @bugs) {
$vars->{'severities'} = get_legal_field_values('bug_severity');
$vars->{'resolutions'} = get_legal_field_values('resolution');
+ ($vars->{'flag_types'}, $vars->{any_flags_requesteeble})
+ = _get_common_flag_types([keys %$bugcomponentids]);
+
# Convert bug statuses to their ID.
my @bug_statuses = map {$dbh->quote($_)} keys %$bugstatuses;
my $bug_status_ids =