Browse Source

CLDC-4090: Document linked validations

CLDC-4090-validate-end-date-of-LA-ECode
Samuel Young 2 weeks ago
parent
commit
20c5b2c625
  1. 4
      app/models/validations/property_validations.rb
  2. 4
      app/models/validations/sales/property_validations.rb

4
app/models/validations/property_validations.rb

@ -32,6 +32,7 @@ module Validations::PropertyValidations
end
end
# see also: this validation in sales/property_validations.rb
def validate_uprn(record)
return unless record.uprn
@ -40,6 +41,7 @@ module Validations::PropertyValidations
record.errors.add :uprn, I18n.t("validations.lettings.property.uprn.invalid")
end
# see also: this validation in sales/property_validations.rb
def validate_property_postcode(record)
postcode = record.postcode_full
return unless postcode
@ -50,6 +52,7 @@ module Validations::PropertyValidations
end
end
# see also: this validation in sales/property_validations.rb
def validate_la_in_england(record)
return unless record.form.start_year_2025_or_later?
@ -77,6 +80,7 @@ module Validations::PropertyValidations
end
end
# see also: this validation in sales/property_validations.rb
def validate_la_is_active(record)
return unless record.form.start_year_2025_or_later? && record.startdate.present?

4
app/models/validations/sales/property_validations.rb

@ -21,6 +21,7 @@ module Validations::Sales::PropertyValidations
end
end
# see also: this validation in validations/property_validations.rb
def validate_uprn(record)
return unless record.uprn
@ -29,6 +30,7 @@ module Validations::Sales::PropertyValidations
record.errors.add :uprn, I18n.t("validations.sales.property_information.uprn.invalid")
end
# see also: this validation in validations/property_validations.rb
def validate_property_postcode(record)
postcode = record.postcode_full
return unless postcode
@ -39,6 +41,7 @@ module Validations::Sales::PropertyValidations
end
end
# see also: this validation in validations/property_validations.rb
def validate_la_in_england(record)
return unless record.form.start_year_2025_or_later? && record.la.present?
return if record.la.in?(LocalAuthority.england.pluck(:code))
@ -55,6 +58,7 @@ module Validations::Sales::PropertyValidations
end
end
# see also: this validation in validations/property_validations.rb
def validate_la_is_active(record)
return unless record.form.start_year_2025_or_later? && record.la.present? && record.startdate.present?

Loading…
Cancel
Save