mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Set defaults and cast invoice items if they are blank (#3030)
This commit is contained in:
parent
aad22f607e
commit
e7a6a8c403
@ -52,8 +52,10 @@ class InvoiceItem
|
|||||||
|
|
||||||
public $custom_value4 = '';
|
public $custom_value4 = '';
|
||||||
|
|
||||||
|
public $invoice_item_type_id = 1;
|
||||||
|
|
||||||
public static $casts = [
|
public static $casts = [
|
||||||
|
'invoice_item_type_id' => 'string',
|
||||||
'quantity' => 'float',
|
'quantity' => 'float',
|
||||||
'cost' => 'float',
|
'cost' => 'float',
|
||||||
'product_key' => 'string',
|
'product_key' => 'string',
|
||||||
|
@ -282,8 +282,12 @@ class InvoiceItemSum
|
|||||||
foreach($invoice_item as $key => $value)
|
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);
|
$this->item->{$key} = BaseSettings::castAttribute(InvoiceItem::$casts[$key], $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user