summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-11-29 15:44:21 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-11-29 15:44:21 +0000
commit8be3e7878d5d9837c3961c53c137f40d3ee6d6f0 (patch)
tree282c23070ecc0f9d624a6733b3c5e4cf531fcd7b /lib
parentb9fb0189ddd52617a50dc4458ee4129ee25d3425 (diff)
downloadredmine-8be3e7878d5d9837c3961c53c137f40d3ee6d6f0.tar.gz
redmine-8be3e7878d5d9837c3961c53c137f40d3ee6d6f0.zip
Merged r17645 to 3.4-stable (#29674).
git-svn-id: http://svn.redmine.org/redmine/branches/3.4-stable@17654 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/field_format.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/redmine/field_format.rb b/lib/redmine/field_format.rb
index 497147388..e4bad2863 100644
--- a/lib/redmine/field_format.rb
+++ b/lib/redmine/field_format.rb
@@ -736,6 +736,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))