diff --git a/app/DataMapper/InvoiceItem.php b/app/DataMapper/InvoiceItem.php index e2fcb21f0c..af6080de13 100644 --- a/app/DataMapper/InvoiceItem.php +++ b/app/DataMapper/InvoiceItem.php @@ -52,8 +52,10 @@ class InvoiceItem public $custom_value4 = ''; + public $invoice_item_type_id = 1; public static $casts = [ + 'invoice_item_type_id' => 'string', 'quantity' => 'float', 'cost' => 'float', 'product_key' => 'string', diff --git a/app/Helpers/Invoice/InvoiceItemSum.php b/app/Helpers/Invoice/InvoiceItemSum.php index 2dc8be53a3..d03c9629e5 100644 --- a/app/Helpers/Invoice/InvoiceItemSum.php +++ b/app/Helpers/Invoice/InvoiceItemSum.php @@ -282,8 +282,12 @@ class InvoiceItemSum foreach($invoice_item as $key => $value) { - if(!property_exists($this->item, $key)) + if(!property_exists($this->item, $key) || !isset($this->item->{$key})){ + $this->item->{$key} = $value; $this->item->{$key} = BaseSettings::castAttribute(InvoiceItem::$casts[$key], $value); + } + + }