Browse Source

Update validation logic for change dates to handle immediate changes

pull/3053/head
Manny Dinssa 3 weeks ago
parent
commit
b52035cce3
  1. 3
      app/models/organisation_name_change.rb

3
app/models/organisation_name_change.rb

@ -74,7 +74,8 @@ private
return if change_date.blank?
if organisation.organisation_name_changes.visible.select(&:persisted?).any? { |record| record.change_date == change_date }
errors.add(:change_date, "Start date cannot be the same as another name change.")
errors.add(:change_date, "Start date cannot be the same as another name change.") unless immediate_change
errors.add(:immediate_change, "Start date cannot be the same as another name change.") if immediate_change
end
end

Loading…
Cancel
Save