Bugzilla – Attachment 125500 Details for
Bug 28633
Add a preferred name field to patrons
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28633: (follow-up) Show legal name and add preferredname to searches
Bug-28633-follow-up-Show-legal-name-and-add-prefer.patch (text/plain), 8.08 KB, created by
Nick Clemens (kidclamp)
on 2021-09-30 12:55:53 UTC
(
hide
)
Description:
Bug 28633: (follow-up) Show legal name and add preferredname to searches
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-09-30 12:55:53 UTC
Size:
8.08 KB
patch
obsolete
>From 8277ae03b2f8ad8a0559d7bb85979afd7eef6194 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 30 Sep 2021 12:43:39 +0000 >Subject: [PATCH] Bug 28633: (follow-up) Show legal name and add preferredname > to searches > >This patch adds to the DB update a condition to add 'preferredname' to >DefaultPatronSearchFields. It also adjust the koha defaults to include it >if the pref is empty > >The 'firstname' is displayed as 'Legal name' on the details page, with id/class >to allow ajusting via JS/CSS > >PatronAutoComplete/ysearch is updated to use 'effective_name' method > >To test: >1 - Aply patches and updatedatabase and restart_all >2 - Add a preferredname to a patron >3 - Verify DefaultPatronSearchFields contains 'preferredname' if your pref had firstname > Add preferredname if not >4 - Perform checkout and patron search using preferredname, confirm patron is found >5 - On patron's detail page confirm 'Legal name' shows >6 - Remove patron's first name, confirm 'Legal name' is no longer present >7 - Enable PatronAutoComplete system preference >8 - Type patron's surname into Checkout or patron search but don't hit enter >9 - Confirm patron is dsiplayed with 'preferredname' in the preview >--- > C4/Utils/DataTables/Members.pm | 2 +- > circ/ysearch.pl | 2 +- > .../{bug_28633.perl => bug_28633.pl} | 18 +++++++++++++----- > .../prog/en/includes/patronfields.inc | 2 +- > .../en/modules/admin/preferences/patrons.pref | 2 +- > .../prog/en/modules/members/moremember.tt | 6 ++++++ > 6 files changed, 23 insertions(+), 9 deletions(-) > rename installer/data/mysql/atomicupdate/{bug_28633.perl => bug_28633.pl} (56%) > >diff --git a/C4/Utils/DataTables/Members.pm b/C4/Utils/DataTables/Members.pm >index 3d677b8e01..7273b945c4 100644 >--- a/C4/Utils/DataTables/Members.pm >+++ b/C4/Utils/DataTables/Members.pm >@@ -113,7 +113,7 @@ sub search { > } > > my $searchfields = { >- standard => C4::Context->preference('DefaultPatronSearchFields') || 'surname,firstname,othernames,cardnumber,userid', >+ standard => C4::Context->preference('DefaultPatronSearchFields') || 'surname,firstname,preferredname,othernames,cardnumber,userid', > email => 'email,emailpro,B_email', > borrowernumber => 'borrowernumber', > phone => 'phone,phonepro,B_phone,altcontactphone,mobile', >diff --git a/circ/ysearch.pl b/circ/ysearch.pl >index dd04aaf966..b26eba3f18 100755 >--- a/circ/ysearch.pl >+++ b/circ/ysearch.pl >@@ -84,7 +84,7 @@ while ( my $b = $borrowers_rs->next ) { > push @borrowers, > { borrowernumber => $b->borrowernumber, > surname => $b->surname // '', >- firstname => $b->firstname // '', >+ firstname => $b->effective_name // '', > cardnumber => $b->cardnumber // '', > dateofbirth => format_sqldatetime($b->dateofbirth, undef, undef, 1) // '', > age => $b->get_age // '', >diff --git a/installer/data/mysql/atomicupdate/bug_28633.perl b/installer/data/mysql/atomicupdate/bug_28633.pl >similarity index 56% >rename from installer/data/mysql/atomicupdate/bug_28633.perl >rename to installer/data/mysql/atomicupdate/bug_28633.pl >index 2cb0cbcd8d..251697bb63 100644 >--- a/installer/data/mysql/atomicupdate/bug_28633.perl >+++ b/installer/data/mysql/atomicupdate/bug_28633.pl >@@ -13,7 +13,7 @@ return { > COMMENT "patron/borrower's preferred name" > AFTER firstname > }); >- say $out "Add preferred name column to borrowers table"; >+ say $out "Added preferred name column to borrowers table"; > } > if( !column_exists( 'deletedborrowers', 'preferredname' ) ) { > $dbh->do(q{ >@@ -22,7 +22,7 @@ return { > COMMENT "patron/borrower's preferred name" > AFTER firstname > }); >- say $out "Add preferred name column to deletedborrowers table"; >+ say $out "Added preferred name column to deletedborrowers table"; > } > if( !column_exists( 'borrower_modifications', 'preferredname' ) ) { > $dbh->do(q{ >@@ -31,9 +31,17 @@ return { > COMMENT "patron/borrower's preferred name" > AFTER firstname > }); >- say $out "Add preferred name column to borrower_modifications table"; >+ say $out "Added preferred name column to borrower_modifications table"; >+ } >+ my @default_patron_search_fields = split(',',C4::Context->preference('DefaultPatronSearchFields')); >+ unless( grep /preferredname/, @default_patron_search_fields ){ >+ if( grep /firstname/, @default_patron_search_fields ){ >+ push @default_patron_search_fields,'preferredname'; >+ C4::Context->set_preference('DefaultPatronSearchFields', join(',',@default_patron_search_fields) ); >+ say $out "Added preferred name to DefaultPatronSearchFields"; >+ } else { >+ say $out "Please add 'preferredname' to DefaultPatronSearchFields if you want it searched by default"; >+ } > } >- $dbh->do(q{}); >- # Print useful stuff here > }, > } >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc >index e9b2680e46..1f5ef69e50 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc >@@ -5,7 +5,7 @@ > [%- CASE 'cardnumber' -%]<span>Card number</span> > [%- CASE 'surname' -%]<span>Surname</span> > [%- CASE 'firstname' -%]<span>First name</span> >- [%- CASE 'firstname' -%]<span>Preferred name</span> >+ [%- CASE 'preferredname' -%]<span>Preferred 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 5a6f1bd5a4..4e60f8dea6 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 \"surname,firstname,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 \"surname,firstname,preferredname,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/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index ee7558cb06..2c4dbc1503 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -124,6 +124,12 @@ > > <div class="rows"> > <ol> >+ [% IF ( patron.preferredname && patron.firstname ) %] >+ <li id="patron_legal_name"> >+ <span class="label patron_legal_name">Legal name: </span> >+ [% patron.firstname | html %] >+ </li> >+ [% END %] > [% IF ( patron.phone ) %] > <li> > <span class="label">Primary phone: </span> >-- >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 28633
:
123008
|
123009
|
123010
|
123658
|
125497
|
125498
|
125499
|
125500
|
126591
|
128968
|
128969
|
128970
|
130000
|
130001
|
130002
|
133445
|
133446
|
133447
|
133448
|
133449
|
133450
|
133451
|
133958
|
133959
|
133960
|
133961
|
133962
|
133963
|
133964
|
133965
|
166792
|
166793
|
166794
|
166813
|
166814
|
166815
|
166816
|
166817
|
167163
|
167164
|
173628
|
173629
|
173630
|
173631
|
173632
|
173633
|
173634
|
173664
|
173665
|
173666
|
173667
|
173668
|
173669
|
173670
|
173717
|
173718
|
173719
|
173813
|
173814
|
173815
|
173816
|
173826
|
173827
|
173828
|
173829
|
173930
|
173931
|
173932
|
173933
|
173934
|
173935
|
173936
|
174419
|
174420
|
174472
|
175177