Prevent duplicating contact/client name if they are the same!

This commit is contained in:
David Bomba 2025-03-04 10:51:09 +11:00
parent 935433a9fb
commit cac4920cc6
5 changed files with 42 additions and 8 deletions

View File

@ -1822,6 +1822,10 @@ class PdfBuilder
$variables = $this->service->config->pdf_variables['client_details']; $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) { foreach ($variables as $variable) {
$elements[] = ['element' => 'div', 'content' => $variable, 'show_empty' => false, 'properties' => ['data-ref' => 'client_details-' . substr($variable, 1)]]; $elements[] = ['element' => 'div', 'content' => $variable, 'show_empty' => false, 'properties' => ['data-ref' => 'client_details-' . substr($variable, 1)]];
} }

View File

@ -71,9 +71,6 @@ info:
license: license:
name: 'Elastic License' name: 'Elastic License'
url: 'https://www.elastic.co/licensing/elastic-license' url: 'https://www.elastic.co/licensing/elastic-license'
externalDocs:
description: 'Invoice Ninja Documentation'
url: 'https://invoiceninja.github.io'
version: 5.11.48 version: 5.11.48
servers: servers:
@ -11063,7 +11060,7 @@ paths:
required: false required: false
schema: schema:
type: string type: string
example: ?over_due= example: ?overdue=
- name: payable - name: payable
in: query in: query
description: | description: |
@ -11087,6 +11084,22 @@ paths:
schema: schema:
type: string type: string
example: ?private_notes=super secret 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: responses:
200: 200:
description: "A list of invoices" description: "A list of invoices"
@ -23184,6 +23197,7 @@ tags:
externalDocs: externalDocs:
description: "Client Libraries" description: "Client Libraries"
url: 'https://invoiceninja.github.io'
x-libraries: x-libraries:
- name: PHP SDK - name: PHP SDK
description: Official PHP client library description: Official PHP client library
@ -23196,3 +23210,4 @@ externalDocs:
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []

View File

@ -71,9 +71,6 @@ info:
license: license:
name: 'Elastic License' name: 'Elastic License'
url: 'https://www.elastic.co/licensing/elastic-license' url: 'https://www.elastic.co/licensing/elastic-license'
externalDocs:
description: 'Invoice Ninja Documentation'
url: 'https://invoiceninja.github.io'
version: 5.11.48 version: 5.11.48
servers: servers:

View File

@ -133,6 +133,7 @@ tags:
externalDocs: externalDocs:
description: "Client Libraries" description: "Client Libraries"
url: 'https://invoiceninja.github.io'
x-libraries: x-libraries:
- name: PHP SDK - name: PHP SDK
description: Official PHP client library description: Official PHP client library
@ -145,3 +146,4 @@ externalDocs:
security: security:
- ApiKeyAuth: [] - ApiKeyAuth: []

View File

@ -70,7 +70,7 @@
required: false required: false
schema: schema:
type: string type: string
example: ?over_due= example: ?overdue=
- name: payable - name: payable
in: query in: query
description: | description: |
@ -94,6 +94,22 @@
schema: schema:
type: string type: string
example: ?private_notes=super secret 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: responses:
200: 200:
description: "A list of invoices" description: "A list of invoices"