Commit d771ac8c authored by Simon Green's avatar Simon Green

Bug 653597 - Reports with "Real Name" fields use foo_real_name in the url…

Bug 653597 - Reports with "Real Name" fields use foo_real_name in the url parameters for linked queries r=gerv, a=justdave
parent f1a0dec0
...@@ -201,6 +201,12 @@ use constant DEFAULT_FIELDS => ( ...@@ -201,6 +201,12 @@ use constant DEFAULT_FIELDS => (
buglist => 1}, buglist => 1},
{name => 'qa_contact', desc => 'QAContact', in_new_bugmail => 1, {name => 'qa_contact', desc => 'QAContact', in_new_bugmail => 1,
buglist => 1}, buglist => 1},
{name => 'assigned_to_realname', desc => 'AssignedToName',
in_new_bugmail => 0, buglist => 1},
{name => 'reporter_realname', desc => 'ReportedByName',
in_new_bugmail => 0, buglist => 1},
{name => 'qa_contact_realname', desc => 'QAContactName',
in_new_bugmail => 0, buglist => 1},
{name => 'cc', desc => 'CC', in_new_bugmail => 1}, {name => 'cc', desc => 'CC', in_new_bugmail => 1},
{name => 'dependson', desc => 'Depends on', in_new_bugmail => 1, {name => 'dependson', desc => 'Depends on', in_new_bugmail => 1,
is_numeric => 1, buglist => 1}, is_numeric => 1, buglist => 1},
......
...@@ -235,6 +235,9 @@ use constant OPERATOR_FIELD_OVERRIDE => { ...@@ -235,6 +235,9 @@ use constant OPERATOR_FIELD_OVERRIDE => {
assigned_to => { assigned_to => {
_non_changed => \&_user_nonchanged, _non_changed => \&_user_nonchanged,
}, },
assigned_to_realname => {
_non_changed => \&_user_nonchanged,
},
cc => { cc => {
_non_changed => \&_user_nonchanged, _non_changed => \&_user_nonchanged,
}, },
...@@ -244,6 +247,9 @@ use constant OPERATOR_FIELD_OVERRIDE => { ...@@ -244,6 +247,9 @@ use constant OPERATOR_FIELD_OVERRIDE => {
reporter => { reporter => {
_non_changed => \&_user_nonchanged, _non_changed => \&_user_nonchanged,
}, },
reporter_realname => {
_non_changed => \&_user_nonchanged,
},
'requestees.login_name' => { 'requestees.login_name' => {
_non_changed => \&_user_nonchanged, _non_changed => \&_user_nonchanged,
}, },
...@@ -253,7 +259,10 @@ use constant OPERATOR_FIELD_OVERRIDE => { ...@@ -253,7 +259,10 @@ use constant OPERATOR_FIELD_OVERRIDE => {
qa_contact => { qa_contact => {
_non_changed => \&_user_nonchanged, _non_changed => \&_user_nonchanged,
}, },
qa_contact_realname => {
_non_changed => \&_user_nonchanged,
},
# General Bug Fields # General Bug Fields
alias => { _non_changed => \&_nullable }, alias => { _non_changed => \&_nullable },
'attach_data.thedata' => MULTI_SELECT_OVERRIDE, 'attach_data.thedata' => MULTI_SELECT_OVERRIDE,
...@@ -570,9 +579,6 @@ sub COLUMNS { ...@@ -570,9 +579,6 @@ sub COLUMNS {
# of short_short_desc.) # of short_short_desc.)
my %columns = ( my %columns = (
relevance => { title => 'Relevance' }, relevance => { title => 'Relevance' },
assigned_to_realname => { title => 'Assignee' },
reporter_realname => { title => 'Reporter' },
qa_contact_realname => { title => 'QA Contact' },
); );
# Next we define columns that have special SQL instead of just something # Next we define columns that have special SQL instead of just something
...@@ -629,7 +635,7 @@ sub COLUMNS { ...@@ -629,7 +635,7 @@ sub COLUMNS {
$sql = $dbh->sql_string_until($sql, $dbh->quote('@')); $sql = $dbh->sql_string_until($sql, $dbh->quote('@'));
} }
$special_sql{$col} = $sql; $special_sql{$col} = $sql;
$columns{"${col}_realname"}->{name} = "map_${col}.realname"; $special_sql{"${col}_realname"} = "map_${col}.realname";
} }
foreach my $col (@id_fields) { foreach my $col (@id_fields) {
...@@ -2399,6 +2405,20 @@ sub _user_nonchanged { ...@@ -2399,6 +2405,20 @@ sub _user_nonchanged {
if ($args->{value_is_id}) { if ($args->{value_is_id}) {
$null_alternate = 0; $null_alternate = 0;
} }
elsif (substr($field, -9) eq '_realname') {
my $as = "name_${field}_$chart_id";
# For fields with periods in their name.
$as =~ s/\./_/;
my $join = {
table => 'profiles',
as => $as,
from => substr($args->{full_field}, 0, -9),
to => 'userid',
join => (!$is_in_other_table and !$is_nullable) ? 'INNER' : undef,
};
push(@$joins, $join);
$args->{full_field} = "$as.realname";
}
else { else {
my $as = "name_${field}_$chart_id"; my $as = "name_${field}_$chart_id";
# For fields with periods in their name. # For fields with periods in their name.
...@@ -2413,7 +2433,7 @@ sub _user_nonchanged { ...@@ -2413,7 +2433,7 @@ sub _user_nonchanged {
push(@$joins, $join); push(@$joins, $join);
$args->{full_field} = "$as.login_name"; $args->{full_field} = "$as.login_name";
} }
# We COALESCE fields that can be NULL, to make "not"-style operators # We COALESCE fields that can be NULL, to make "not"-style operators
# continue to work properly. For example, "qa_contact is not equal to bob" # continue to work properly. For example, "qa_contact is not equal to bob"
# should also show bugs where the qa_contact is NULL. With COALESCE, # should also show bugs where the qa_contact is NULL. With COALESCE,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment