diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-11-29 15:44:32 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2018-11-29 15:44:32 +0000 |
commit | f2b0e224a1aa80c8c2442890678239629395bae4 (patch) | |
tree | ff0aca9de6c53fdb5b9fd0c0aca4845c9cd15c46 /lib/redmine/field_format.rb | |
parent | edd27a3216657ceda278e2f61d1aa76d8ca920f4 (diff) | |
download | redmine-f2b0e224a1aa80c8c2442890678239629395bae4.tar.gz redmine-f2b0e224a1aa80c8c2442890678239629395bae4.zip |
Merged r17645 to 3.3-stable (#29674).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@17655 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/field_format.rb')
-rw-r--r-- | lib/redmine/field_format.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb index bdc0d1a98..e5591284b 100644 --- a/lib/redmine/field_format.rb +++ b/lib/redmine/field_format.rb @@ -674,6 +674,16 @@ module Redmine options end + def validate_custom_value(custom_value) + values = Array.wrap(custom_value.value).reject {|value| value.to_s == ''} + invalid_values = values - possible_custom_value_options(custom_value).map(&:last) + if invalid_values.any? + [::I18n.t('activerecord.errors.messages.inclusion')] + else + [] + end + end + def order_statement(custom_field) if target_class.respond_to?(:fields_for_order_statement) target_class.fields_for_order_statement(value_join_alias(custom_field)) |