diff --git a/app/Services/Pdf/PdfBuilder.php b/app/Services/Pdf/PdfBuilder.php index 612027b85d7a..c57fef889f33 100644 --- a/app/Services/Pdf/PdfBuilder.php +++ b/app/Services/Pdf/PdfBuilder.php @@ -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; } } diff --git a/app/Services/Pdf/PdfMock.php b/app/Services/Pdf/PdfMock.php index 94f9855a0bac..34a6fe52d5a3 100644 --- a/app/Services/Pdf/PdfMock.php +++ b/app/Services/Pdf/PdfMock.php @@ -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' => 'View Invoice', @@ -405,12 +403,12 @@ EPD '$task.tax' => '', '$discount' => '$0.00', '$subtotal' => '$0.00', - '$company1' => ' ', - '$company2' => ' ', - '$company3' => ' ', - '$company4' => ' ', - '$due_date' => ' ', - '$poNumber' => ' ', + '$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' => ' ', - '$client2' => ' ', - '$client3' => ' ', - '$client4' => ' ', - '$dueDate' => ' ', + '$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' => ' ', '$number' => '0029', '$footer' => 'Default invoice footer', - '$client' => 'cypress', + '$client' => 'The Client Name', '$email' => 'email@invoiceninja.net', '$notes' => '', '_rate1' => '', diff --git a/app/Services/PdfMaker/PdfMakerUtilities.php b/app/Services/PdfMaker/PdfMakerUtilities.php index 6670360c0691..95be78b0b1e1 100644 --- a/app/Services/PdfMaker/PdfMakerUtilities.php +++ b/app/Services/PdfMaker/PdfMakerUtilities.php @@ -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 === ' ') { + if ($value === '' || $value === ' ' || $value === ' '){ $child['is_empty'] = true; } }