Defect #37008
openCustom query
Description
We have made a query for our entities, inheriting the basic redmine Query.
But faced a problem with using custom methods sql_for_['field_name']_field
This is how the filters are defined
def sql_for_something_field(field, operator, values) sql_for_field(field, operator, values, ::StateContract.table_name, :identifier) end
And during the exploitation found that filters with the operator "!*" and string data type do not always work correctly.
All next filters stop working.
Here is the resulting SQL
The problem is the missing brackets around
After some digging, I found (app/models/query.rb:989)
Which did not expose brackets for the custom filter.
I believe that filters, even custom ones, should be isolated.
Please replace
on the
Note
For most filters, your implementation is not a problem
But for the operator "!*" with the string data type in the query, an OR is set, which breaks the query.
No data to display