Project

General

Profile

Defect #37268 » 37268.patch

Marius BĂLTEANU, 2022-09-13 23:08

View differences:

app/models/query.rb
1159 1159
    if /[<>]/.match?(operator)
1160 1160
      where = "(#{where}) AND #{db_table}.#{db_field} <> ''"
1161 1161
    end
1162
    "#{queried_table_name}.#{customized_key} #{not_in} IN (" \
1163
      "SELECT #{customized_class.table_name}.id FROM #{customized_class.table_name}" \
1162
    "#{not_in} EXISTS (" \
1163
      "SELECT ct.id FROM #{customized_class.table_name} ct" \
1164 1164
      " LEFT OUTER JOIN #{db_table} ON #{db_table}.customized_type='#{customized_class}'" \
1165
      " AND #{db_table}.customized_id=#{customized_class.table_name}.id" \
1165
      " AND #{db_table}.customized_id=ct.id" \
1166 1166
      " AND #{db_table}.custom_field_id=#{custom_field_id}" \
1167
      " WHERE (#{where}) AND (#{filter[:field].visibility_by_project_condition}))"
1167
      " WHERE #{queried_table_name}.#{customized_key} = ct.id AND " \
1168
      "  (#{where}) AND (#{filter[:field].visibility_by_project_condition}))"
1168 1169
  end
1169 1170
  def sql_for_chained_custom_field(field, operator, value, custom_field_id, chained_custom_field_id)
(10-10/10)