Minutes - Presences

Hello,

In our minutes for the directors and the presences we are using following code:

Blockquote
Zijn aanwezig of vertegenwoordigd:

{% capture options %}{% for zaakvoerder in period.directors %}{% if zaakvoerder.custom.represented_by_name == blank %}{{zaakvoerder.name}}|{% endif %}{% endfor %}{% endcapture %}
{% capture rechtspersoon_opties %}{% for director in period.directors %}{% if director.custom.represented_by_name != blank %}{{director.name}}|{% endif %}{% endfor %}{% endcapture %}
{% fori aanwezig in period.custom.aanwezig %}

  • {% ic %}{% input aanwezig.type as:select options:‘Natuurlijk persoon|Rechtspersoon’ %}{% endic %}{% if aanwezig.type ==‘Natuurlijk persoon’%}{% input aanwezig.geslacht as:select options:‘De heer|Mevrouw’ %} {% input aanwezig.options as:select options:options %} {% endif %}{% if aanwezig.type ==‘Rechtspersoon’%}{% input aanwezig.rechtspersoon_opties as:select options:rechtspersoon_opties %} {% for director2 in period.directors %}{% assign director_name = director2.name %} {% if director_name == aanwezig.rechtspersoon_opties %}{% assign director = director2.custom %}{% break %}{% endif %}{% endfor %}, vertegenwoordigd door haar vaste vertegenwoordiger, {% input aanwezig.rechtspersoon_geslacht as:select options:‘de heer|mevrouw’ %} {{director.represented_by_name}} {% endif %}{% endfori %}

Blockquote

With this code we have a problem when we add manually a director natural person in the company parameters because the name is not filed in the field Company name but in 2 separate fields Firstname & Lastname.

How can we solve the problem without changing all our code in the different mintues?

Thanks a lot,

Sylvie

Hi Sylvie.

To also capture the name of natural directors, it would be best to add an if-statement that checks which type of director you have and then capture the correct name based on that.

An example could look like this:

{% for person in period.directors %}
  {% if person.custom.type == "legal" %}
    {% capture director_name %}{{ person.name }}{% endcapture %}
  {% else %}
    {% capture director_name %}{{ person.custom.first_name }} {{ person.custom.last_name }}{% endcapture %}
  {% endif %}
Director's name: {{ director_name }}  
{% endfor %}

Applying a similar logic anywhere you capture the name should solve your problem here.
I hope that helps,

Kind regards,
Romy

Hi Romy,

I’m not sure your code is the correct solution. I change the code a little bit to see of the If for the type works:

{% for person in period.directors %}
{% if person.custom.type == ‘legal’ %}
{% capture director_name %}Legal {{ person.name }}{% endcapture %}
{% else %}
{% capture director_name %}Nature {{ person.custom.first_name }} {{ person.custom.last_name }}{% endcapture %}
{% endif %}
Director’s name: {{ director_name }}
{% endfor %}

I receive as result in a test file always the line Nature … also for directors of type Legal.

Can you have a look please?

Thanks a lot,

Sylvie