Improve efficiency of PDF generation when encountering custom date fields in product tables
This commit is contained in:
parent
99d2652f89
commit
b7c815b048
|
|
@ -49,7 +49,7 @@ class ProjectRepository extends BaseRepository
|
||||||
$body = '<div class="task-time-details">'.$task->description().'</div>';
|
$body = '<div class="task-time-details">'.$task->description().'</div>';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$body = '';
|
$body = $task->description ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$item = new InvoiceItem();
|
$item = new InvoiceItem();
|
||||||
|
|
|
||||||
|
|
@ -729,6 +729,7 @@ class PdfBuilder
|
||||||
*/
|
*/
|
||||||
public function buildTableBody(string $type): array
|
public function buildTableBody(string $type): array
|
||||||
{
|
{
|
||||||
|
|
||||||
$elements = [];
|
$elements = [];
|
||||||
|
|
||||||
$items = $this->transformLineItems($this->service->config->entity->line_items, $type);
|
$items = $this->transformLineItems($this->service->config->entity->line_items, $type);
|
||||||
|
|
@ -776,6 +777,9 @@ class PdfBuilder
|
||||||
$table_type = "product_quote_columns";
|
$table_type = "product_quote_columns";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$_type = Str::startsWith($type, '$') ? ltrim($type, '$') : $type;
|
||||||
|
|
||||||
|
$column_visibility = $this->getColumnVisibility($this->service->config->entity->line_items, $_type);
|
||||||
|
|
||||||
foreach ($items as $row) {
|
foreach ($items as $row) {
|
||||||
$element = ['element' => 'tr', 'elements' => []];
|
$element = ['element' => 'tr', 'elements' => []];
|
||||||
|
|
@ -804,9 +808,6 @@ class PdfBuilder
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$_type = Str::startsWith($type, '$') ? ltrim($type, '$') : $type;
|
|
||||||
|
|
||||||
$column_visibility = $this->getColumnVisibility($this->service->config->entity->line_items, $_type);
|
|
||||||
|
|
||||||
foreach ($this->service->config->pdf_variables[$table_type] as $key => $cell) {
|
foreach ($this->service->config->pdf_variables[$table_type] as $key => $cell) {
|
||||||
// We want to keep aliases like these:
|
// We want to keep aliases like these:
|
||||||
|
|
|
||||||
|
|
@ -981,6 +981,8 @@ class Design extends BaseDesign
|
||||||
$table_type = "product_quote_columns";
|
$table_type = "product_quote_columns";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$column_visibility = $this->getColumnVisibility($this->entity->line_items, $_type);
|
||||||
|
|
||||||
foreach ($items as $row) {
|
foreach ($items as $row) {
|
||||||
$element = ['element' => 'tr', 'elements' => []];
|
$element = ['element' => 'tr', 'elements' => []];
|
||||||
|
|
||||||
|
|
@ -1009,8 +1011,6 @@ class Design extends BaseDesign
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$column_visibility = $this->getColumnVisibility($this->entity->line_items, $_type);
|
|
||||||
|
|
||||||
foreach ($this->context['pdf_variables'][$table_type] as $key => $cell) {
|
foreach ($this->context['pdf_variables'][$table_type] as $key => $cell) {
|
||||||
// We want to keep aliases like these:
|
// We want to keep aliases like these:
|
||||||
// $task.cost => $task.rate
|
// $task.cost => $task.rate
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,10 @@
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://github.com/turbo124/snappdf"
|
"url": "https://github.com/turbo124/snappdf"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "path",
|
||||||
|
"url": "../admin-api"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "a8c8a77c6cc5e0b0c046923603c2110a",
|
"content-hash": "2f0a47c420c857b7fc7a4a71e2f3224d",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adrienrn/php-mimetyper",
|
"name": "adrienrn/php-mimetyper",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue