1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-04 14:49:41 +00:00

Missing validation for custom field formats based on RecordList (#29674).

Patch by Alexander Achenbach.

git-svn-id: http://svn.redmine.org/redmine/trunk@17645 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2018-11-28 18:15:34 +00:00
parent 726a6e3c81
commit bee7f2531b

View File

@ -740,6 +740,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))