Bug 406371 - 3.27: Additional columns available in query resultsgroups
3.27: Additional columns available in query resultsgroups
Product: Bugzilla
Classification: Community
Component: Bugzilla General (Show other bugs)
All Linux
high Severity medium (vote)
: ---
: ---
Assigned To: David Lawrence
6 hours
Depends On:
Blocks: RHBZ30UpgradeTracker 427052
  Show dependency treegraph
Reported: 2007-11-30 11:58 EST by David Lawrence
Modified: 2013-06-24 00:15 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-02-15 02:22:13 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Patch to add methods to db modules to access stored db functions (v1) (2.49 KB, patch)
2008-02-12 23:37 EST, David Lawrence
no flags Details | Diff
Update colchange.cgi and buglist.cgi to show additional columns (5.69 KB, patch)
2008-02-13 01:50 EST, Tony Fu
no flags Details | Diff
Patch to add additional columns in query resultsgroups (7.21 KB, patch)
2008-02-14 00:02 EST, David Lawrence
no flags Details | Diff

  None (edit)
Description David Lawrence 2007-11-30 11:58:51 EST
Red Hat Bugzilla has additional columns that are allowed to be displayed in a search results page that are not available in the standard Bugzilla source. These fields include bug groups, bug dependencies, issuetracker id's, IT Max Score, set flags, etc. Requires the addition of stored functions in the MySQL database which are already have installed in the live database.

Function Requirements:
colchange.cgi template/en/default/list/change-columns.html.tmpl template/en/default/list/table.html.tmpl Bugzilla/Search.pm buglist.cgi
Comment 1 David Lawrence 2007-12-21 16:31:21 EST
LOC Estimation:

Schema.pm: 62
buglist.cgi: 6
Bugzilla/DBcompat.pm: 103
colchange.cgi: 5
template/en/default/list/table.html.tmpl: 5
selenium tests to verify proper display of dependencies, issuetrackers, and
flags: 6 hours 

Add 30% for conversion to 3.0 API

LOC Total: 181 + (181 * .30) = 236
Comment 2 David Lawrence 2008-02-12 23:37:20 EST
Created attachment 294729 [details]
Patch to add methods to db modules to access stored db functions (v1)

Tony, here is a patch for Bugzilla/DB/{Mysql,Pg}.pm to add methods to access
the stored procedures (for Mysql). You can now use these in buglist.cgi to get
the SQL
necessary to display the column.

For example in buglist.cgi to access the 'flags' columns you would add the

DefineColumn("flags", $dbh->sql_flag_list(values(%{Bugzilla->user->groups})) .
" AS flags", "Flags");

So we would need to do similar for IssueTrackerList, BlockedByList and

Comment 3 Tony Fu 2008-02-13 01:48:37 EST

I have updated colchange.cgi and buglist.cig files and added modification into
your patch.

Comment 4 Tony Fu 2008-02-13 01:50:27 EST
Created attachment 294756 [details]
Update colchange.cgi and buglist.cgi to show additional columns
Comment 5 David Lawrence 2008-02-13 18:28:08 EST
Comment on attachment 294756 [details]
Update colchange.cgi and buglist.cgi to show additional columns

>+if (Bugzilla->params->{"useissuetracker"} && Bugzilla->user->in_group('issuetracker')) {
>+    push(@masterlist, "cust_facing");
>+    push(@masterlist, "issuetrackers");
>+    push(@masterlist, "itmaxscore");

Only include issuetrackers and itmaxscore in this conditional. Remove
cust_facing since it is already present before the conditional.

Comment 6 David Lawrence 2008-02-14 00:02:57 EST
Created attachment 294892 [details]
Patch to add additional columns in query resultsgroups

Tony, I was able to get your patch to work fine after a couple of small
changes. I am attaching the patch I created here for your review.

Things I did:
1. Created Bugzilla::DB::{Mysql,Pg}::sql_it_max_score() to return the SQL for
showing IT Max Score in query columns. You had the column there in buglist.cgi
but I felt it cleaner to have a function for it similar to the others.
2. Added the new column descriptions to
template/en/default/global/field-descs.none.tmpl that were missing.
3. Only sql_flag_list() needed the values(%{Bugzilla->user->groups}) passed in
as an argument. The others can be blank.

Comment 7 David Lawrence 2008-02-14 00:34:01 EST
I spoke too soon. There is a problem when adding the flags query column. It is
not showing the proper amount of flags. Even though they are set when you view
thew same bug using show_bug.cgi. Will need to investigate.

Comment 8 David Lawrence 2008-02-14 13:28:05 EST
Ok figured out the flag issue. There is a bug in the FlagList stored procedure
that was messing up the group id list temporary table so that some flags would
be missing. I assume this has been this way for a while on the live db and noone
was complaining as it is random and easy to miss.

The REPLACE() string function in MySQL acts globally so it will replace *all*
occurrences of a search string instead of just the first one it finds. So I have
replaced the REPLACE() with TRIM() and it works much better now.

Index: redhat/bugs-functions.mysql
RCS file: /cvs/qa/rh_bugzilla_2_18/redhat/bugs-functions.mysql,v
retrieving revision 1.6
diff -u -r1.6 bugs-functions.mysql
--- redhat/bugs-functions.mysql 27 Aug 2007 16:44:52 -0000      1.6
+++ redhat/bugs-functions.mysql 14 Feb 2008 17:38:10 -0000
@@ -69,7 +69,7 @@
   SET foundPos = INSTR(group_id_list,delim);
   WHILE foundPos <> 0 DO
     SET element = SUBSTRING(group_id_list, 1, foundPos-1);
-    SET group_id_list = REPLACE(group_id_list, CONCAT(element,delim), '');
+    SET group_id_list = TRIM(LEADING CONCAT(element,delim) FROM group_id_list);
     INSERT INTO tmpGroupIds (value) VALUES (element);

I have applied this fix to the live db as well as the test bugs db on
bz-db1-test.devel.redhat.com. After that I was able to view the proper flags
consistently on the test system.

Tony, if you feel that this patch is ready to go then please go ahead and check
in to CVS.


Comment 9 Tony Fu 2008-02-15 02:22:13 EST
I have checked all updates into cvs respository.

Close this ticket.

Note You need to log in before you can comment on or make changes to this bug.