" SELECT customized_id FROM #{CustomValue.table_name}" +
" WHERE customized_type='#{target_class}' AND custom_field_id=#{chained_custom_field_id}" +
" AND #{sql_for_field(field, operator, value, CustomValue.table_name, 'value')}))"
-
+
end
def sql_for_custom_field_attribute(field, operator, value, custom_field_id, attribute)
end
when "!*"
sql = "#{db_table}.#{db_field} IS NULL"
- sql << " OR #{db_table}.#{db_field} = ''" if is_custom_filter
+ sql << " OR #{db_table}.#{db_field} = ''" if (is_custom_filter || [:text, :string].include?(type_for(field)))
when "*"
sql = "#{db_table}.#{db_field} IS NOT NULL"
sql << " AND #{db_table}.#{db_field} <> ''" if is_custom_filter
assert issues.all? {|i| i.custom_field_value(2).blank?}
end
+ def test_operator_none_for_text
+ query = IssueQuery.new(:name => '_')
+ query.add_filter('status_id', '*', [''])
+ query.add_filter('description', '!*', [''])
+ assert query.has_filter?('description')
+ issues = find_issues_with_query(query)
+
+ assert issues.any?
+ assert issues.all? {|i| i.description.blank?}
+ assert_equal [11, 12], issues.map(&:id).sort
+ end
+
def test_operator_all
query = IssueQuery.new(:project => Project.find(1), :name => '_')
query.add_filter('fixed_version_id', '*', [''])