Updates for mocks

This commit is contained in:
David Bomba 2023-02-26 16:50:57 +11:00
parent 79ae2709f1
commit 0a195e4bbe
3 changed files with 37 additions and 39 deletions

View File

@ -1586,7 +1586,7 @@ class PdfBuilder
foreach ($children as $key => $child) { foreach ($children as $key => $child) {
if (isset($child['content']) && isset($child['show_empty']) && $child['show_empty'] === false) { if (isset($child['content']) && isset($child['show_empty']) && $child['show_empty'] === false) {
$value = strtr($child['content'], $this->service->html_variables['values']); $value = strtr($child['content'], $this->service->html_variables['values']);
if ($value === '' || $value === ' ') { if ($value === '' || $value === ' ' || $value === ' ') {
$child['is_empty'] = true; $child['is_empty'] = true;
} }
} }

View File

@ -69,15 +69,13 @@ class PdfMock
$html = $pdf_service->getHtml(); $html = $pdf_service->getHtml();
// nlog($html);
return $pdf_service->resolvePdfEngine($html); return $pdf_service->resolvePdfEngine($html);
} }
public function build(): self public function build(): self
{ {
$this->mock = $this->initEntity(); $this->mock = $this->initEntity();
return $this; return $this;
} }
@ -225,14 +223,14 @@ class PdfMock
'$line_tax_values' => '', '$line_tax_values' => '',
'$secondary_color' => $this->settings->secondary_color, '$secondary_color' => $this->settings->secondary_color,
'$invoice.balance' => '$0.00', '$invoice.balance' => '$0.00',
'$invoice.custom1' => ' ', '$invoice.custom1' => 'custom value',
'$invoice.custom2' => ' ', '$invoice.custom2' => 'custom value',
'$invoice.custom3' => ' ', '$invoice.custom3' => 'custom value',
'$invoice.custom4' => ' ', '$invoice.custom4' => 'custom value',
'$company.custom1' => ' ', '$company.custom1' => 'custom value',
'$company.custom2' => ' ', '$company.custom2' => 'custom value',
'$company.custom3' => ' ', '$company.custom3' => 'custom value',
'$company.custom4' => ' ', '$company.custom4' => 'custom value',
'$quote.po_number' => 'PO12345', '$quote.po_number' => 'PO12345',
'$company.website' => $this->settings->website, '$company.website' => $this->settings->website,
'$balance_due_raw' => '0.00', '$balance_due_raw' => '0.00',
@ -255,11 +253,11 @@ class PdfMock
'$credit_balance' => '$0.00', '$credit_balance' => '$0.00',
'$gross_subtotal' => '$0.00', '$gross_subtotal' => '$0.00',
'$invoice.amount' => '$0.00', '$invoice.amount' => '$0.00',
'$client.custom1' => ' ', '$client.custom1' => 'custom value',
'$client.custom2' => ' ', '$client.custom2' => 'custom value',
'$client.custom3' => ' ', '$client.custom3' => 'custom value',
'$client.custom4' => ' ', '$client.custom4' => 'custom value',
'$emailSignature' => ' ', '$emailSignature' => 'A email signature.',
'$invoice.number' => '0029', '$invoice.number' => '0029',
'$quote.quote_no' => '0029', '$quote.quote_no' => '0029',
'$quote.datetime' => '25/Feb/2023 1:10 am', '$quote.datetime' => '25/Feb/2023 1:10 am',
@ -276,15 +274,15 @@ class PdfMock
'$dir_text_align' => 'left', '$dir_text_align' => 'left',
'$entity_images' => '', '$entity_images' => '',
'$task.discount' => '', '$task.discount' => '',
'$contact.email' => '', '$contact.email' => 'bob@gmail.com',
'$primary_color' => $this->settings->primary_color, '$primary_color' => $this->settings->primary_color,
'$credit_amount' => '$0.00', '$credit_amount' => '$0.00',
'$invoice.total' => '$0.00', '$invoice.total' => '$0.00',
'$invoice.taxes' => '$0.00', '$invoice.taxes' => '$0.00',
'$quote.custom1' => ' ', '$quote.custom1' => 'custom value',
'$quote.custom2' => ' ', '$quote.custom2' => 'custom value',
'$quote.custom3' => ' ', '$quote.custom3' => 'custom value',
'$quote.custom4' => ' ', '$quote.custom4' => 'custom value',
'$company.email' => $this->settings->email, '$company.email' => $this->settings->email,
'$client.number' => '12345', '$client.number' => '12345',
'$company.phone' => $this->settings->phone, '$company.phone' => $this->settings->phone,
@ -308,7 +306,7 @@ class PdfMock
'$paid_to_date' => '$0.00', '$paid_to_date' => '$0.00',
'$quote.amount' => '$0.00', '$quote.amount' => '$0.00',
'$company.city' => $this->settings->city, '$company.city' => $this->settings->city,
'$payment.date' => ' ', '$payment.date' => '2022-10-10',
'$client.phone' => '555-123-3212', '$client.phone' => '555-123-3212',
'$number_short' => '0029', '$number_short' => '0029',
'$quote.number' => '0029', '$quote.number' => '0029',
@ -391,7 +389,7 @@ EPD
'$statement' => '', '$statement' => '',
'$user_iban' => ' ', '$user_iban' => ' ',
'$signature' => ' ', '$signature' => ' ',
'$id_number' => ' ', '$id_number' => 'ID Number',
'$credit_no' => '0029', '$credit_no' => '0029',
'$font_size' => $this->settings->font_size, '$font_size' => $this->settings->font_size,
'$view_link' => '<a class="button" href="http://ninja.test:8000/client/invoice/UAUY8vIPuno72igmXbbpldwo5BDDKIqs">View Invoice</a>', '$view_link' => '<a class="button" href="http://ninja.test:8000/client/invoice/UAUY8vIPuno72igmXbbpldwo5BDDKIqs">View Invoice</a>',
@ -405,12 +403,12 @@ EPD
'$task.tax' => '', '$task.tax' => '',
'$discount' => '$0.00', '$discount' => '$0.00',
'$subtotal' => '$0.00', '$subtotal' => '$0.00',
'$company1' => '&nbsp;', '$company1' => 'custom value',
'$company2' => '&nbsp;', '$company2' => 'custom value',
'$company3' => '&nbsp;', '$company3' => 'custom value',
'$company4' => '&nbsp;', '$company4' => 'custom value',
'$due_date' => '&nbsp;', '$due_date' => '2022-01-01',
'$poNumber' => '&nbsp;', '$poNumber' => 'PO-123456',
'$quote_no' => '0029', '$quote_no' => '0029',
'$address2' => '63993 Aiyana View', '$address2' => '63993 Aiyana View',
'$address1' => '8447', '$address1' => '8447',
@ -421,24 +419,24 @@ EPD
'$details' => '', '$details' => '',
'$balance' => '$0.00', '$balance' => '$0.00',
'$partial' => '$0.00', '$partial' => '$0.00',
'$client1' => '&nbsp;', '$client1' => 'custom value',
'$client2' => '&nbsp;', '$client2' => 'custom value',
'$client3' => '&nbsp;', '$client3' => 'custom value',
'$client4' => '&nbsp;', '$client4' => 'custom value',
'$dueDate' => '&nbsp;', '$dueDate' => '2022-01-01',
'$invoice' => '0029', '$invoice' => '0029',
'$account' => '434343', '$account' => '434343',
'$country' => 'Afghanistan', '$country' => 'United States',
'$contact' => 'Benedict Eichmann', '$contact' => 'Benedict Eichmann',
'$app_url' => 'http://ninja.test:8000', '$app_url' => 'http://ninja.test:8000',
'$website' => 'http://www.parisian.org/', '$website' => 'http://www.parisian.org/',
'$entity' => '', '$entity' => '',
'$thanks' => '', '$thanks' => 'Thanks!',
'$amount' => '$0.00', '$amount' => '$0.00',
'$method' => '&nbsp;', '$method' => '&nbsp;',
'$number' => '0029', '$number' => '0029',
'$footer' => 'Default invoice footer', '$footer' => 'Default invoice footer',
'$client' => 'cypress', '$client' => 'The Client Name',
'$email' => 'email@invoiceninja.net', '$email' => 'email@invoiceninja.net',
'$notes' => '', '$notes' => '',
'_rate1' => '', '_rate1' => '',

View File

@ -178,7 +178,7 @@ trait PdfMakerUtilities
foreach ($children as $key => &$child) { foreach ($children as $key => &$child) {
if (isset($child['content']) && isset($child['show_empty']) && $child['show_empty'] === false) { if (isset($child['content']) && isset($child['show_empty']) && $child['show_empty'] === false) {
$value = strtr($child['content'], $variables['values']); $value = strtr($child['content'], $variables['values']);
if ($value === '' || $value === '&nbsp;') { if ($value === '' || $value === '&nbsp;' || $value === ' '){
$child['is_empty'] = true; $child['is_empty'] = true;
} }
} }