diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-12-15 09:49:12 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-12-15 09:49:12 +0000 |
commit | c6fc1a8047cb2707882cbc586065bf3bd7872aa2 (patch) | |
tree | 97c3b957e08bd9885d4f7526dbe7a72875740425 /app/models/time_entry_query.rb | |
parent | a4a91cab7ef70d900f35c7d0b6b41de5e1ba8ea4 (diff) | |
download | redmine-c6fc1a8047cb2707882cbc586065bf3bd7872aa2.tar.gz redmine-c6fc1a8047cb2707882cbc586065bf3bd7872aa2.zip |
Fixed that filtering time entries on activity does not take care of activity overrides (#15623).
git-svn-id: http://svn.redmine.org/redmine/trunk@12414 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/time_entry_query.rb')
-rw-r--r-- | app/models/time_entry_query.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/models/time_entry_query.rb b/app/models/time_entry_query.rb index 3325b55a8..02bc10090 100644 --- a/app/models/time_entry_query.rb +++ b/app/models/time_entry_query.rb @@ -106,7 +106,20 @@ class TimeEntryQuery < Query TimeEntry.visible. where(statement). order(order_option). - joins(joins_for_order_statement(order_option.join(','))) + joins(joins_for_order_statement(order_option.join(','))). + includes(:activity) + end + + def sql_for_activity_id_field(field, operator, value) + condition_on_id = sql_for_field(field, operator, value, Enumeration.table_name, 'id') + condition_on_parent_id = sql_for_field(field, operator, value, Enumeration.table_name, 'parent_id') + ids = value.map(&:to_i).join(',') + table_name = Enumeration.table_name + if operator == '=' + "(#{table_name}.id IN (#{ids}) OR #{table_name}.parent_id IN (#{ids}))" + else + "(#{table_name}.id NOT IN (#{ids}) AND (#{table_name}.parent_id IS NULL OR #{table_name}.parent_id NOT IN (#{ids})))" + end end # Accepts :from/:to params as shortcut filters |