@ -464,7 +465,7 @@ class BulkUpload::Lettings::Year2023::RowParser
"field_8",# startdate
"field_9",# startdate
"field_13",# tenancycode
field_4!=1?"field_17":nil,# location
field_4!=1?location_field.to_s:nil,# location
field_4!=2?"field_23":nil,# postcode
field_4!=2?"field_24":nil,# postcode
"field_46",# age1
@ -734,43 +735,43 @@ private
unlesslocation.scheme==scheme
block_log_creation!
errors.add(:field_17,"Scheme code must relate to a location that is owned by owning organisation or managing organisation",category::setup)
errors.add(location_field,"#{scheme_or_management_group.capitalize} code must relate to a #{location_or_scheme} that is owned by owning organisation or managing organisation",category::setup)
end
end
defvalidate_location_exists
ifscheme&&field_17.present?&&location.nil?
errors.add(:field_17,"Location could not be found with the provided scheme code",category::setup)
ifscheme&&location.nil?
errors.add(location_field,"#{location_or_scheme.capitalize} could not be found with the provided #{scheme_or_management_group} code",category::setup)
errors.add(:field_16,"This management group code does not belong to your organisation, or any of your stock owners / managing agents",category::setup)
errors.add(scheme_field,"This #{scheme_or_management_group} code does not belong to your organisation, or any of your stock owners / managing agents",category::setup)
end
end
defvalidate_scheme_exists
iffield_16.present?&&scheme.nil?
errors.add(:field_16,"The management group code is not correct",category::setup)
ifscheme_id.present?&&scheme.nil?
errors.add(scheme_field,"The #{scheme_or_management_group} code is not correct",category::setup)
end
end
defvalidate_scheme_data_given
ifsupported_housing?&&field_16.blank?
errors.add(:field_16,I18n.t("validations.not_answered",question:"management group code"),category:"setup")
expect(parser.errors.where(:field_16,category::setup).map(&:message)).toinclude("This management group code does not belong to your organisation, or any of your stock owners / managing agents")
it"returns a setup error"do
expect(parser.errors.where(:field_16,category::setup).map(&:message)).toinclude("This scheme code does not belong to your organisation, or any of your stock owners / managing agents")
expect(parser.errors.where(:field_16,category::setup).map(&:message)).toinclude("This scheme code does not belong to your organisation, or any of your stock owners / managing agents")