]> source.dussan.org Git - redmine.git/commitdiff
Merged r9671 from trunk.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 12 May 2012 12:42:30 +0000 (12:42 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 12 May 2012 12:42:30 +0000 (12:42 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9672 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/query.rb
test/fixtures/custom_fields.yml
test/unit/query_test.rb

index 4e72ae5c7c5695febed068bf82cccd026abc6f22..7fffc136c8f2c7a8b4b5099d325d55dc04e41c47 100644 (file)
@@ -126,8 +126,8 @@ class Query < ActiveRecord::Base
                                  :list_subprojects => [ "*", "!*", "=" ],
                                  :date => [ "=", ">=", "<=", "><", "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-", "!*", "*" ],
                                  :date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "t-", "t", "w", "!*", "*" ],
-                                 :string => [ "=", "~", "!", "!~" ],
-                                 :text => [  "~", "!~" ],
+                                 :string => [ "=", "~", "!", "!~", "!*", "*" ],
+                                 :text => [  "~", "!~", "!*", "*" ],
                                  :integer => [ "=", ">=", "<=", "><", "!*", "*" ],
                                  :float => [ "=", ">=", "<=", "><", "!*", "*" ] }
 
index b99de35a3e6496906fa95625cf804c0d76ae5a62..1f1b34b305f4019c7e9f3a3e9e9f84dc9584fac2 100644 (file)
@@ -21,6 +21,7 @@ custom_fields_002:
   min_length: 1
   regexp: ""
   is_for_all: true
+  is_filter: true
   type: IssueCustomField
   max_length: 100
   possible_values: ""
index 52e29de7e9db81da199d5eb088713e9ea64573e7..091030104ff4d768ebf72b66a094491ed0e0a860 100644 (file)
@@ -112,6 +112,15 @@ class QueryTest < ActiveSupport::TestCase
     assert issues.all? {|i| i.start_date.nil?}
   end
 
+  def test_operator_none_for_string_custom_field
+    query = Query.new(:project => Project.find(1), :name => '_')
+    query.add_filter('cf_2', '!*', [''])
+    assert query.has_filter?('cf_2')
+    issues = find_issues_with_query(query)
+    assert !issues.empty?
+    assert issues.all? {|i| i.custom_field_value(2).blank?}
+  end
+
   def test_operator_all
     query = Query.new(:project => Project.find(1), :name => '_')
     query.add_filter('fixed_version_id', '*', [''])
@@ -129,6 +138,15 @@ class QueryTest < ActiveSupport::TestCase
     assert issues.all? {|i| i.start_date.present?}
   end
 
+  def test_operator_all_for_string_custom_field
+    query = Query.new(:project => Project.find(1), :name => '_')
+    query.add_filter('cf_2', '*', [''])
+    assert query.has_filter?('cf_2')
+    issues = find_issues_with_query(query)
+    assert !issues.empty?
+    assert issues.all? {|i| i.custom_field_value(2).present?}
+  end
+
   def test_numeric_filter_should_not_accept_non_numeric_values
     query = Query.new(:name => '_')
     query.add_filter('estimated_hours', '=', ['a'])