Problem with double names in PDF

I have a problem with the billing address.


<div id="client-details"></div>
and in “Invoice Design → Client Details” select the following properties:

  • Name
  • Contact Full Name
  • Street
  • Apt/Suit
  • Postel/City/State

When I have a customer with company the fields are filled as follows:

Name: Sample company
First name (contact): John
Last name (contact): Doe
Street: Sample Street 5
Postal/City/State: 55555 Sample City

The result in PDF:

Sample Company
John Doe
Sample Street 5
55555 sample city

This is correct :white_check_mark:

The Problem:

If the customer is a private person and not a company:

Variant 1:

I leave the Name field empty and set only the first name (contact) and the last name (contact).

This way I get the contact name correctly displayed when creating the invoice. When generating the PDF I get the contact name displayed twice, so:

John Doe
John Doe
Sample Street 5
55555 sample city

Variant 2:

I fill the Name field and leave the first name (contact) and last name (contact) blank.

This way when I create the invoice I get the name displayed and underneath it says “Empty Contact”. When generating the PDF I get the name displayed twice again, so:

John Doe
John Doe
Sample Street 5
55555 sample city

In version 4 I could solve the problem by setting the following in the template:

   "text":"$\n$contact.firstName $contact.lastName\n$client.address1\n$client.postalCode $",
"style": "address"

I tried this option with the new variables but it doesn’t work.

How do I get the problem solved?

Best regards

As a workaround I can create a second template, but not all of my users are able to select it reliably.

@ben do you have any suggestions?

Hey… You can hide elements with CSS.

If its not clear, please let me know.

I solved it with different templates for different groups. Hiding was not practical for me.

I am thinking about writing a best practice for the German application area

1 Like


had the same issue and it did bug me. Different templates were not an option for me. I added the following Javascript to the invoice template footer. It hides the contact full name when it equals the client name. This should work, as long as template definitions in IN do not change.

// Hide duplicate customer/contact name
document.addEventListener('DOMContentLoaded', () => {
    document.querySelector('[data-ref=""]').innerText == document.querySelector('[data-ref="client_details-contact.full_name"]').innerText
    ? document.querySelector('[data-ref="client_details-contact.full_name"]').style.display = "none"
    : '';

I’m not sure why this behaviour with duplicate fields exists in the first place, as I’d expect the full name field to be hidden when empty.