Bug 406371

Summary: 3.27: Additional columns available in query resultsgroups
Product: [Community] Bugzilla Reporter: David Lawrence <dkl>
Component: Bugzilla GeneralAssignee: David Lawrence <dkl>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: high    
Version: 3.2   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: 6 hours
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-02-15 07:22:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 406071, 427052    
Attachments:
Description Flags
Patch to add methods to db modules to access stored db functions (v1)
none
Update colchange.cgi and buglist.cgi to show additional columns
none
Patch to add additional columns in query resultsgroups none

Description David Lawrence 2007-11-30 16:58:51 UTC
Description:
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 21:31:21 UTC
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-13 04:37:20 UTC
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
line:

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

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

Dave

Comment 3 Tony Fu 2008-02-13 06:48:37 UTC
Dave,

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


Tony


Comment 4 Tony Fu 2008-02-13 06:50:27 UTC
Created attachment 294756 [details]
Update colchange.cgi and buglist.cgi to show additional columns

Comment 5 David Lawrence 2008-02-13 23:28:08 UTC
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.

Dave

Comment 6 David Lawrence 2008-02-14 05:02:57 UTC
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.

Dave

Comment 7 David Lawrence 2008-02-14 05:34:01 UTC
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.

Dave 

Comment 8 David Lawrence 2008-02-14 18:28:05 UTC
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.

review+

Dave

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

Close this ticket.