mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
[OFN-9870] Display accurate error message for differing variant_unit_name for same product in import
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user