From 2fb485ec13198adc66206f53bb19f9d02509edda Mon Sep 17 00:00:00 2001 From: samyou-softwire Date: Fri, 10 Apr 2026 14:23:26 +0100 Subject: [PATCH] CLDC-4300: Stricten validation on initialpurchase --- app/models/validations/sales/sale_information_validations.rb | 2 +- config/locales/validations/sales/sale_information.en.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/validations/sales/sale_information_validations.rb b/app/models/validations/sales/sale_information_validations.rb index 32bf2a716..a38cf1b0c 100644 --- a/app/models/validations/sales/sale_information_validations.rb +++ b/app/models/validations/sales/sale_information_validations.rb @@ -42,7 +42,7 @@ module Validations::Sales::SaleInformationValidations record.errors.add :initialpurchase, I18n.t("validations.sales.sale_information.initialpurchase.must_be_after_1980") end - if record.saledate.present? && record.initialpurchase > record.saledate + if record.saledate.present? && record.initialpurchase >= record.saledate record.errors.add :initialpurchase, I18n.t("validations.sales.sale_information.initialpurchase.must_be_before_saledate") record.errors.add :saledate, :skip_bu_error, message: I18n.t("validations.sales.sale_information.saledate.must_be_after_initial_purchase_date") end diff --git a/config/locales/validations/sales/sale_information.en.yml b/config/locales/validations/sales/sale_information.en.yml index ffdf1a874..698c74dec 100644 --- a/config/locales/validations/sales/sale_information.en.yml +++ b/config/locales/validations/sales/sale_information.en.yml @@ -25,11 +25,11 @@ en: initialpurchase: must_be_after_1980: "The initial purchase date must be after January 1, 1980." must_be_before_last_transaction: "The initial purchase date must be before the last staircasing transaction date." - must_be_before_saledate: "The initial purchase date must be before the date of this sale." + must_be_before_saledate: "The initial staircasing transaction date must be before the sale date of this staircasing transaction." lasttransaction: must_be_after_1980: "The last staircasing transaction date must be after January 1, 1980." must_be_after_initial_purchase: "The last staircasing transaction date must be after the initial purchase date." - must_be_before_saledate: "The last staircasing transaction date must be before the date of this sale." + must_be_before_saledate: "The initial staircasing transaction date must be before the sale date of this staircasing transaction." fromprop: previous_property_type_bedsit: "A bedsit cannot have more than 1 bedroom." frombeds: