diff --git a/app/models/validations/sales/property_validations.rb b/app/models/validations/sales/property_validations.rb index 197f664b4..59d616c9a 100644 --- a/app/models/validations/sales/property_validations.rb +++ b/app/models/validations/sales/property_validations.rb @@ -4,10 +4,11 @@ module Validations::Sales::PropertyValidations return unless record.ppostcode_full.present? && record.postcode_full.present? if record.discounted_ownership_sale? && record.ppostcode_full != record.postcode_full - record.errors.add :postcode_full, I18n.t("validations.sales.property_information.postcode_full.postcode_must_match_previous", buyer_possessive: record.joint_purchase? ? "Buyers’" : "Buyer’s") - record.errors.add :ppostcode_full, I18n.t("validations.sales.property_information.ppostcode_full.postcode_must_match_previous", buyer_possessive: record.joint_purchase? ? "Buyers’" : "Buyer’s") - record.errors.add :ownershipsch, I18n.t("validations.sales.property_information.ownershipsch.postcode_must_match_previous", buyer_possessive: record.joint_purchase? ? "Buyers’" : "Buyer’s") - record.errors.add :uprn, I18n.t("validations.sales.property_information.uprn.postcode_must_match_previous", buyer_possessive: record.joint_purchase? ? "Buyers’" : "Buyer’s") + joint_purchase_id = record.joint_purchase? ? "joint_purchase" : "not_joint_purchase" + record.errors.add :postcode_full, I18n.t("validations.sales.property_information.postcode_full.postcode_must_match_previous.#{joint_purchase_id}") + record.errors.add :ppostcode_full, I18n.t("validations.sales.property_information.ppostcode_full.postcode_must_match_previous.#{joint_purchase_id}") + record.errors.add :ownershipsch, I18n.t("validations.sales.property_information.ownershipsch.postcode_must_match_previous.#{joint_purchase_id}") + record.errors.add :uprn, I18n.t("validations.sales.property_information.uprn.postcode_must_match_previous.#{joint_purchase_id}") end end diff --git a/config/locales/validations/sales/property_information.en.yml b/config/locales/validations/sales/property_information.en.yml index 5a5f1c69c..e69f90edf 100644 --- a/config/locales/validations/sales/property_information.en.yml +++ b/config/locales/validations/sales/property_information.en.yml @@ -3,13 +3,21 @@ en: sales: property_information: postcode_full: - postcode_must_match_previous: "%{buyer_possessive} last accommodation and discounted ownership postcodes must match." + postcode_must_match_previous: + joint_purchase: "Buyers’ last accommodation and discounted ownership postcodes must match." + not_joint_purchase: "Buyer’s last accommodation and discounted ownership postcodes must match." ppostcode_full: - postcode_must_match_previous: "%{buyer_possessive} last accommodation and discounted ownership postcodes must match." + postcode_must_match_previous: + joint_purchase: "Buyers’ last accommodation and discounted ownership postcodes must match." + not_joint_purchase: "Buyer’s last accommodation and discounted ownership postcodes must match." ownershipsch: - postcode_must_match_previous: "%{buyer_possessive} last accommodation and discounted ownership postcodes must match." + postcode_must_match_previous: + joint_purchase: "Buyers’ last accommodation and discounted ownership postcodes must match." + not_joint_purchase: "Buyer’s last accommodation and discounted ownership postcodes must match." uprn: - postcode_must_match_previous: "%{buyer_possessive} last accommodation and discounted ownership postcodes must match." + postcode_must_match_previous: + joint_purchase: "Buyers’ last accommodation and discounted ownership postcodes must match." + not_joint_purchase: "Buyer’s last accommodation and discounted ownership postcodes must match." invalid: "UPRN must be 12 digits or less." beds: bedsits_have_max_one_bedroom: "Number of bedrooms must be 1 if the property is a bedsit."