[%# Parameter no_html - if 1, the html tags are NOT generated %]
[%- IF no_html %]
[%- span_start = '' %]
[%- span_end = '' %]
[%- ELSE %]
[%- span_start = '' %]
[%- span_end = '' %]
[%- END %]
[%- IF ( borrower.borrowernumber ) %]
[%- IF borrower.category_type == 'I' %]
[%- borrower.surname | html %] [% IF borrower.othernames %] ([% borrower.othernames | html %]) [% END %]
[%- ELSE %]
[%- IF invert_name %]
[%- IF borrower.title %][% span_start %][%- borrower.title | html %][% span_end %] [% END %][%- borrower.surname | html %], [% borrower.firstname | html %] [% IF borrower.othernames %] ([% borrower.othernames | html %]) [% END %]
[%- ELSE %]
[%- IF borrower.title %][% span_start %][%- borrower.title | html %][% span_end %] [% END %][%- borrower.firstname | html %] [% IF borrower.othernames %] ([% borrower.othernames | html %]) [% END %] [% borrower.surname | html %]
[%- END -%]
[%- END -%]
[%- IF ( borrower.cardnumber ) -%]
([% borrower.cardnumber | html %])
[%- END %]
[%- ELSIF ( borrowernumber ) %]
[%- IF category_type == 'I' %]
[%- surname | html %] [% IF othernames %] ([% othernames | html %]) [% END %]
[%- ELSE %]
[%- IF invert_name %]
[%- IF title %][% span_start %][%- title | html %][% span_end %] [% END %][%- surname | html %], [% firstname | html %] [% IF othernames %] ([% othernames | html %]) [% END %]
[%- ELSE %]
[%- IF title %][% span_start %][%- title | html %][% span_end %] [% END %][%- firstname | html %] [% IF othernames %] ([% othernames | html %]) [% END %] [% surname | html %]
[%- END %]
[%- END -%]
[%- IF ( cardnumber ) -%]
([% cardnumber | html %])
[%- END %]
[%- END -%]