General company info is deleted

Hi there

If I use the directors of the current period in combination with a mapped account in a template, the users are able to overwrite the amount of the account, but also to delete it if it’s wrong. If they delete this line, the director and the amount are deleted in the template (which is correct), but also in the general company information. This should be avoided of course, but how…
I’ve tried already to but the period directors into another variable through using assign and displaying that variable, but still it deletes the director in the general company information if you delete it in the template. So currently I’m looping over the active directors and I put the active directors into another variable, but it doesn’t help.
Can someone help me out?

Thanks! :slight_smile:

Hi @JelleBe ,

I’m wondering what exactly you mean by ‘If I use the directors of the current period in combination with a mapped account’. Can you show me this codewise?

In Silverfin, however, it’s always the case that if you click the bin for a certain field of an iteration in your collection (for example the name of a director in your people collection ), that iteration (=director) will be removed.

Kind regards,

Michiel

Hi Michiel

Thank you for your answer.
This is the code we currently use for it:
{% stripnewlines %}
| {% ifi show_bez_bl or show_extra_bez_bl %}| | Vergoeding{% endifi %}{% ifi show_vaa_bl or show_extra_vaa_bl %}| | Voordelen alle aard {% endifi %}
{% newline %}
|:------------------------------------|----10%—|-------:|----10%—|-----------:
{% for zaakvoerder in period.directors %}

{% unless zaakvoerder.director_end_date != blank and zaakvoerder.director_end_date < period.year_start_date %}

{% comment %}it is the db var “represented_by_name” that decides if a person is legal or not - needed for default dropdown LEGAL OR NOT{% endcomment %}
{% assign default_type = “” %}
{% if zaakvoerder.custom.represented_by_name != blank %}
{% assign default_type = “legal” %}
{% else %}
{% assign default_type = “nature” %}
{% endif %}
{% comment %}look at the dropdown to check whether someone is LEGAL or not{% endcomment %}
{% assign type = zaakvoerder.custom.type | default:default_type %}

