Browse Source

Remove add inactive key

pull/2677/head
Manny Dinssa 2 years ago
parent
commit
688939db74
  1. 4
      app/models/validations/sales/setup_validations.rb
  2. 9
      config/locales/validations/sales/setup/en.yml

4
app/models/validations/sales/setup_validations.rb

@ -46,12 +46,12 @@ module Validations::Sales::SetupValidations
if record.owning_organisation.present?
if record.owning_organisation&.merge_date.present? && record.owning_organisation.merge_date <= record.saledate
record.errors.add :owning_organisation_id, I18n.t("validations.sales.setup.owning_organisation.inactive_merged_organisation",
record.errors.add :owning_organisation_id, I18n.t("validations.sales.setup.owning_organisation.inactive.merged_organisation",
owning_organisation: record.owning_organisation.name,
merge_date: record.owning_organisation.merge_date.to_formatted_s(:govuk_date),
absorbing_organisation: record.owning_organisation.absorbing_organisation.name)
elsif record.owning_organisation&.absorbed_organisations.present? && record.owning_organisation.available_from.present? && record.owning_organisation.available_from.to_date > record.saledate.to_date
record.errors.add :owning_organisation_id, I18n.t("validations.sales.setup.owning_organisation.inactive_absorbing_organisation",
record.errors.add :owning_organisation_id, I18n.t("validations.sales.setup.owning_organisation.inactive.absorbing_organisation",
owning_organisation: record.owning_organisation.name,
available_from: record.owning_organisation.available_from.to_formatted_s(:govuk_date))
end

9
config/locales/validations/sales/setup/en.yml

@ -16,8 +16,9 @@ en:
"Enter a date when the owning organisation was active. %{owning_organisation} became active on %{available_from}."
owning_organisation:
inactive_merged_organisation:
"The owning organisation must be active on the sale completion date. %{owning_organisation} became inactive on %{merge_date} and was replaced by %{absorbing_organisation}."
inactive_absorbing_organisation:
"The owning organisation must be active on the sale completion date. %{owning_organisation} became active on %{available_from}."
inactive:
merged_organisation:
"The owning organisation must be active on the sale completion date. %{owning_organisation} became inactive on %{merge_date} and was replaced by %{absorbing_organisation}."
absorbing_organisation:
"The owning organisation must be active on the sale completion date. %{owning_organisation} became active on %{available_from}."

Loading…
Cancel
Save