Merge pull request #2249 from burakcakirel/fix-source-for-empty-item-id
Get source from the request if the document's item has not item_id
This commit is contained in:
		| @@ -174,6 +174,9 @@ class CreateDocumentItemsAndTotals extends Job implements HasOwner, HasSource, S | |||||||
|                 $item['global_discount'] = $this->request['discount']; |                 $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'])) { |             if (empty($item['item_id'])) { | ||||||
|                 $new_item_request = [ |                 $new_item_request = [ | ||||||
|                     'company_id' => $this->request['company_id'], |                     'company_id' => $this->request['company_id'], | ||||||
| @@ -181,6 +184,8 @@ class CreateDocumentItemsAndTotals extends Job implements HasOwner, HasSource, S | |||||||
|                     'description' => $item['description'], |                     'description' => $item['description'], | ||||||
|                     'sale_price' => $item['price'], |                     'sale_price' => $item['price'], | ||||||
|                     'purchase_price' => $item['price'], |                     'purchase_price' => $item['price'], | ||||||
|  |                     'created_from' => $item['created_from'], | ||||||
|  |                     'created_by' => $item['created_by'], | ||||||
|                     'enabled' => '1', |                     'enabled' => '1', | ||||||
|                 ]; |                 ]; | ||||||
|  |  | ||||||
| @@ -193,9 +198,6 @@ class CreateDocumentItemsAndTotals extends Job implements HasOwner, HasSource, S | |||||||
|                 $item['item_id'] = $new_item->id; |                 $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)); |             $document_item = $this->dispatch(new CreateDocumentItem($this->document, $item)); | ||||||
|  |  | ||||||
|             $item_amount = (double) $item['price'] * (double) $item['quantity']; |             $item_amount = (double) $item['price'] * (double) $item['quantity']; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user