summaryrefslogtreecommitdiffstats
path: root/lib/redmine/field_format.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/redmine/field_format.rb')
-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 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))