View | Details | Raw Unified | Return to bug 28633
Collapse All | Expand All

(-)a/Koha/Database/Columns.pm (+1 lines)
Lines 174-179 sub columns { Link Here
174
            "password"                    => __("Password"),
174
            "password"                    => __("Password"),
175
            "phone"                       => __("Primary phone"),
175
            "phone"                       => __("Primary phone"),
176
            "phonepro"                    => __("Secondary phone"),
176
            "phonepro"                    => __("Secondary phone"),
177
            "preferred_name"              => __("Preferred_name"),
177
            "primary_contact_method"      => __("Primary contact method"),
178
            "primary_contact_method"      => __("Primary contact method"),
178
            "privacy_guarantor_checkouts" => __("Show checkouts to guarantor"),
179
            "privacy_guarantor_checkouts" => __("Show checkouts to guarantor"),
179
            "privacy_guarantor_fines"     => __("Show fines to guarantor"),
180
            "privacy_guarantor_fines"     => __("Show fines to guarantor"),
(-)a/Koha/Patron.pm (+13 lines)
Lines 117-122 sub new { Link Here
117
    return $class->SUPER::new($params);
117
    return $class->SUPER::new($params);
118
}
118
}
119
119
120
=head3 effective_name
121
122
Return the preferred name for a patron, or their firstname if no
123
preferred name is set
124
125
=cut
126
127
sub effective_name {
128
    my ($self) = @_;
129
130
    return $self->preferred_name || $self->firstname;
131
}
132
120
=head3 fixup_cardnumber
133
=head3 fixup_cardnumber
121
134
122
Autogenerate next cardnumber from highest value found in database
135
Autogenerate next cardnumber from highest value found in database
(-)a/api/v1/swagger/paths/patrons.yaml (+5 lines)
Lines 29-34 Link Here
29
        description: Case insensitive search on firstname
29
        description: Case insensitive search on firstname
30
        required: false
30
        required: false
31
        type: string
31
        type: string
32
      - name: preferred_name
33
        in: query
34
        description: Case insensitive search on preferred name
35
        required: false
36
        type: string
32
      - name: title
37
      - name: title
33
        in: query
38
        in: query
34
        description: Case insensitive search on title
39
        description: Case insensitive search on title
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc (-2 / +4 lines)
Lines 20-26 Link Here
20
20
21
            var name;
21
            var name;
22
            var firstname   = escape_str(patron.firstname);
22
            var firstname   = escape_str(patron.firstname);
23
            var preferred_name = escape_str(patron.preferred_name);
23
            var surname     = escape_str(patron.surname);
24
            var surname     = escape_str(patron.surname);
25
            var effective_name = preferred_name || firstname;
24
26
25
            if ( patron.middle_name != null && patron.middle_name != '' ) {
27
            if ( patron.middle_name != null && patron.middle_name != '' ) {
26
                firstname += ' ' + escape_str(patron.middle_name);
28
                firstname += ' ' + escape_str(patron.middle_name);
Lines 30-39 Link Here
30
                firstname += ' (' + escape_str(patron.other_name) + ')';
32
                firstname += ' (' + escape_str(patron.other_name) + ')';
31
            }
33
            }
32
            if ( config && config.invert_name ) {
34
            if ( config && config.invert_name ) {
33
                name = surname + ( firstname ? ', ' + firstname : '' );
35
                name = surname + ( effective_name ? ', ' + effective_name : '' );
34
            }
36
            }
35
            else {
37
            else {
36
                name = firstname + ' ' + surname;
38
                name = effective_name + ' ' + surname;
37
            }
39
            }
38
40
39
            if ( name.replace(' ', '').length == 0 ) {
41
            if ( name.replace(' ', '').length == 0 ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (-2 / +2 lines)
Lines 493-499 Link Here
493
                            }
493
                            }
494
                            [% CASE 'name-address' %]
494
                            [% CASE 'name-address' %]
