1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-10-17 17:01:01 +00:00

shorten long line of Query#sql_for_custom_field

git-svn-id: http://svn.redmine.org/redmine/trunk@20640 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2020-12-12 15:49:44 +00:00
parent fd112cb766
commit a91da01ade

View File

@ -1129,9 +1129,11 @@ class Query < ActiveRecord::Base
if /[<>]/.match?(operator)
where = "(#{where}) AND #{db_table}.#{db_field} <> ''"
end
"#{queried_table_name}.#{customized_key} #{not_in} IN (" +
"SELECT #{customized_class.table_name}.id FROM #{customized_class.table_name}" +
" LEFT OUTER JOIN #{db_table} ON #{db_table}.customized_type='#{customized_class}' AND #{db_table}.customized_id=#{customized_class.table_name}.id AND #{db_table}.custom_field_id=#{custom_field_id}" +
"#{queried_table_name}.#{customized_key} #{not_in} IN (" \
"SELECT #{customized_class.table_name}.id FROM #{customized_class.table_name}" \
" LEFT OUTER JOIN #{db_table} ON #{db_table}.customized_type='#{customized_class}'" \
" AND #{db_table}.customized_id=#{customized_class.table_name}.id" \
" AND #{db_table}.custom_field_id=#{custom_field_id}" \
" WHERE (#{where}) AND (#{filter[:field].visibility_by_project_condition}))"
end