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

(-)a/circ/ysearch.pl (-13 / +17 lines)
Lines 74-99 my $borrowers_rs = Koha::Patrons->search_limited( Link Here
74
        # Get the first 10 results
74
        # Get the first 10 results
75
        page     => 1,
75
        page     => 1,
76
        rows     => 10,
76
        rows     => 10,
77
        order_by => [ 'surname', 'firstname' ],
77
        order_by => [ 'surname', 'firstname', 'middle_name' ],
78
        prefetch => 'branchcode',
78
        prefetch => 'branchcode',
79
    },
79
    },
80
);
80
);
81
81
82
my @borrowers;
82
my @borrowers;
83
while ( my $b = $borrowers_rs->next ) {
83
while ( my $b = $borrowers_rs->next ) {
84
    my $name =
85
      $b->middle_name ? $b->firstname . ' ' . $b->middle_name : $b->firstname;
84
    push @borrowers,
86
    push @borrowers,
85
      { borrowernumber => $b->borrowernumber,
87
      {
86
        surname        => $b->surname    // '',
88
        borrowernumber => $b->borrowernumber,
87
        firstname      => $b->firstname  // '',
89
        surname        => $b->surname     // '',
88
        cardnumber     => $b->cardnumber // '',
90
        firstname      => $name   // '',
89
        dateofbirth    => format_sqldatetime($b->dateofbirth, undef, undef, 1) // '',
91
        middle_name    => $b->middle_name // '',
90
        age            => $b->get_age    // '',
92
        cardnumber     => $b->cardnumber  // '',
91
        address        => $b->address    // '',
93
        dateofbirth    => format_sqldatetime( $b->dateofbirth, undef, undef, 1 ) // '',
92
        city           => $b->city       // '',
94
        age        => $b->get_age             // '',
93
        zipcode        => $b->zipcode    // '',
95
        address    => $b->address             // '',
94
        country        => $b->country    // '',
96
        city       => $b->city                // '',
95
        branchcode     => $b->branchcode // '',
97
        zipcode    => $b->zipcode             // '',
96
        branchname     => $b->library->branchname // '',
98
        country    => $b->country             // '',
99
        branchcode => $b->branchcode          // '',
100
        branchname => $b->library->branchname // '',
97
      };
101
      };
98
}
102
}
99
103
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc (-2 / +6 lines)
Lines 19-26 Link Here
19
            }
19
            }
20
20
21
            var name;
21
            var name;
22
            var firstname = escape_str(patron.firstname);
22
            var firstname   = escape_str(patron.firstname);
23
            var surname   = escape_str(patron.surname);
23
            var surname     = escape_str(patron.surname);
24
25
            if ( patron.middle_name != null && patron.middle_name != '' ) {
26
                firstname += ' ' + escape_str(patron.middle_name);
27
            }
