summaryrefslogtreecommitdiffstats
path: root/app/models/time_entry_query.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-09 21:03:30 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-12-09 21:03:30 +0000
commit0ce6eb92850b550c5fd23bd87fc42ed4f29bcc0c (patch)
treec648b688f81bcf124aafa2809b217d09cd977e33 /app/models/time_entry_query.rb
parent60088ed5a30408eb99207c11509deb888494846b (diff)
downloadredmine-0ce6eb92850b550c5fd23bd87fc42ed4f29bcc0c.tar.gz
redmine-0ce6eb92850b550c5fd23bd87fc42ed4f29bcc0c.zip
Makes time entry custom fields available for display on the time entries list (#1766).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10972 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/time_entry_query.rb')
-rw-r--r--app/models/time_entry_query.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/time_entry_query.rb b/app/models/time_entry_query.rb
index 60fc84312..9a2cd5af6 100644
--- a/app/models/time_entry_query.rb
+++ b/app/models/time_entry_query.rb
@@ -21,7 +21,7 @@ class TimeEntryQuery < Query
self.available_columns = [
QueryColumn.new(:project, :sortable => "#{Project.table_name}.name", :groupable => true),
- QueryColumn.new(:spent_on, :sortable => ["#{TimeEntry.table_name}.spent_on", "#{TimeEntry.table_name}.created_on"]),
+ QueryColumn.new(:spent_on, :sortable => ["#{TimeEntry.table_name}.spent_on", "#{TimeEntry.table_name}.created_on"], :default_order => 'desc', :groupable => true),
QueryColumn.new(:user, :sortable => lambda {User.fields_for_order_statement}, :groupable => true),
QueryColumn.new(:activity, :sortable => "#{TimeEntryActivity.table_name}.position", :groupable => true),
QueryColumn.new(:issue, :sortable => "#{Issue.table_name}.id"),
@@ -96,6 +96,13 @@ class TimeEntryQuery < Query
@available_filters
end
+ def available_columns
+ return @available_columns if @available_columns
+ @available_columns = self.class.available_columns.dup
+ @available_columns += TimeEntryCustomField.all.map {|cf| QueryCustomFieldColumn.new(cf) }
+ @available_columns
+ end
+
def default_columns_names
@default_columns_names ||= [:project, :spent_on, :user, :activity, :issue, :comments, :hours]
end