From 0782fa3c6d2049056d8a36cc2a82b65fb952f500 Mon Sep 17 00:00:00 2001 From: Dave Shoreman Date: Tue, 28 May 2024 13:10:41 +0100 Subject: [PATCH 1/5] Set 'issued to' label based on entity type string --- app/Services/Pdf/PdfMock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/Pdf/PdfMock.php b/app/Services/Pdf/PdfMock.php index 4d7f6a7a50dc..9635398490ce 100644 --- a/app/Services/Pdf/PdfMock.php +++ b/app/Services/Pdf/PdfMock.php @@ -606,7 +606,7 @@ class PdfMock '$task.description_label' => ctrans('texts.description'), '$product.discount_label' => ctrans('texts.discount'), '$product.quantity_label' => ctrans('texts.quantity'), - '$entity_issued_to_label' => ctrans('texts.quote_issued_to'), + '$entity_issued_to_label' => ctrans("texts.{$this->entity_string}_issued_to"), '$partial_due_date_label' => ctrans('texts.partial_due_date'), '$invoice.datetime_label' => ctrans('texts.datetime_format_id'), '$invoice.due_date_label' => ctrans('texts.due_date'), From 2a11fa994b039a125c7ea6e5f8d83114728348be Mon Sep 17 00:00:00 2001 From: Dave Shoreman Date: Tue, 28 May 2024 20:21:46 +0100 Subject: [PATCH 2/5] Fix $company.customX on Invoice Settings preview When fetched without going through the settings object, all these values were null, thus displaying nothing when used in custom invoice designs. --- app/Services/Pdf/PdfMock.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Services/Pdf/PdfMock.php b/app/Services/Pdf/PdfMock.php index 9635398490ce..0d2e75d53d3a 100644 --- a/app/Services/Pdf/PdfMock.php +++ b/app/Services/Pdf/PdfMock.php @@ -309,10 +309,10 @@ class PdfMock '$invoice.custom2' => 'custom value', '$invoice.custom3' => 'custom value', '$invoice.custom4' => 'custom value', - '$company.custom1' => $this->company->custom_value1, - '$company.custom2' => $this->company->custom_value2, - '$company.custom3' => $this->company->custom_value3, - '$company.custom4' => $this->company->custom_value4, + '$company.custom1' => $this->company->settings->custom_value1, + '$company.custom2' => $this->company->settings->custom_value2, + '$company.custom3' => $this->company->settings->custom_value3, + '$company.custom4' => $this->company->settings->custom_value4, '$quote.po_number' => 'PO12345', '$company.website' => $this->settings->website, '$balance_due_raw' => '0.00', From e568076ad05f0ef8891e34f2814ec4f095323d79 Mon Sep 17 00:00:00 2001 From: Dave Shoreman Date: Tue, 28 May 2024 22:43:40 +0100 Subject: [PATCH 3/5] Update date/total labels in entity details table --- app/Services/Pdf/PdfMock.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Services/Pdf/PdfMock.php b/app/Services/Pdf/PdfMock.php index 0d2e75d53d3a..a9983fc78022 100644 --- a/app/Services/Pdf/PdfMock.php +++ b/app/Services/Pdf/PdfMock.php @@ -609,7 +609,7 @@ class PdfMock '$entity_issued_to_label' => ctrans("texts.{$this->entity_string}_issued_to"), '$partial_due_date_label' => ctrans('texts.partial_due_date'), '$invoice.datetime_label' => ctrans('texts.datetime_format_id'), - '$invoice.due_date_label' => ctrans('texts.due_date'), + '$invoice.due_date_label' => ctrans('texts.invoice_due_date'), '$company.address1_label' => ctrans('texts.address1'), '$company.address2_label' => ctrans('texts.address2'), '$total_tax_labels_label' => ctrans('texts.total_taxes'), @@ -704,16 +704,16 @@ class PdfMock '$contact.email_label' => ctrans('texts.email'), '$invoice.taxes_label' => ctrans('texts.taxes'), '$credit_amount_label' => ctrans('texts.credit_amount'), - '$invoice.total_label' => ctrans('texts.total'), + '$invoice.total_label' => ctrans('texts.invoice_total'), '$product.date_label' => ctrans('texts.date'), '$product.item_label' => ctrans('texts.item'), '$public_notes_label' => ctrans('texts.public_notes'), '$entity.terms_label' => ctrans('texts.terms'), '$task.service_label' => ctrans('texts.service'), '$portalButton_label' => '', - '$payment.date_label' => ctrans('texts.date'), + '$payment.date_label' => ctrans('texts.payment_date'), '$client.phone_label' => ctrans('texts.phone'), - '$invoice.date_label' => ctrans('texts.date'), + '$invoice.date_label' => ctrans('texts.invoice_date'), '$client.state_label' => ctrans('texts.state'), '$number_short_label' => '', '$quote.number_label' => ctrans('texts.number'), From 7cedc48b55c2ece8ca7202d3cfcf5d91ae2ab2fe Mon Sep 17 00:00:00 2001 From: Dave Shoreman Date: Thu, 30 May 2024 00:08:11 +0100 Subject: [PATCH 4/5] Fix `$company[1..4]` aliases for custom_values --- app/Services/Pdf/PdfMock.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Services/Pdf/PdfMock.php b/app/Services/Pdf/PdfMock.php index a9983fc78022..b0b6f7f419ec 100644 --- a/app/Services/Pdf/PdfMock.php +++ b/app/Services/Pdf/PdfMock.php @@ -456,10 +456,10 @@ class PdfMock '$task.tax' => '', '$discount' => '$0.00', '$subtotal' => '$0.00', - '$company1' => $this->company->custom_value1, - '$company2' => $this->company->custom_value2, - '$company3' => $this->company->custom_value3, - '$company4' => $this->company->custom_value4, + '$company1' => $this->company->settings->custom_value1, + '$company2' => $this->company->settings->custom_value2, + '$company3' => $this->company->settings->custom_value3, + '$company4' => $this->company->settings->custom_value4, '$due_date' => '2022-01-01', '$poNumber' => 'PO-123456', '$quote_no' => '0029', From ed3d482d4439b9b73f0e859567e15e08950a3a22 Mon Sep 17 00:00:00 2001 From: Dave Shoreman Date: Thu, 30 May 2024 01:03:49 +0100 Subject: [PATCH 5/5] Fallback to original value just in case --- app/Services/Pdf/PdfMock.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/Pdf/PdfMock.php b/app/Services/Pdf/PdfMock.php index b0b6f7f419ec..cb57315902a6 100644 --- a/app/Services/Pdf/PdfMock.php +++ b/app/Services/Pdf/PdfMock.php @@ -606,7 +606,7 @@ class PdfMock '$task.description_label' => ctrans('texts.description'), '$product.discount_label' => ctrans('texts.discount'), '$product.quantity_label' => ctrans('texts.quantity'), - '$entity_issued_to_label' => ctrans("texts.{$this->entity_string}_issued_to"), + '$entity_issued_to_label' => ctrans("texts.{$this->entity_string}_issued_to") ?: ctrans('texts.quote_issued_to'), '$partial_due_date_label' => ctrans('texts.partial_due_date'), '$invoice.datetime_label' => ctrans('texts.datetime_format_id'), '$invoice.due_date_label' => ctrans('texts.invoice_due_date'),