diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2022-09-26 21:44:06 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2022-09-26 21:44:06 +0000 |
commit | cecbd9cd73f007438cf4cf007ec19d0ef73856c3 (patch) | |
tree | 64a01fbe19ba9b762a975d8af67f54af8d1c8f01 /app | |
parent | 06308f5bdf3c704b858375f72d8e2107fb18ed6f (diff) | |
download | redmine-cecbd9cd73f007438cf4cf007ec19d0ef73856c3.tar.gz redmine-cecbd9cd73f007438cf4cf007ec19d0ef73856c3.zip |
Merge r21833 to 5.0-stable (#37268).
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@21847 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/query.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index 1a614f175..8f1a0cee3 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -1159,12 +1159,13 @@ 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}" \ + "#{not_in} EXISTS (" \ + "SELECT ct.id FROM #{customized_class.table_name} ct" \ " 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}.customized_id=ct.id" \ " AND #{db_table}.custom_field_id=#{custom_field_id}" \ - " WHERE (#{where}) AND (#{filter[:field].visibility_by_project_condition}))" + " WHERE #{queried_table_name}.#{customized_key} = ct.id AND " \ + " (#{where}) AND (#{filter[:field].visibility_by_project_condition}))" end def sql_for_chained_custom_field(field, operator, value, custom_field_id, chained_custom_field_id) |