Support truncated versions of assigned_to, reporter and qa_contact in search

master
Vitaliy Filippov 2014-08-25 15:05:25 +04:00
parent 10c4d41651
commit 96bea7c648
3 changed files with 18 additions and 8 deletions

View File

@ -465,6 +465,9 @@ sub STATIC_COLUMNS
assigned_to_realname => { title => 'Assignee Name' },
reporter_realname => { title => 'Reporter Name' },
qa_contact_realname => { title => 'QA Contact Name' },
assigned_to_short => { title => 'Assignee Login' },
reporter_short => { title => 'Reporter Login' },
qa_contact_short => { title => 'QA Contact Login' },
# FIXME save aggregated work_time in bugs table and search on it
work_time => { name => $actual_time },
interval_time => { name => $actual_time, title => 'Period Worktime', noreports => 1 },
@ -527,14 +530,13 @@ sub STATIC_COLUMNS
foreach my $col (qw(assigned_to reporter qa_contact))
{
my $sql = "map_${col}.login_name";
if (!Bugzilla->user->id)
{
$sql = $dbh->sql_string_until($sql, $dbh->quote('@'));
}
$columns->{$col.'_realname'}->{name} = "map_${col}.realname";
$columns->{$col}->{name} = $sql;
$columns->{$col.'_short'}->{name} = $dbh->sql_string_until($sql, $dbh->quote('@'));
$columns->{$col}->{name} = Bugzilla->user->id ? $sql : $columns->{$col.'_short'}->{name};
# Only the qa_contact field can be NULL
$columns->{$col}->{joins} = $columns->{"${col}_realname"}->{joins} = [
$columns->{$col}->{joins} =
$columns->{$col.'_short'}->{joins} =
$columns->{$col.'_realname'}->{joins} = [
($col eq 'qa_contact' ? 'LEFT' : 'INNER').
" JOIN profiles AS map_$col ON bugs.$col = map_$col.userid"
];

View File

@ -680,11 +680,11 @@ if (grep { $_ eq 'percentage_complete' } @displaycolumns)
# Make sure that the login_name version of a field is always also
# requested if the realname version is requested, so that we can
# display the login name when the realname is empty.
my @realname_fields = grep(/_realname$/, @displaycolumns);
my @realname_fields = grep(/_realname$|_short$/, @displaycolumns);
foreach my $item (@realname_fields)
{
my $login_field = $item;
$login_field =~ s/_realname$//;
$login_field =~ s/_realname$|_short$//;
if (!grep($_ eq $login_field, @selectcolumns))
{
push(@selectcolumns, $login_field);
@ -1320,6 +1320,9 @@ $vars->{abbrev} = {
assigned_to => { maxlength => 30, ellipsis => "..." },
reporter => { maxlength => 30, ellipsis => "..." },
qa_contact => { maxlength => 30, ellipsis => "..." },
assigned_to_short => { title => "Assignee" },
reporter_short => { title => "Reporter" },
qa_contact_short => { title => "QA" },
resolution => { maxlength => 4 },
short_short_desc => { maxlength => 60, ellipsis => "..." },
status_whiteboard => { title => "Whiteboard" },

View File

@ -236,6 +236,11 @@
[%- bug.$column.truncate(abbrev.$column.maxlength, abbrev.$column.ellipsis) FILTER html -%]
</a>
[% END %]
[% ELSIF column == 'assigned_to_short' || column == 'qa_contact_short' || column == 'reporter_short' %]
[% SET login_column = column.remove('_short$') %]
<a href="buglist.cgi?quicksearch=[% 'OPEN ' _ login_column _ ':' _ bug.$login_column | url_quote %]">
[%- bug.$column.truncate(abbrev.$column.maxlength, abbrev.$column.ellipsis) FILTER html -%]
</a>
[% ELSIF column == 'product' %]
<a href="buglist.cgi?quicksearch=[% "OPEN product:" _ bug.$column | url_quote %]">
[%- bug.$column.truncate(abbrev.$column.maxlength, abbrev.$column.ellipsis) FILTER html -%]