@@ -, +, @@ displayed. modification screens `SelfModificationBorrowerUnwantedField`, `PatronSelfModificationMandatoryField`, `PatronSelfRegistrationBorrowerMandatoryField` and `PatronSelfRegistrationBorrowerUnwantedField` to confirm you can make the new field required or hidden. already had 'firstname' in the field list return --- Koha/Database/Columns.pm | 1 + circ/ysearch.pl | 35 ++++++++++--------- .../intranet-tmpl/js/autocomplete/patrons.js | 4 +-- .../prog/en/includes/js-patron-format.inc | 8 +++-- .../prog/en/includes/js_includes.inc | 7 +++- .../prog/en/includes/patron-search-header.inc | 2 +- .../prog/en/includes/patron-search.inc | 8 ++--- .../prog/en/includes/patron-title.inc | 7 ++-- .../prog/en/includes/patronfields.inc | 1 + .../en/modules/admin/preferences/patrons.pref | 2 +- .../prog/en/modules/members/memberentrygen.tt | 17 ++++++++- .../prog/en/modules/members/members-update.tt | 1 + .../prog/en/modules/members/moremember.tt | 7 +--- .../bootstrap/en/includes/patron-title.inc | 2 +- .../bootstrap/en/modules/opac-memberentry.tt | 15 ++++++-- 15 files changed, 77 insertions(+), 40 deletions(-) --- a/Koha/Database/Columns.pm +++ a/Koha/Database/Columns.pm @@ -63,6 +63,7 @@ sub columns { "title" => __("Salutation"), "surname" => __("Surname"), "firstname" => __("First name"), + "middle_name" => __("Middle name"), "dateofbirth" => __("Date of birth"), "initials" => __("Initials"), "othernames" => __("Other name"), --- a/circ/ysearch.pl +++ a/circ/ysearch.pl @@ -59,9 +59,10 @@ foreach my $p (@parts) { push( @params, -or => [ - surname => { -like => "%$p%" }, - firstname => { -like => "%$p%" }, - cardnumber => { -like => "$p%" }, + surname => { -like => "%$p%" }, + firstname => { -like => "%$p%" }, + middle_name => { -like => "%$p%" }, + cardnumber => { -like => "$p%" }, ] ); } @@ -74,7 +75,7 @@ my $borrowers_rs = Koha::Patrons->search_limited( # Get the first 10 results page => 1, rows => 10, - order_by => [ 'surname', 'firstname' ], + order_by => [ 'surname', 'firstname', 'middle_name' ], prefetch => 'branchcode', }, ); @@ -82,18 +83,20 @@ my $borrowers_rs = Koha::Patrons->search_limited( my @borrowers; while ( my $b = $borrowers_rs->next ) { push @borrowers, - { borrowernumber => $b->borrowernumber, - surname => $b->surname // '', - firstname => $b->firstname // '', - cardnumber => $b->cardnumber // '', - dateofbirth => format_sqldatetime($b->dateofbirth, undef, undef, 1) // '', - age => $b->get_age // '', - address => $b->address // '', - city => $b->city // '', - zipcode => $b->zipcode // '', - country => $b->country // '', - branchcode => $b->branchcode // '', - branchname => $b->library->branchname // '', + { + borrowernumber => $b->borrowernumber, + surname => $b->surname // '', + firstname => $b->firstname // '', + middle_name => $b->middle_name // '', + cardnumber => $b->cardnumber // '', + dateofbirth => format_sqldatetime( $b->dateofbirth, undef, undef, 1 ) // '', + age => $b->get_age // '', + address => $b->address // '', + city => $b->city // '', + zipcode => $b->zipcode // '', + country => $b->country // '', + branchcode => $b->branchcode // '', + branchname => $b->library->branchname // '', }; } --- a/koha-tmpl/intranet-tmpl/js/autocomplete/patrons.js +++ a/koha-tmpl/intranet-tmpl/js/autocomplete/patrons.js @@ -12,7 +12,7 @@ function patron_autocomplete(params) { if ( field_to_retrieve == 'borrowernumber' ) { field = ui.item.borrowernumber; } - AddPatron( ui.item.firstname + " " + ui.item.surname, field, patron_container, patron_input_name ); + AddPatron( ui.item.firstname + " " + ui.item.middle_name + " " + ui.item.surname, field, patron_container, patron_input_name ); input_autocomplete.val('').focus(); return false; } @@ -20,7 +20,7 @@ function patron_autocomplete(params) { .data( "ui-autocomplete" )._renderItem = function( ul, item ) { return $( "
  • " ) .data( "ui-autocomplete-item", item ) - .append( "" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "" ) + .append( "" + item.surname + ", " + item.firstname + " " + item.middle_name + " (" + item.cardnumber + ") " + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "" ) .appendTo( ul ); }; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc @@ -19,8 +19,12 @@ } var name; - var firstname = escape_str(patron.firstname); - var surname = escape_str(patron.surname); + var firstname = escape_str(patron.firstname); + var surname = escape_str(patron.surname); + + if ( patron.middle_name != null && patron.middle_name != '' ) { + firstname += ' ' + escape_str(patron.middle_name); + } if ( patron.other_name != null && patron.other_name != '' ) { firstname += ' (' + escape_str(patron.other_name) + ')'; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc @@ -87,7 +87,11 @@ // Display card number in parentheses if it exists cardnumber = " (" + item.cardnumber + ") "; } - var itemString = "" + ( item.surname ? item.surname.escapeHtml() : "" ) + ", " + ( item.firstname ? item.firstname.escapeHtml() : "" ) + cardnumber.escapeHtml() + " "; + var itemString = "" + ( item.surname ? item.surname.escapeHtml() : "" ) + ", " + + ( item.firstname ? item.firstname.escapeHtml() : "" ) + + ( item.middle_name ? " " + item.middle_name.escapeHtml() : "" ) + + cardnumber.escapeHtml() + + " "; if( item.branchcode == loggedInLibrary ){ loggedInClass = "ac-currentlibrary"; @@ -150,6 +154,7 @@ .append( "" + ( item.surname ? item.surname.escapeHtml() : "" ) + ", " + ( item.firstname ? item.firstname.escapeHtml() : "" ) + + ( item.middle_name ? " " + item.middle_name.escapeHtml() : "" ) + cardnumber.escapeHtml() + " " + ( item.dateofbirth ? item.dateofbirth.escapeHtml() : "" ) + " " --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc @@ -23,7 +23,7 @@

    - [% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname,surname,othernames,cardnumber,userid' %] + [% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' %] [% default_fields = [ standard, 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %] [% search_options = default_fields.merge(standard.split(',')).unique %] [% FOREACH s_o IN search_options %] @@ -303,7 +303,7 @@ let search_type = $("#searchtype_filter").val() || "contain"; let search_fields = $("#searchfieldstype_filter").val(); if ( !search_fields ) { - search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,surname,othernames,cardnumber,userid' | html %]"; + search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]"; } search_fields.split(',').forEach(function(e,i){ filters.push({["me."+e]:{"like":(search_type == "contain" ? "%" : "" ) + filter + "%"}}); @@ -440,7 +440,7 @@ } [% CASE 'name-address' %] { - "data": "me.surname:me.firstname:me.othernames:me.street_number:me.address:me.address2:me.city:me.state:me.postal_code:me.country", + "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", "searchable": true, "orderable": true, "render": function( data, type, row, meta ) { @@ -490,7 +490,7 @@ } [% CASE 'name' %] { - "data": "me.surname:me.firstname:me.othernames", + "data": "me.surname:me.firstname:me.middle_name:me.othernames", "searchable": true, "orderable": true, "render": function( data, type, row, meta ) { --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc @@ -7,6 +7,7 @@ [%- SET data.surname = patron.surname -%] [%- SET data.othernames = patron.othernames -%] [%- SET data.firstname = patron.firstname -%] + [%- SET data.middle_name = patron.middle_name -%] [%- SET data.cardnumber = patron.cardnumber -%] [%- SET data.borrowernumber = patron.borrowernumber -%] [%- SET data.title = patron.title -%] @@ -15,6 +16,7 @@ [%- SET data.surname = borrower.surname -%] [%- SET data.othernames = borrower.othernames -%] [%- SET data.firstname = borrower.firstname -%] + [%- SET data.middle_name = borrower.middle_name -%] [%- SET data.cardnumber = borrower.cardnumber -%] [%- SET data.borrowernumber = borrower.borrowernumber -%] [%- SET data.title = borrower.title -%] @@ -23,6 +25,7 @@ [%- SET data.surname = surname -%] [%- SET data.othernames = othernames -%] [%- SET data.firstname = firstname -%] + [%- SET data.middle_name = middle_name -%] [%- SET data.cardnumber = cardnumber -%] [%- SET data.borrowernumber = borrowernumber -%] [%- SET data.title = title -%] @@ -61,9 +64,9 @@ [%- 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 -%] + [% 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 -%] [%- ELSE -%] - [% data.title | $raw %][%- data.firstname | html %] [% IF data.othernames %] ([% data.othernames | html %]) [% END %] [% data.surname | html -%] + [% 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 -%] [%- END -%] [%- IF display_cardnumber AND data.cardnumber %] ([% data.cardnumber | html %])[% END -%] [%- ELSIF display_cardnumber -%] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc @@ -5,6 +5,7 @@ [%- CASE 'cardnumber' -%]Card number [%- CASE 'surname' -%]Surname [%- CASE 'firstname' -%]First name + [%- CASE 'middle_name' -%]Middle name [%- CASE 'title' -%]Salutation [%- CASE 'othernames' -%]Other name [%- CASE 'initials' -%]Initials --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref @@ -48,7 +48,7 @@ Patrons: - "Comma separated list defining the default fields to be used during a patron search using the \"standard\" option:" - pref: DefaultPatronSearchFields class: multi - - "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." + - "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." - - "Show the following fields from the items database table as columns on the statistics tab on the patron record: " - pref: StatisticsFields --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -264,7 +264,7 @@ legend:hover { [% END %] [% IF ( step_1 ) %] - [% UNLESS notitle && nosurname && nofirstname && nodateofbirth && noinitials && noothernames &&nosex %] + [% UNLESS notitle && nosurname && nofirstname && nomiddle_name && nodateofbirth && noinitials && noothernames &&nosex %]

    [% IF ( I ) %]Organization [% ELSE %]Patron [% END %]identity
      @@ -338,6 +338,21 @@ legend:hover { [% END %] [% END #/UNLESS nofirstname %] + [% UNLESS nomiddle_name %] +
    1. + [% IF ( mandatorymiddle_name ) %] +
    2. + [% END #/UNLESS nomiddle_name %] [% UNLESS nodateofbirth %]
    3. [% IF ( mandatorydateofbirth ) %] --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt @@ -19,6 +19,7 @@ [% CASE 'branchcode' %]Home library (branchcode) [% CASE 'surname' %]Surname [% CASE 'firstname' %]First name +[% CASE 'middle_name' %]Middle name [% CASE 'title' %]Title [% CASE 'othernames' %]Other names [% CASE 'initials' %]Initials --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -95,12 +95,7 @@ [% INCLUDE 'patron_messages.inc' %]
    -

    - [% UNLESS ( I ) %] - [% patron.title | html %] [% patron.firstname | html %] - [% END %] - [% patron.surname | html %] ([% patron.cardnumber | html %]) -

    +

    [% INCLUDE 'patron-title.inc' no_html = 1 %]

    --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/patron-title.inc +++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/patron-title.inc @@ -4,5 +4,5 @@ [%- IF patron.title -%] [% patron.title | html %] [%- END -%] - [% patron.firstname | html %] [% patron.surname | html %] + [% patron.firstname | html %] [% patron.middle_name | html %] [% patron.surname | html %] [%- END -%] --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt @@ -176,7 +176,7 @@ Guaranteed by [% FOREACH gr IN patron.guarantor_relationships %] [% SET g = gr.guarantor %] - [% g.firstname | html %] [% g.surname | html %] + [% g.firstname | html %] [% g.middle_name | html %] [% g.surname | html %] [%- IF ! loop.last %], [% END %] [% END %] @@ -193,7 +193,7 @@
    - [% 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' ] %] + [% 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' ] %] [% IF mandatory.defined( field ) %] [% SET required.$field = 'required' %] [% END %] @@ -300,7 +300,7 @@ [% END # / defined 'branchcode' %] [%# Following on one line for translatability %] - [% UNLESS hidden.defined('title') && hidden.defined('surname') && hidden.defined('firstname') && hidden.defined('dateofbirth') && hidden.defined('initials') && hidden.defined('othernames') && hidden.defined('sex') %] + [% 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') %]
    @@ -343,6 +343,15 @@ [% END %] + [% UNLESS hidden.defined('middle_name') %] +
  • + + + +
    Required
    +
  • + [% END %] + [% UNLESS hidden.defined('dateofbirth') %]
  • --