summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-05-08 04:30:24 +0000
committerGo MAEDA <maeda@farend.jp>2020-05-08 04:30:24 +0000
commit4fd0e739dbfe69cdaada4fdba80423d5da0a154d (patch)
tree70d51a4bb09dd8fc2a809013a743cf69877a846d /app
parentdc20ffcfaeb9ac6fcbf126053d486f8efee41542 (diff)
downloadredmine-4fd0e739dbfe69cdaada4fdba80423d5da0a154d.tar.gz
redmine-4fd0e739dbfe69cdaada4fdba80423d5da0a154d.zip
Fix that totals of custom fields may not be sorted as configured (#33281).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@19758 e93f8b46-1217-0410-a6f0-8f06a7374b81
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