Commit 0d7dc740 authored by jplang's avatar jplang

Moves sort joins for issues to IssueQuery.

git-svn-id: https://svn.redmine.org/redmine/trunk@16216 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 33907fa0
......@@ -505,4 +505,16 @@ class IssueQuery < Query
IssueRelation::TYPES.keys.each do |relation_type|
alias_method "sql_for_#{relation_type}_field".to_sym, :sql_for_relations
end
def joins_for_order_statement(order_options)
joins = [super]
if order_options
if order_options.include?('authors')
joins << "LEFT OUTER JOIN #{User.table_name} authors ON authors.id = #{queried_table_name}.author_id"
end
end
joins.any? ? joins.join(' ') : nil
end
end
......@@ -1297,9 +1297,6 @@ class Query < ActiveRecord::Base
joins = []
if order_options
if order_options.include?('authors')
joins << "LEFT OUTER JOIN #{User.table_name} authors ON authors.id = #{queried_table_name}.author_id"
end
order_options.scan(/cf_\d+/).uniq.each do |name|
column = available_columns.detect {|c| c.name.to_s == name}
join = column && column.custom_field.join_for_order_statement
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment