From 597404adad377538d8637aa1bec94726a8356caf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Sat, 11 Sep 2021 14:18:15 +0100 Subject: [PATCH 1/2] Get source from the request if the document's item has not item_id --- app/Jobs/Document/CreateDocumentItemsAndTotals.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/Jobs/Document/CreateDocumentItemsAndTotals.php b/app/Jobs/Document/CreateDocumentItemsAndTotals.php index 3307bfe97..fc8140efc 100644 --- a/app/Jobs/Document/CreateDocumentItemsAndTotals.php +++ b/app/Jobs/Document/CreateDocumentItemsAndTotals.php @@ -174,6 +174,9 @@ class CreateDocumentItemsAndTotals extends Job implements HasOwner, HasSource, S $item['global_discount'] = $this->request['discount']; } + $item['created_from'] = $this->request['created_from']; + $item['created_by'] = $this->request['created_by']; + if (empty($item['item_id'])) { $new_item_request = [ 'company_id' => $this->request['company_id'], @@ -181,6 +184,8 @@ class CreateDocumentItemsAndTotals extends Job implements HasOwner, HasSource, S 'description' => $item['description'], 'sale_price' => $item['price'], 'purchase_price' => $item['price'], + 'created_from' => $item['created_from'], + 'created_by' => $item['created_by'], 'enabled' => '1', ]; From e363370d988fa134ccee2c0de0847fc37a53adf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20=C3=87ak=C4=B1rel?= Date: Wed, 29 Sep 2021 20:36:25 +0100 Subject: [PATCH 2/2] Delete unnecessary line --- app/Jobs/Document/CreateDocumentItemsAndTotals.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/Jobs/Document/CreateDocumentItemsAndTotals.php b/app/Jobs/Document/CreateDocumentItemsAndTotals.php index fc8140efc..6afa43ddd 100644 --- a/app/Jobs/Document/CreateDocumentItemsAndTotals.php +++ b/app/Jobs/Document/CreateDocumentItemsAndTotals.php @@ -198,9 +198,6 @@ class CreateDocumentItemsAndTotals extends Job implements HasOwner, HasSource, S $item['item_id'] = $new_item->id; } - $item['created_from'] = $this->request['created_from']; - $item['created_by'] = $this->request['created_by']; - $document_item = $this->dispatch(new CreateDocumentItem($this->document, $item)); $item_amount = (double) $item['price'] * (double) $item['quantity'];