Browse Source

feat: add 22/23 year validation

pull/1232/head
natdeanlewissoftwire 4 years ago
parent
commit
9cb8d89ef7
  1. 1
      app/models/sales_log.rb
  2. 9
      app/models/validations/sales/setup_validations.rb
  3. 2
      config/locales/en.yml

1
app/models/sales_log.rb

@ -1,4 +1,5 @@
class SalesLogValidator < ActiveModel::Validator class SalesLogValidator < ActiveModel::Validator
include Validations::Sales::SetupValidations
include Validations::Sales::HouseholdValidations include Validations::Sales::HouseholdValidations
include Validations::Sales::PropertyValidations include Validations::Sales::PropertyValidations
include Validations::SharedValidations include Validations::SharedValidations

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

@ -0,0 +1,9 @@
module Validations::Sales::SetupValidations
def validate_saledate(record)
return unless record.saledate
if record.saledate < Time.zone.local(2022, 4, 1)
record.errors.add :saledate, I18n.t("validations.setup.saledate.financial_year")
end
end
end

2
config/locales/en.yml

@ -147,6 +147,8 @@ en:
setup: setup:
intermediate_rent_product_name: intermediate_rent_product_name:
blank: "Enter name of other intermediate rent product" blank: "Enter name of other intermediate rent product"
saledate:
financial_year: "Date must be from 22/23 financial year"
startdate: startdate:
later_than_14_days_after: "The tenancy start date must not be later than 14 days from today’s date" later_than_14_days_after: "The tenancy start date must not be later than 14 days from today’s date"
before_scheme_end_date: "The tenancy start date must be before the end date for this supported housing scheme" before_scheme_end_date: "The tenancy start date must be before the end date for this supported housing scheme"

Loading…
Cancel
Save