495
                            {
495
                            {
496
                                "data": "me.surname:me.firstname:me.middle_name:me.othernames:me.street_number:me.address:me.address2:me.city:me.state:me.postal_code:me.country",
496
                                "data": "me.surname:me.preferred_name:me.firstname:me.middle_name:me.othernames:me.street_number:me.address:me.address2:me.city:me.state:me.postal_code:me.country",
497
                                "searchable": true,
497
                                "searchable": true,
498
                                "orderable": true,
498
                                "orderable": true,
499
                                "render": function( data, type, row, meta ) {
499
                                "render": function( data, type, row, meta ) {
Lines 518-524 Link Here
518
                            }
518
                            }
519
                            [% CASE 'name' %]
519
                            [% CASE 'name' %]
520
                            {
520
                            {
521
                                "data": "me.surname:me.firstname:me.middle_name:me.othernames",
521
                                "data": "me.surname:me.preferred_name:me.firstname:me.middle_name:me.othernames",
522
                                "searchable": true,
522
                                "searchable": true,
523
                                "orderable": true,
523
                                "orderable": true,
524
                                "render": function( data, type, row, meta ) {
524
                                "render": function( data, type, row, meta ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc (-2 / +11 lines)
Lines 7-12 Link Here
7
    [%- SET data.surname        = patron.surname -%]
7
    [%- SET data.surname        = patron.surname -%]
8
    [%- SET data.othernames     = patron.othernames -%]
8
    [%- SET data.othernames     = patron.othernames -%]
9
    [%- SET data.firstname      = patron.firstname -%]
9
    [%- SET data.firstname      = patron.firstname -%]
10
    [%- SET data.preferred_name = patron.preferred_name -%]
11
    [%- SET data.effective_name = patron.effective_name -%]
10
    [%- SET data.middle_name    = patron.middle_name -%]
12
    [%- SET data.middle_name    = patron.middle_name -%]
11
    [%- SET data.cardnumber     = patron.cardnumber -%]
13
    [%- SET data.cardnumber     = patron.cardnumber -%]
12
    [%- SET data.borrowernumber = patron.borrowernumber -%]
14
    [%- SET data.borrowernumber = patron.borrowernumber -%]
Lines 16-21 Link Here
16
    [%- SET data.surname        = borrower.surname -%]
18
    [%- SET data.surname        = borrower.surname -%]
17
    [%- SET data.othernames     = borrower.othernames -%]
19
    [%- SET data.othernames     = borrower.othernames -%]
18
    [%- SET data.firstname      = borrower.firstname -%]
20
    [%- SET data.firstname      = borrower.firstname -%]
21
    [%- SET data.preferred_name = borrower.preferred_name -%]
22
    [%- SET data.effective_name = borrower.effective_name -%]
19
    [%- SET data.middle_name    = borrower.middle_name -%]
23
    [%- SET data.middle_name    = borrower.middle_name -%]
20
    [%- SET data.cardnumber     = borrower.cardnumber -%]
24
    [%- SET data.cardnumber     = borrower.cardnumber -%]
21
    [%- SET data.borrowernumber = borrower.borrowernumber -%]
25
    [%- SET data.borrowernumber = borrower.borrowernumber -%]
Lines 25-35 Link Here
25
    [%- SET data.surname        = surname -%]
29
    [%- SET data.surname        = surname -%]
26
    [%- SET data.othernames     = othernames -%]
30
    [%- SET data.othernames     = othernames -%]
27
    [%- SET data.firstname      = firstname -%]
31
    [%- SET data.firstname      = firstname -%]
32
    [%- SET data.preferred_name = preferred_name -%]
33
    [%- SET data.effective_name = effective_name -%]
28
    [%- SET data.middle_name    = middle_name -%]
34
    [%- SET data.middle_name    = middle_name -%]
29
    [%- SET data.cardnumber     = cardnumber -%]
35
    [%- SET data.cardnumber     = cardnumber -%]
30
    [%- SET data.borrowernumber = borrowernumber -%]
36
    [%- SET data.borrowernumber = borrowernumber -%]
31
    [%- SET data.title          = title -%]
37
    [%- SET data.title          = title -%]
32
[%- END -%]
38
[%- END -%]
39
[%- UNLESS data.effective_name -%]
40
    [%- SET data.effective_name = data.preferred_name || data.firstname -%]
41
[%- END -%]
33
[%# Parameter no_html - if 1, the html tags are NOT generated -%]
42
[%# Parameter no_html - if 1, the html tags are NOT generated -%]
34
[%- IF no_title -%][%- SET data.title = "" -%][%- END -%]
43
[%- IF no_title -%][%- SET data.title = "" -%][%- END -%]
35
[%- IF data.title -%]
44
[%- IF data.title -%]
Lines 66-74 Link Here
66
    [%- IF data.category_type == 'I' -%]
75
    [%- IF data.category_type == 'I' -%]
67
        [%- data.surname | html -%] [%- IF data.othernames -%] ([%- data.othernames | html -%])[%- END -%]
76
        [%- data.surname | html -%] [%- IF data.othernames -%] ([%- data.othernames | html -%])[%- END -%]
68
    [%- ELSIF invert_name -%]
77
    [%- ELSIF invert_name -%]
69
        [%- data.title | $raw -%][%- data.surname | html -%][%- IF ( data.firstname ) -%], [% data.firstname | html -%][%- END -%][%- IF data.middle_name -%] [% data.middle_name | html -%][%- END -%][%- IF data.othernames -%] ([%- data.othernames | html -%])[%- END -%]
78
        [%- data.title | $raw -%][%- data.surname | html -%][%- IF ( data.effective_name ) -%], [% data.effective_name | html -%][%- END -%][%- IF data.middle_name -%] [% data.middle_name | html -%][%- END -%][%- IF data.othernames -%] ([%- data.othernames | html -%])[%- END -%]
70
    [%- ELSE -%]
79
    [%- ELSE -%]
71
        [%- data.title | $raw -%][%- data.firstname | html %][%- IF data.middle_name -%] [% data.middle_name | html -%][%- END -%][%- IF data.othernames -%] ([%- data.othernames | html -%]) [%- END -%] [% data.surname | html -%]
80
        [%- data.title | $raw -%][%- data.effective_name | html %][%- IF data.middle_name -%] [% data.middle_name | html -%][%- END -%][%- IF data.othernames -%] ([%- data.othernames | html -%]) [%- END -%] [% data.surname | html -%]
72
    [%- END -%]
81
    [%- END -%]
73
    [%- IF display_cardnumber AND data.cardnumber -%] ([%- data.cardnumber | html -%])[%- END -%]
82
    [%- IF display_cardnumber AND data.cardnumber -%] ([%- data.cardnumber | html -%])[%- END -%]
74
[%- ELSIF display_cardnumber -%]
83
[%- ELSIF display_cardnumber -%]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc (-1 / +2 lines)
Lines 8-13 Link Here
8
    [%- CASE 'cardnumber' -%][% t("Card number") | html %]
8
    [%- CASE 'cardnumber' -%][% t("Card number") | html %]
9
    [%- CASE 'surname' -%][% t("Surname") | html %]
9
    [%- CASE 'surname' -%][% t("Surname") | html %]
10
    [%- CASE 'firstname' -%][% t("First name") | html %]
10
    [%- CASE 'firstname' -%][% t("First name") | html %]
11
    [%- CASE 'preferred_name' -%][% t("Preferred name") | html %]
11
    [%- CASE 'middle_name' -%][% t("Middle name") | html %]
12
    [%- CASE 'middle_name' -%][% t("Middle name") | html %]
12
    [%- CASE 'title' -%][% t("Salutation") | html %]
13
    [%- CASE 'title' -%][% t("Salutation") | html %]
13
    [%- CASE 'othernames' -%][% t("Other name") | html %]
14
    [%- CASE 'othernames' -%][% t("Other name") | html %]
Lines 86-92 Link Here
86
        <label for="searchfieldstype_filter">Search field:</label>
87
        <label for="searchfieldstype_filter">Search field:</label>
87
        <select name="searchfieldstype" class="searchfieldstype_filter">
88
        <select name="searchfieldstype" class="searchfieldstype_filter">
88
    [% END %]
89
    [% END %]
89
        [% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' %]
90
        [% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname|preferred_name|middle_name|surname|othernames|cardnumber|userid' %]
90
        [%# Above is needed for adding fields from the DefaultPatronSearchFields preference to the dropdowns %]
91
        [%# Above is needed for adding fields from the DefaultPatronSearchFields preference to the dropdowns %]
91
        [% default_fields = [ 'standard', 'surname', 'cardnumber', 'all_emails', 'borrowernumber', 'userid', 'all_phones', 'full_address', 'dateofbirth', 'sort1', 'sort2' ] %]
92
        [% default_fields = [ 'standard', 'surname', 'cardnumber', 'all_emails', 'borrowernumber', 'userid', 'all_phones', 'full_address', 'dateofbirth', 'sort1', 'sort2' ] %]
92
        [% search_options = default_fields.merge(standard.split('\|')).unique %]
93
        [% search_options = default_fields.merge(standard.split('\|')).unique %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +1 lines)
Lines 67-73 Patrons: Link Here
67
           type: modalselect
67
           type: modalselect
68
           source: borrowers
68
           source: borrowers
69
           exclusions: anonymized|auth_method|autorenew_checkouts|date_renewed|dateenrolled|dateexpiry|lang|lastseen|login_attempts|overdrive_auth_token|password|password_expiration_date|primary_contact_method|gonenoaddress|lost|debarred|debarredcomment|branchcode|categorycode|flags|guarantorid|relationship|privacy|privacy_guarantor_checkouts|privacy_guarantor_fines|pronouns|secret|sms_provider_id|updated_on|checkprevcheckout
69
           exclusions: anonymized|auth_method|autorenew_checkouts|date_renewed|dateenrolled|dateexpiry|lang|lastseen|login_attempts|overdrive_auth_token|password|password_expiration_date|primary_contact_method|gonenoaddress|lost|debarred|debarredcomment|branchcode|categorycode|flags|guarantorid|relationship|privacy|privacy_guarantor_checkouts|privacy_guarantor_fines|pronouns|secret|sms_provider_id|updated_on|checkprevcheckout
70
         - "If empty Koha will default to \"firstname|middle_name|surname|othernames|cardnumber|userid\". Additional fields added to this preference will be added as search options in the dropdown menu on the patron search page."
70
         - "If empty Koha will default to \"firstname|preferred_name|middle_name|surname|othernames|cardnumber|userid\". Additional fields added to this preference will be added as search options in the dropdown menu on the patron search page."
71
     -
71
     -
72
         - pref: DefaultPatronSearchMethod
72
         - pref: DefaultPatronSearchMethod
73
           choices:
73
           choices:
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +16 lines)
Lines 290-296 legend.collapsed i.fa.fa-caret-down::before { Link Here
290
                            [% END %]
290
                            [% END %]
291
291
292
                            [% IF ( step_1 ) %]
292
                            [% IF ( step_1 ) %]
293
                                [% UNLESS notitle && nosurname && nofirstname && nomiddle_name && nodateofbirth && noinitials && noothernames &&nosex && nopronouns %]
293
                                [% UNLESS notitle && nosurname && nofirstname && nopreferred_name && nomiddle_name && nodateofbirth && noinitials && noothernames &&nosex && nopronouns %]
294
                                    <fieldset class="rows" id="memberentry_identity">
294
                                    <fieldset class="rows" id="memberentry_identity">
295
                                        <legend class="expanded" id="identity_lgd">
295
                                        <legend class="expanded" id="identity_lgd">
296
                                            <i class="fa fa-caret-down" title="Collapse this section"></i>
296
                                            <i class="fa fa-caret-down" title="Collapse this section"></i>
Lines 367-372 legend.collapsed i.fa.fa-caret-down::before { Link Here
367
                                                        [% END %]
367
                                                        [% END %]
368
                                                    </li>
368
                                                    </li>
369
                                                [% END #/UNLESS nofirstname %]
369
                                                [% END #/UNLESS nofirstname %]
370
                                                [% UNLESS nopreferred_name %]
371
                                                    <li>
372
                                                        [% IF ( mandatorypreferred_name ) %]
373
                                                            <label for="preferred_name" class="required">
374
                                                        [% ELSE %]
375
                                                            <label for="preferred_name">
376
                                                        [% END %]
377
                                                            Preferred name:
378
                                                        </label>
379
                                                        <input type="text" id="preferred_name" name="preferred_name" size="20"  value="[% borrower_data.preferred_name | html UNLESS opduplicate %]" />
380
                                                        [% IF ( mandatorypreferred_name ) %]
381
                                                            <span class="required">Required</span>
382
                                                        [% END %]
383
                                                    </li>
384
                                                [% END #/UNLESS nopreferred_name %]
370
                                                [% UNLESS nomiddle_name %]
385
                                                [% UNLESS nomiddle_name %]
371
                                                    <li>
386
                                                    <li>
372
                                                        [% IF ( mandatorymiddle_name ) %]
387
                                                        [% IF ( mandatorymiddle_name ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt (+1 lines)
Lines 25-30 Link Here
25
[% CASE 'branchcode'          %]<span>Home library (branchcode)</span>
25
[% CASE 'branchcode'          %]<span>Home library (branchcode)</span>
26
[% CASE 'surname'             %]<span>Surname</span>
26
[% CASE 'surname'             %]<span>Surname</span>
27
[% CASE 'firstname'           %]<span>First name</span>
27
[% CASE 'firstname'           %]<span>First name</span>
28
[% CASE 'preferred_name'      %]<span>Preferred name</span>
28
[% CASE 'middle_name'         %]<span>Middle name</span>
29
[% CASE 'middle_name'         %]<span>Middle name</span>
29
[% CASE 'title'               %]<span>Title</span>
30
[% CASE 'title'               %]<span>Title</span>
30
[% CASE 'othernames'          %]<span>Other names</span>
31
[% CASE 'othernames'          %]<span>Other names</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-2 / +8 lines)
Lines 135-140 Link Here
135
135
136
                                <div class="rows">
136
                                <div class="rows">
137
                                    <ol>
137
                                    <ol>
138
                                        [% IF ( patron.preferred_name && patron.firstname ) %]
139
                                            <li id="patron_first_name">
140
                                                <span class="label patron_first_name">First name: </span>
141
                                                [% patron.firstname | html %]
142
                                            </li>
143
                                        [% END %]
138
                                        [% IF ( patron.phone ) %]
144
                                        [% IF ( patron.phone ) %]
139
                                            <li>
145
                                            <li>
140
                                                <span class="label">Primary phone: </span>
146
                                                <span class="label">Primary phone: </span>
Lines 225-231 Link Here
225
                                                        [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
231
                                                        [% IF logged_in_user.can_see_patron_infos( guarantee ) %]
226
                                                            <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber | uri %]">[% guarantee.firstname | html %] [% guarantee.surname | html %]</a></li>
232
                                                            <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantee.borrowernumber | uri %]">[% guarantee.firstname | html %] [% guarantee.surname | html %]</a></li>
227
                                                        [% ELSE %]
233
                                                        [% ELSE %]
228
                                                            <li>[% guarantee.firstname | html %] [% guarantee.surname | html %]</li>
234
                                                            <li>[% guarantee.effective_name | html %] [% guarantee.surname | html %]</li>
229
                                                        [% END %]
235
                                                        [% END %]
230
                                                    [% END %]
236
                                                    [% END %]
231
                                                </ul>
237
                                                </ul>
Lines 241-247 Link Here
241
                                                    [% FOREACH gr IN guarantor_relationships %]
247
                                                    [% FOREACH gr IN guarantor_relationships %]
242
                                                        [% SET guarantor = gr.guarantor %]
248
                                                        [% SET guarantor = gr.guarantor %]
243
                                                        [% IF logged_in_user.can_see_patron_infos( guarantor ) %]
249
                                                        [% IF logged_in_user.can_see_patron_infos( guarantor ) %]
244
                                                            <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.id | uri %]">[% guarantor.firstname | html %] [% guarantor.surname | html %][% IF gr.relationship %] ([% gr.relationship | html %])[% END %]</a></li>
250
                                                            <li><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% guarantor.id | uri %]">[% guarantor.effective_name | html %] [% guarantor.surname | html %][% IF gr.relationship %] ([% gr.relationship | html %])[% END %]</a></li>
245
                                                        [% END %]
251
                                                        [% END %]
246
                                                    [% END %]
252
                                                    [% END %]
247
                                                    [% IF patron.contactfirstname OR patron.contactname %]
253
                                                    [% IF patron.contactfirstname OR patron.contactname %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js (-1 / +1 lines)
Lines 680-686 function patron_autocomplete(node, options) { Link Here
680
                    (item.link ? '<a href="' + item.link + '">' : "<a>") +
680
                    (item.link ? '<a href="' + item.link + '">' : "<a>") +
681
                    (item.surname ? item.surname.escapeHtml() : "") +
681
                    (item.surname ? item.surname.escapeHtml() : "") +
682
                    ", " +
682
                    ", " +
683
                    (item.firstname ? item.firstname.escapeHtml() : "") +
683
                    (item.preferred_name ? item.preferred_name.escapeHtml() : item.firstname ? item.firstname.escapeHtml() : "") +
684
                    " " +
684
                    " " +
685
                    (item.middle_name ? item.middle_name.escapeHtml() : "") +
685
                    (item.middle_name ? item.middle_name.escapeHtml() : "") +
686
                    " " +
686
                    " " +
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/patron-title.inc (-1 / +1 lines)
Lines 4-8 Link Here
4
    [%- IF patron.title -%]
4
    [%- IF patron.title -%]
5
        <span class="patron-title">[% patron.title | html %]</span>
5
        <span class="patron-title">[% patron.title | html %]</span>
6
    [%- END -%]
6
    [%- END -%]
7
    [% patron.firstname | html %] [% patron.middle_name | html %] [% patron.surname | html %]
7
    [% patron.effective_name | html %] [% patron.middle_name | html %] [% patron.surname | html %]
8
[%- END -%]
8
[%- END -%]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-3 / +12 lines)
Lines 194-200 Link Here
194
                                            Guaranteed by
194
                                            Guaranteed by
195
                                            [% FOREACH gr IN patron.guarantor_relationships %]
195
                                            [% FOREACH gr IN patron.guarantor_relationships %]
196
                                                [% SET g = gr.guarantor %]
196
                                                [% SET g = gr.guarantor %]
197
                                                [% g.firstname | html %] [% g.middle_name | html %] [% g.surname | html %]
197
                                                [% g.effective_name | html %] [% g.middle_name | html %] [% g.surname | html %]
198
                                                [%- IF ! loop.last %], [% END %]
198
                                                [%- IF ! loop.last %], [% END %]
199
                                            [% END %]
199
                                            [% END %]
200
                                        </span>
200
                                        </span>
Lines 212-218 Link Here
212
                <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form" autocomplete="off">
212
                <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form" autocomplete="off">
213
                    [% INCLUDE 'csrf-token.inc' %]
213
                    [% INCLUDE 'csrf-token.inc' %]
214
214
215
                [% FOREACH field = ['streetnumber' 'streettype'  'cardnumber' 'branchcode' 'categorycode' 'title' 'surname' 'firstname' 'middle_name' 'dateofbirth' 'initials' 'pronouns' 'othernames' 'address' 'address2' 'city' 'state' 'zipcode' 'country' 'phone' 'phonepro' 'mobile' 'email' 'emailpro' 'fax' 'B_streettype' 'B_streetnumber' 'B_address' 'B_address2' 'B_city' 'B_state' 'B_zipcode' 'B_country' 'B_phone' 'B_email' 'contactnote' 'altcontactsurname' 'altcontactfirstname' 'altcontactaddress1' 'altcontactaddress2' 'altcontactaddress3' 'altcontactstate' 'altcontactzipcode' 'altcontactcountry' 'altcontactphone' 'password' 'lang' ] %]
215
                [% FOREACH field = ['streetnumber' 'streettype'  'cardnumber' 'branchcode' 'categorycode' 'title' 'surname' 'firstname' 'preferred_name' 'middle_name' 'dateofbirth' 'initials' 'pronouns' 'othernames' 'address' 'address2' 'city' 'state' 'zipcode' 'country' 'phone' 'phonepro' 'mobile' 'email' 'emailpro' 'fax' 'B_streettype' 'B_streetnumber' 'B_address' 'B_address2' 'B_city' 'B_state' 'B_zipcode' 'B_country' 'B_phone' 'B_email' 'contactnote' 'altcontactsurname' 'altcontactfirstname' 'altcontactaddress1' 'altcontactaddress2' 'altcontactaddress3' 'altcontactstate' 'altcontactzipcode' 'altcontactcountry' 'altcontactphone' 'password' 'lang' ] %]
216
                    [% IF mandatory.defined( field ) %]
216
                    [% IF mandatory.defined( field ) %]
217
                        [% SET required.$field = 'required' %]
217
                        [% SET required.$field = 'required' %]
218
                    [% END %]
218
                    [% END %]
Lines 328-334 Link Here
328
                    [% END # / defined 'branchcode' %]
328
                    [% END # / defined 'branchcode' %]
329
329
330
                    [%# Following on one line for translatability %]
330
                    [%# Following on one line for translatability %]
331
                    [% UNLESS hidden.defined('title') && hidden.defined('surname') && hidden.defined('firstname') && hidden.defined('middle_name') && hidden.defined('dateofbirth') && hidden.defined('initials') && hidden.defined('pronouns') && hidden.defined('othernames') && hidden.defined('sex') %]
331
                    [% UNLESS hidden.defined('title') && hidden.defined('surname') && hidden.defined('firstname') && hidden.defined('preferred_name') && hidden.defined('middle_name') && hidden.defined('dateofbirth') && hidden.defined('initials') && hidden.defined('pronouns') && hidden.defined('othernames') && hidden.defined('sex') %]
332
                        <div class="row">
332
                        <div class="row">
333
                            <div class="col">
333
                            <div class="col">
334
                                <fieldset class="rows" id="memberentry_identity">
334
                                <fieldset class="rows" id="memberentry_identity">
Lines 380-385 Link Here
380
                                            </li>
380
                                            </li>
381
                                        [% END %]
381
                                        [% END %]
382
382
383
                                        [% UNLESS hidden.defined('preferred_name') %]
384
                                            <li>
385
                                                <label for="borrower_preferred_name" class="[% required.preferred_name | html %]">Preferred name:</label>
386
387
                                                <input type="text" id="borrower_preferred_name" name="borrower_preferred_name" value="[% borrower.preferred_name | html %]" class="[% required.preferred_name | html %]" />
388
                                                <div class="required_label [% required.preferred_name | html %]">Required</div>
389
                                            </li>
390
                                        [% END %]
391
383
                                        [% UNLESS hidden.defined('dateofbirth') %]
392
                                        [% UNLESS hidden.defined('dateofbirth') %]
384
                                            <li>
393
                                            <li>
385
                                                <label for="borrower_dateofbirth" class="[% required.dateofbirth | html %]">Date of birth:</label>
394
                                                <label for="borrower_dateofbirth" class="[% required.dateofbirth | html %]">Date of birth:</label>
(-)a/t/db_dependent/Koha/Patron.t (-2 / +32 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 32;
22
use Test::More tests => 33;
23
use Test::Exception;
23
use Test::Exception;
24
use Test::Warn;
24
use Test::Warn;
25
use Time::Fake;
25
use Time::Fake;
Lines 2247-2249 subtest 'guarantor requirements tests' => sub { Link Here
2247
    'Koha::Exceptions::Patron::Relationship::NoGuarantor',
2247
    'Koha::Exceptions::Patron::Relationship::NoGuarantor',
2248
        'Exception thrown when guarantor is deleted.';
2248
        'Exception thrown when guarantor is deleted.';
2249
};
2249
};
2250
- 
2250
2251
subtest 'effective_name() tests' => sub {
2252
2253
    plan tests => 2;
2254
2255
    $schema->storage->txn_begin;
2256
2257
    my $patron_1 = $builder->build_object(
2258
        {
2259
            class => 'Koha::Patrons',
2260
            value => {
2261
                firstname      => 'John',
2262
                preferred_name => 'Jacob',
2263
            }
2264
        }
2265
    );
2266
    my $patron_2 = $builder->build_object(
2267
        {
2268
            class => 'Koha::Patrons',
2269
            value => {
2270
                firstname      => "Bob",
2271
                preferred_name => undef,
2272
            }
2273
        }
2274
    );
2275
2276
    is( $patron_1->effective_name, "Jacob", 'Preferred name correctly chosen' );
2277
    is( $patron_2->effective_name, "Bob",   'First name correctly chosen if no preferred name' );
2278
2279
    $schema->storage->txn_rollback;
2280
};

Return to bug 28633