summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-10 18:19:21 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-10 18:19:21 +0000
commitbedbb166b7e7c68e40f7e0e23a17ae2dc3783811 (patch)
tree698f5b7c6463d5b4e6b4602d93995f2111f39bb5 /app
parentbf15b06d98a8db28d610e38f8266d03d018a3b9f (diff)
downloadredmine-bedbb166b7e7c68e40f7e0e23a17ae2dc3783811.tar.gz
redmine-bedbb166b7e7c68e40f7e0e23a17ae2dc3783811.zip
Reject non numeric values for numeric fields.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6228 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/query.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 33fe2ec5f..b9be08519 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -278,7 +278,11 @@ class Query < ActiveRecord::Base
# allowed_values = values & ([""] + (filter_options[:values] || []).collect {|val| val[1]})
# filters[field] = {:operator => operator, :values => allowed_values } if (allowed_values.first and !allowed_values.first.empty?) or ["o", "c", "!*", "*", "t"].include? operator
#end
- filters[field] = {:operator => operator, :values => (values || ['']) }
+ values ||= ['']
+ if filter_options[:type] == :integer
+ values = values.select {|v| v.blank? || v.match(/^\d+(\.\d+)?$/) }
+ end
+ filters[field] = {:operator => operator, :values => values }
end
end