24
28
25
            if ( patron.other_name != null && patron.other_name != '' ) {
29
            if ( patron.other_name != null && patron.other_name != '' ) {
26
                firstname += ' (' + escape_str(patron.other_name) + ')';
30
                firstname += ' (' + escape_str(patron.other_name) + ')';
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (-4 / +4 lines)
Lines 61-67 Link Here
61
                            <label for="searchfieldstype_filter">Search field:</label>
61
                            <label for="searchfieldstype_filter">Search field:</label>
62
                            <select name="searchfieldstype" id="searchfieldstype_filter">
62
                            <select name="searchfieldstype" id="searchfieldstype_filter">
63
                                [% pref_fields = Koha.Preference('DefaultPatronSearchFields').split(',') %]
63
                                [% pref_fields = Koha.Preference('DefaultPatronSearchFields').split(',') %]
64
                                [% default_fields = [ 'firstname,surname,othernames,cardnumber,userid', 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %]
64
                                [% default_fields = [ 'firstname,middlename,surname,othernames,cardnumber,userid', 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %]
65
                                [% search_options = default_fields.merge(pref_fields).unique %]
65
                                [% search_options = default_fields.merge(pref_fields).unique %]
66
                                [% FOREACH s_o IN search_options %]
66
                                [% FOREACH s_o IN search_options %]
67
                                    [% display_name = PROCESS patron_fields name=s_o %]
67
                                    [% display_name = PROCESS patron_fields name=s_o %]
Lines 303-309 Link Here
303
                    let search_type = $("#searchtype_filter").val() || "contain";
303
                    let search_type = $("#searchtype_filter").val() || "contain";
304
                    let search_fields = $("#searchfieldstype_filter").val();
304
                    let search_fields = $("#searchfieldstype_filter").val();
305
                    if ( !search_fields ) {
305
                    if ( !search_fields ) {
306
                        search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,surname,othernames,cardnumber,userid' | html %]";
306
                        search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]";
307
                    }
307
                    }
308
                    search_fields.split(',').forEach(function(e,i){
308
                    search_fields.split(',').forEach(function(e,i){
309
                        filters.push({["me."+e]:{"like":(search_type == "contain" ? "%" : "" ) + filter + "%"}});
309
                        filters.push({["me."+e]:{"like":(search_type == "contain" ? "%" : "" ) + filter + "%"}});
Lines 440-446 Link Here
440
                            }
440
                            }
441
                            [% CASE 'name-address' %]
441
                            [% CASE 'name-address' %]
442
                            {
442
                            {
443
                                "data": "me.surname:me.firstname:me.othernames:me.street_number:me.address:me.address2:me.city:me.state:me.postal_code:me.country",
443
                                "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",
444
                                "searchable": true,
444
                                "searchable": true,
445
                                "orderable": true,
445
                                "orderable": true,
446
                                "render": function( data, type, row, meta ) {
446
                                "render": function( data, type, row, meta ) {
Lines 490-496 Link Here
490
                            }
490
                            }
491
                            [% CASE 'name' %]
491
                            [% CASE 'name' %]
492
                            {
492
                            {
493
                                "data": "me.surname:me.firstname:me.othernames",
493
                                "data": "me.surname:me.firstname:me.middle_name:me.othernames",
494
                                "searchable": true,
494
                                "searchable": true,
495
                                "orderable": true,
495
                                "orderable": true,
496
                                "render": function( data, type, row, meta ) {
496
                                "render": function( data, type, row, meta ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc (-2 / +5 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.middle_name    = patron.middle_name -%]
10
    [%- SET data.cardnumber     = patron.cardnumber -%]
11
    [%- SET data.cardnumber     = patron.cardnumber -%]
11
    [%- SET data.borrowernumber = patron.borrowernumber -%]
12
    [%- SET data.borrowernumber = patron.borrowernumber -%]
12
    [%- SET data.title          = patron.title -%]
13
    [%- SET data.title          = patron.title -%]
Lines 15-20 Link Here
15
    [%- SET data.surname        = borrower.surname -%]
16
    [%- SET data.surname        = borrower.surname -%]
16
    [%- SET data.othernames     = borrower.othernames -%]
17
    [%- SET data.othernames     = borrower.othernames -%]
17
    [%- SET data.firstname      = borrower.firstname -%]
18
    [%- SET data.firstname      = borrower.firstname -%]
19
    [%- SET data.middle_name    = borrower.middle_name -%]
18
    [%- SET data.cardnumber     = borrower.cardnumber -%]
20
    [%- SET data.cardnumber     = borrower.cardnumber -%]
19
    [%- SET data.borrowernumber = borrower.borrowernumber -%]
21
    [%- SET data.borrowernumber = borrower.borrowernumber -%]
20
    [%- SET data.title          = borrower.title -%]
22
    [%- SET data.title          = borrower.title -%]
Lines 23-28 Link Here
23
    [%- SET data.surname        = surname -%]
25
    [%- SET data.surname        = surname -%]
24
    [%- SET data.othernames     = othernames -%]
26
    [%- SET data.othernames     = othernames -%]
25
    [%- SET data.firstname      = firstname -%]
27
    [%- SET data.firstname      = firstname -%]
28
    [%- SET data.middle_name    = middle_name -%]
26
    [%- SET data.cardnumber     = cardnumber -%]
29
    [%- SET data.cardnumber     = cardnumber -%]
27
    [%- SET data.borrowernumber = borrowernumber -%]
30
    [%- SET data.borrowernumber = borrowernumber -%]
28
    [%- SET data.title          = title -%]
31
    [%- SET data.title          = title -%]
Lines 61-69 Link Here
61
    [%- IF data.category_type == 'I' -%]
64
    [%- IF data.category_type == 'I' -%]
62
        [%- data.surname | html %] [% IF data.othernames %] ([% data.othernames | html %])[% END -%]
65
        [%- data.surname | html %] [% IF data.othernames %] ([% data.othernames | html %])[% END -%]
63
    [%- ELSIF invert_name -%]
66
    [%- ELSIF invert_name -%]
64
        [% data.title | $raw %][%- data.surname | html %][% IF ( data.firstname ) %], [% data.firstname | html %][% END %][% IF data.othernames %] ([% data.othernames | html %]) [% END -%]
67
        [% 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 -%]
65
    [%- ELSE -%]
68
    [%- ELSE -%]
66
        [% data.title | $raw %][%- data.firstname | html %] [% IF data.othernames %] ([% data.othernames | html %]) [% END %] [% data.surname | html -%]
69
        [% 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 -%]
67
    [%- END -%]
70
    [%- END -%]
68
    [%- IF display_cardnumber AND data.cardnumber %] ([% data.cardnumber | html %])[% END -%]
71
    [%- IF display_cardnumber AND data.cardnumber %] ([% data.cardnumber | html %])[% END -%]
69
[%- ELSIF display_cardnumber -%]
72
[%- ELSIF display_cardnumber -%]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc (+1 lines)
Lines 5-10 Link Here
5
     [%- CASE 'cardnumber' -%]<span>Card number</span>
5
     [%- CASE 'cardnumber' -%]<span>Card number</span>
6
     [%- CASE 'surname' -%]<span>Surname</span>
6
     [%- CASE 'surname' -%]<span>Surname</span>
7
     [%- CASE 'firstname' -%]<span>First name</span>
7
     [%- CASE 'firstname' -%]<span>First name</span>
8
     [%- CASE 'middle_name' -%]<span>Middle name</span>
8
     [%- CASE 'title' -%]<span>Salutation</span>
9
     [%- CASE 'title' -%]<span>Salutation</span>
9
     [%- CASE 'othernames' -%]<span>Other name</span>
10
     [%- CASE 'othernames' -%]<span>Other name</span>
10
     [%- CASE 'initials' -%]<span>Initials</span>
11
     [%- CASE 'initials' -%]<span>Initials</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref (-1 / +1 lines)
Lines 48-54 Patrons: Link Here
48
         - "Comma separated list defining the default fields to be used during a patron search using the \"standard\" option:"
48
         - "Comma separated list defining the default fields to be used during a patron search using the \"standard\" option:"
49
         - pref: DefaultPatronSearchFields
49
         - pref: DefaultPatronSearchFields
50
           class: multi
50
           class: multi
51
         - "If empty Koha will default to \"firstname,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."
51
         - "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."
52
     -
52
     -
53
         - "Show the following fields from the items database table as columns on the statistics tab on the patron record: "
53
         - "Show the following fields from the items database table as columns on the statistics tab on the patron record: "
54
         - pref: StatisticsFields
54
         - pref: StatisticsFields
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +16 lines)
Lines 264-270 legend:hover { Link Here
264
                            [% END %]
264
                            [% END %]
265
265
266
                            [% IF ( step_1 ) %]
266
                            [% IF ( step_1 ) %]
267
                                [% UNLESS notitle && nosurname && nofirstname && nodateofbirth && noinitials && noothernames &&nosex %]
267
                                [% UNLESS notitle && nosurname && nofirstname && nomiddle_name && nodateofbirth && noinitials && noothernames &&nosex %]
268
                                    <fieldset class="rows" id="memberentry_identity">
268
                                    <fieldset class="rows" id="memberentry_identity">
269
                                        <legend id="identity_lgd">[% IF ( I ) %]Organization [% ELSE %]Patron [% END %]identity</legend>
269
                                        <legend id="identity_lgd">[% IF ( I ) %]Organization [% ELSE %]Patron [% END %]identity</legend>
270
                                        <ol>
270
                                        <ol>
Lines 338-343 legend:hover { Link Here
338
                                                        [% END %]
338
                                                        [% END %]
339
                                                    </li>
339
                                                    </li>
340
                                                [% END #/UNLESS nofirstname %]
340
                                                [% END #/UNLESS nofirstname %]
341
                                                [% UNLESS nomiddle_name %]
342
                                                    <li>
343
                                                        [% IF ( mandatorymiddle_name ) %]
344
                                                            <label for="middle_name" class="required">
345
                                                        [% ELSE %]
346
                                                            <label for="middle_name">
347
                                                        [% END %]
348
                                                            Middle name:
349
                                                        </label>
350
                                                        <input type="text" id="middle_name" name="middle_name" size="20"  value="[% borrower_data.middle_name | html UNLESS opduplicate %]" />
351
                                                        [% IF ( mandatorymiddle_name ) %]
352
                                                            <span class="required">Required</span>
353
                                                        [% END %]
354
                                                    </li>
355
                                                [% END #/UNLESS nomiddle_name %]
341
                                                [% UNLESS nodateofbirth %]
356
                                                [% UNLESS nodateofbirth %]
342
                                                    <li>
357
                                                    <li>
343
                                                        [% IF ( mandatorydateofbirth ) %]
358
                                                        [% IF ( mandatorydateofbirth ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt (+1 lines)
Lines 19-24 Link Here
19
[% CASE 'branchcode'          %]<span>Home library (branchcode)</span>
19
[% CASE 'branchcode'          %]<span>Home library (branchcode)</span>
20
[% CASE 'surname'             %]<span>Surname</span>
20
[% CASE 'surname'             %]<span>Surname</span>
21
[% CASE 'firstname'           %]<span>First name</span>
21
[% CASE 'firstname'           %]<span>First name</span>
22
[% CASE 'middle_name'         %]<span>Middle name</span>
22
[% CASE 'title'               %]<span>Title</span>
23
[% CASE 'title'               %]<span>Title</span>
23
[% CASE 'othernames'          %]<span>Other names</span>
24
[% CASE 'othernames'          %]<span>Other names</span>
24
[% CASE 'initials'            %]<span>Initials</span>
25
[% CASE 'initials'            %]<span>Initials</span>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt (-6 / +1 lines)
Lines 85-96 Link Here
85
85
86
                    <div class="row">
86
                    <div class="row">
87
87
88
                        <h3>
88
                        <h3>[% INCLUDE 'patron-title.inc' no_html = 1 %]</h3>
89
                            [% UNLESS ( I ) %]
90
                                [% patron.title | html %] [% patron.firstname | html %]
91
                            [% END %]
92
                            [% patron.surname | html %] ([% patron.cardnumber | html %])
93
                        </h3>
94
89
95
                        [% IF ( was_renewed ) %]
90
                        [% IF ( was_renewed ) %]
96
                            <div class="dialog message">
91
                            <div class="dialog message">
(-)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.surname | html %]
7
    [% patron.firstname | html %] [% patron.middle_name | html %] [% patron.surname | html %]
8
[%- END -%]
8
[%- END -%]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt (-4 / +12 lines)
Lines 176-182 Link Here
176
                                            Guaranteed by
176
                                            Guaranteed by
177
                                            [% FOREACH gr IN patron.guarantor_relationships %]
177
                                            [% FOREACH gr IN patron.guarantor_relationships %]
178
                                                [% SET g = gr.guarantor %]
178
                                                [% SET g = gr.guarantor %]
179
                                                [% g.firstname | html %] [% g.surname | html %]
179
                                                [% g.firstname | html %] [% g.middle_name | html %] [% g.surname | html %]
180
                                                [%- IF ! loop.last %], [% END %]
180
                                                [%- IF ! loop.last %], [% END %]
181
                                            [% END %]
181
                                            [% END %]
182
                                        </span>
182
                                        </span>
Lines 193-199 Link Here
193
193
194
                <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form" autocomplete="off">
194
                <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form" autocomplete="off">
195
195
196
                [% FOREACH field = ['streetnumber' 'streettype'  'cardnumber' 'branchcode' 'categorycode' 'title' 'surname' 'firstname' 'dateofbirth' 'initials' 'othernames' 'address' 'address2' 'city' 'state' 'zipcode' 'country' 'phone' 'phonepro' 'mobile' 'email' 'emailpro' 'fax' 'B_streettype' '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' ] %]
196
                [% FOREACH field = ['streetnumber' 'streettype'  'cardnumber' 'branchcode' 'categorycode' 'title' 'surname' 'firstname' 'middle_name' 'dateofbirth' 'initials' 'othernames' 'address' 'address2' 'city' 'state' 'zipcode' 'country' 'phone' 'phonepro' 'mobile' 'email' 'emailpro' 'fax' 'B_streettype' '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' ] %]
197
                    [% IF mandatory.defined( field ) %]
197
                    [% IF mandatory.defined( field ) %]
198
                        [% SET required.$field = 'required' %]
198
                        [% SET required.$field = 'required' %]
199
                    [% END %]
199
                    [% END %]
Lines 300-306 Link Here
300
                    [% END # / defined 'branchcode' %]
300
                    [% END # / defined 'branchcode' %]
301
301
302
                    [%# Following on one line for translatability %]
302
                    [%# Following on one line for translatability %]
303
                    [% UNLESS hidden.defined('title') && hidden.defined('surname') && hidden.defined('firstname') && hidden.defined('dateofbirth') && hidden.defined('initials') && hidden.defined('othernames') && hidden.defined('sex') %]
303
                    [% UNLESS hidden.defined('title') && hidden.defined('surname') && hidden.defined('firstname') && hidden.defined('middle_name') && hidden.defined('dateofbirth') && hidden.defined('initials') && hidden.defined('othernames') && hidden.defined('sex') %]
304
                        <div class="row">
304
                        <div class="row">
305
                            <div class="col">
305
                            <div class="col">
306
                                <fieldset class="rows" id="memberentry_identity">
306
                                <fieldset class="rows" id="memberentry_identity">
Lines 343-348 Link Here
343
                                            </li>
343
                                            </li>
344
                                        [% END %]
344
                                        [% END %]
345
345
346
                                        [% UNLESS hidden.defined('middle_name') %]
347
                                            <li>
348
                                                <label for="borrower_middle_name" class="[% required.middle_name | html %]">Preferrred name:</label>
349
350
                                                <input type="text" id="borrower_middle_name" name="borrower_middle_name" value="[% borrower.middle_name | html %]" class="[% required.middle_name | html %]" />
351
                                                <div class="required_label [% required.middle_name | html %]">Required</div>
352
                                            </li>
353
                                        [% END %]
354
346
                                        [% UNLESS hidden.defined('dateofbirth') %]
355
                                        [% UNLESS hidden.defined('dateofbirth') %]
347
                                            <li>
356
                                            <li>
348
                                                <label for="borrower_dateofbirth" class="[% required.dateofbirth | html %]">Date of birth:</label>
357
                                                <label for="borrower_dateofbirth" class="[% required.dateofbirth | html %]">Date of birth:</label>
349
- 

Return to bug 21978