From cac4920cc667eabb5452c89dd29064ecac6a56c4 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 4 Mar 2025 10:51:09 +1100 Subject: [PATCH] Prevent duplicating contact/client name if they are the same! --- app/Services/Pdf/PdfBuilder.php | 4 ++++ openapi/api-docs.yaml | 23 +++++++++++++++++++---- openapi/info.yaml | 3 --- openapi/misc/misc.yaml | 2 ++ openapi/paths/invoices.yaml | 18 +++++++++++++++++- 5 files changed, 42 insertions(+), 8 deletions(-) diff --git a/app/Services/Pdf/PdfBuilder.php b/app/Services/Pdf/PdfBuilder.php index a8c5d557e5..52b6b50e8e 100644 --- a/app/Services/Pdf/PdfBuilder.php +++ b/app/Services/Pdf/PdfBuilder.php @@ -1822,6 +1822,10 @@ class PdfBuilder $variables = $this->service->config->pdf_variables['client_details']; + if(strlen($this->service->config->client->name ?? '') == 0 && in_array('$client.name', $variables) && in_array('$contact.full_name', $variables)) { + $variables = array_diff($variables, ['$contact.full_name']); + } + foreach ($variables as $variable) { $elements[] = ['element' => 'div', 'content' => $variable, 'show_empty' => false, 'properties' => ['data-ref' => 'client_details-' . substr($variable, 1)]]; } diff --git a/openapi/api-docs.yaml b/openapi/api-docs.yaml index 084ef155ee..37f608710a 100644 --- a/openapi/api-docs.yaml +++ b/openapi/api-docs.yaml @@ -71,9 +71,6 @@ info: license: name: 'Elastic License' url: 'https://www.elastic.co/licensing/elastic-license' - externalDocs: - description: 'Invoice Ninja Documentation' - url: 'https://invoiceninja.github.io' version: 5.11.48 servers: @@ -11063,7 +11060,7 @@ paths: required: false schema: type: string - example: ?over_due= + example: ?overdue= - name: payable in: query description: | @@ -11087,6 +11084,22 @@ paths: schema: type: string example: ?private_notes=super secret + - name: date + in: query + description: | + Filters the invoices by invoice date returns a list of invoices after (and including) the date + required: false + schema: + type: string + example: ?date=2022-01-01 + - name: date_range + in: query + description: | + Filters the invoices by invoice date returns a list of invoices between two dates + required: false + schema: + type: string + example: ?date_range=2022-01-01,2022-01-31 responses: 200: description: "A list of invoices" @@ -23184,6 +23197,7 @@ tags: externalDocs: description: "Client Libraries" + url: 'https://invoiceninja.github.io' x-libraries: - name: PHP SDK description: Official PHP client library @@ -23196,3 +23210,4 @@ externalDocs: security: - ApiKeyAuth: [] + \ No newline at end of file diff --git a/openapi/info.yaml b/openapi/info.yaml index 3ccd000771..b664225df3 100644 --- a/openapi/info.yaml +++ b/openapi/info.yaml @@ -71,9 +71,6 @@ info: license: name: 'Elastic License' url: 'https://www.elastic.co/licensing/elastic-license' - externalDocs: - description: 'Invoice Ninja Documentation' - url: 'https://invoiceninja.github.io' version: 5.11.48 servers: diff --git a/openapi/misc/misc.yaml b/openapi/misc/misc.yaml index 5a9efb9413..9e7ce7169f 100644 --- a/openapi/misc/misc.yaml +++ b/openapi/misc/misc.yaml @@ -133,6 +133,7 @@ tags: externalDocs: description: "Client Libraries" + url: 'https://invoiceninja.github.io' x-libraries: - name: PHP SDK description: Official PHP client library @@ -145,3 +146,4 @@ externalDocs: security: - ApiKeyAuth: [] + \ No newline at end of file diff --git a/openapi/paths/invoices.yaml b/openapi/paths/invoices.yaml index c775c11747..6175a35b35 100644 --- a/openapi/paths/invoices.yaml +++ b/openapi/paths/invoices.yaml @@ -70,7 +70,7 @@ required: false schema: type: string - example: ?over_due= + example: ?overdue= - name: payable in: query description: | @@ -94,6 +94,22 @@ schema: type: string example: ?private_notes=super secret + - name: date + in: query + description: | + Filters the invoices by invoice date returns a list of invoices after (and including) the date + required: false + schema: + type: string + example: ?date=2022-01-01 + - name: date_range + in: query + description: | + Filters the invoices by invoice date returns a list of invoices between two dates + required: false + schema: + type: string + example: ?date_range=2022-01-01,2022-01-31 responses: 200: description: "A list of invoices"