]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 108243: Add flags as columns in buglist.cgi - Patch by Frédéric Buclin <LpSolit...
authorlpsolit%gmail.com <>
Tue, 18 Aug 2009 22:09:34 +0000 (22:09 +0000)
committerlpsolit%gmail.com <>
Tue, 18 Aug 2009 22:09:34 +0000 (22:09 +0000)
Bugzilla/Field.pm
Bugzilla/Search.pm
colchange.cgi
template/en/default/global/field-descs.none.tmpl
template/en/default/list/table.html.tmpl

index a71afef359b97a0d73fb1b28c5517be07bbad15f..a2a08cd4b0b7311eda3ea24f0da6a37a29bfeb97 100644 (file)
@@ -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},
index c606b774d97d4092b7529803611e826537e1486c..9ba7a8c42f9e727952d249f2edbcc82eb9b8acf9 100644 (file)
@@ -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));
 }
index 5aef57ff8a1ae3294c14a008d87ce918abd8bcb5..e28bccf0437ef420d6e5007531382a4bc3d89f93 100755 (executable)
@@ -74,7 +74,9 @@ if (Bugzilla->params->{"usestatuswhiteboard"}) {
 if (Bugzilla::Keyword->any_exist) {
     push(@masterlist, "keywords");
 }
-
+if (Bugzilla->has_flags) {
+    push(@masterlist, "flagtypes.name");
+}
 if (Bugzilla->user->in_group(Bugzilla->params->{"timetrackinggroup"})) {
     push(@masterlist, ("estimated_time", "remaining_time", "actual_time",
                        "percentage_complete", "deadline")); 
index 2c70b11c63073a4db1eef0058c0f1cd3b0295824..762d10904e3883e45d3d8f93b1f319342030fdf2 100644 (file)
@@ -57,7 +57,7 @@
                    "dup_id"                  => "Duplicate",
                    "estimated_time"          => "Orig. Est.",
                    "everconfirmed"           => "Ever confirmed",
-                   "flagtypes.name"          => "Flag",
+                   "flagtypes_name"          => "Flags",
                    "keywords"                => "Keywords",
                    "longdesc"                => "Comment",
                    "longdescs.isprivate"     => "Comment is private",
index 938c430cb5712b5b2a3350f6ca84fe42302cff80..760a59cfde9726d498f6bb2521c9e49d63e59d04 100644 (file)
@@ -54,6 +54,7 @@
     "short_short_desc"  => { maxlength => 60 , ellipsis => "..." , wrap => 1 } ,
     "status_whiteboard" => { title => "Whiteboard" , wrap => 1 } , 
     "keywords"          => { wrap => 1 } ,
+    "flagtypes.name"    => { wrap => 1 } ,
     "component"         => { maxlength => 8 , title => "Comp" } , 
     "product"           => { maxlength => 8 } , 
     "version"           => { maxlength => 5 , title => "Vers" } ,