fix so the generic importer works with already exisiting categories
This commit is contained in:
parent
0572d752be
commit
1008a064ee
|
@ -1356,13 +1356,15 @@ class BulkImport::Base
|
|||
def process_category(category)
|
||||
if (existing_category_id = category[:existing_id]).present?
|
||||
if existing_category_id.is_a?(String)
|
||||
existing_category_id = SiteSetting.get(category[:existing_id])
|
||||
existing_category_id = Category.find_by(id: category[:existing_id])&.id
|
||||
end
|
||||
|
||||
if existing_category_id
|
||||
@categories[category[:imported_id].to_i] = existing_category_id
|
||||
category[:skip] = true
|
||||
return category
|
||||
end
|
||||
end
|
||||
|
||||
category[:id] ||= @last_category_id += 1
|
||||
@categories[category[:imported_id].to_i] ||= category[:id]
|
||||
|
|
Loading…
Reference in New Issue