Issue: Representative does not appear in template

Hi

We made a template ‘Infoblad’ based on the Bedrijfsparameters.
However everything in the Bedrijfsparameters seems correct. On the Infolbad, it is not:

Code:

Overzicht van de bedrijfsleiding
{% stripnewlines %}
{% newline %}
|Bedrijfsleiders
|Begin mandaat
|Einde mandaat
{% newline %}

—:{% ic %}#{% endic %}{% nic %}+{% endnic %}{% for director in period.directors%}
{% assign words = director.name
{% assign lastname = “” %}
{% assign person_first_name = “” %}
{% assign current_signature = “” %}
{% for word in words %}
{% if forloop.last %} {% comment %}correct for syncs like adminis{% endcomment %}
  {% assign person_first_name = word %}
{% else %}
  {% assign lastname = lastname | append:" " | append:word %}
{% endif %}

{% endfor %}
{% newline %}
{% if director.custom.first_name == blank and director.custom.last_name == blank %}
{% assign current_signature = director.name %}
{% elsif director.custom.first_name == blank and director.custom.last_name != blank %}
{% assign current_signature = current_signature | append:person_first_name | append:" " | append:director.custom.last_name %}
{% elsif director.custom.first_name != blank and director.custom.last_name == blank %}
{% assign current_signature = current_signature | append:director.custom.first_name | append:" " | append:lastname %}
{% else %}
{% assign current_signature = current_signature | append:director.custom.first_name | append:" " | append:director.custom.last_name %}
{% endif %}
|{{ current_signature }}{% if director.custom.type ==“legal” %} met als vaste vertegenwoordiger {{ director.custom.represented_by_name }}{% endif %}
|{{ director.director_start_date | date:“%d/%m/%Y” }}
|{{ director.director_end_date | date:“%d/%m/%Y” }}
{% endfor %}
{% endstripnewlines %}

Hi Sylvia

Can you please specify what is not correct according to you? What values would you expect?

Best regards,

Michiel

Hi Michiel

The name of the representative should appear. Now the text stops at ‘met als vaste vertegenwoordiger’.

Hi Sylvia,

this is because for some directors the type is a default value. Therefore director.custom.type will be blank. You can add the default as follows:

{% if director.custom.represented_by_name != blank %}
  {% assign default_type = "legal" %}
{% else %}
  {% assign default_type = "nature" %}
{% endif %}

{% assign type = director.custom.type  | default:default_type %} 

{% if  type == "legal" %} met als vaste vertegenwoordiger {{ director.custom.represented_by_name }}{% endif %}

Regards,
Michiel

Hi Michiel

It’s partially OK now. I stille have the following issues:

  • BVBA Baletech should actually be The Coaching loop (it stands correctly in the Bedrijfsparameters)

  • For Belacasa & Creative Lean Consult, there is no representative so ‘met als vaste vertegenwoordiger’ shoudl not be mentioned.

Code:

Overzicht van de bedrijfsleiding
{% stripnewlines %}
{% newline %}
|Bedrijfsleiders
|Begin mandaat
|Einde mandaat
{% newline %}

—:{% ic %}#{% endic %}{% nic %}+{% endnic %}{% for director in period.directors%}
{% assign words = director.name
{% assign lastname = “” %}
{% assign person_first_name = “” %}
{% assign current_signature = “” %}
{% for word in words %}
{% if forloop.last %} {% comment %}correct for syncs like adminis{% endcomment %}
  {% assign person_first_name = word %}
{% else %}
  {% assign lastname = lastname | append:" " | append:word %}
{% endif %}

{% endfor %}
{% newline %}
{% if director.custom.first_name == blank and director.custom.last_name == blank %}
{% assign current_signature = director.name %}
{% elsif director.custom.first_name == blank and director.custom.last_name != blank %}
{% assign current_signature = current_signature | append:person_first_name | append:" " | append:director.custom.last_name %}
{% elsif director.custom.first_name != blank and director.custom.last_name == blank %}
{% assign current_signature = current_signature | append:director.custom.first_name | append:" " | append:lastname %}
{% else %}
{% assign current_signature = current_signature | append:director.custom.first_name | append:" " | append:director.custom.last_name %}
{% endif %}
{% if director.custom.represented_by_name != blank %}
{% assign default_type = “legal” %}
{% else %}
{% assign default_type = “nature” %}
{% endif %}
{% assign type = director.custom.type | default:default_type %}
|{{ current_signature }}{% if type == “legal” %} met als vaste vertegenwoordiger {{ director.custom.represented_by_name }}{% endif %}
|{{ director.director_start_date | date:“%d/%m/%Y” }}
|{{ director.director_end_date | date:“%d/%m/%Y” }}
{% endfor %}
{% endstripnewlines %}

Hi Sylvia,

What happened according to me for The Coaching Loop BVBA is the following: this was first a natural person where you have entered a last name and afterwards you switched the type to legal person. However, the variable director.custom.last_name still has that value and therefore the current_signature is not correct. I suggest to turn the type to natural person in the template general company information, remove the last name. Restate the type variable to legal person and your custom template should be OK!

With regard to the second point you can simply turn {% if type == “legal” %} into {% if type == “legal” and director.custom.represented_by_name != blank %}. All code within the if statement will not be executed when there is no representative entered.

Regards,
Michiel