summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/project_query.rb2
-rw-r--r--app/models/query.rb9
-rw-r--r--app/models/time_entry_query.rb6
3 files changed, 11 insertions, 6 deletions
diff --git a/app/models/project_query.rb b/app/models/project_query.rb
index 72a0922bd..b8c79072f 100644
--- a/app/models/project_query.rb
+++ b/app/models/project_query.rb
@@ -69,7 +69,7 @@ class ProjectQuery < Query
def available_columns
return @available_columns if @available_columns
@available_columns = self.class.available_columns.dup
- @available_columns += ProjectCustomField.visible.
+ @available_columns += project_custom_fields.visible.
map {|cf| QueryCustomFieldColumn.new(cf) }
@available_columns
end
diff --git a/app/models/query.rb b/app/models/query.rb
index 100728cff..45e9882a7 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -609,13 +609,18 @@ class Query < ActiveRecord::Base
if project
project.rolled_up_custom_fields
else
- IssueCustomField.all
+ IssueCustomField.sorted
end
end
# Returns a scope of project custom fields that are available as columns or filters
def project_custom_fields
- ProjectCustomField.all
+ ProjectCustomField.sorted
+ end
+
+ # Returns a scope of time entry custom fields that are available as columns or filters
+ def time_entry_custom_fields
+ TimeEntryCustomField.sorted
end
# Returns a scope of project statuses that are available as columns or filters
diff --git a/app/models/time_entry_query.rb b/app/models/time_entry_query.rb
index 610e7628e..c8f8eeaeb 100644
--- a/app/models/time_entry_query.rb
+++ b/app/models/time_entry_query.rb
@@ -100,7 +100,7 @@ class TimeEntryQuery < Query
add_available_filter "comments", :type => :text
add_available_filter "hours", :type => :float
- add_custom_fields_filters(TimeEntryCustomField)
+ add_custom_fields_filters(time_entry_custom_fields)
add_associations_custom_fields_filters :project
add_custom_fields_filters(issue_custom_fields, :issue)
add_associations_custom_fields_filters :user
@@ -109,11 +109,11 @@ class TimeEntryQuery < Query
def available_columns
return @available_columns if @available_columns
@available_columns = self.class.available_columns.dup
- @available_columns += TimeEntryCustomField.visible.
+ @available_columns += time_entry_custom_fields.visible.
map {|cf| QueryCustomFieldColumn.new(cf) }
@available_columns += issue_custom_fields.visible.
map {|cf| QueryAssociationCustomFieldColumn.new(:issue, cf, :totalable => false) }
- @available_columns += ProjectCustomField.visible.
+ @available_columns += project_custom_fields.visible.
map {|cf| QueryAssociationCustomFieldColumn.new(:project, cf) }
@available_columns
end