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) {
if (isset($child['content']) && isset($child['show_empty']) && $child['show_empty'] === false) {
$value = strtr($child['content'], $this->service->html_variables['values']);
if ($value === '' || $value === ' ') {
if ($value === '' || $value === ' ' || $value === ' ') {
$child['is_empty'] = true;
}
}

View File

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

View File

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