diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index cea6afa828fc..e8913cb7de23 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -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', diff --git a/app/Designs/Designer.php b/app/Designs/Designer.php index cfe1df77cf06..5aa110a439c0 100644 --- a/app/Designs/Designer.php +++ b/app/Designs/Designer.php @@ -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); diff --git a/app/Http/Requests/Company/StoreCompanyRequest.php b/app/Http/Requests/Company/StoreCompanyRequest.php index e45630c8cc75..e9f2b92a0c17 100644 --- a/app/Http/Requests/Company/StoreCompanyRequest.php +++ b/app/Http/Requests/Company/StoreCompanyRequest.php @@ -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); + } }