@ -337,6 +337,30 @@ class BulkUpload::Lettings::Year2023::RowParser
},
on::after_log
validates:field_116,
inclusion:{
in:[1,2],
message:I18n.t("validations.invalid_option",question:"was the letting made under the Choice-Based Lettings (CBL)"),
if:->{field_116.present?},
},
on::after_log
validates:field_117,
inclusion:{
in:[1,2],
message:I18n.t("validations.invalid_option",question:"was the letting made under the Common Allocation Policy (CAP)"),
if:->{field_117.present?},
},
on::after_log
validates:field_118,
inclusion:{
in:[1,2],
message:I18n.t("validations.invalid_option",question:"was the letting made under the Common Housing Register (CHR)"),
if:->{field_118.present?},
},
on::after_log
validates:field_46,format:{with:/\A\d{1,3}\z|\AR\z/,message:"Age of person 1 must be a number or the letter R"},on::after_log
validates:field_52,format:{with:/\A\d{1,3}\z|\AR\z/,message:"Age of person 2 must be a number or the letter R"},on::after_log,if:proc{details_known?(2).zero?}
validates:field_56,format:{with:/\A\d{1,3}\z|\AR\z/,message:"Age of person 3 must be a number or the letter R"},on::after_log,if:proc{details_known?(3).zero?}
@ -337,6 +337,38 @@ class BulkUpload::Lettings::Year2024::RowParser
},
on::after_log
validates:field_112,
inclusion:{
in:[1,2],
message:I18n.t("validations.invalid_option",question:"was the letting made under the Choice-Based Lettings (CBL)"),
if:->{field_112.present?},
},
on::after_log
validates:field_113,
inclusion:{
in:[1,2],
message:I18n.t("validations.invalid_option",question:"was the letting made under the Common Allocation Policy (CAP)"),
if:->{field_113.present?},
},
on::after_log
validates:field_114,
inclusion:{
in:[1,2],
message:I18n.t("validations.invalid_option",question:"was the letting made under the Common Housing Register (CHR)"),
if:->{field_114.present?},
},
on::after_log
validates:field_115,
inclusion:{
in:[1,2],
message:I18n.t("validations.invalid_option",question:"was the letting made under the Accessible Register"),
if:->{field_115.present?},
},
on::after_log
validates:field_42,format:{with:/\A\d{1,3}\z|\AR\z/,message:"Age of person 1 must be a number or the letter R"},on::after_log
validates:field_48,format:{with:/\A\d{1,3}\z|\AR\z/,message:"Age of person 2 must be a number or the letter R"},on::after_log,if:proc{details_known?(2).zero?}
validates:field_52,format:{with:/\A\d{1,3}\z|\AR\z/,message:"Age of person 3 must be a number or the letter R"},on::after_log,if:proc{details_known?(3).zero?}
@ -376,6 +408,7 @@ class BulkUpload::Lettings::Year2024::RowParser
not_internal_transfer:"Answer cannot be ‘permanently decanted from another property owned by this landlord’ as you told us the source of referral for this tenancy was not an internal transfer"
renewal_reason_needed:'The reason for leaving must be "End of assured shorthold tenancy - no fault" or "End of fixed term tenancy - no fault" if the letting is a renewal'
renewal_reason_needed_2024:'The reason for leaving must be "End of social housing tenancy - no fault", "End of social housing tenancy - evicted due to anti-social behaviour (ASB)", "End of social housing tenancy - evicted due to rent arrears" or "End of social housing tenancy - evicted for any other reason"'
other_not_settled:"Please give the reason for the tenant leaving their last settled home. This is where they were living before they became homeless, were living in temporary accommodation or sleeping rough"
condition_effects:
no_choices:"You cannot answer this question as you told us nobody in the household has a physical or mental health condition (or other illness) expected to last 12 months or more"
@ -558,8 +559,8 @@ en:
tenancy:
length:
fixed_term_not_required:"You must only answer the length of the tenancy if it's fixed-term"
shorthold:"Enter a tenancy length between %{min_tenancy_length} and 99 years for a tenancy of this type"
secure:"Enter a tenancy length between %{min_tenancy_length} and 99 years (or don't specify the length) for a tenancy of this type"
invalid_fixed:"Enter a tenancy length between %{min_tenancy_length} and 99 years for a tenancy of this type"
invalid_periodic:"Enter a tenancy length between %{min_tenancy_length} and 99 years (or don't specify the length) for a tenancy of this type"
internal_transfer:"Answer must be secure tenancy as this tenancy is an internal transfer"
cannot_be_internal_transfer:"Answer cannot be internal transfer as this is not a secure tenancy"
not_joint:"This cannot be a joint tenancy as you've told us there's only one person in the household"
expect(parser.errors[:field_98]).toinclude('The reason for leaving must be "End of social housing tenancy - no fault", "End of social housing tenancy - evicted due to anti-social behaviour (ASB)", "End of social housing tenancy - evicted due to rent arrears" or "End of social housing tenancy - evicted for any other reason"')
end
end
end
@ -1654,7 +1670,7 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
end
context"when soft validation is triggered and not required"do
@ -2253,14 +2323,38 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do
expect(parser.errors[:field_125]).toeql(["Please enter the basic rent. If there is no basic rent, please enter '0'."])
expect(parser.errors[:field_126]).toeql(["Please enter the service charge. If there is no service charge, please enter '0'."])
expect(parser.errors[:field_127]).toeql(["Please enter the personal service charge. If there is no personal service charge, please enter '0'."])
expect(parser.errors[:field_128]).tobe_empty
expect(parser.errors[:field_128]).toeql(["Please enter the basic rent. If there is no basic rent, please enter '0'.","Please enter the service charge. If there is no service charge, please enter '0'.","Please enter the personal service charge. If there is no personal service charge, please enter '0'."])