{% assign current_director = “” %}
{% assign words = zaakvoerder.name | split: ’ ’ %}
{% assign lastname = “” %}
{% assign person_first_name = “” %}
{% 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 %}
{% if type == “legal” %}
{% assign current_director = zaakvoerder.name %}
{% else %}
{% if zaakvoerder.custom.first_name == blank and zaakvoerder.custom.last_name == blank %}
{% assign current_director = zaakvoerder.name %}
{% elsif zaakvoerder.custom.first_name == blank and zaakvoerder.custom.last_name != blank %}
{% assign current_director = current_director | append:person_first_name | append:" " | append:zaakvoerder.custom.last_name %}
{% elsif zaakvoerder.custom.first_name != blank and zaakvoerder.custom.last_name == blank %}
{% assign current_director = current_director | append:zaakvoerder.custom.first_name | append:" " | append:lastname %}
{% else %}
{% assign current_director = current_director | append:zaakvoerder.custom.first_name | append:" " | append:zaakvoerder.custom.last_name %}
{% endif %}
{% endif %}
{% if type == “legal” %}
{% case zaakvoerder.custom.company_form %}
{% when 1 %}{% assign legal_type = ‘SCE’ %}
{% when 2 %}{% assign legal_type = ‘OFP’ %}
{% when 6 %}{% assign legal_type = ‘CVOA’ %}
{% when 8 %}{% assign legal_type = ‘CVBA’ %}
{% when 11 %}{% assign legal_type = ‘VOF’ %}
{% when 12 %}{% assign legal_type = ‘CV’ %}
{% when 13 %}{% assign legal_type = ‘COMMVA’ %}
{% when 14 %}{% assign legal_type = ‘NV’ %}
{% when 15 %}{% assign legal_type = ‘BVBA’ %}
{% when 21 %}{% assign legal_type = ‘OVM’ %}
{% when 17 %}{% assign legal_type = ‘VZW’ %}
{% when 27 %}{% assign legal_type = ‘SE’ %}
{% when 18 %}{% assign legal_type = ‘ION’ %}
{% when 30 %}{% assign legal_type = ‘Buitenlandse onderneming’ %}
{% when 60 %}{% assign legal_type = ‘ESV’ %}
{% when 23 %}{% assign legal_type = ‘Buitenlandse privaatrechtelijke vereniging met vestiging, agentschappen, kantoor of bijhuis in België’ %}
{% when 65 %}{% assign legal_type = ‘EESV’ %}
{% when 26 %}{% assign legal_type = ‘PRIV ST’ %}
{% when 265 %}{% assign legal_type = ‘Europees economisch samenwerkingsverband zonder zetel met vestiging in België’ %}
{% when 506 %}{% assign legal_type = ‘CVOA SO’ %}
{% when 29 %}{% assign legal_type = ‘SON’ %}
{% when 508 %}{% assign legal_type = ‘CVBA SO’ %}
{% when 511 %}{% assign legal_type = ‘VOF SO’ %}
{% when 512 %}{% assign legal_type = ‘GCV SO’ %}
{% when 513 %}{% assign legal_type = ‘CVA SO’ %}
{% when 121 %}{% assign legal_type = ‘Onderlinge verzekeringsmaatschappij, van publiek recht’ %}
{% when 514 %}{% assign legal_type = ‘NV SO’ %}
{% when 125 %}{% assign legal_type = ‘IVZW’ %}
{% when 510 %}{% assign legal_type = ‘BVBA SO’ %}
{% when 560 %}{% assign legal_type = ‘ESV SO’ %}
{% endcase %}
{% assign current_director = current_director %}
{% endif %}
{% assign bez_waarde = period.accounts | range:zaakvoerder.custom.bezoldiging_range %}
{% assign zaakvoerder_bezoldiging_check = zaakvoerder.custom.bezoldiging | default:bez_waarde %}
{% assign vaa_waarde = period.accounts | range:zaakvoerder.custom.vaa_range %}
{% assign zaakvoerder_vaa_check = zaakvoerder.custom.vaa | default:vaa_waarde %}
{% ifi zaakvoerder_vaa_check != 0 or zaakvoerder_bezoldiging_check != 0 %}
{% newline %}
| {{ current_director }}    
{% ifi zaakvoerder_bezoldiging_check != 0 %}
| {% input zaakvoerder.custom.bezoldiging_range as:account_collection range:618,62,74 accounts_var:bez %}{% rollforward nil zaakvoerder.custom.bezoldiging_range %}
{% assign abs_bez = bez.6-bez.7 %}
| {% input zaakvoerder.custom.bezoldiging default:abs_bez as:currency %}{% rollforward nil zaakvoerder.custom.bezoldiging %}
{% else %}
||
{% endifi %}
{% ifi zaakvoerder_vaa_check != 0 %}
| {% input zaakvoerder.custom.vaa_range as:account_collection range:74,618 accounts_var:vaa %}{% rollforward nil zaakvoerder.custom.vaa_range %}
{% assign abs_vaa = vaa.6-vaa.7 %}
|{% input zaakvoerder.custom.vaa default:abs_vaa as:currency %}{% rollforward nil zaakvoerder.custom.vaa %}
{% else %}
||
{% endifi %}
{% endifi %}
{% endunless %}
{% endfor %}
{% fori bezoldiging in period.custom.extra_bezoldiging %}
{% assign bez_waarde_extra = period.accounts | range:bezoldiging.bezoldinging_range %}
{% assign zaakvoerder_bezoldiging_check_extra = bezoldiging.bedrag | default:bez_waarde_extra %}
{% assign vaa_waarde_extra = period.accounts | range:bezoldiging.accounts %}
{% assign zaakvoerder_vaa_check_extra = bezoldiging.vaa_extra | default:vaa_waarde_extra %}
{% ifi zaakvoerder_bezoldiging_check_extra != 0 or zaakvoerder_vaa_check_extra != 0 %}
{% newline %}
| {% input bezoldiging.name %}{% rollforward nil bezoldiging.name %}
{% ifi zaakvoerder_bezoldiging_check_extra != 0 %}
| {% input bezoldiging.bezoldinging_range as:account_collection range:618,62,74 accounts_var:bez_bez %}{% rollforward nil bezoldiging.bezoldinging_range %}
{% assign abs_bez_bez = bez_bez.6-bez_bez.7 %}
| {% input bezoldiging.bedrag default:abs_bez_bez as:currency %}{% rollforward nil bezoldiging.bedrag %}
{% else %}
||
{% endifi %}
{% ifi zaakvoerder_vaa_check_extra != 0 %}
| {% input bezoldiging.accounts as:account_collection range:74,618 accounts_var:extra_vaa %}{% rollforward nil bezoldiging.accounts %}
{% assign abs_extra_vaa = extra_vaa.6-extra_vaa.7 %}
|{% input bezoldiging.vaa_extra default:abs_extra_vaa as:currency %}{% rollforward nil bezoldiging.vaa_extra %}
{% else %}
||
{% endifi %}
{% endifi %}
{% endfori %}
{% endstripnewlines %}

image

This is quiet a lot. But It thought if I do a loop over the directors and place them into another variable in this template, that I can delete the information without deleting the directors in the general company info. Isn’t this possible?

Thanks in advance.

Hi @JelleBe ,

Please keep in mind we have some standards available on how to post your code on the community.

A solution to your problem is to create a custom variable that is using the persistent id of a person as a variable part in the name. The persistent id of a person in the people drop remains the same over time (unlike the person.id which changes over time and therefor might lead to rollforwarding issues).

The advantage of this solution is that each director will have a variable that is uniquely linked to him/her but it will not remove the director from the people collection when the renumeration variable is cleared!

{% for director in period.directors %}
  | {{ director.name }}
  {% capture person_id %}person_{{ director.persistent_id }}{% endcapture %}
  | {% input custom.[person_id].renumeration %}
{% endfor %}

Kind regards,
Michiel

Thanks Michiel for the tips & tricks.

We will have to revise the code and try it with yours. Thanks.

Kind regards
Jelle