mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 07:02:34 +01:00
Fixes for base repo. (#3464)
* Fixes for designs * remove logs * Minor fixes for Invoice Item * Fixes for company defaults
This commit is contained in:
parent
6ffea888b0
commit
25e29ed54c
@ -51,10 +51,10 @@ class InvoiceItem
|
|||||||
|
|
||||||
public $custom_value4 = '';
|
public $custom_value4 = '';
|
||||||
|
|
||||||
public $line_item_type_id = 1; //1 = product, 2 = service, 3 unpaid gateway fee, 4 paid gateway fee
|
public $type_id = 1; //1 = product, 2 = service, 3 unpaid gateway fee, 4 paid gateway fee
|
||||||
|
|
||||||
public static $casts = [
|
public static $casts = [
|
||||||
'line_item_type_id' => 'string',
|
'type_id' => 'string',
|
||||||
'quantity' => 'float',
|
'quantity' => 'float',
|
||||||
'cost' => 'float',
|
'cost' => 'float',
|
||||||
'product_key' => 'string',
|
'product_key' => 'string',
|
||||||
|
@ -464,19 +464,24 @@ class Client extends BaseModel implements HasLocalePreference
|
|||||||
return $this->company->company_key . '/';
|
return $this->company->company_key . '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCompanyDefaults($data, $entity_name)
|
public function setCompanyDefaults($data, $entity_name) :array
|
||||||
{
|
{
|
||||||
|
$defaults = [];
|
||||||
|
|
||||||
if(!(array_key_exists('terms', $data) && strlen($data['terms']) > 1))
|
if(!(array_key_exists('terms', $data) && strlen($data['terms']) > 1))
|
||||||
$data['terms'] = $this->getSetting($entity_name.'_terms');
|
$defaults['terms'] = $this->getSetting($entity_name.'_terms');
|
||||||
|
elseif(array_key_exists('terms', $data))
|
||||||
|
$defaults['terms'] = $data['terms'];
|
||||||
|
|
||||||
if(!(array_key_exists('footer', $data) && strlen($data['footer']) > 1))
|
if(!(array_key_exists('footer', $data) && strlen($data['footer']) > 1))
|
||||||
$data['footer'] = $this->getSetting($entity_name.'_footer');
|
$defaults['footer'] = $this->getSetting($entity_name.'_footer');
|
||||||
|
elseif(array_key_exists('footer', $data))
|
||||||
|
$defaults['footer'] = $data['footer'];
|
||||||
|
|
||||||
if(strlen($this->public_notes) >=1)
|
if(strlen($this->public_notes) >=1)
|
||||||
$data['public_notes'] = $this->public_notes;
|
$defaults['public_notes'] = $this->public_notes;
|
||||||
|
|
||||||
return $data;
|
return $defaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -201,8 +201,10 @@ class BaseRepository
|
|||||||
$state['starting_amount'] = $model->amount;
|
$state['starting_amount'] = $model->amount;
|
||||||
|
|
||||||
if (!$model->id) {
|
if (!$model->id) {
|
||||||
$data = $client->setCompanyDefaults($data,lcfirst($resource));
|
$company_defaults = $client->setCompanyDefaults($data,lcfirst($resource));
|
||||||
$model->uses_inclusive_taxes = $client->getSetting('inclusive_taxes');
|
$model->uses_inclusive_taxes = $client->getSetting('inclusive_taxes');
|
||||||
|
|
||||||
|
$data = array_merge($company_defaults, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
$model->fill($data);
|
$model->fill($data);
|
||||||
|
Loading…
Reference in New Issue
Block a user