From 688939db74abad2260d6d9e413d79fce1dd9d37e Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:50:13 +0100 Subject: [PATCH] Remove add inactive key --- app/models/validations/sales/setup_validations.rb | 4 ++-- config/locales/validations/sales/setup/en.yml | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/models/validations/sales/setup_validations.rb b/app/models/validations/sales/setup_validations.rb index 6f31a393a..8417edbc7 100644 --- a/app/models/validations/sales/setup_validations.rb +++ b/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 diff --git a/config/locales/validations/sales/setup/en.yml b/config/locales/validations/sales/setup/en.yml index 733240339..38a1488db 100644 --- a/config/locales/validations/sales/setup/en.yml +++ b/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}."