Bugzilla – Attachment 133437 Details for
Bug 21978
Add middle name field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21978: Add support for middle name
Bug-21978-Add-support-for-middle-name.patch (text/plain), 22.10 KB, created by
Martin Renvoize (ashimema)
on 2022-04-20 07:33:48 UTC
(
hide
)
Description:
Bug 21978: Add support for middle name
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-04-20 07:33:48 UTC
Size:
22.10 KB
patch
obsolete
>From d1071b25e66e7a959c43ee5f800cfd2d5b0b30fa Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 19 Apr 2022 16:20:51 +0100 >Subject: [PATCH] Bug 21978: Add support for middle name > >This patch adds the new 'Middle name' field to the patron record. > >To test: >1) Apply patches >2) Update database, restart all and clear the browser cache >3) Load a patron in the staff module >4) Confirm you can see and edit the new 'Middle name' field >5) Confirm the new middle name data displays on patron details >6) Confirm the new middle name data displays on patron search results >7) Confirm the new middle name data displays everywhere patron names are > displayed. >8) Confirm the new middle name data displays on the OPAC >9) Confirm the 'Middle name' field appears in the OPAC borrower > modification screens >10) Edit syspref BorrowerMandatoryFields and BorrowerUnwantedFields to > confirm you can make the new field required or hidden >11) Verify that DefaultPatronSearchFields contains the new field if you > already had 'firstname' in the field list >12) Enable PatronAutoComplete system preference >13) Type patrons surname into checkout or patron search but don't hit > return >14) Confirm the patrons middle name is displayed in the preview >--- > circ/ysearch.pl | 30 +++++++++++-------- > .../prog/en/includes/js-patron-format.inc | 8 +++-- > .../prog/en/includes/patron-search.inc | 8 ++--- > .../prog/en/includes/patron-title.inc | 11 ++++--- > .../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 ++++++++-- > 11 files changed, 67 insertions(+), 35 deletions(-) > >diff --git a/circ/ysearch.pl b/circ/ysearch.pl >index 3f2650cbeb..33aee174b1 100755 >--- a/circ/ysearch.pl >+++ b/circ/ysearch.pl >@@ -74,26 +74,30 @@ 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', > }, > ); > > my @borrowers; > while ( my $b = $borrowers_rs->next ) { >+ my $name = >+ $b->middle_name ? $b->firstname . ' ' . $b->middle_name : $b->firstname; > 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 => $name // '', >+ 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 // '', > }; > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc >index 0c1daae17f..660d492cfe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js-patron-format.inc >+++ b/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) + ')'; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >index de738dab2b..7f7615f030 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -61,7 +61,7 @@ > <label for="searchfieldstype_filter">Search field:</label> > <select name="searchfieldstype" id="searchfieldstype_filter"> > [% pref_fields = Koha.Preference('DefaultPatronSearchFields').split(',') %] >- [% default_fields = [ 'firstname,surname,othernames,cardnumber,userid', 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %] >+ [% default_fields = [ 'firstname,middlename,surname,othernames,cardnumber,userid', 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %] > [% search_options = default_fields.merge(pref_fields).unique %] > [% FOREACH s_o IN search_options %] > [% display_name = PROCESS patron_fields name=s_o %] >@@ -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 ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc >index 5a9b14d727..e6a6340063 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc >+++ b/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 -%] >@@ -33,7 +36,7 @@ > [%- IF no_html %] > [%- span_start = '' %] > [%- span_end = '' %] >- [%- ELSE %] >+ [%- ELSE %] > [%- span_start = '<span class="patron-title">' %] > [%- span_end = '</span>' %] > [%- END %] >@@ -61,16 +64,16 @@ > [%- 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 %][% 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 -%] > [%- IF data.cardnumber -%][%# FIXME Cardnumber should always be defined, right? -%] > [%- data.cardnumber | html -%] > [%- END -%] >-[%- ELSE -%] >+[%- ELSE -%] > A patron from library [% Branches.GetName( patron.branchcode ) | html -%] > [%- END -%] > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc >index 5e1c58f38e..4f88b5be6f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc >@@ -5,6 +5,7 @@ > [%- CASE 'cardnumber' -%]<span>Card number</span> > [%- CASE 'surname' -%]<span>Surname</span> > [%- CASE 'firstname' -%]<span>First name</span> >+ [%- CASE 'middle_name' -%]<span>Middle name</span> > [%- CASE 'title' -%]<span>Salutation</span> > [%- CASE 'othernames' -%]<span>Other name</span> > [%- CASE 'initials' -%]<span>Initials</span> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >index 256962915b..2674058a01 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/patrons.pref >+++ b/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 >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index 9f64400a89..23bdf847e1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/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 %] > <fieldset class="rows" id="memberentry_identity"> > <legend id="identity_lgd">[% IF ( I ) %]Organization [% ELSE %]Patron [% END %]identity</legend> > <ol> >@@ -338,6 +338,21 @@ legend:hover { > [% END %] > </li> > [% END #/UNLESS nofirstname %] >+ [% UNLESS nomiddle_name %] >+ <li> >+ [% IF ( mandatorymiddle_name ) %] >+ <label for="middle_name" class="required"> >+ [% ELSE %] >+ <label for="middle_name"> >+ [% END %] >+ Middle name: >+ </label> >+ <input type="text" id="middle_name" name="middle_name" size="20" value="[% borrower_data.middle_name | html UNLESS opduplicate %]" /> >+ [% IF ( mandatorymiddle_name ) %] >+ <span class="required">Required</span> >+ [% END %] >+ </li> >+ [% END #/UNLESS nomiddle_name %] > [% UNLESS nodateofbirth %] > <li> > [% IF ( mandatorydateofbirth ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >index 93bb308d9d..cadd9fc2f7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/members-update.tt >@@ -19,6 +19,7 @@ > [% CASE 'branchcode' %]<span>Home library (branchcode)</span> > [% CASE 'surname' %]<span>Surname</span> > [% CASE 'firstname' %]<span>First name</span> >+[% CASE 'middle_name' %]<span>Middle name</span> > [% CASE 'title' %]<span>Title</span> > [% CASE 'othernames' %]<span>Other names</span> > [% CASE 'initials' %]<span>Initials</span> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index f62109cb17..c8879f16f8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -85,12 +85,7 @@ > > <div class="row"> > >- <h3> >- [% UNLESS ( I ) %] >- [% patron.title | html %] [% patron.firstname | html %] >- [% END %] >- [% patron.surname | html %] ([% patron.cardnumber | html %]) >- </h3> >+ <h3>[% INCLUDE 'patron-title.inc' no_html = 1 %]</h3> > > [% IF ( was_renewed ) %] > <div class="dialog message"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/patron-title.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/patron-title.inc >index d77961d713..d34475359d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/patron-title.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/patron-title.inc >@@ -4,5 +4,5 @@ > [%- IF patron.title -%] > <span class="patron-title">[% patron.title | html %]</span> > [%- END -%] >- [% patron.firstname | html %] [% patron.surname | html %] >+ [% patron.firstname | html %] [% patron.middle_name | html %] [% patron.surname | html %] > [%- END -%] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >index 4e1a4fd692..6172eb347c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-memberentry.tt >+++ b/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 %] [% g.surname | html %] > [%- IF ! loop.last %], [% END %] > [% END %] > </span> >@@ -193,7 +193,7 @@ > > <form method="post" action="/cgi-bin/koha/opac-memberentry.pl" id="memberentry-form" autocomplete="off"> > >- [% 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') %] > <div class="row"> > <div class="col"> > <fieldset class="rows" id="memberentry_identity"> >@@ -343,6 +343,15 @@ > </li> > [% END %] > >+ [% UNLESS hidden.defined('middle_name') %] >+ <li> >+ <label for="borrower_middle_name" class="[% required.middle_name | html %]">Preferrred name:</label> >+ >+ <input type="text" id="borrower_middle_name" name="borrower_middle_name" value="[% borrower.middle_name | html %]" class="[% required.middle_name | html %]" /> >+ <div class="required_label [% required.middle_name | html %]">Required</div> >+ </li> >+ [% END %] >+ > [% UNLESS hidden.defined('dateofbirth') %] > <li> > <label for="borrower_dateofbirth" class="[% required.dateofbirth | html %]">Date of birth:</label> >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21978
:
133431
|
133432
|
133433
|
133434
|
133435
|
133436
|
133437
|
133438
|
133453
|
133454
|
133455
|
133456
|
133534
|
133535
|
133536
|
133537
|
133544
|
133545
|
133546
|
133547
|
133751
|
133752
|
133753
|
133754
|
133755
|
133756
|
133757
|
134254
|
134255
|
134256
|
134257
|
134258
|
134259
|
134495
|
134497
|
134498
|
134499
|
134500
|
134501
|
134502
|
134503
|
134745
|
134746
|
134747
|
134748
|
134749
|
134750
|
134751
|
135147
|
135148
|
135149
|
135150
|
135151
|
135152
|
135153
|
135154
|
135155
|
135180
|
135181
|
135182
|
135183
|
135184
|
135185
|
135186
|
135187
|
135188
|
135189
|
136513
|
136514
|
136515
|
136516
|
136517
|
136518
|
136519
|
136520
|
136521
|
136522
|
137612