REQUEST: function from people as result

Hello there!

Is it possible to request that the function of a person (eg. director, statutory auditor, …) is made available as a result in the BE template be_legal_shareholders_and_directors?

I see it is done for the chosen country of a person, like this:

"internal-1477402_country": "BE",
  "internal-1477401_country": "BE",
  "internal-4719293_country": "BE",
  "internal-4719295_valid_vat_nbr": true,
  "internal-4719295_country": "BE",
  "internal-4719301_country": "BE",

so, perhaps the same could be done for the function? And while we’re at it, as well as all the other “popular” fields as well?

Would be greatly appreciated :man_bowing:

This to make sure the data of the package “BE Legal docs” can be correctly displayed in our own BE package “WCO” :smiling_face:

Thanks in advance

1 Like

I have the following code that I use in a shared part to display any function names or anything else related to the people drop I want to use in my templates, which also covers the defaults so we’re not dependant on needing results, feel free to use it as well:

{% comment %}
=====================================================================
                          ---------------
                          About this part
                          ---------------

Shared part used to create information related to people linked to the period
Used in: 


Variables that need to come in from the templates where this shared part is used:
  - applicable_date: date of the report that we are using (to be converted to the date: %F format)
  - check_date_begin_mandate (to be converted to the date: %F format)
  - check_date_end_mandate (to be converted to the date: %F format)

In case you also want to include people that have the option "Chairman/secretary/­teller" checked, add the following boolean variable before including the shared part:
  - include_chairman_or_secretary_or_scrutineer
  
