process custom columns
This commit is contained in:
parent
eb5ad3a4ea
commit
8fd560dcce
2 changed files with 20 additions and 0 deletions
|
|
@ -298,6 +298,7 @@ class Design extends BaseDesign
|
|||
public function buildTableHeader(string $type): array
|
||||
{
|
||||
$this->processTaxColumns($type);
|
||||
$this->processCustomColumns($type);
|
||||
|
||||
$elements = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -266,4 +266,23 @@ trait DesignHelpers
|
|||
|
||||
return $logs;
|
||||
}
|
||||
|
||||
public function processCustomColumns(string $type): void
|
||||
{
|
||||
$custom_columns = [];
|
||||
|
||||
foreach ((array) $this->client->company->custom_fields as $field => $value) {
|
||||
info($field);
|
||||
|
||||
if (\Illuminate\Support\Str::startsWith($field, $type)) {
|
||||
$custom_columns[] = '$' . $type . '.' . $field;
|
||||
}
|
||||
}
|
||||
|
||||
$key = array_search(sprintf('%s%s.description', '$', $type), $this->context['pdf_variables']["{$type}_columns"], true);
|
||||
|
||||
if ($key) {
|
||||
array_splice($this->context['pdf_variables']["{$type}_columns"], $key + 1, 0, $custom_columns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue