errors.add(:field_3,category::setup,message:I18n.t("validations.not_answered",question:"what is the CORE username of the account this sales log should be assigned to?"))
errors.add(:field_3,category::setup,message:I18n.t("#{ERROR_BASE_KEY}.not_answered",question:"what is the CORE username of the account this sales log should be assigned to?"))
blank_file:"Template is blank - The template must be filled in for us to create the logs and check if data is correct."
wrong_field_numbers_count:"Incorrect number of fields, please ensure you have used the correct template."
over_max_column_count:"Too many columns, please ensure you have used the correct template."
wrong_template:"Incorrect sale dates, please ensure you have used the correct template."
no_headers:"Your file does not contain the required header rows. Add or check the header rows and upload your file again. [Read more about using the template headers](%{guidance_link})."
invalid_option:"Enter a valid value for %{question}"
spreadsheet_dupe:"This is a duplicate of a log in your file."
duplicate:"This is a duplicate log."
blank_file:"Template is blank - The template must be filled in for us to create the logs and check if data is correct."
wrong_template:
wrong_template:"Incorrect sale dates, please ensure you have used the correct template."
no_headers:"Your file does not contain the required header rows. Add or check the header rows and upload your file again. [Read more about using the template headers](%{guidance_link})."
wrong_field_numbers_count:"Incorrect number of fields, please ensure you have used the correct template."
over_max_column_count:"Too many columns, please ensure you have used the correct template."
owning_organisation:
not_answered:"The owning organisation code is incorrect."
not_found:"The owning organisation code is incorrect."
not_stock_owner:"The owning organisation code provided is for an organisation that does not own stock."
not_permitted:"You do not have permission to add logs for this owning organisation."
assigned_to:
not_found:"User with the specified email could not be found."
organisation_not_related:"User must be related to owning organisation or managing organisation."
managing_organisation_not_related:"This user belongs to an organisation that does not have a relationship with the owning organisation."
saledate:
outside_collection_window:"Enter a date within the %{year_combo} collection year, which is between 1st April %{start_year} and 31st March %{end_year}."
year_not_two_or_four_digits:"Sale completion year must be 2 or 4 digits."
ecstat1:
child_under_16:"Buyer 1 cannot be a child under 16."
invalid_option:"Enter a valid value for %{question}"
spreadsheet_dupe:"This is a duplicate of a log in your file."
duplicate:"This is a duplicate log."
blank_file:"Template is blank - The template must be filled in for us to create the logs and check if data is correct."
wrong_template:
over_max_column_count:"Too many columns, please ensure you have used the correct template."
no_headers:"Your file does not contain the required header rows. Add or check the header rows and upload your file again. [Read more about using the template headers](%{guidance_link})."
wrong_field_numbers_count:"Incorrect number of fields, please ensure you have used the correct template."
wrong_template:"Incorrect sale dates, please ensure you have used the correct template."
numeric:
within_range:"%{field} must be between %{min} and %{max}."
owning_organisation:
not_found:"The owning organisation code is incorrect."
not_stock_owner:"The owning organisation code provided is for an organisation that does not own stock."
not_permitted:
support:"This owning organisation is not affiliated with %(name)."
not_support:"You do not have permission to add logs for this owning organisation."
assigned_to:
not_found:"User with the specified email could not be found."
organisation_not_related:"User must be related to owning organisation or managing organisation."
managing_organisation_not_related:"This organisation does not have a relationship with the owning organisation."
saledate:
outside_collection_window:"Enter a date within the %{year_combo} collection year, which is between 1st April %{start_year} and 31st March %{end_year}."
year_not_two_or_four_digits:"Sale completion year must be 2 or 4 digits."
ecstat1:
buyer_cannot_be_over_16_and_child:"Buyer 1's age cannot be 16 or over if their working situation is child under 16."
buyer_cannot_be_child:"Buyer 1 cannot have a working situation of child under 16."
age1:
buyer_cannot_be_over_16_and_child:"Buyer 1's age cannot be 16 or over if their working situation is child under 16."
ecstat2:
buyer_cannot_be_over_16_and_child:"Buyer 2's age cannot be 16 or over if their working situation is child under 16."
buyer_cannot_be_child:"Buyer 2 cannot have a working situation of child under 16."
age2:
buyer_cannot_be_over_16_and_child:"Buyer 2's age cannot be 16 or over if their working situation is child under 16."
address:
not_found:"We could not find this address. Check the address data in your CSV file is correct and complete, or select the correct address using the CORE site."
expect(parser.errors[:field_105]).toinclude("Enter a valid value for was a mortgage used for the purchase of this property? - Shared ownership.")
expect(parser.errors[:field_105]).toinclude(I18n.t("validations.sales.2023.bulk_upload.invalid_option",question:"was a mortgage used for the purchase of this property? - Shared ownership."))
parser.log.blank_invalid_non_setup_fields!
parser.log.save!
expect(parser.log.mortgageused).tobe_nil
@ -1420,7 +1420,7 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do
expect(setup_errors.find{|e|e.attribute==:field_2}.message).toeql("This user belongs to an organisation that does not have a relationship with the owning organisation.")
expect(setup_errors.find{|e|e.attribute==:field_1}.message).toeql("The owning organisation code provided is for an organisation that does not own stock.")
@ -631,7 +631,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it"is not permitted"do
parser.valid?
expect(parser.errors[:field_3]).tobe_present
expect(parser.errors[:field_3]).toinclude("You must answer what is the CORE username of the account this sales log should be assigned to?")
expect(parser.errors[:field_3]).toinclude(I18n.t("validations.sales.2024.bulk_upload.not_answered",question:"what is the CORE username of the account this sales log should be assigned to?"))
end
it"blocks log creation"do
@ -736,7 +736,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it"returns a setup error"do
parser.valid?
expect(parser.errors.where(:field_6,category::setup).map(&:message)).toinclude("Sale completion year must be 2 or 4 digits.")
expect(parser.errors[field]).toeql(["We could not find this address. Check the address data in your CSV file is correct and complete, or select the correct address using the CORE site."])
expect(parser.errors[field]).toeql(["We could not find this address. Check the address data in your CSV file is correct and complete, or select the correct address using the CORE site."])
@ -1333,7 +1329,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it"returns correct errors"do
parser.valid?
expect(parser.errors[:field_103]).toinclude("Enter a valid value for was a mortgage used for the purchase of this property? - Shared ownership.")
expect(parser.errors[:field_103]).toinclude(I18n.t("validations.sales.2024.bulk_upload.invalid_option",question:"was a mortgage used for the purchase of this property? - Shared ownership."))
parser.log.blank_invalid_non_setup_fields!
parser.log.save!
@ -1370,7 +1366,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it"returns correct errors"do
parser.valid?
expect(parser.errors[:field_103]).toinclude("Enter a valid value for was a mortgage used for the purchase of this property?")
expect(parser.errors[:field_103]).toinclude(I18n.t("validations.invalid_option",question:"was a mortgage used for the purchase of this property?"))
parser.log.blank_invalid_non_setup_fields!
parser.log.save!
@ -1383,7 +1379,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it"returns correct errors"do
parser.valid?
expect(parser.errors[:field_103]).toinclude("Enter a valid value for was a mortgage used for the purchase of this property?")
expect(parser.errors[:field_103]).toinclude(I18n.t("validations.invalid_option",question:"was a mortgage used for the purchase of this property?"))
parser.log.blank_invalid_non_setup_fields!
parser.log.save!
@ -1440,7 +1436,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
it"does not allow 3 (don't know) as an option for discounted ownership"do
parser.valid?
expect(parser.errors[:field_117]).toinclude("Enter a valid value for was a mortgage used for the purchase of this property?")
expect(parser.errors[:field_117]).toinclude(I18n.t("validations.invalid_option",question:"was a mortgage used for the purchase of this property?"))
parser.log.blank_invalid_non_setup_fields!
parser.log.save!
@ -1696,7 +1692,7 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do
expect(setup_errors.find{|e|e.attribute==:field_1}.message).toeql("The owning organisation code provided is for an organisation that does not own stock.")