diff --git a/app/models/validations/shared_validations.rb b/app/models/validations/shared_validations.rb index 1a697f31a..f509e0cf1 100644 --- a/app/models/validations/shared_validations.rb +++ b/app/models/validations/shared_validations.rb @@ -124,7 +124,11 @@ module Validations::SharedValidations return if record.skip_dpo_validation if record.owning_organisation_id_changed? && record.owning_organisation.present? && !record.owning_organisation.data_protection_confirmed? - record.errors.add :owning_organisation_id, I18n.t("validations.shared.setup.owning_organisation.data_sharing_agreement_not_signed") + if record.sales? + record.errors.add :owning_organisation_id, I18n.t("validations.sales.setup.owning_organisation.data_sharing_agreement_not_signed") + else + record.errors.add :owning_organisation_id, I18n.t("validations.lettings.setup.owning_organisation.data_sharing_agreement_not_signed") + end end end diff --git a/config/locales/validations/lettings/setup.en.yml b/config/locales/validations/lettings/setup.en.yml index 1d787101c..96b5af04b 100644 --- a/config/locales/validations/lettings/setup.en.yml +++ b/config/locales/validations/lettings/setup.en.yml @@ -54,6 +54,7 @@ en: owning_organisation: invalid: "Please select the owning organisation or managing organisation that you belong to." + data_sharing_agreement_not_signed: "The organisation must accept the Data Sharing Agreement before it can be selected as the owning organisation." inactive: merged_organisation: "The owning organisation must be active on the tenancy start date. %{owning_organisation} became inactive on %{merge_date} and was replaced by %{absorbing_organisation}." diff --git a/config/locales/validations/sales/setup.en.yml b/config/locales/validations/sales/setup.en.yml index 9dd13b525..62819a029 100644 --- a/config/locales/validations/sales/setup.en.yml +++ b/config/locales/validations/sales/setup.en.yml @@ -17,6 +17,7 @@ en: "Enter a date when the owning organisation was active. %{owning_organisation} became active on %{available_from}." owning_organisation: + data_sharing_agreement_not_signed: "The organisation must accept the Data Sharing Agreement before it can be selected as the 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}." diff --git a/config/locales/validations/shared.en.yml b/config/locales/validations/shared.en.yml index 97a3eb2b8..a29d2bd74 100644 --- a/config/locales/validations/shared.en.yml +++ b/config/locales/validations/shared.en.yml @@ -17,11 +17,3 @@ en: date: invalid_date: "Enter a date in the correct format, for example 31 1 2024." - - setup: - owning_organisation: - data_sharing_agreement_not_signed: "The organisation must accept the Data Sharing Agreement before it can be selected as the owning organisation." - - - -