From bdc4e53a1b36afdb5fc22e9a17d66c4a7c9ca544 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 1 Nov 2023 17:07:12 +1100 Subject: [PATCH] v5.7.41 --- VERSION.txt | 2 +- app/Services/Pdf/PdfBuilder.php | 17 ++++++++++++++--- config/ninja.php | 4 ++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index d9d5c2ee5339..6d2f642f5767 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.7.40 \ No newline at end of file +5.7.41 \ No newline at end of file diff --git a/app/Services/Pdf/PdfBuilder.php b/app/Services/Pdf/PdfBuilder.php index 07f55b3c7e88..fa4431deada8 100644 --- a/app/Services/Pdf/PdfBuilder.php +++ b/app/Services/Pdf/PdfBuilder.php @@ -614,7 +614,7 @@ class PdfBuilder } else { $_type = Str::startsWith($type, '$') ? ltrim($type, '$') : $type; - foreach ($this->service->config->pdf_variables["{$_type}_columns"] as $key => $cell) { + foreach ($this->service->config->pdf_variables[$table_type] as $key => $cell) { // We want to keep aliases like these: // $task.cost => $task.rate // $task.quantity => $task.hours @@ -773,7 +773,6 @@ class PdfBuilder */ public function buildTableHeader(string $type): array { - $this->processTaxColumns($type); $elements = []; @@ -785,11 +784,16 @@ class PdfBuilder ]; $table_type = "{$type}_columns"; + + $column_type = $type; - if ($type == 'product' && $this->service->config->entity instanceof Quote && !$this->service->config->settings_object?->sync_invoice_quote_columns) { + if ($type == 'product' && $this->service->config->entity instanceof Quote && !$this->service->config->settings?->sync_invoice_quote_columns) { $table_type = "product_quote_columns"; + $column_type = 'product_quote'; } + $this->processTaxColumns($column_type); + foreach ($this->service->config->pdf_variables[$table_type] as $column) { if (array_key_exists($column, $aliases)) { $elements[] = ['element' => 'th', 'content' => $aliases[$column] . '_label', 'properties' => ['data-ref' => "{$type}_table-" . substr($aliases[$column], 1) . '-th', 'hidden' => $this->service->config->settings->hide_empty_columns_on_pdf]]; @@ -831,6 +835,13 @@ class PdfBuilder $type_id = 2; } + /** 17-05-2023 need to explicity define product_quote here */ + if ($type == 'product_quote') { + $type_id = 1; + $column_type = 'product_quote'; + $type = 'product'; + } + // At the moment we pass "task" or "product" as type. // However, "pdf_variables" contains "$task.tax" or "$product.tax" <-- Notice the dollar sign. // This sprintf() will help us convert "task" or "product" into "$task" or "$product" without diff --git a/config/ninja.php b/config/ninja.php index 4f66c102994b..9430d9200b95 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -15,8 +15,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => env('APP_VERSION','5.7.40'), - 'app_tag' => env('APP_TAG','5.7.40'), + 'app_version' => env('APP_VERSION','5.7.41'), + 'app_tag' => env('APP_TAG','5.7.41'), 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),