Variables that are returned to the templates where the shared part is used:
  - people_values (names of the people as a string separated by "|")
  - people_options (keys of the people as a string separated by "|")
  - director_count (amount of directors that are eligible as an integer
  - statutory_directors (boolean that is true when there is at least one statutory director in the company)
=====================================================================
{% endcomment %}

{% comment %}Translations{% endcomment %}
{% t= "t_represented_by" default:"with permanent representative" nl:"vertegenwoordigd door" fr:"représentée par son représentant permanent" %}
{% t="t_10" default:"Voorzitter van de Raad van Bestuur" fr:"Président du Conseil d'Administration" en:"Chairman of the board of directors" %}
{% t="t_11" default:"Ondervoorzitter van de Raad van Bestuur" fr:"Vice-président du conseil d'administration" en:"Vice-Chairman of the board of directors" %}
{% t="t_13" default:"Bestuurder" fr:"Administrateur" en:"Director" %}
{% t="t_14" default:"Gedelegeerd Bestuurder" fr:"Administrateur délégué" en:"Managing Director" %}
{% t="t_20" default:"Bestuurder-zaakvoerder" fr:"Administrateur-gérant" en:"Director-Manager" %}
{% t="t_30" default:"Zaakvoerder" fr:"Gérant" en:"Manager" %}
{% t="t_30_woman" default:"Zaakvoerder" fr:"Gérante" en:"Manager" %}
{% t="t_40" default:"Vennoot" fr:"Associé" en:"Partner" %}
{% t="t_60" default:"Voorzitter van de Raad van Commissarissen" fr:"Président du Collège des Commissaires" en:"Chairman of the Supervisory Board" %}
{% t="t_61" default:"Commissaris" fr:"Commissaire" en:"Commissioner" %}
{% t="t_63" default:"Regeringscommissaris" fr:"Commissaire du Gouvernement" en:"Government Commissioner" %}
{% t="t_70" default:"Externe accountant" fr:"Expert-comptable externe" en:"External Accountant" %}
{% t="t_71" default:"Bedrijfsrevisor" fr:"Réviseur d'entreprise" en:"Auditor" %}
{% t="t_72" default:"Erkende boekhouder" fr:"Comptable agréé" en:"Certified Accountant" %}
{% t="t_73" default:"Erkende boekhouder-fiscalist" fr:"Comptable-fiscaliste agréé" en:"Certified Tax Accountant" %}
{% t="t_80" default:"Vereffenaar" fr:"Liquidateur" en:"Liquidator" %}
{% t="t_81" default:"Curator" fr:"Curateur" en:"Curator" %}
{% t="t_other_1" default:"Wettelijke vertegenwoordiger" fr:"Représentant légal" en:"Legal Representative" %}
{% t="t_other_2" default:"Persoon belast met dagelijks bestuur" fr:"Personne chargée de la gestion quotidienne" en:"Person in charge of daily management" %}
{% t="t_other_3" default:"Statutaire Bestuurder" fr:"Administrateur statutaire" en:"Statutory Director" %}
{% t="t_other_4" default:"Bewindvoerder" fr:"Administrateur judiciaire" en:"Administrator" %}
{% t="t_other_5" default:"Voorzitter van het Bestuursorgaan" fr:"Président de l'organe d'administration" en:"Chairman of the Governing Body" %}

{% capture t_represented_by %} {% t "t_represented_by" %} {% endcapture %}
{% assign shareholders_and_directors_template = period.reconciliations.be_legal_shareholders_and_directors %}

{% comment %}
==========================
    Company form logic
==========================
{% endcomment %}
{% comment %}get the company form from the company drop{% endcomment %}
{% capture company_form %}{{ company.company_form | replace: '.','' | replace: ' ','' | remove:'-' | upcase }}{% endcapture %}

{% case company_form %}
  {% when 'NV' or "SA" %}
    {% assign NV = true %}
    {% assign legal_type = "014" %}
    {% capture full_company_form %}{% t "Public limited liability company (NV/SA)" %}{% endcapture %}
  {% when 'CVBA' or 'SCRL' %}
    {% assign improper_cvba = true %}
    {% assign legal_type = "008" %}
    {% capture full_company_form %}{% t "Limited liability cooperative partnership" %}{% endcapture %}
  {% when 'VZW' or "ASBL" %}
    {% assign VZW = true %}
    {% assign legal_type = "017" %}
    {% capture full_company_form %}{% t "Non-profit organisation" %}{% endcapture %}
  {% when 'COMMV' or 'SCOMM' %}
    {% assign COMMV = true %}
    {% assign legal_type = "612" %}
    {% capture full_company_form %}{% t "Limited partnership (CommV/SComm)" %}{% endcapture %}
  {% when 'BV' or 'SRL' %}
    {% assign BV = true %}
    {% assign legal_type = "610" %}
    {% capture full_company_form %}{% t "Private limited liability company (BV/SRL)" %}{% endcapture %}
  {% when 'CV' or "SC" %}
    {% assign CV = true %}
    {% assign legal_type = "706" %}
    {% capture full_company_form %}{% t "Cooperative limited liability company (CV/SC)" %}{% endcapture %}
  {% when 'COMMVA' or 'SCA' %}
    {% assign NV = true %}
    {% assign COMMVA = true %}
    {% assign supported_commva = true %}
    {% assign legal_type = "013" %}
    {% capture full_company_form %}{% t "Limited partnership with share capital" %}{% endcapture %}
  {% when 'MAATSCHAP' or "SOCIETE SIMPLE" %}
    {% assign MAATSCHAP = true %}
    {% assign legal_type = "other_2" %}
  {% when 'VOF' or "SNC" %}
    {% assign VOF = true %}
    {% assign legal_type = "011" %}
    {% capture full_company_form %}{% t "General partnership (VOF/SNC)" %}{% endcapture %}
{% endcase %}

{% comment %}Create arrays used to hold the information about the people{% endcomment %}
{% assign people_values = "" | split:"|" %}
{% assign people_options = "" | split:"|" %}

{% assign natural_people_values = "" | split:"|" %}
{% assign natural_people_options = "" | split:"|" %}

{% assign natural_director_values = "" | split:"|" %}
{% assign natural_director_options = "" | split:"|" %}

{% comment %}Make sure that the variables to check the mandate dates with are always converted to the correct format to compare dates{% endcomment %}
{% assign applicable_date = applicable_date | date:"%F" %}
{% assign check_date_begin_mandate = check_date_begin_mandate | date:"%F" %}
{% assign check_date_end_mandate = check_date_end_mandate | date:"%F" %}

{% comment %}Store if there is at least one statutory director to determine if nanaging director agenda points are applicable{% endcomment %}
{% assign statutory_director = false %}

{% comment %}Variable that counts the directors{% endcomment %}
{% assign director_count = 0 %}

{% for person in period.people %}
  {% capture person_target_id %}person_{{ person.id }}{% endcapture %}
  {% comment %}Determine the type of the person (legal or natural){% endcomment %}
  {% assign default_type = "" %}
  {% if person.custom.represented_by_name != blank %}
    {% assign default_type = "legal" %}
  {% else %}
    {% assign default_type = "nature" %}
  {% endif %}
  {% assign type = person.custom.type | default:default_type %}
  {% assign begin_mandate = person.director_start_date | date:"%F" %}
  {% assign end_mandate = person.director_end_date | date:"%F" %}
  
  {% comment %}Determine if the person is a natural person and has a valid manddate{% endcomment %}
  {% assign eligible = false %}

  {% if include_chairman_or_secretary_or_scrutineer %}
    {% if person.custom.chairman_or_secretary_or_scrutineer == true %}
      {% assign eligible = true %}
    {% endif %}
  {% endif %}
  
  {% if person.shareholder == true %}
    {% assign eligible = true %}
  {% endif %}
  
  {% if person.director == true %}
    {% assign eligible = true %}    
  {% endif %}   
  
  {% if person.statutory == true %}
    {% assign statutory_director = true %}
    {% assign eligible = true %}
  {% else %}

    {% if applicable_date != blank %}
    
      {% comment %}Show director if dates/ begin/end mandate are not blank & valid{% endcomment %}
      {% assign eligible = true %}
      
      {% comment %}Don't show director is the mandate starts after the check of the begin mandate{% endcomment %}
      {% if begin_mandate != blank and begin_mandate > check_date_begin_mandate %}
        {% assign eligible = false %}
      {% endif %}
      
      {% comment %}Don't show director if the mandate ended before the check of the end mandate{% endcomment %}
      {% if end_mandate != blank and end_mandate <  check_date_end_mandate %}
        {% assign eligible = false %}
      {% endif %}
    
    {% endif %} {% comment %}endif applicable_date{% endcomment %}
    
  {% endif %} {% comment %}endif person.shareholder{% endcomment %}
  
  {% comment %}Count the directors that are eligible{% endcomment %}
  {% if person.director and eligible %}
    {% assign director_count = director_count | plus:1 %}
  {% endif %}

  {% assign words = person.name | split: ' ' %}
  {% assign def_person_last_name = "" %}
  {% assign def_person_first_name = "" %}
   
  {% for word in words %}
    {% if forloop.last %} {% comment %}correct for syncs like adminis{% endcomment %}
      {% assign def_person_first_name = word %}
    {% else %}
      {% assign def_person_last_name = def_person_last_name | append:" " | append:word %}
    {% endif %}
  {% endfor %}
   
  {% assign person_first_name = person.custom.first_name | default:def_person_first_name %}
  {% assign person_last_name = person.custom.last_name | default:def_person_last_name %}
   
  {% if type == "legal" %}
    {% capture person_name %}{{ person.name }} {{ t_represented_by }} {{ person.custom.represented_by_name }}{% endcapture %}
  {% else %}
    {% capture person_name %}{{ person_first_name }} {{ person_last_name }}{% endcapture %}
  {% endif %}
    
  {% comment %}obtain gender{% endcomment %}
  {% assign person_gender = person.custom.applicable_gender %}
  
  {% comment %}Director info{% endcomment %}
  {% assign person_email = person.custom.email %}
  {% assign person_phone_number = person.custom.phone_number %}

  {% comment %}This part breaks the company street address up into usable strings, to set defaults for input fields{% endcomment %}
  {% assign street_address = person.address_1 %}
  {% assign street_parts = street_address | split: ' ' %}
  {% assign number_part = false %}
  {% assign number = "" %}
  {% assign street = "" %}
  {% for part in street_parts %}
    {% assign part_down = part | downcase %}
    {% if part contains "1" or part contains "2" or part contains "3" or part contains "4" or part contains "5" or part contains "6" or part contains "7" or part contains "8" or part contains "9" or part contains "0" or part_down == "bus" %}
      {% assign number_part = true %}
    {% else %}
      {% assign number_part = false %}
    {% endif %}
    {% if number_part %}
      {% assign number = number | append:" " | append:part %}
    {% else %}
      {% assign street = street | append:" " | append:part %}  
    {% endif %}
  {% endfor %}
  {% assign street = street | strip %}
  {% assign number = number | strip %}
  {% capture address_street %}{{ street | strip }}{% endcapture %}
  {% capture address_number %}{{ number | strip }}{% endcapture %}
  {% assign person_city = person.address_2 | remove:"1" | remove:"2" | remove:"3" | remove:"4" | remove:"5" | remove:"6" | remove:"7" | remove:"8" | remove:"9" | remove:"0" | remove:"bus" | remove:"Bus" | remove:"BUS" | strip %}
  {% assign person_postal_code = person.address_2 | downcase | remove:"a" | remove:"b" | remove:"c" | remove:"d" | remove:"e" | remove:"f" | remove:"g" | remove:"h" | remove:"i" | remove:"j" | remove:"k" | remove:"l" | remove:"m" | remove:"n" | remove:"o" | remove:"p" | remove:"q" | remove:"r" | remove:"s" | remove:"t" | remove:"u" | remove:"v" | remove:"w" | remove:"x" | remove:"y" | remove:"z"  | remove:" " | remove:"-" | strip %}

  {% assign person_street = person.custom.street | default:street %}
  {% assign person_number = person.custom.street_number | default:number %}
  {% assign person_postal_code = person.custom.postal_code |default:person_postal_code %}
  {% assign person_city = person.custom.city | localized | default:person_city %}
  {% assign person_national_number = person.custom.ni_number %}

  {% if person_national_number == blank %}
    {% capture person_national_number %}{% if shareholders_and_directors_template.exists? %}{% linkto shareholders_and_directors_template new_tab:true target:person_target_id %}XX.XX.XX-XXX.XX{% endlinkto %}{% else %}XX.XX.XX-XXX.XX{% endif %}{% endcapture %}
  {% endif %}

  {% comment %}for each person, create a default function {% endcomment %}
  {% assign default_function = "" %}
  {% if person.shareholder %}
    {% if person.director %}
    {% case company_form %}
        {% when 'MAATSCHAP' or 'VOF' or 'COMMV' %}
          {% assign default_function = "30" %}
        {% else %}
          {% assign default_function = "13" %}
      {% endcase %}
    {% elsif person.statutory == true %}
      {% if NV or CVBA or CVOA or VZW %}
        {% assign default_function = "14" %}
      {% else %}
        {% assign default_function = "30" %}
      {% endif %}
    {% elsif person.custom.auditor or person.custom.chairman_or_secretary_or_scrutineer %}
      {% if NV or CVBA or CVOA or VZW %}
        {% assign default_function = 13 %}
      {% else %}
        {% assign default_function = "30" %}
      {% endif %}
    {% else %}
      {% assign default_function = "" %}
    {% endif %}
  {% elsif person.director %}
  {% case company_form %}
      {% when 'MAATSCHAP' or 'VOF' or 'COMMV' %}
        {% assign default_function = "30" %}
      {% else %}
        {% assign default_function = "13" %}
    {% endcase %}
  {% else %}
    {% if person.statutory == true %}
        {% if NV or CVBA or CVOA or VZW %}
          {% assign default_function = "14" %}
        {% else %}
          {% assign default_function = "30" %}
        {% endif %}
    {% else %}
        {% if NV or CVBA or CVOA or VZW %}
          {% assign default_function = 13 %}
        {% else %}
          {% assign default_function = "30" %}
        {% endif %}  
    {% endif %}
  {% endif %}

  {% assign person_function_code = person.custom.function | default:default_function %}
  {% capture person_function_key %}t_{{ person_function_code }}{% endcapture %}
  {% capture person_function_name %}{% endcapture %}

  {% if person_function_code != blank %}
    {% capture person_function_name %}{% t person_function_key %}{% endcapture %}  
  {% endif %} 
    
  {% comment %}Use the persistent_id, because this can be rollforwarded - the "replace" filter is used because of a bug that doesn't fetch names for synced values (core){% endcomment %}
  {% assign person_id = person.persistent_id | replace:"-", "-" %}
  {% assign person_local_id = person.id %}

  {% if eligible %}
    {% comment %}Add the eligible person to the array{% endcomment %}
    {% if person_name != blank %}
      {% push person_name to:people_options %}
      {% push person_id to:people_values %}
      
      {% if type == "nature" %}
        {% push person_name to:natural_people_options %}
        {% push person_id to:natural_people_values %}     

        {% if person.director %}
          {% push person_name to:natural_director_options %}
          {% push person_id to:natural_director_values %}   
        {% endif %}
      {% endif %}
    {% endif %}
    
    {% assign scrutineer_options = scrutineer_options | append:person.persistent_id | append:";" | append:person_name | append:";" | append:person.custom.email | append:";" | append:person_gender %}
    {% unless forloop.last %}
      {% assign scrutineer_options = scrutineer_options | append:"|" %}
    {% endunless %}
  {% endif %} {% comment %}endif eligible{% endcomment %}
  
  {% comment %}Store the person information in dynamic variables that can be used in other places{% endcomment %}
  {% assign fetched_person_data = "local_id|name|email|phone_number|function_name|gender|postal_code|city|street|number|national_number" | split:"|" %}

  {% for data_key in fetched_person_data %}
    {% capture person_data_id %}person_{{ data_key }}_{{ person_id }}{% endcapture %}  
    {% capture local_variable_key %}person_{{ data_key }}{% endcapture %}

    {% assign [person_data_id] = [local_variable_key] %}
  {% endfor %}  
    
  {% comment %}active mandate for current legal doc{% endcomment %}
  {% capture person_mandate_active %}person_mandate_{{ person_id }}{% endcapture %}
  {% assign [person_mandate_active] = true %}
    
  {% comment %}Natural or legal person{% endcomment %}
  {% capture person_type %}person_type_{{ person_id }}{% endcapture %}
  {% assign [person_type] = type %}
  
{% endfor %} {% comment %}endfor people{% endcomment %}

{% comment %}Convert the arrays to a string so that they can be used in the people dropdowns{% endcomment %}
{% assign people_options = people_options | join:"|" %}
{% assign people_values = people_values | join:"|" %}

{% assign natural_people_values = natural_people_values | join:"|" %}
{% assign natural_people_options = natural_people_options | join:"|" %}

{% assign natural_director_count = natural_director_values.size %}
{% t= "t_other" default:"Andere" %}
{% capture t_other %}{% t "t_other" %}{% endcapture %}
{% push t_other to:natural_director_options %}
{% push "other" to:natural_director_values %}   

{% assign natural_director_values = natural_director_values | join:"|" %}
{% assign natural_director_options = natural_director_options | join:"|" %}

{% assign scrutineer_options = scrutineer_options | split:"|" | uniq | join:"|" %}

{% result 'scrutineer_options' scrutineer_options %}

@Prioflux greatly appreciated, but it beats the purpose of my request however :smiling_face:

I want results from Silverfin so I’m sure that - whenever an update comes in the BE law (and therefor in the Silverfin templates) - I do not need to alter local code of the WCO templates and I can just rely on the results from the Silverfin templates…

But greatly appreciate your willingness to share :facepunch:

Any news on this when (and if) we can expect this? :smiling_face:

A result for this should be available now in the results of the template be_legal_shareholders_and_directors:
image

The result name per function description of a director consists of the persistent id + a suffix of “_function_name”.

Have fun!

1 Like

Thanks a lot :raised_hands: