Owen Leonard
d2f136713e
This patch adds a check for the existence of "firstname" to patron-title.inc so that if the patron has no firstname the "invert name" setting doesn't cause an unnecessary comma to appear. To test, apply the patch and locate or create a patron with no first name. - When checking out to the patron, examine the page title. It should say "Checking out to <lastname> (<cardnumber>). - When checking out to a patron with first and last name it should show as before, "Checking out to <lastname>, <firstname> (<cardnumber) Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
78 lines
3.6 KiB
PHP
78 lines
3.6 KiB
PHP
[%- USE raw -%]
|
|
[%- USE Koha -%]
|
|
[%- USE Branches -%]
|
|
[%- SET data = {} -%]
|
|
[%- IF patron -%]
|
|
[%- SET data.category_type = patron.category.category_type -%]
|
|
[%- SET data.surname = patron.surname -%]
|
|
[%- SET data.othernames = patron.othernames -%]
|
|
[%- SET data.firstname = patron.firstname -%]
|
|
[%- SET data.cardnumber = patron.cardnumber -%]
|
|
[%- SET data.borrowernumber = patron.borrowernumber -%]
|
|
[%- SET data.title = patron.title -%]
|
|
[%- ELSIF ( borrower.borrowernumber ) -%]
|
|
[%- SET data.category_type = borrower.category_type -%]
|
|
[%- SET data.surname = borrower.surname -%]
|
|
[%- SET data.othernames = borrower.othernames -%]
|
|
[%- SET data.firstname = borrower.firstname -%]
|
|
[%- SET data.cardnumber = borrower.cardnumber -%]
|
|
[%- SET data.borrowernumber = borrower.borrowernumber -%]
|
|
[%- SET data.title = borrower.title -%]
|
|
[%- ELSIF ( borrowernumber ) -%]
|
|
[%- SET data.category_type = category_type -%]
|
|
[%- SET data.surname = surname -%]
|
|
[%- SET data.othernames = othernames -%]
|
|
[%- SET data.firstname = firstname -%]
|
|
[%- SET data.cardnumber = cardnumber -%]
|
|
[%- SET data.borrowernumber = borrowernumber -%]
|
|
[%- SET data.title = title -%]
|
|
[%- END -%]
|
|
[%# Parameter no_html - if 1, the html tags are NOT generated %]
|
|
[%- IF no_title %][% SET data.title = "" %][% END -%]
|
|
[%- IF data.title %]
|
|
[%- IF no_html %]
|
|
[%- span_start = '' %]
|
|
[%- span_end = '' %]
|
|
[%- ELSE %]
|
|
[%- span_start = '<span class="patron-title">' %]
|
|
[%- span_end = '</span>' %]
|
|
[%- END %]
|
|
[% data.title = data.title | html %]
|
|
[%- SET data.title = span_start _ data.title _ span_end _ ' ' -%]
|
|
[%- END -%]
|
|
[%- SET display_patron_name = 1 -%]
|
|
[%- SET display_cardnumber = 1 -%]
|
|
[%- IF hide_patron_infos_if_needed %] [%# Should only be set if patron is set -%]
|
|
[%- SET can_see_patron_infos = logged_in_user.can_see_patron_infos( patron ) -%]
|
|
[%- UNLESS can_see_patron_infos -%]
|
|
[%- SET display_patron_name = 0 -%]
|
|
[%- SET display_cardnumber = 0 -%]
|
|
[%- ELSIF Koha.Preference('HidePatronName') -%]
|
|
[%- SET display_patron_name = 0 -%]
|
|
[%- END -%]
|
|
[%- END -%]
|
|
[%- IF hide_patron_infos_if_needed AND ( display_patron_name OR display_cardnumber ) -%]
|
|
[%- IF link_to == 'circulation_reserves' %]<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% data.borrowernumber | uri %]#reserves">
|
|
[%- ELSE %]<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% data.borrowernumber | uri %]">
|
|
[%- END -%]
|
|
[%- END -%]
|
|
[%- IF display_patron_name -%]
|
|
[%- IF data.category_type == 'I' -%]
|
|
[%- data.surname | html %] [% IF data.othernames %] ([% data.othernames | html %])[% END -%]
|
|
[%- ELSIF invert_name -%]
|
|
[% data.title | $raw %][%- data.surname | html %][% IF ( data.firstname ) %], [% data.firstname | html %][% END %][% IF data.othernames %] ([% data.othernames | html %]) [% END -%]
|
|
[%- ELSE -%]
|
|
[% data.title | $raw %][%- data.firstname | html %] [% IF data.othernames %] ([% data.othernames | html %]) [% END %] [% data.surname | html -%]
|
|
[%- END -%]
|
|
[%- IF display_cardnumber AND data.cardnumber %] ([% data.cardnumber | html %])[% END -%]
|
|
[%- ELSIF display_cardnumber -%]
|
|
[%- IF data.cardnumber -%][%# FIXME Cardnumber should always be defined, right? -%]
|
|
[%- data.cardnumber | html -%]
|
|
[%- END -%]
|
|
[%- ELSE -%]
|
|
A patron from library [% Branches.GetName( patron.branchcode ) | html -%]
|
|
[%- END -%]
|
|
|
|
[%- IF hide_patron_infos_if_needed AND ( display_patron_name OR display_cardnumber ) -%]
|
|
</a>
|
|
[%- END -%]
|