Patch #20124
openQuery option, The sql for field to allow groups option.
0%
Description
The simple commit help abundantly and allow us to grouping the custom queries.
When the available filters is added with the field name, the check already exists for sql field statement.
Another check is added when the field is added with grouping.
Please update this patch in the core.
Thanks.
Files
Updated by Rupesh J over 9 years ago
The advantage of this patch, is that I do not need to alias the sql_for_field method in my plugin!
I am also open for more elegant solution.
Thanks.
Updated by Toshi MARUYAMA almost 9 years ago
- Status changed from New to Needs feedback
Where is $2
from?field =~ /^(.+)\./
returns only $1
.
Updated by Rupesh J almost 9 years ago
For the below cases, With grouping of filters,
Suppose, If I add a custom filter through a plugin patch
add_available_filter("question.qassigned_to_id", :type => :list, :values => author_values,
:caption => :field_question_assigned_to_id, :name => l(:field_question_assigned_to_id_esi)
)
The only way to handle the corresponding SQL query is to alias the sql_for_field.
Instead if the attached patch is provided,
I can avoid the alias and also have my method,
def sql_for_qassigned_to_id_field(.....)
.... sql logic...
end
Thank You.
Updated by Toshi MARUYAMA almost 9 years ago
In your sql_for_fields_with_group-git.diff
elsif field =~ /^(.+)\./ && respond_to?("sql_for_#{$2}_field")
# specific statement
filters_clauses << send("sql_for_#{$2}_field", field, operator, v)
http://ruby-doc.org/core-2.1.1/Regexp.html#class-Regexp-label-Special+global+variables
$1, $2 and so on contain text matching first, second, etc capture group;
But your field =~ /^(.+)\./
has only one parenthesis.
Updated by Rupesh J almost 9 years ago
Yes, Realized my mistake. Thank You.
Here is the Updated patch.
Thanks.
Updated by Toshi MARUYAMA almost 9 years ago
- Status changed from Needs feedback to New