[OFN-9870] Display accurate error message for differing variant_unit_name for same product in import

This commit is contained in:
ijdershem-jf
2022-12-18 16:15:54 -07:00
parent 1ca305ab7c
commit 18e9aba6b8
2 changed files with 7 additions and 1 deletions

View File

@@ -211,7 +211,7 @@ module ProductImport
reference_entry = all_entries_for_product(entry).first
return if entry.variant_unit_name.to_s == reference_entry.variant_unit_name.to_s
mark_as_not_updatable(entry, "variant_unit_name")
mark_as_values_must_be_same(entry, "variant_unit_name")
end
def producer_validation(entry)
@@ -425,6 +425,11 @@ module ProductImport
error: I18n.t("admin.product_import.model.not_updatable"))
end
def mark_as_values_must_be_same(entry, attribute)
mark_as_invalid(entry, attribute: attribute,
error: I18n.t("admin.product_import.model.values_must_be_same"))
end
def import_into_inventory?
@import_settings.dig(:settings, 'import_into') == 'inventories'
end

View File

@@ -730,6 +730,7 @@ en:
not_found: not found in database
category_not_found: doesn't match allowed categories. See the correct categories to choose from on the product import page, or check that there's no misspelling.
not_updatable: cannot be updated on existing products via product import
values_must_be_same: must be the same for products with the same name
blank: can't be blank
products_no_permission: you do not have permission to manage products for this enterprise
inventory_no_permission: you do not have permission to create inventory for this producer