|
|
|
@ -340,6 +340,7 @@ class BulkUpload::Lettings::Year2022::RowParser
|
|
|
|
|
validate :validate_no_disabled_needs_conjunction, on: :after_log |
|
|
|
|
validate :validate_dont_know_disabled_needs_conjunction, on: :after_log |
|
|
|
|
validate :validate_no_and_dont_know_disabled_needs_conjunction, on: :after_log |
|
|
|
|
validate :validate_no_housing_needs_questions_answered, on: :after_log |
|
|
|
|
validate :validate_if_log_already_exists, on: :after_log, if: -> { FeatureToggle.bulk_upload_duplicate_log_check_enabled? } |
|
|
|
|
|
|
|
|
|
validate :validate_owning_org_data_given, on: :after_log |
|
|
|
@ -648,6 +649,16 @@ private
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def validate_no_housing_needs_questions_answered |
|
|
|
|
if [field_55, field_56, field_57, field_58, field_59, field_60].all?(&:blank?) |
|
|
|
|
errors.add(:field_59, I18n.t("validations.not_answered", question: "anybody with disabled access needs")) |
|
|
|
|
errors.add(:field_58, I18n.t("validations.not_answered", question: "other access needs")) |
|
|
|
|
%i[field_55 field_56 field_57].each do |field| |
|
|
|
|
errors.add(field, I18n.t("validations.not_answered", question: "disabled access needs type")) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def validate_lettings_type_matches_bulk_upload |
|
|
|
|
if [1, 3, 5, 7, 9, 11].include?(field_1) && !bulk_upload.general_needs? |
|
|
|
|
errors.add(:field_1, I18n.t("validations.setup.lettype.supported_housing_mismatch")) |
|
|
|
|