mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Do not update or create a product if Invoice generated from a task/expense
This commit is contained in:
parent
9ce00ee960
commit
27c7572821
@ -55,6 +55,17 @@ class UpdateOrCreateProduct implements ShouldQueue
|
|||||||
{
|
{
|
||||||
MultiDB::setDB($this->company->db);
|
MultiDB::setDB($this->company->db);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the invoice was generated from a Task or Expense then
|
||||||
|
* we do NOT update the product details this short block we
|
||||||
|
* check for the presence of a task_id and/or expense_id
|
||||||
|
*/
|
||||||
|
$expense_count = count(array_column((array)$this->products, 'expense_id'));
|
||||||
|
$task_count = count(array_column((array)$this->products, 'task_id'));
|
||||||
|
|
||||||
|
if($task_count >= 1 || $expense_count >= 1)
|
||||||
|
return;
|
||||||
|
|
||||||
//only update / create products - not tasks or gateway fees
|
//only update / create products - not tasks or gateway fees
|
||||||
$updateable_products = collect($this->products)->filter(function ($item) {
|
$updateable_products = collect($this->products)->filter(function ($item) {
|
||||||
return $item->type_id == 1;
|
return $item->type_id == 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user