diff --git a/app/models/bulk_upload.rb b/app/models/bulk_upload.rb index 66e83cd85..ed1e9ab21 100644 --- a/app/models/bulk_upload.rb +++ b/app/models/bulk_upload.rb @@ -14,6 +14,10 @@ class BulkUpload < ApplicationRecord "#{year}/#{year - 2000 + 1}" end + def end_year + year + 1 + end + def logs if lettings? lettings_logs diff --git a/app/services/bulk_upload/lettings/year2022/row_parser.rb b/app/services/bulk_upload/lettings/year2022/row_parser.rb index 62cf9e872..216008287 100644 --- a/app/services/bulk_upload/lettings/year2022/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2022/row_parser.rb @@ -680,9 +680,9 @@ private return if start_date.blank? || bulk_upload.form.blank? unless bulk_upload.form.valid_start_date_for_form?(start_date) - errors.add(:field_96, I18n.t("validations.date.outside_collection_window"), category: :setup) - errors.add(:field_97, I18n.t("validations.date.outside_collection_window"), category: :setup) - errors.add(:field_98, I18n.t("validations.date.outside_collection_window"), category: :setup) + errors.add(:field_96, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_97, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_98, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) end end diff --git a/app/services/bulk_upload/lettings/year2023/row_parser.rb b/app/services/bulk_upload/lettings/year2023/row_parser.rb index 9dc5b60de..4783f22ff 100644 --- a/app/services/bulk_upload/lettings/year2023/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2023/row_parser.rb @@ -624,9 +624,9 @@ private return if start_date.blank? || bulk_upload.form.blank? unless bulk_upload.form.valid_start_date_for_form?(start_date) - errors.add(:field_7, I18n.t("validations.date.outside_collection_window"), category: :setup) - errors.add(:field_8, I18n.t("validations.date.outside_collection_window"), category: :setup) - errors.add(:field_9, I18n.t("validations.date.outside_collection_window"), category: :setup) + errors.add(:field_7, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_8, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_9, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) end end diff --git a/app/services/bulk_upload/sales/year2022/row_parser.rb b/app/services/bulk_upload/sales/year2022/row_parser.rb index fb783b499..9cc2f1f02 100644 --- a/app/services/bulk_upload/sales/year2022/row_parser.rb +++ b/app/services/bulk_upload/sales/year2022/row_parser.rb @@ -941,9 +941,9 @@ private return if saledate.blank? || bulk_upload.form.blank? unless bulk_upload.form.valid_start_date_for_form?(saledate) - errors.add(:field_2, I18n.t("validations.date.outside_collection_window"), category: :setup) - errors.add(:field_3, I18n.t("validations.date.outside_collection_window"), category: :setup) - errors.add(:field_4, I18n.t("validations.date.outside_collection_window"), category: :setup) + errors.add(:field_2, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_3, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) + errors.add(:field_4, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year), category: :setup) end end diff --git a/app/services/bulk_upload/sales/year2023/row_parser.rb b/app/services/bulk_upload/sales/year2023/row_parser.rb index 41e50a112..91b6a0d40 100644 --- a/app/services/bulk_upload/sales/year2023/row_parser.rb +++ b/app/services/bulk_upload/sales/year2023/row_parser.rb @@ -1102,9 +1102,9 @@ private return if saledate.blank? || bulk_upload.form.blank? unless bulk_upload.form.valid_start_date_for_form?(saledate) - errors.add(:field_3, I18n.t("validations.date.outside_collection_window")) - errors.add(:field_4, I18n.t("validations.date.outside_collection_window")) - errors.add(:field_5, I18n.t("validations.date.outside_collection_window")) + errors.add(:field_3, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year)) + errors.add(:field_4, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year)) + errors.add(:field_5, I18n.t("validations.date.outside_collection_window", year_combo: bulk_upload.year_combo, start_year: bulk_upload.year, end_year: bulk_upload.end_year)) end end end diff --git a/config/locales/en.yml b/config/locales/en.yml index 0e2500dce..1ac1fb6c3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -165,7 +165,7 @@ en: date: invalid_date: "Enter a date in the correct format, for example 31 1 2022" - outside_collection_window: Enter a date within the 22/23 collection year, which is between 1st April 2022 and 31st March 2023 + outside_collection_window: Enter a date within the %{year_combo} collection year, which is between 1st April %{start_year} and 31st March %{end_year} postcode: "Enter a postcode in the correct format, for example AA1 1AA" location_admin_district: "Select a local authority" email: