fix document item type import issue

This commit is contained in:
Cihan Şentürk 2023-06-04 18:04:32 +03:00 committed by GitHub
parent badeb55801
commit 52b3fafbb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -323,8 +323,10 @@ trait Import
return $contact->id; return $contact->id;
} }
public function getItemIdFromName($row, $type = 'product') public function getItemIdFromName($row, $type = null)
{ {
$type = !empty($type) ? $type : (!empty($row['item_type']) ? $row['item_type'] : 'product');
$item_id = Item::type($type)->where('name', $row['item_name'])->pluck('id')->first(); $item_id = Item::type($type)->where('name', $row['item_name'])->pluck('id')->first();
if (!empty($item_id)) { if (!empty($item_id)) {