mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Set Default PDF Variables (#3409)
This commit is contained in:
parent
db88d6a50d
commit
cf345b1932
@ -515,7 +515,16 @@ class CompanySettings extends BaseSettings {
|
||||
'credit_balance',
|
||||
'credit_amount',
|
||||
],
|
||||
'table_columns' => [
|
||||
'product_columns' => [
|
||||
'product_key',
|
||||
'notes',
|
||||
'cost',
|
||||
'quantity',
|
||||
'discount',
|
||||
'tax_name1',
|
||||
'line_total'
|
||||
],
|
||||
'task_columns' => [
|
||||
'product_key',
|
||||
'notes',
|
||||
'cost',
|
||||
|
@ -81,8 +81,8 @@ class Designer {
|
||||
public function getTable($entity):string
|
||||
{
|
||||
|
||||
$table_header = $entity->table_header($this->input_variables['table_columns'], $this->design->table_styles());
|
||||
$table_body = $entity->table_body($this->input_variables['table_columns'], $this->design->table_styles());
|
||||
$table_header = $entity->table_header($this->input_variables['product_columns'], $this->design->table_styles());
|
||||
$table_body = $entity->table_body($this->input_variables['product_columns'], $this->design->table_styles());
|
||||
|
||||
$data = str_replace('$table_header', $table_header, $this->getSection('table'));
|
||||
$data = str_replace('$table_body', $table_body, $data);
|
||||
|
@ -45,4 +45,17 @@ class StoreCompanyRequest extends Request
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
protected function prepareForValidation()
|
||||
{
|
||||
|
||||
$input = $this->all();
|
||||
|
||||
if(array_key_exists('settings', $input) && property_exists($input['settings'], 'pdf_variables') && empty((array) $input['settings']->pdf_variables))
|
||||
{
|
||||
$input['settings']['pdf_variables'] = CompanySettings::getEntityVariableDefaults();
|
||||
}
|
||||
|
||||
$this->replace($input);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user