diff options
author | lpsolit%gmail.com <> | 2009-08-19 00:09:34 +0200 |
---|---|---|
committer | lpsolit%gmail.com <> | 2009-08-19 00:09:34 +0200 |
commit | 0ffa0857e7a68fba89ecb3dd313a479ee6d61198 (patch) | |
tree | 5a9155aea64884c2d9d99d17d025e20edde293b1 /Bugzilla | |
parent | 56c9e8034aa591a50a7aa11dee2f7289e807c6f4 (diff) | |
download | bugzilla-0ffa0857e7a68fba89ecb3dd313a479ee6d61198.tar.gz bugzilla-0ffa0857e7a68fba89ecb3dd313a479ee6d61198.tar.xz |
Bug 108243: Add flags as columns in buglist.cgi - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Field.pm | 2 | ||||
-rw-r--r-- | Bugzilla/Search.pm | 23 |
2 files changed, 21 insertions, 4 deletions
diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm index a71afef35..a2a08cd4b 100644 --- a/Bugzilla/Field.pm +++ b/Bugzilla/Field.pm @@ -219,7 +219,7 @@ use constant DEFAULT_FIELDS => ( {name => 'deadline', desc => 'Deadline', in_new_bugmail => 1, buglist => 1}, {name => 'commenter', desc => 'Commenter'}, - {name => 'flagtypes.name', desc => 'Flag'}, + {name => 'flagtypes.name', desc => 'Flags', buglist => 1}, {name => 'requestees.login_name', desc => 'Flag Requestee'}, {name => 'setters.login_name', desc => 'Flag Setter'}, {name => 'work_time', desc => 'Hours Worked', buglist => 1}, diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index c606b774d..9ba7a8c42 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -123,6 +123,9 @@ sub COLUMNS { . " ELSE 100" . " * ($actual_time / ($actual_time + bugs.remaining_time))" . " END)", + + 'flagtypes.name' => $dbh->sql_group_concat('DISTINCT ' + . $dbh->sql_string_concat('flagtypes.name', 'flags.status'), "', '"), ); # Backward-compatibility for old field names. Goes new_name => old_name. @@ -270,6 +273,11 @@ sub init { "ON ldtime.bug_id = bugs.bug_id"); } + if (grep($_ eq 'flagtypes.name', @fields)) { + push(@supptables, "LEFT JOIN flags ON flags.bug_id = bugs.bug_id AND attach_id IS NULL"); + push(@supptables, "LEFT JOIN flagtypes ON flagtypes.id = flags.type_id"); + } + my $minvotes; if (defined $params->param('votes')) { my $c = trim($params->param('votes')); @@ -911,8 +919,15 @@ sub init { # Make sure we create a legal SQL query. @andlist = ("1 = 1") if !@andlist; - my @sql_fields = map { $_ eq EMPTY_COLUMN ? EMPTY_COLUMN - : COLUMNS->{$_}->{name} . ' AS ' . $_ } @fields; + my @sql_fields; + foreach my $field (@fields) { + my $alias = $field; + # Aliases cannot contain dots in them. We convert them to underscores. + $alias =~ s/\./_/g; + my $sql_field = ($field eq EMPTY_COLUMN) ? EMPTY_COLUMN + : COLUMNS->{$field}->{name} . " AS $alias"; + push(@sql_fields, $sql_field); + } my $query = "SELECT " . join(', ', @sql_fields) . " FROM $suppstring" . " LEFT JOIN bug_group_map " . @@ -945,7 +960,7 @@ sub init { # These fields never go into the GROUP BY (bug_id goes in # explicitly, below). next if (grep($_ eq $field, EMPTY_COLUMN, - qw(bug_id actual_time percentage_complete))); + qw(bug_id actual_time percentage_complete flagtypes.name))); my $col = COLUMNS->{$field}->{name}; push(@groupby, $col) if !grep($_ eq $col, @groupby); } @@ -1160,6 +1175,8 @@ sub BuildOrderBy { } return; } + # Aliases cannot contain dots in them. We convert them to underscores. + $orderfield =~ s/\./_/g if exists COLUMNS->{$orderfield}; push(@$stringlist, trim($orderfield . ' ' . $orderdirection)); } |