mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
shipping_category now required for products
This commit is contained in:
committed by
Matt-Yorkley
parent
6f0d155508
commit
dee9521f77
@@ -40,6 +40,7 @@ module ProductImport
|
||||
category_validation(entry)
|
||||
tax_and_shipping_validation(entry, 'tax', entry.tax_category, @spreadsheet_data.tax_index)
|
||||
tax_and_shipping_validation(entry, 'shipping', entry.shipping_category, @spreadsheet_data.shipping_index)
|
||||
shipping_presence_validation(entry)
|
||||
product_validation(entry)
|
||||
end
|
||||
end
|
||||
@@ -233,6 +234,10 @@ module ProductImport
|
||||
end
|
||||
end
|
||||
|
||||
def shipping_presence_validation(entry)
|
||||
mark_as_invalid(entry, attribute: "shipping_category", error: I18n.t(:error_required)) unless entry.shipping_category_id
|
||||
end
|
||||
|
||||
def product_validation(entry)
|
||||
products = Spree::Product.where(supplier_id: entry.enterprise_id,
|
||||
name: entry.name,
|
||||
|
||||
Reference in New Issue
Block a user