Fixes that custom values length and attachment size validation error raises an error.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2667 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2009-04-08 16:56:01 +00:00
1 parent a4a41e05a8
commit 1c03b98e5d
2 files changed
+5 -3

No files matched your search

+2 -2
View File
@@ -48,8 +48,8 @@ protected
errors.add(:value, :blank) if custom_field.is_required? and value.blank?
else
errors.add(:value, :invalid) unless custom_field.regexp.blank? or value =~ Regexp.new(custom_field.regexp)
errors.add(:value, :too_short) if custom_field.min_length > 0 and value.length < custom_field.min_length
errors.add(:value, :too_long) if custom_field.max_length > 0 and value.length > custom_field.max_length
errors.add(:value, :too_short, :count => custom_field.min_length) if custom_field.min_length > 0 and value.length < custom_field.min_length
errors.add(:value, :too_long, :count => custom_field.max_length) if custom_field.max_length > 0 and value.length > custom_field.max_length
# Format specific validations
case custom_field.field_format