Browse Source

Add validation for previous tenancy value when renewal is indicated

pull/3050/head
Manny Dinssa 4 weeks ago
parent
commit
892a441b40
  1. 8
      app/services/bulk_upload/lettings/year2024/row_parser.rb
  2. 8
      app/services/bulk_upload/lettings/year2025/row_parser.rb
  3. 2
      config/locales/validations/lettings/2024/bulk_upload.en.yml
  4. 2
      config/locales/validations/lettings/2025/bulk_upload.en.yml

8
app/services/bulk_upload/lettings/year2024/row_parser.rb

@ -445,6 +445,7 @@ class BulkUpload::Lettings::Year2024::RowParser
validate :validate_incomplete_soft_validations, on: :after_log
validate :validate_nationality, on: :after_log
validate :validate_reasonpref_reason_values, on: :after_log
validate :validate_prevten_value_when_renewal, on: :after_log
validate :validate_nulls, on: :after_log
@ -674,6 +675,13 @@ private
end
end
def validate_prevten_value_when_renewal
return unless field_7 == 1
return if field_100.blank? || [6, 30, 31, 32, 33, 34, 35, 36].include?(field_100)
errors.add(:field_100, I18n.t("#{ERROR_BASE_KEY}.prevten.invalid"))
end
def duplicate_check_fields
[
"startdate",

8
app/services/bulk_upload/lettings/year2025/row_parser.rb

@ -444,6 +444,7 @@ class BulkUpload::Lettings::Year2025::RowParser
validate :validate_incomplete_soft_validations, on: :after_log
validate :validate_nationality, on: :after_log
validate :validate_reasonpref_reason_values, on: :after_log
validate :validate_prevten_value_when_renewal, on: :after_log
validate :validate_nulls, on: :after_log
@ -673,6 +674,13 @@ private
end
end
def validate_prevten_value_when_renewal
return unless field_7 == 1
return if field_100.blank? || [6, 30, 31, 32, 33, 34, 35, 38].include?(field_100)
errors.add(:field_100, I18n.t("#{ERROR_BASE_KEY}.prevten.invalid"))
end
def duplicate_check_fields
[
"startdate",

2
config/locales/validations/lettings/2024/bulk_upload.en.yml

@ -62,3 +62,5 @@ en:
conflict:
dont_know: "You cannot select 'Don't know' if any of the other reasonable preference reasons are also selected."
other: "You cannot select this reasonable preference reason as you've also selected 'Don't know' as a reason."
prevten:
invalid: "You said this letting is a renewal to the same tenant in the same property in the set up section. This means where the household was immediately before this letting must be \"Fixed-term local authority general needs tenancy\", \"Fixed-term private registered provider (PRP) general needs tenancy\", \"Lifetime local authority general needs tenancy\", \"Lifetime private registered provider (PRP) general needs tenancy\", \"Extra care housing\", \"Specialist retirement housing\", \"Sheltered housing for adults under 55 years\" or \"Other supported housing.\""

2
config/locales/validations/lettings/2025/bulk_upload.en.yml

@ -62,3 +62,5 @@ en:
conflict:
dont_know: "You cannot select 'Don't know' if any of the other reasonable preference reasons are also selected."
other: "You cannot select this reasonable preference reason as you've also selected 'Don't know' as a reason."
prevten:
invalid: "You said this letting is a renewal to the same tenant in the same property in the set up section. This means where the household was immediately before this letting must be \"Fixed-term local authority general needs tenancy\", \"Fixed-term private registered provider (PRP) general needs tenancy\", \"Lifetime local authority general needs tenancy\", \"Lifetime private registered provider (PRP) general needs tenancy\", \"Extra care housing\", \"Older people's housing for tenants with low support needs\" or \"Other supported housing.\""

Loading…
Cancel
Save