mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 17:44:32 -04:00
process custom columns
This commit is contained in:
parent
eb5ad3a4ea
commit
8fd560dcce
@ -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…
x
Reference in New Issue
Block a user