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'];
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)]];
}

View File

@ -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: []

View File

@ -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:

View File

@ -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: []

View File

@ -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"