From badeb558013291cd380ef5f440065bc9926cf7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihan=20=C5=9Eent=C3=BCrk?= <53110792+CihanSenturk@users.noreply.github.com> Date: Sun, 4 Jun 2023 18:01:59 +0300 Subject: [PATCH 1/2] fix item type scope --- app/Models/Common/Item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Common/Item.php b/app/Models/Common/Item.php index 915583c5e..affc32f4e 100644 --- a/app/Models/Common/Item.php +++ b/app/Models/Common/Item.php @@ -107,7 +107,7 @@ class Item extends Model return $query; } - return $query->whereIn($this->qualifyColumn('type'), $type); + return $query->where($this->qualifyColumn('type'), $type); } /** From 52b3fafbb32c59ef443d6bffe820c9ea3489edcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihan=20=C5=9Eent=C3=BCrk?= <53110792+CihanSenturk@users.noreply.github.com> Date: Sun, 4 Jun 2023 18:04:32 +0300 Subject: [PATCH 2/2] fix document item type import issue --- app/Traits/Import.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Traits/Import.php b/app/Traits/Import.php index da1719998..e04b113ec 100644 --- a/app/Traits/Import.php +++ b/app/Traits/Import.php @@ -323,8 +323,10 @@ trait Import 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(); if (!empty($item_id)) {