diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-07-28 09:59:34 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-07-28 09:59:34 +0000 |
commit | 21fc903c0424c45c86430588b0ecb8f0cc589efa (patch) | |
tree | d9654cffe1586acae13bf7cdcfca21292f8a6429 /app/models | |
parent | dc5e5eca6b7cb124da1e47036f8a688bb4a7688c (diff) | |
download | redmine-21fc903c0424c45c86430588b0ecb8f0cc589efa.tar.gz redmine-21fc903c0424c45c86430588b0ecb8f0cc589efa.zip |
Fixed that sorting time entries by custom field raises a SQL error (#14366).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12042 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/time_entry_query.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/time_entry_query.rb b/app/models/time_entry_query.rb index 3a6ab64ef..3325b55a8 100644 --- a/app/models/time_entry_query.rb +++ b/app/models/time_entry_query.rb @@ -100,6 +100,15 @@ class TimeEntryQuery < Query @default_columns_names ||= [:project, :spent_on, :user, :activity, :issue, :comments, :hours] end + def results_scope(options={}) + order_option = [group_by_sort_order, options[:order]].flatten.reject(&:blank?) + + TimeEntry.visible. + where(statement). + order(order_option). + joins(joins_for_order_statement(order_option.join(','))) + end + # Accepts :from/:to params as shortcut filters def build_from_params(params) super |