From 6b78cd7a63b177f760c8123eee921f190d5ffb83 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 25 Jun 2023 16:54:36 +1000 Subject: [PATCH] Fixes for PDF Previews --- app/Jobs/Util/WebhookSingle.php | 4 +++- app/Services/Pdf/PdfBuilder.php | 2 +- app/Services/Pdf/PdfMock.php | 14 ++++++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/Jobs/Util/WebhookSingle.php b/app/Jobs/Util/WebhookSingle.php index ca6185a5c3dd..26f79e992250 100644 --- a/app/Jobs/Util/WebhookSingle.php +++ b/app/Jobs/Util/WebhookSingle.php @@ -122,7 +122,9 @@ class WebhookSingle implements ShouldQueue $client = new Client(['headers' => array_merge($base_headers, $headers)]); try { - $response = $client->{$subscription->rest_method}($subscription->target_url, [ + $verb = $subscription->rest_method ?? 'post'; + + $response = $client->{$verb}($subscription->target_url, [ RequestOptions::JSON => $data, // or 'json' => [...] ]); diff --git a/app/Services/Pdf/PdfBuilder.php b/app/Services/Pdf/PdfBuilder.php index 39775948626a..78d8d38fb2a9 100644 --- a/app/Services/Pdf/PdfBuilder.php +++ b/app/Services/Pdf/PdfBuilder.php @@ -653,7 +653,7 @@ class PdfBuilder $data[$key][$table_type.".{$_table_type}4"] = strlen($item->custom_value4) >= 1 ? $helpers->formatCustomFieldValue($this->service->company->custom_fields, "{$_table_type}4", $item->custom_value4, $this->service->config->currency_entity) : ''; if ($item->quantity > 0 || $item->cost > 0) { - $data[$key][$table_type.'.quantity'] = $this->service->config->formatMoney($item->quantity); + $data[$key][$table_type.'.quantity'] = $item->quantity; $data[$key][$table_type.'.unit_cost'] = $this->service->config->formatMoney($item->cost); diff --git a/app/Services/Pdf/PdfMock.php b/app/Services/Pdf/PdfMock.php index 8c569ed0323f..06a572c0680d 100644 --- a/app/Services/Pdf/PdfMock.php +++ b/app/Services/Pdf/PdfMock.php @@ -232,6 +232,9 @@ class PdfMock '$secondary_font_url' => 'https://fonts.googleapis.com/css2?family=Roboto&display=swap', '$contact.signature' => '', '$company_logo_size' => $this->settings->company_logo_size ?: '65%', + '$product.tax_rate1' => ctrans('texts.tax'), + '$product.tax_rate2' => ctrans('texts.tax'), + '$product.tax_rate3' => ctrans('texts.tax'), '$product.tax_name1' => '', '$product.tax_name2' => '', '$product.tax_name3' => '', @@ -688,8 +691,11 @@ class PdfMock '$net_subtotal_label' => ctrans('texts.net_subtotal'), '$credit.total_label' => ctrans('texts.total'), '$quote.amount_label' => ctrans('texts.amount'), - '$description_label' => ctrans('texts.description'), + '$product.tax_rate1_label' => ctrans('texts.tax'), + '$product.tax_rate2_label' => ctrans('texts.tax'), + '$product.tax_rate3_label' => ctrans('texts.tax'), '$product.tax_label' => ctrans('texts.tax'), + '$description_label' => ctrans('texts.description'), '$your_entity_label' => ctrans("texts.your_{$this->entity_string}"), '$view_button_label' => ctrans('texts.view'), '$status_logo_label' => ctrans('texts.logo'), @@ -782,9 +788,9 @@ class PdfMock '$amount_label' => ctrans('texts.amount'), '$notes_label' => ctrans('texts.notes'), '$terms_label' => ctrans('texts.terms'), - 'tax_rate1_label' => ctrans('texts.tax_rate1'), - 'tax_rate2_label' => ctrans('texts.tax_rate2'), - 'tax_rate3_label' => ctrans('texts.tax_rate3'), + '$tax_rate1_label' => ctrans('texts.tax_rate1'), + '$tax_rate2_label' => ctrans('texts.tax_rate2'), + '$tax_rate3_label' => ctrans('texts.tax_rate3'), '$phone_label' => ctrans('texts.phone'), '$email_label' => ctrans('texts.email'), '$taxes_label' => ctrans('texts.taxes'),