diff options
Diffstat (limited to 'app/models/time_entry_query.rb')
-rw-r--r-- | app/models/time_entry_query.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/models/time_entry_query.rb b/app/models/time_entry_query.rb index a921f6d93..148c657c0 100644 --- a/app/models/time_entry_query.rb +++ b/app/models/time_entry_query.rb @@ -86,7 +86,9 @@ class TimeEntryQuery < Query add_available_filter "hours", :type => :float add_custom_fields_filters(TimeEntryCustomField) - add_associations_custom_fields_filters :project, :issue, :user + add_associations_custom_fields_filters :project + add_custom_fields_filters(issue_custom_fields, :issue) + add_associations_custom_fields_filters :user end def available_columns @@ -94,7 +96,7 @@ class TimeEntryQuery < Query @available_columns = self.class.available_columns.dup @available_columns += TimeEntryCustomField.visible. map {|cf| QueryCustomFieldColumn.new(cf) } - @available_columns += IssueCustomField.visible. + @available_columns += issue_custom_fields.visible. map {|cf| QueryAssociationCustomFieldColumn.new(:issue, cf) } @available_columns end @@ -138,4 +140,12 @@ class TimeEntryQuery < Query end self end + + def issue_custom_fields + if project + project.all_issue_custom_fields + else + IssueCustomField.where(:is_for_all => true) + end + end end |