Check field type for "in search" operators

classes
Vitaliy Filippov 2016-01-27 18:11:29 +03:00
parent a6ec66012c
commit b8f096bd42
2 changed files with 17 additions and 2 deletions

View File

@ -3289,8 +3289,18 @@ sub _in_search_results
}
else
{
$self->{term}->{where} = "$self->{fieldsql} = $t.bug_id";
$self->{term}->{notnull_field} = "$t.bug_id";
my $f = Bugzilla->get_field($self->{field});
if ($f && ($f->type == FIELD_TYPE_BUG_ID || $f->type == FIELD_TYPE_BUG_ID_REV) ||
$self->{field} eq 'blocked' || $self->{field} eq 'dependson' || $self->{field} eq 'dup_id')
{
$self->{term}->{where} = "$self->{fieldsql} = $t.bug_id";
$self->{term}->{notnull_field} = "$t.bug_id";
$self->{term}->{supp} = [ @{$self->{supptables}} ];
}
else
{
ThrowUserError('in_search_needs_bugid_field', { field => $self->{field} });
}
}
}

View File

@ -532,6 +532,11 @@
Can't use [% field FILTER html %] as a field name.
[% END %]
[% BLOCK error_in_search_needs_bugid_field %]
Subquery search operator ("In Search Results") can only be applied to fields of type "Bug ID".
"[% field | html %]" is not a Bug ID field.
[% END %]
[% BLOCK error_useless_customfield_type %]
[% title = "Can't create field of a useless type" %]
It is impossible to create "[% lc_messages.field_types.$type %]" fields,