mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-20 15:31:12 +00:00
Moves sort joins for issues to IssueQuery.
git-svn-id: http://svn.redmine.org/redmine/trunk@16216 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
dfe2a91684
commit
82afdc7f78
@ -505,4 +505,16 @@ class IssueQuery < Query
|
|||||||
IssueRelation::TYPES.keys.each do |relation_type|
|
IssueRelation::TYPES.keys.each do |relation_type|
|
||||||
alias_method "sql_for_#{relation_type}_field".to_sym, :sql_for_relations
|
alias_method "sql_for_#{relation_type}_field".to_sym, :sql_for_relations
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
@ -1297,9 +1297,6 @@ class Query < ActiveRecord::Base
|
|||||||
joins = []
|
joins = []
|
||||||
|
|
||||||
if order_options
|
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|
|
order_options.scan(/cf_\d+/).uniq.each do |name|
|
||||||
column = available_columns.detect {|c| c.name.to_s == name}
|
column = available_columns.detect {|c| c.name.to_s == name}
|
||||||
join = column && column.custom_field.join_for_order_statement
|
join = column && column.custom_field.join_for_order_statement
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user