Skip to content

Commit 9c0ca2b

Browse files
authored
Null-checks toevoegen in vcf-twig (#1255)
1 parent e260c30 commit 9c0ca2b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

templates/profiel/vcard.ical.twig

+10-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ BEGIN:VCARD
22
VERSION:4.0
33
FN;CHARSET=UTF-8:{{ profiel.getNaam('volledig') }}
44
N;CHARSET=UTF-8:{{ (profiel.tussenvoegsel ? profiel.tussenvoegsel ~ ' ' : '') ~ profiel.achternaam }};{{ profiel.voornaam }};;;
5-
{% if profiel | is_zichtbaar('nickname') -%}
5+
{% if profiel | is_zichtbaar('nickname') and profiel.nickname is defined and profiel.nickname is not null -%}
66
NICKNAME;CHARSET=UTF-8:{{ profiel.nickname }}
77
{% endif %}
88
{% if profiel|is_zichtbaar('geslacht') -%}
@@ -12,19 +12,23 @@ UID;CHARSET=UTF-8:{{ profiel.uid }}
1212
{% if profiel|is_zichtbaar('gebdatum') -%}
1313
BDAY:{{ profiel.gebdatum | date('Ymd') }}
1414
{% endif %}
15-
{% if profiel|is_zichtbaar('email') -%}
15+
{% if profiel|is_zichtbaar('email') and profiel.email is defined and profiel.email is not null -%}
1616
EMAIL;CHARSET=UTF-8;type=HOME,INTERNET:{{ profiel.email }}
1717
{% endif %}
18-
{% if profiel|is_zichtbaar('profielfoto', 'intern') -%}
18+
{% if profiel|is_zichtbaar('profielfoto', 'intern') and profiel.pasfotoInternalPath is defined and profiel.pasfotoInternalPath is not null -%}
1919
PHOTO;ENCODING=BASE64;TYPE=JPEG:{{ profiel.pasfotoInternalPath | file_base64 }}
2020
{% endif %}
21-
{% if profiel|is_zichtbaar('mobiel') -%}
21+
{% if profiel|is_zichtbaar('mobiel') and profiel.mobiel is defined and profiel.mobiel is not null -%}
2222
TEL;TYPE=CELL:{{ profiel.mobiel }}
2323
{% endif %}
24-
{% if profiel|is_zichtbaar('telefoon') -%}
24+
{% if profiel|is_zichtbaar('telefoon') and profiel.telefoon is defined and profiel.telefoon is not null -%}
2525
TEL;TYPE=HOME,VOICE:{{ profiel.telefoon }}
2626
{% endif %}
27-
{% if profiel|is_zichtbaar(['adres', 'woonplaats', 'postcode', 'land']) -%}
27+
{% if profiel|is_zichtbaar(['adres', 'woonplaats', 'postcode', 'land'])
28+
and profiel.adres is defined and profiel.adres is not null
29+
and profiel.woonplaats is defined and profiel.woonplaats is not null
30+
and profiel.postcode is defined and profiel.postcode is not null
31+
and profiel.land is defined and profiel.land is not null -%}
2832
ADR;CHARSET=UTF-8;TYPE=HOME:;;{{ profiel.adres }};{{ profiel.woonplaats }};;{{ profiel.postcode }};{{ profiel.land }}
2933
{% endif %}
3034
REV:{{ date().format('c') }}

0 commit comments

Comments
 (0)