Defect #12146 » 11_correct_bug_with_required_cf_with_multiple_values.patch
| app\models\issue.rb 2013-09-18 09:33:10.000000000 +0200 | ||
|---|---|---|
|
user = new_record? ? author : current_journal.try(:user)
|
||
|
|
||
|
required_attribute_names(user).each do |attribute|
|
||
|
if attribute =~ /^\d+$/
|
||
|
attribute = attribute.to_i
|
||
|
v = custom_field_values.detect {|v| v.custom_field_id == attribute }
|
||
|
if v && v.value.blank?
|
||
|
errors.add :base, v.custom_field.name + ' ' + l('activerecord.errors.messages.blank')
|
||
|
if v
|
||
|
if v.value.is_a?(Array)
|
||
|
if ((v.value.count == 0) || ((v.value.count == 1) && (v.value[0] == "")))
|
||
|
errors.add :base, v.custom_field.name + ' ' + l('activerecord.errors.messages.blank')
|
||
|
end
|
||
|
else
|
||
|
if v.value.blank?
|
||
|
errors.add :base, v.custom_field.name + ' ' + l('activerecord.errors.messages.blank')
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
else
|
||
|
if respond_to?(attribute) && send(attribute).blank?
|
||
|
errors.add attribute, :blank
|
||
|
end
|
||
|
end
|
||