@@ -505,4 +505,16 class IssueQuery < Query | |||
|
505 | 505 | IssueRelation::TYPES.keys.each do |relation_type| |
|
506 | 506 | alias_method "sql_for_#{relation_type}_field".to_sym, :sql_for_relations |
|
507 | 507 | end |
|
508 | ||
|
509 | def joins_for_order_statement(order_options) | |
|
510 | joins = [super] | |
|
511 | ||
|
512 | if order_options | |
|
513 | if order_options.include?('authors') | |
|
514 | joins << "LEFT OUTER JOIN #{User.table_name} authors ON authors.id = #{queried_table_name}.author_id" | |
|
515 | end | |
|
516 | end | |
|
517 | ||
|
518 | joins.any? ? joins.join(' ') : nil | |
|
519 | end | |
|
508 | 520 | end |
@@ -1297,9 +1297,6 class Query < ActiveRecord::Base | |||
|
1297 | 1297 | joins = [] |
|
1298 | 1298 | |
|
1299 | 1299 | if order_options |
|
1300 | if order_options.include?('authors') | |
|
1301 | joins << "LEFT OUTER JOIN #{User.table_name} authors ON authors.id = #{queried_table_name}.author_id" | |
|
1302 | end | |
|
1303 | 1300 | order_options.scan(/cf_\d+/).uniq.each do |name| |
|
1304 | 1301 | column = available_columns.detect {|c| c.name.to_s == name} |
|
1305 | 1302 | join = column && column.custom_field.join_for_order_statement |
General Comments 0
You need to be logged in to leave comments.
Login now