Adding a custom report column

Christian Reis kiko at async.com.br
Fri Jun 10 18:16:05 UTC 2005


Here's an interesting question for this breezy Friday: how do I add a
column to the reports that indicates the /date/ a bug was created? I've
done the trivial modification as per the patch below, which adds
creation_ts to the list of available options, but the main issues are:

    - I would like the label to say "Bug creation date", not "time"

    - It follows that I am abusing the creation_ts' column, so even if I
      was to hack in an evil rename somewhere, I wouldn't allow the
      actual creation_ts to be offered as a potential column.

Any hints from the master?

Index: report.cgi
===================================================================
RCS file: /cvs/bugzilla/report.cgi,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 report.cgi
--- report.cgi	3 Mar 2004 04:33:30 -0000	1.1.1.2
+++ report.cgi	10 Jun 2005 17:58:42 -0000
@@ -119,6 +119,7 @@ $columns{'op_sys'}           = "bugs.op_
 $columns{'votes'}            = "bugs.votes";
 $columns{'keywords'}         = "bugs.keywords";
 $columns{'target_milestone'} = "bugs.target_milestone";
+$columns{'creation_ts'}      = "DATE_FORMAT(bugs.creation_ts, '%Y-%m-%d')";
 # One which means "nothing". Any number would do, really. It just gets SELECTed
 # so that we always select 3 items in the query.
 $columns{''}                 = "42217354";
Index: template/en/default/search/search-report-select.html.tmpl
===================================================================
RCS file: /cvs/bugzilla/template/en/default/search/search-report-select.html.tmpl,v
retrieving revision 1.1.1.2
diff -u -p -r1.1.1.2 search-report-select.html.tmpl
--- template/en/default/search/search-report-select.html.tmpl	24 Jun 2004 14:37:12 -0000	1.1.1.2
+++ template/en/default/search/search-report-select.html.tmpl	10 Jun 2005 17:58:42 -0000
@@ -30,7 +30,7 @@
   [% rep_fields = ["product", "component", "version", "rep_platform",  
                    "op_sys", "bug_status", "resolution", "bug_severity", 
                    "priority", "target_milestone", "assigned_to",
-                   "reporter", "qa_contact", "votes" ] %]
+                   "reporter", "qa_contact", "votes", "creation_ts" ] %]
 
   <select name="[% name FILTER html %]">
     <option value=""><none></option>

Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331



More information about the developers mailing list