1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #4189 from beganovich/v2-fix-for-invoice-customs

(v5) Fixes for invoice custom fields
This commit is contained in:
David Bomba 2020-10-21 07:26:36 +11:00 committed by GitHub
commit b347cc75e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 5 deletions

View File

@ -196,7 +196,7 @@ class PreviewController extends BaseController
->design($design)
->build();
// info($maker->getCompiledHTML(true));
info($maker->getCompiledHTML(true));
$file_path = PreviewPdf::dispatchNow($maker->getCompiledHTML(true), auth()->user()->company());

View File

@ -109,6 +109,8 @@ class CreateInvoicePdf implements ShouldQueue
->design($template)
->build();
info($maker->getCompiledHTML());
//todo - move this to the client creation stage so we don't keep hitting this unnecessarily
Storage::makeDirectory($path, 0775);

View File

@ -168,10 +168,20 @@ class Design extends BaseDesign
$elements = [];
foreach ($variables as $variable) {
$elements[] = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'elements' => [
['element' => 'th', 'content' => $variable . '_label'],
['element' => 'th', 'content' => $variable],
]];
$_variable = explode('.', $variable)[1];
$_customs = ['custom1', 'custom2', 'custom3', 'custom4'];
if (in_array($_variable, $_customs)) {
$elements[] = ['element' => 'tr', 'elements' => [
['element' => 'th', 'content' => $variable . '_label'],
['element' => 'th', 'content' => $variable],
]];
} else {
$elements[] = ['element' => 'tr', 'properties' => ['hidden' => $this->entityVariableCheck($variable)], 'elements' => [
['element' => 'th', 'content' => $variable . '_label'],
['element' => 'th', 'content' => $variable],
]];
}
}
return $elements;