Bug 21978 - Add middle name field
Summary: Add middle name field
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement with 20 votes (vote)
Assignee: Martin Renvoize
QA Contact: Testopia
URL:
Keywords:
Depends on: 30576
Blocks: 30617
  Show dependency treegraph
 
Reported: 2018-12-07 19:33 UTC by Christopher Brannon
Modified: 2023-06-08 22:26 UTC (History)
14 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Medium patch
Documentation contact: Martin Renvoize
Documentation submission:
Text to go in the release notes:
This adds a new free text field 'Middle name' to the patron record.
Version(s) released in:
22.11.00


Attachments
Bug 21978: Add middle_name field to the database (5.48 KB, patch)
2022-04-20 07:27 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name to api specification (954 bytes, patch)
2022-04-20 07:27 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add support for middle name (21.18 KB, patch)
2022-04-20 07:27 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Schema Update (4.04 KB, patch)
2022-04-20 07:28 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name field to the database (5.48 KB, patch)
2022-04-20 07:33 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name to api specification (954 bytes, patch)
2022-04-20 07:33 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add support for middle name (22.10 KB, patch)
2022-04-20 07:33 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Schema Update (4.04 KB, patch)
2022-04-20 07:33 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name field to the database (5.48 KB, patch)
2022-04-20 10:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name to api specification (954 bytes, patch)
2022-04-20 10:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add support for middle name (21.59 KB, patch)
2022-04-20 10:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Schema Update (4.04 KB, patch)
2022-04-20 10:43 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name field to the database (5.48 KB, patch)
2022-04-21 10:55 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name to api specification (954 bytes, patch)
2022-04-21 10:55 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add support for middle name (27.00 KB, patch)
2022-04-21 10:55 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Schema Update (3.14 KB, patch)
2022-04-21 10:55 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name field to the database (5.48 KB, patch)
2022-04-21 12:09 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name to api specification (954 bytes, patch)
2022-04-21 12:10 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add support for middle name (26.45 KB, patch)
2022-04-21 12:10 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Schema Update (3.14 KB, patch)
2022-04-21 12:10 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 30576: Use DefaultPatronSearchFields in patron search (5.22 KB, patch)
2022-04-25 11:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name field to the database (5.48 KB, patch)
2022-04-25 11:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name to api specification (954 bytes, patch)
2022-04-25 11:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add support for middle name (27.26 KB, patch)
2022-04-25 11:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Schema Update (3.14 KB, patch)
2022-04-25 11:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name into hold request autocomplete (1.12 KB, patch)
2022-04-25 11:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Use patron-title.inc in request.tt (16.29 KB, patch)
2022-04-25 11:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name field to the database (5.52 KB, patch)
2022-04-28 13:20 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name to api specification (954 bytes, patch)
2022-04-28 13:20 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add support for middle name (27.28 KB, patch)
2022-04-28 13:20 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Schema Update (3.14 KB, patch)
2022-04-28 13:20 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name into hold request autocomplete (1.12 KB, patch)
2022-04-28 13:20 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Use patron-title.inc in request.tt (16.29 KB, patch)
2022-04-28 13:20 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Use patron-title for holdfor handling in results (12.20 KB, patch)
2022-05-03 10:49 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name field to the database (5.52 KB, patch)
2022-05-03 10:53 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name to api specification (954 bytes, patch)
2022-05-03 10:53 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add support for middle name (27.28 KB, patch)
2022-05-03 10:53 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Schema Update (3.14 KB, patch)
2022-05-03 10:53 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name into hold request autocomplete (1.12 KB, patch)
2022-05-03 10:53 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Use patron-title.inc in request.tt (16.29 KB, patch)
2022-05-03 10:54 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Use patron-title for holdfor handling in results (12.20 KB, patch)
2022-05-03 10:54 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name field to the database (5.58 KB, patch)
2022-05-06 15:50 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 21978: Add middle_name to api specification (1021 bytes, patch)
2022-05-06 15:50 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 21978: Add support for middle name (27.35 KB, patch)
2022-05-06 15:50 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 21978: Schema Update (3.20 KB, patch)
2022-05-06 15:51 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 21978: Add middle_name into hold request autocomplete (1.19 KB, patch)
2022-05-06 15:51 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 21978: Use patron-title.inc in request.tt (16.36 KB, patch)
2022-05-06 15:51 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 21978: Use patron-title for holdfor handling in results (12.26 KB, patch)
2022-05-06 15:51 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 21978: Add middle_name field to the database (5.58 KB, patch)
2022-05-18 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name to api specification (1021 bytes, patch)
2022-05-18 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add support for middle name (27.21 KB, patch)
2022-05-18 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Schema Update (3.20 KB, patch)
2022-05-18 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name into hold request autocomplete (1.19 KB, patch)
2022-05-18 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Use patron-title.inc in request.tt (16.37 KB, patch)
2022-05-18 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Use patron-title for holdfor handling in results (12.26 KB, patch)
2022-05-18 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: (follow-up) Stop passing holdfor_cardnumber (10.42 KB, patch)
2022-05-18 15:19 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: (follow-up) Stop using C4 methods in atomicupdate (2.07 KB, patch)
2022-05-18 15:36 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name field to the database (5.66 KB, patch)
2022-05-19 05:31 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21978: Add middle_name to api specification (1.07 KB, patch)
2022-05-19 05:31 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21978: Add support for middle name (27.32 KB, patch)
2022-05-19 05:31 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21978: Schema Update (3.28 KB, patch)
2022-05-19 05:31 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21978: Add middle_name into hold request autocomplete (1.26 KB, patch)
2022-05-19 05:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21978: Use patron-title.inc in request.tt (16.44 KB, patch)
2022-05-19 05:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21978: Use patron-title for holdfor handling in results (12.35 KB, patch)
2022-05-19 05:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21978: (follow-up) Stop passing holdfor_cardnumber (10.51 KB, patch)
2022-05-19 05:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21978: (follow-up) Stop using C4 methods in atomicupdate (2.14 KB, patch)
2022-05-19 05:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21978: Add middle_name to sysprefs.sql (4.02 KB, patch)
2022-05-19 05:32 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 21978: Add middle_name field to the database (5.65 KB, patch)
2022-06-24 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name to api specification (1.07 KB, patch)
2022-06-24 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add support for middle name (27.32 KB, patch)
2022-06-24 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Schema Update (3.27 KB, patch)
2022-06-24 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name into hold request autocomplete (1.26 KB, patch)
2022-06-24 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Use patron-title.inc in request.tt (16.43 KB, patch)
2022-06-24 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Use patron-title for holdfor handling in results (12.33 KB, patch)
2022-06-24 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: (follow-up) Stop passing holdfor_cardnumber (10.49 KB, patch)
2022-06-24 15:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: (follow-up) Stop using C4 methods in atomicupdate (2.14 KB, patch)
2022-06-24 15:19 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Add middle_name to sysprefs.sql (4.02 KB, patch)
2022-06-24 15:19 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 21978: Fix Selenium tests (5.26 KB, patch)
2022-07-12 08:43 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Brannon 2018-12-07 19:33:36 UTC
We would like there to be a middle name field.  We don't want middle names shown in all cases, but would like it for authentication.  Currently we add the middle name to the first name field.  This is not ideal.  Other names is used for nicknames and such, and not ideal for middle names.
Comment 1 Christopher Brannon 2020-06-10 21:54:31 UTC
I cannot stress enough the importance of this field.  I'm not sure why there is a hold back on this.  I RARELY see a database that doesn't include a field for a middle name.  Yes, I can probably hack something together with attributes, but this is information that really needs to be in the patron record.
Comment 2 Sally 2020-06-11 09:02:42 UTC
+1.  I agree - this would be very useful for librarians.  The current set up leads to lots of confusion.  

Most staff lean to adding as much information as possible, especially with names which are common: e.g.

First name:  John
Last name:  Smith

Becomes:  

First name:  John David
Last name:  Smith

But the addition of the middle name into the first name field means that the patron match feature doesn't work in all scenarios, because Koha (understandably) thinks that John David is a very different name to John.
Comment 3 Katrin Fischer 2020-06-11 10:30:35 UTC
In German we don't have the same concept of a middle name than in the US I think. I've kind of thought that you'd end up using the initials field for the second name that seems common. Would you mind explaining how this usually works?

We've had a request for the 'father's name' as used in Russian (we support some libraries located in Ukraine and Russia) and they have been quite happy with using one of the existing fields we relabelled (not sure if it was alias or initials)

I think requirements are quite different between countries, I'd like to learn more about it.
Comment 4 Sally 2020-06-11 11:02:14 UTC
Hi Katrin,

Ah yes, sorry, I can imagine that the differences between countries are quite pronounced - I think Christopher is in the US, but I'm in the UK.  It's much more common here to have a middle name than not - there's a bit on Wikipedia about it, which refers to the UK and the US:  https://en.wikipedia.org/wiki/Middle_name

Koha has a comprehensive 'borrowersunwantedfield' system preference, so it would be great if we could offer this functionality because for those geographic areas where it's not relevant, it could be easily disabled.

The issues with using Initials / Other Name:

1)  Initials and Other Name are located at the foot of Patron Identity when joining a patron - this is not logical for a middle name, it should be Surname / First Name / Middle Name or First Name / Middle Name / Surname.  

The Patron Identity fields aren't trivial to move around with jquery (I think, please correct me if I'm wrong - I'm fairly new to jquery and happy to learn more).

2)  If using Initials, the patron's middle name is never formatted within the patron's name on the checkout or details pages - it looks bizarre to UK eyes to have Mr John Smith on the details screen, and then the middle name below the patron's phone numbers; all of the names should be grouped together.

3)  If using Other Name, the patron's middle name is bracketed - e.g. John (David) Smith, or quoted:  Mr John Smith (card number) "David" - again, this looks really strange to UK eyes, because quotes and brackets imply that the name is fake or optional.  This makes sense because that field is designed to be for a nickname that the patron prefers to be called - but it doesn't work for middle names at all.  

It's hard to explain, but I guess I would say that when it comes to identity, your middle name is a key part of your name - just as much as your first name or surname is.

It would be great if:

- Koha accepted middle names in a properly designed field
- The middle name input field was located next to first name / surname on the patron identity screen
- The content of the middle name field is displayed in context - e.g. on the details screen, instead of Title / First Name / Surname, it should be Title / First Name / Middle Name / Surname - Mr John David Smith.
- It should be possible for the field to be entered into the borrowersunwantedfield system preference so other regions can switch the feature off
Comment 5 Katrin Fischer 2020-06-11 11:29:16 UTC
Hi Sally, thanks for your answer, that's super helpful!

I actually have multiple surnames too, but it's not so common here to use all of them. For me they only show up on my passport and when trying to enter them for a flight booking (because they insist it should match the passport and then complain when they are too long to fit :) )
Comment 6 Christopher Brannon 2020-06-11 16:27:42 UTC
Sally, thanks for the input.  This helps.

I've played around with othername and initials, and neither appear in search results or suggestions, although you can include them for searching.  This makes distinguishing one patron from the other difficult when this information doesn't show.  And Sally is right...the brackets around the othername doesn't make sense if it is a middle name.

Middle names are used in the US for more formal identification (and some people have multiple middle names), but not commonly used in greetings or business letters.  So, to have a middle name field that is searchable, and shows in searches, and properly laid out, but something that can be excluded in communications and notices, and on screen greetings would be preferred.

Currently we are using othernames for nicknames, like if Mary Jo prefers to be called MJ.  So, we can't really use that.  And initials are not as visible as othernames.  We can always adjust things like that, but as stated above, they are not visible in searches.
Comment 7 Mark Foster 2020-06-11 16:40:20 UTC
+1
Comment 8 Lisette Scheer 2020-06-12 15:32:19 UTC
+1

Especially in a consortium, it is part of how we indicate that this patron is not the same John Smith as the John Smith that lives in one of the other parts of our consortium. We sometimes get complaints from patrons that their notices say "Dear John David" instead of just "Dear John". I agree that having it be next to the first name field would be great and that is should be hidable for libraries that don't want/need it. 

Having it searchable would also be key. 
Lisette
Comment 9 Christopher Brannon 2020-11-10 20:20:11 UTC
I have managed to work around the short comings of the initials field not showing in the search results, but I have to use a report to fix each result in the results table.  I imagine this is taxing on the server, as each time you do a vague patron search, and you end up with 10 possible patrons, for example, the jquery has to run 10 reports to grab the patron info needed.  It doesn't seem to be too slow, but I don't like having to do this for something that is commonplace for the US.

What if we could just get away from the name structures, and have 5 or 6 generic name fields (i.e. Name1, Name2, Name3 etc.), and we can label them in the editor for whatever purpose we need, and on screens they appear in the order that they are used.  For example, Name1 is used as Surname, Name2 is First Name, Name3 is Middle Name, and so on.  Sort will always sort in order of the fields (Name1 first, Name2 next, and so on), and would display similar to how they appear now:

In results:
Name1, Name2 [Name3] [Name4] [Name5] [Name6]

On patron account:
Name2 [Name3] [Name4] [Name5] [Name6] Name1

I suggest keeping othernames, initials, title, and such as is.

Thoughts?
Comment 10 Christopher Brannon 2020-11-10 20:59:17 UTC
(In reply to Christopher Brannon from comment #9)
> I have managed to work around the short comings of the initials field not
> showing in the search results, but I have to use a report to fix each result
> in the results table.  I imagine this is taxing on the server, as each time
> you do a vague patron search, and you end up with 10 possible patrons, for
> example, the jquery has to run 10 reports to grab the patron info needed. 
> It doesn't seem to be too slow, but I don't like having to do this for
> something that is commonplace for the US.

I retract this statement.  My workaround is horrible.  There are latent issue with using the report.  Changes made to the name take forever to refresh.  The name is just to much a part of things to work around with via jQuery.  This is best fixed by an enhancement.
Comment 11 Rebecca Coert 2021-08-13 19:26:56 UTC
+1 
I agree with the group that this would be an extremely useful field to have in Koha.
Comment 12 Christopher Brannon 2021-08-13 20:35:31 UTC
Could someone just simply start off by adding a middle name field in the borrower tables, and putting the field on the patron edit page???  That would be a start.  Please, lets get this ball rolling at least!
Comment 13 Mark Rogers 2021-09-16 14:09:10 UTC
+1 Having a middle name field would be very useful.

I work with a school in Bogotá, Colombia, where most Colombian students and staff also have a second surname (family name), which is treated much like middle (given) names are treated in the US and UK, namely, that they aren't usually used except for legal and disambiguation purposes. Having both "middle name" and "subsequent surnames" fields would be helpful.

So in the case of someone named José Manuel Pérez Rodríguez, that would be

First name: José
Middle name: Manuel
Surname ("last name"): Pérez
Subsequent surnames: Rodríguez

In general usage, the above person would just be called "José Pérez" while official documentation would have his name as "José Manuel Pérez Rodríguez" or "Pérez Rodríguez, José Manuel".

Portuguese names also tend to have multiple surnames, but work opposite Spanish surnames, from what I understand, i.e. that the last surname is typically used in the shortened version of their name. Perhaps a solution like Christopher Brannon's for generic name fields would be best. In order to accommodate different naming conventions, perhaps a configuration field or two could also be added to allow for defining:

 - A "display name" (patron account), e.g.
   "name1 name3" (English-speaking and Spanish-speaking)
   "name1 name4" (Portuguese-speaking)
   "name3 name1" (Korea/China/Japan)

 - A "sort name" (in results), e.g.
   "name 3 [name4], name1 [name2]" (Spanish-speaking countries)
   "name3, name 1 [name2]" (English-speaking)
   "name 3 name1" (Korea/China/Japan)

If we wanted even further configuration, we could even allow for multiple formats to be added as authorized values, with the possibility of setting a default value for the database, with the option to choose a different "display name" or "full name" for individual patrons. But perhaps this is too much customization.

At the very least, having a middle name field and a subsequent surnames field would be very helpful.
Comment 14 Christopher Brannon 2021-09-16 15:07:51 UTC
Mark,
Thank you for your input.  This is very valuable and helpful.  I know our situation is unique to the US, and we do have some patrons with more than three names.  I think anything we can do to make the names more definable and purposeful without lumping a bunch of them in a single field would be a tremendous help and improvement.  The information you gave will help us come together on a good solution.
Comment 15 David Cook 2021-09-16 23:28:41 UTC
(In reply to Christopher Brannon from comment #14)
> I know our
> situation is unique to the US, and we do have some patrons with more than
> three names.  

It's not really unique to the US. It's common to "English" countries like the US, Canada, Australia, New Zealand, and the UK. 

That said, I don't often see fields in Australia for middle name. Typically I see either "First name" and "Last name", or "Given names" and "Last name". Occasionally I'll see a field for middle name. 

I actually have found previously that giving my middle name in situations has led to data errors. For some reason I end up being referred to by my middle name instead of my first name (both in Canada and Australia), so I try to omit it wherever possible.
Comment 16 Christopher Brannon 2022-02-16 22:48:27 UTC
It seems like we've generated a lot of discussion on this.  Would sure love it if this could get off the ground.  Are there any developers who would be interested in giving a bid for this development?
Comment 17 Martin Renvoize 2022-02-17 12:47:12 UTC
I think we need a clear specification before we can attempt this.

It sounds simple of course.. just add a 'middle name' field.. but I'm already seeing a few questions to raise:

1. How do you want this to display in the various places in Koha. (i.e should we always combine these fields and in what order)
2. What features do you want this new field to work with (I already see requests for the patron matching)
3. Should this field be included in the default search fields?
4. How does this field compare to the existing 'othernames' and new 'preferred_name' fields (bug 28633)
Comment 18 Christopher Brannon 2022-02-28 16:10:10 UTC
(In reply to Martin Renvoize from comment #17)
> 1. How do you want this to display in the various places in Koha. (i.e
> should we always combine these fields and in what order)
> 2. What features do you want this new field to work with (I already see
> requests for the patron matching)
> 3. Should this field be included in the default search fields?
> 4. How does this field compare to the existing 'othernames' and new
> 'preferred_name' fields (bug 28633)

1. I think maybe a new field like additional_names could be added, and it could include any other names that should be included that are not firstname or surname, and isn't a othername.
2-3. It should have the option of being included in patron searches.  If so, these names should be included in any list that returns multiple results on patrons in a list, for easy identification, and should be on patron pages.
4.  Othernames does not show on patron search results when you see multiple results.  This is okay.  I don't know what other countries use this for, but at least our libraries use this field for nicknames.  The big difference is that this field is displayed, and othernames is not, on search results.  Othernames also appears somewhat separately from the main name on the patron pages.  This one would show with the other primary names as defined in #5 below.

preferred_name sounds like what WE currently use othernames for, but better.  Since that is becoming a new feature, we could enhance othernames for this purpose, but I wouldn't want to take away what people currently use othernames for, if not for nicknames (preferred_name).  Plus, applying these options to othernames would only allow you to use it one way or the other.  I think a new field (additional_names) would be best.

5. (new) Where ever this name shows, there should be a place to define the order the names show.  Should it be after the firstname when displayed?  After the surname?
Comment 19 Martin Renvoize 2022-04-20 07:27:46 UTC Comment hidden (obsolete)
Comment 20 Martin Renvoize 2022-04-20 07:27:51 UTC Comment hidden (obsolete)
Comment 21 Martin Renvoize 2022-04-20 07:27:56 UTC Comment hidden (obsolete)
Comment 22 Martin Renvoize 2022-04-20 07:28:01 UTC Comment hidden (obsolete)
Comment 23 Martin Renvoize 2022-04-20 07:33:38 UTC Comment hidden (obsolete)
Comment 24 Martin Renvoize 2022-04-20 07:33:43 UTC Comment hidden (obsolete)
Comment 25 Martin Renvoize 2022-04-20 07:33:48 UTC Comment hidden (obsolete)
Comment 26 Martin Renvoize 2022-04-20 07:33:53 UTC Comment hidden (obsolete)
Comment 27 Martin Renvoize 2022-04-20 08:43:35 UTC
I've stuck to the basics here to get the ball rolling and I want to open a new bug for allowing for more fine-grained control over display and search ordering and things... there's some great idea's above around that so I'll copy those in to the new bug too.
Comment 28 Sally 2022-04-20 09:17:23 UTC
Sorry, Martin - patch doesn't apply with the following message:

Applying: Bug 21978: Add support for middle name
.git/rebase-apply/patch:75: trailing whitespace.
            
.git/rebase-apply/patch:155: trailing whitespace.
    [%- ELSE %] 
warning: 2 lines add whitespace errors.
Using index info to reconstruct a base tree...
M	koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc
M	koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
M	koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
.git/rebase-apply/patch:75: trailing whitespace.
            
.git/rebase-apply/patch:155: trailing whitespace.
    [%- ELSE %] 
warning: 2 lines applied after fixing whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
Auto-merging koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc
CONFLICT (content): Merge conflict in koha-tmpl/intranet-tmpl/prog/en/includes/patron-title.inc
error: Failed to merge in the changes.
Patch failed at 0001 Bug 21978: Add support for middle name
Comment 29 Martin Renvoize 2022-04-20 10:43:19 UTC
Created attachment 133453 [details] [review]
Bug 21978: Add middle_name field to the database

This patch adds a new field, middle_name, to the borrowers,
deletedborrowers and borrower_modifications tables.

It also updates the DefaultPatronSearchFields preference to include the
new field if the preference is still set to it's default settings from
install.
Comment 30 Martin Renvoize 2022-04-20 10:43:24 UTC
Created attachment 133454 [details] [review]
Bug 21978: Add middle_name to api specification

This patch adds middle_name to the accaeptable fields in API requests
and responses.

Test plan
1) Search for a user using the API
2) Confirm the API responds with a 200
Comment 31 Martin Renvoize 2022-04-20 10:43:29 UTC
Created attachment 133455 [details] [review]
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
Comment 32 Martin Renvoize 2022-04-20 10:43:34 UTC
Created attachment 133456 [details] [review]
Bug 21978: Schema Update
Comment 33 Martin Renvoize 2022-04-20 10:45:19 UTC
Ooop.. master moved.. rebased for you Sally.
Comment 34 Sally 2022-04-20 14:16:44 UTC
Great, thanks Martin!

It seems as though the patch changes the default patron search from the standard fields to surname only.  To replicate:

1)  Add two patrons called Henry - e.g. Henry Jones and Henry Smith
2)  On the homepage, set the search to 'check out' and search for Henry

Results:  

i)  Note that at least two patrons are returned
ii)  Note that in the 'Search for patron' box on the left, the Search field is listed as 'Standard'
iii)  Note that the search text says:  Patrons found for: Standard containing 'henry'

Add the patch and repeat step 2.

i)  Note that the search brings back no results
ii)  Note that in the 'Search for patron' box on the left, the Search field is listed as 'Surname'
iii)  Note that the search text says:  Patrons found for: Surname containing 'henry'
iv)  Note that if you attempt to change the Search field in the 'Search for patron' box, Standard is not available as an option.
Comment 35 Martin Renvoize 2022-04-21 10:55:30 UTC Comment hidden (obsolete)
Comment 36 Martin Renvoize 2022-04-21 10:55:36 UTC Comment hidden (obsolete)
Comment 37 Martin Renvoize 2022-04-21 10:55:41 UTC Comment hidden (obsolete)
Comment 38 Martin Renvoize 2022-04-21 10:55:46 UTC Comment hidden (obsolete)
Comment 39 Martin Renvoize 2022-04-21 11:04:43 UTC
Good catch Sally, I think I've resolved that here now, but it has lead me to submit a new bug 'Bug 30576 - DefaultPatronSearchFields no longer takes effect' as I think the core feature has broken in the recent patron search changes push.
Comment 40 Martin Renvoize 2022-04-21 12:09:57 UTC Comment hidden (obsolete)
Comment 41 Martin Renvoize 2022-04-21 12:10:03 UTC Comment hidden (obsolete)
Comment 42 Martin Renvoize 2022-04-21 12:10:09 UTC Comment hidden (obsolete)
Comment 43 Martin Renvoize 2022-04-21 12:10:16 UTC Comment hidden (obsolete)
Comment 44 Martin Renvoize 2022-04-21 12:11:01 UTC
Added 30576 as a dependency here and rebased appropriately.  That should fix the DefaultPatronSearchFields preference handling.
Comment 45 Martin Renvoize 2022-04-21 12:17:39 UTC
I'm reconsidering whether this should be hard coded to be included in the autocomplete searches.  Those searches only allow for ten results at a time and adding another field into the mix could actually reduce their relevance.. How often is a staff user going to start typing a middle name in preference to a firstname, surname or cardnumber?

We can still display the middle name in the results to allow easily picking between them, but actually searching on middle name seems like an odd practice..?
Comment 46 Christopher Brannon 2022-04-21 15:56:25 UTC
Some of these were in your test plan and didn't show.  Others were not and need to be considered.

* Middle name does not show when typing name to search for patron when placing hold (request.pl)
* Middle name does not show in dialog at top of hold form (request.pl)
* Middle name does not show in patron details at top of hold form (request.pl)
* Middle name field does not show in opac-memberentry.pl
* Middle name is not an option on SelfModificationBorrowerUnwantedField in preferences.pl
* Middle name is not an option on PatronSelfModificationMandatoryField in preferences.pl
* Middle name is not an option on PatronSelfRegistrationBorrowerMandatoryField in preferences.pl
* Middle name is not an option on PatronSelfRegistrationBorrowerUnwantedField in preferences.pl
* Middle name is not an option on BorrowerUnwantedField in preferences.pl
* Middle name is not an option on BorrowerMandatoryField in preferences.pl
Comment 47 Christopher Brannon 2022-04-21 15:57:37 UTC
Otherwise, everything else looked great.  Searching was not a problem.  Just a few missed areas, and the controls are just not all there for mandatory or unwanted preferences.
Comment 48 Martin Renvoize 2022-04-25 11:49:17 UTC Comment hidden (obsolete)
Comment 49 Martin Renvoize 2022-04-25 11:49:22 UTC Comment hidden (obsolete)
Comment 50 Martin Renvoize 2022-04-25 11:49:28 UTC Comment hidden (obsolete)
Comment 51 Martin Renvoize 2022-04-25 11:49:33 UTC Comment hidden (obsolete)
Comment 52 Martin Renvoize 2022-04-25 11:49:38 UTC Comment hidden (obsolete)
Comment 53 Martin Renvoize 2022-04-25 11:49:45 UTC Comment hidden (obsolete)
Comment 54 Martin Renvoize 2022-04-25 11:49:51 UTC Comment hidden (obsolete)
Comment 55 Martin Renvoize 2022-04-25 11:51:36 UTC
Thanks for the thorough testing.. I think those issues should now all be resolved now :)
Comment 56 Martin Renvoize 2022-04-28 10:12:58 UTC
Not to self, add in 'Sponsored-by: Cheshire Libraries' line.
Comment 57 Martin Renvoize 2022-04-28 13:20:29 UTC Comment hidden (obsolete)
Comment 58 Martin Renvoize 2022-04-28 13:20:36 UTC Comment hidden (obsolete)
Comment 59 Martin Renvoize 2022-04-28 13:20:41 UTC
Created attachment 134256 [details] [review]
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 sysprefs `BorrowerMandatoryFields`, `BorrowerUnwantedFields`,
    `SelfModificationBorrowerUnwantedField`, `PatronSelfModificationMandatoryField`,
    `PatronSelfRegistrationBorrowerMandatoryField` and
    `PatronSelfRegistrationBorrowerUnwantedField` 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
15) Go to tools > patron lists and attempt to add a patron to a list
16) Patrons middle name should appear in the autocomplete here too
Comment 60 Martin Renvoize 2022-04-28 13:20:47 UTC Comment hidden (obsolete)
Comment 61 Martin Renvoize 2022-04-28 13:20:53 UTC Comment hidden (obsolete)
Comment 62 Martin Renvoize 2022-04-28 13:20:59 UTC
Created attachment 134259 [details] [review]
Bug 21978: Use patron-title.inc in request.tt

This patch updates all manual accurences of the patron title display
to use the patron-title.inc include (so we get middlename handling)
in request.tt.

We also add the option to hide the cardnumber from the include and set
the link_to to 'members_pay' to retain the current display format on
this page.

Test plan
You'll need to trigger the following cases to test all cases:
1) Too many holds
2) Account expired
3) Has restrictions
4) Outstanding fines
5) Already has hold on item
6) No holds allowed
7) Too many holds for this record
8) Already in possession
9) Already has a hold
10) Already has a recall
11) Pickup library doesn't many patron home library
Comment 63 Martin Renvoize 2022-04-28 13:21:34 UTC
Rebased and added the sponsorship line
Comment 64 Sally 2022-04-29 13:41:31 UTC
Hi Martin,

The bulk of it is perfect.

I noticed that when you use PatronAutoComplete, first names and surnames will partially match, but middle names won't.

e.g.

- Set up two users:  Henry James Johns and Henry Jameston Johnson
- Do a search for 'Hen' - note that both are returned (Henry and Henry)
- Do a search for 'John' - note that both are returned (Johns and Johnson)
- Do a search for 'James' - note that only Henry James Johns is returned, and Henry Jameston Johnson isn't.

I also noticed a few places where the middle name didn't display; to replicate:

1)
- Load patron account
- Press search to hold
- Perform a search which brings back 2+ items (e.g. 'street')
- Note that on the search results it says:  Place hold for 'Firstname Surname'

2)
- Load patron account
- Press search to hold
- Perform a search
- Open a record
- Press the Place hold button
- Note that the drop down for 'Place hold for patron' doesn't include middle name

3)
- Load patron account
- Accounting
- Make a payment (when patron owes no charges)
- Note that it says 'Firstname Surname has no outstanding fines'
Comment 65 Martin Renvoize 2022-05-03 10:49:42 UTC
Created attachment 134495 [details] [review]
Bug 21978: Use patron-title for holdfor handling in results

This patch update the catalogue search results page to use the
patron-title include to display patron titles for the 'Holds for' line
in results and dropdown list.

Test plan
1) Load patron account
2) Press search to hold
3) Perform a search which brings back 2+ items (e.g. 'street')
4) Note that on the search results it says:  Place hold for 'firstname
   (othername) surname (cardnumber)'
5) Press the Place hold button and note that the dropdown includes
   "Place hold for 'firstname (othername) surname'" and "Forget
   'firstname (othername) surname'"
6) Click through to an item from the results, press the 'Place hold'
   button and note the dropdown includes "Place hold for 'firstname
   (othername) surname'"
Comment 66 Martin Renvoize 2022-05-03 10:52:57 UTC
Hi Sally, 

I've resolved the autocomplete issue you mentioned.. and have added another follow-up to correct the mentioned display issue.

I have a feeling if you dig too deeply you'll find a lot more cases where the display isn't yet taken care of.. I've opened a bug to try and catch all of these occurrences..
Comment 67 Martin Renvoize 2022-05-03 10:53:35 UTC
Created attachment 134497 [details] [review]
Bug 21978: Add middle_name field to the database

This patch adds a new field, middle_name, to the borrowers,
deletedborrowers and borrower_modifications tables.

It also updates the DefaultPatronSearchFields preference to include the
new field if the preference is still set to it's default settings from
install.

Sponsored-by: Cheshire Libraries
Comment 68 Martin Renvoize 2022-05-03 10:53:42 UTC
Created attachment 134498 [details] [review]
Bug 21978: Add middle_name to api specification

This patch adds middle_name to the accaeptable fields in API requests
and responses.

Test plan
1) Search for a user using the API
2) Confirm the API responds with a 200
Comment 69 Martin Renvoize 2022-05-03 10:53:47 UTC
Created attachment 134499 [details] [review]
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 sysprefs `BorrowerMandatoryFields`, `BorrowerUnwantedFields`,
    `SelfModificationBorrowerUnwantedField`, `PatronSelfModificationMandatoryField`,
    `PatronSelfRegistrationBorrowerMandatoryField` and
    `PatronSelfRegistrationBorrowerUnwantedField` 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
15) Go to tools > patron lists and attempt to add a patron to a list
16) Patrons middle name should appear in the autocomplete here too
Comment 70 Martin Renvoize 2022-05-03 10:53:53 UTC
Created attachment 134500 [details] [review]
Bug 21978: Schema Update
Comment 71 Martin Renvoize 2022-05-03 10:53:59 UTC
Created attachment 134501 [details] [review]
Bug 21978: Add middle_name into hold request autocomplete
Comment 72 Martin Renvoize 2022-05-03 10:54:09 UTC
Created attachment 134502 [details] [review]
Bug 21978: Use patron-title.inc in request.tt

This patch updates all manual accurences of the patron title display
to use the patron-title.inc include (so we get middlename handling)
in request.tt.

We also add the option to hide the cardnumber from the include and set
the link_to to 'members_pay' to retain the current display format on
this page.

Test plan
You'll need to trigger the following cases to test all cases:
1) Too many holds
2) Account expired
3) Has restrictions
4) Outstanding fines
5) Already has hold on item
6) No holds allowed
7) Too many holds for this record
8) Already in possession
9) Already has a hold
10) Already has a recall
11) Pickup library doesn't many patron home library
Comment 73 Martin Renvoize 2022-05-03 10:54:16 UTC
Created attachment 134503 [details] [review]
Bug 21978: Use patron-title for holdfor handling in results

This patch update the catalogue search results page to use the
patron-title include to display patron titles for the 'Holds for' line
in results and dropdown list.

Test plan
1) Load patron account
2) Press search to hold
3) Perform a search which brings back 2+ items (e.g. 'street')
4) Note that on the search results it says:  Place hold for 'firstname
   (othername) surname (cardnumber)'
5) Press the Place hold button and note that the dropdown includes
   "Place hold for 'firstname (othername) surname'" and "Forget
   'firstname (othername) surname'"
6) Click through to an item from the results, press the 'Place hold'
   button and note the dropdown includes "Place hold for 'firstname
   (othername) surname'"
Comment 74 Biblibre Sandboxes 2022-05-06 15:50:43 UTC
Created attachment 134745 [details] [review]
Bug 21978: Add middle_name field to the database

This patch adds a new field, middle_name, to the borrowers,
deletedborrowers and borrower_modifications tables.

It also updates the DefaultPatronSearchFields preference to include the
new field if the preference is still set to it's default settings from
install.

Sponsored-by: Cheshire Libraries

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 75 Biblibre Sandboxes 2022-05-06 15:50:49 UTC
Created attachment 134746 [details] [review]
Bug 21978: Add middle_name to api specification

This patch adds middle_name to the accaeptable fields in API requests
and responses.

Test plan
1) Search for a user using the API
2) Confirm the API responds with a 200

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 76 Biblibre Sandboxes 2022-05-06 15:50:55 UTC
Created attachment 134747 [details] [review]
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 sysprefs `BorrowerMandatoryFields`, `BorrowerUnwantedFields`,
    `SelfModificationBorrowerUnwantedField`, `PatronSelfModificationMandatoryField`,
    `PatronSelfRegistrationBorrowerMandatoryField` and
    `PatronSelfRegistrationBorrowerUnwantedField` 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
15) Go to tools > patron lists and attempt to add a patron to a list
16) Patrons middle name should appear in the autocomplete here too

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 77 Biblibre Sandboxes 2022-05-06 15:51:00 UTC
Created attachment 134748 [details] [review]
Bug 21978: Schema Update

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 78 Biblibre Sandboxes 2022-05-06 15:51:06 UTC
Created attachment 134749 [details] [review]
Bug 21978: Add middle_name into hold request autocomplete

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 79 Biblibre Sandboxes 2022-05-06 15:51:12 UTC
Created attachment 134750 [details] [review]
Bug 21978: Use patron-title.inc in request.tt

This patch updates all manual accurences of the patron title display
to use the patron-title.inc include (so we get middlename handling)
in request.tt.

We also add the option to hide the cardnumber from the include and set
the link_to to 'members_pay' to retain the current display format on
this page.

Test plan
You'll need to trigger the following cases to test all cases:
1) Too many holds
2) Account expired
3) Has restrictions
4) Outstanding fines
5) Already has hold on item
6) No holds allowed
7) Too many holds for this record
8) Already in possession
9) Already has a hold
10) Already has a recall
11) Pickup library doesn't many patron home library

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 80 Biblibre Sandboxes 2022-05-06 15:51:18 UTC
Created attachment 134751 [details] [review]
Bug 21978: Use patron-title for holdfor handling in results

This patch update the catalogue search results page to use the
patron-title include to display patron titles for the 'Holds for' line
in results and dropdown list.

Test plan
1) Load patron account
2) Press search to hold
3) Perform a search which brings back 2+ items (e.g. 'street')
4) Note that on the search results it says:  Place hold for 'firstname
   (othername) surname (cardnumber)'
5) Press the Place hold button and note that the dropdown includes
   "Place hold for 'firstname (othername) surname'" and "Forget
   'firstname (othername) surname'"
6) Click through to an item from the results, press the 'Place hold'
   button and note the dropdown includes "Place hold for 'firstname
   (othername) surname'"

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 81 Sally 2022-05-06 15:52:43 UTC
(In reply to Martin Renvoize from comment #66)
> Hi Sally, 
> 
> I've resolved the autocomplete issue you mentioned.. and have added another
> follow-up to correct the mentioned display issue.
> 
> I have a feeling if you dig too deeply you'll find a lot more cases where
> the display isn't yet taken care of.. I've opened a bug to try and catch all
> of these occurrences..

Brilliant, thanks for your work on this, Martin - all working well.  The autocomplete is excellent.  

More than happy to pick up those small instances on another bug.
Comment 82 Jonathan Druart 2022-05-18 13:14:26 UTC
C4::Context->set_preference('DefaultPatronSearchFields', join(',',@default_patron_search_fields) );

Shouldn't we alter the DB directly?
Comment 83 Jonathan Druart 2022-05-18 13:16:43 UTC
Please adjust "Bug 21978: Use patron-title.inc in request.tt" to be consistent with spaces:

-                                    <li><strong>No holds allowed: </strong> 
+                                    <li><strong>No holds allowed:</strong> 

vs

-                                    <li><strong>Too many holds for this record: </strong>
+                                    <li><strong>Too many holds for this record: </strong>
Comment 84 Jonathan Druart 2022-05-18 13:20:06 UTC
* request.tt l. 384 not correctly indented

* In last patch:

-        holdfor => $query->cookie("holdfor"),
-        holdfor_surname => $holdfor_patron->surname,
-        holdfor_firstname => $holdfor_patron->firstname,
+        holdfor            => $query->cookie("holdfor"),
+        holdfor_patron     => $holdfor_patron,
         holdfor_cardnumber => $holdfor_patron->cardnumber,

Why do you keep holdfor_cardnumber?
Comment 85 Jonathan Druart 2022-05-18 13:20:59 UTC
Martin, please provide a fresh patchset quickly, this is almost ready for my PQA stamp!
Comment 86 Martin Renvoize 2022-05-18 15:18:22 UTC
Created attachment 135147 [details] [review]
Bug 21978: Add middle_name field to the database

This patch adds a new field, middle_name, to the borrowers,
deletedborrowers and borrower_modifications tables.

It also updates the DefaultPatronSearchFields preference to include the
new field if the preference is still set to it's default settings from
install.

Sponsored-by: Cheshire Libraries

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 87 Martin Renvoize 2022-05-18 15:18:28 UTC
Created attachment 135148 [details] [review]
Bug 21978: Add middle_name to api specification

This patch adds middle_name to the accaeptable fields in API requests
and responses.

Test plan
1) Search for a user using the API
2) Confirm the API responds with a 200

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 88 Martin Renvoize 2022-05-18 15:18:33 UTC
Created attachment 135149 [details] [review]
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 sysprefs `BorrowerMandatoryFields`, `BorrowerUnwantedFields`,
    `SelfModificationBorrowerUnwantedField`, `PatronSelfModificationMandatoryField`,
    `PatronSelfRegistrationBorrowerMandatoryField` and
    `PatronSelfRegistrationBorrowerUnwantedField` 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
15) Go to tools > patron lists and attempt to add a patron to a list
16) Patrons middle name should appear in the autocomplete here too

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 89 Martin Renvoize 2022-05-18 15:18:38 UTC
Created attachment 135150 [details] [review]
Bug 21978: Schema Update

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 90 Martin Renvoize 2022-05-18 15:18:43 UTC
Created attachment 135151 [details] [review]
Bug 21978: Add middle_name into hold request autocomplete

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 91 Martin Renvoize 2022-05-18 15:18:49 UTC
Created attachment 135152 [details] [review]
Bug 21978: Use patron-title.inc in request.tt

This patch updates all manual accurences of the patron title display
to use the patron-title.inc include (so we get middlename handling)
in request.tt.

We also add the option to hide the cardnumber from the include and set
the link_to to 'members_pay' to retain the current display format on
this page.

Test plan
You'll need to trigger the following cases to test all cases:
1) Too many holds
2) Account expired
3) Has restrictions
4) Outstanding fines
5) Already has hold on item
6) No holds allowed
7) Too many holds for this record
8) Already in possession
9) Already has a hold
10) Already has a recall
11) Pickup library doesn't many patron home library

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 92 Martin Renvoize 2022-05-18 15:18:55 UTC
Created attachment 135153 [details] [review]
Bug 21978: Use patron-title for holdfor handling in results

This patch update the catalogue search results page to use the
patron-title include to display patron titles for the 'Holds for' line
in results and dropdown list.

Test plan
1) Load patron account
2) Press search to hold
3) Perform a search which brings back 2+ items (e.g. 'street')
4) Note that on the search results it says:  Place hold for 'firstname
   (othername) surname (cardnumber)'
5) Press the Place hold button and note that the dropdown includes
   "Place hold for 'firstname (othername) surname'" and "Forget
   'firstname (othername) surname'"
6) Click through to an item from the results, press the 'Place hold'
   button and note the dropdown includes "Place hold for 'firstname
   (othername) surname'"

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>
Comment 93 Martin Renvoize 2022-05-18 15:19:00 UTC
Created attachment 135154 [details] [review]
Bug 21978: (follow-up) Stop passing holdfor_cardnumber

We not longer need to pass holdfor_cardnumber distinctly, we can just
refer to holdfor_patron.cardnumber instead.  This patch does that ;P
Comment 94 Martin Renvoize 2022-05-18 15:19:39 UTC
Doh, I missed the first comment.. brb
Comment 95 Martin Renvoize 2022-05-18 15:36:09 UTC
Created attachment 135155 [details] [review]
Bug 21978: (follow-up) Stop using C4 methods in atomicupdate

We should really only use C4::Context methods where absolutely
necessary.. in this case is was simple to replace the get_preference and
set_preference calls with SQL
Comment 96 Martin Renvoize 2022-05-18 15:39:21 UTC
(In reply to Jonathan Druart from comment #83 and #84)

* Spacing fixed and squashed
* Indents fixed and squashed
* Follow-up added to drop passing for holdfor_cardnumber. Original reason for keeping it was that I hadn't dug enough to spot if it was used more widely.. I've not done that digging and replaced the JS reference to it with the right placeholder too.
* Follow-up added to fix atomicupdate to only use SQL where possible.
Comment 97 Jonathan Druart 2022-05-19 05:31:39 UTC
Created attachment 135180 [details] [review]
Bug 21978: Add middle_name field to the database

This patch adds a new field, middle_name, to the borrowers,
deletedborrowers and borrower_modifications tables.

It also updates the DefaultPatronSearchFields preference to include the
new field if the preference is still set to it's default settings from
install.

Sponsored-by: Cheshire Libraries

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 98 Jonathan Druart 2022-05-19 05:31:46 UTC
Created attachment 135181 [details] [review]
Bug 21978: Add middle_name to api specification

This patch adds middle_name to the accaeptable fields in API requests
and responses.

Test plan
1) Search for a user using the API
2) Confirm the API responds with a 200

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 99 Jonathan Druart 2022-05-19 05:31:52 UTC
Created attachment 135182 [details] [review]
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 sysprefs `BorrowerMandatoryFields`, `BorrowerUnwantedFields`,
    `SelfModificationBorrowerUnwantedField`, `PatronSelfModificationMandatoryField`,
    `PatronSelfRegistrationBorrowerMandatoryField` and
    `PatronSelfRegistrationBorrowerUnwantedField` 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
15) Go to tools > patron lists and attempt to add a patron to a list
16) Patrons middle name should appear in the autocomplete here too

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 100 Jonathan Druart 2022-05-19 05:31:59 UTC
Created attachment 135183 [details] [review]
Bug 21978: Schema Update

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 101 Jonathan Druart 2022-05-19 05:32:04 UTC
Created attachment 135184 [details] [review]
Bug 21978: Add middle_name into hold request autocomplete

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 102 Jonathan Druart 2022-05-19 05:32:10 UTC
Created attachment 135185 [details] [review]
Bug 21978: Use patron-title.inc in request.tt

This patch updates all manual accurences of the patron title display
to use the patron-title.inc include (so we get middlename handling)
in request.tt.

We also add the option to hide the cardnumber from the include and set
the link_to to 'members_pay' to retain the current display format on
this page.

Test plan
You'll need to trigger the following cases to test all cases:
1) Too many holds
2) Account expired
3) Has restrictions
4) Outstanding fines
5) Already has hold on item
6) No holds allowed
7) Too many holds for this record
8) Already in possession
9) Already has a hold
10) Already has a recall
11) Pickup library doesn't many patron home library

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 103 Jonathan Druart 2022-05-19 05:32:16 UTC
Created attachment 135186 [details] [review]
Bug 21978: Use patron-title for holdfor handling in results

This patch update the catalogue search results page to use the
patron-title include to display patron titles for the 'Holds for' line
in results and dropdown list.

Test plan
1) Load patron account
2) Press search to hold
3) Perform a search which brings back 2+ items (e.g. 'street')
4) Note that on the search results it says:  Place hold for 'firstname
   (othername) surname (cardnumber)'
5) Press the Place hold button and note that the dropdown includes
   "Place hold for 'firstname (othername) surname'" and "Forget
   'firstname (othername) surname'"
6) Click through to an item from the results, press the 'Place hold'
   button and note the dropdown includes "Place hold for 'firstname
   (othername) surname'"

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 104 Jonathan Druart 2022-05-19 05:32:22 UTC
Created attachment 135187 [details] [review]
Bug 21978: (follow-up) Stop passing holdfor_cardnumber

We not longer need to pass holdfor_cardnumber distinctly, we can just
refer to holdfor_patron.cardnumber instead.  This patch does that ;P

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 105 Jonathan Druart 2022-05-19 05:32:29 UTC
Created attachment 135188 [details] [review]
Bug 21978: (follow-up) Stop using C4 methods in atomicupdate

We should really only use C4::Context methods where absolutely
necessary.. in this case is was simple to replace the get_preference and
set_preference calls with SQL

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 106 Jonathan Druart 2022-05-19 05:32:35 UTC
Created attachment 135189 [details] [review]
Bug 21978: Add middle_name to sysprefs.sql

And add middle_name at the exact same places for installations with the
default value.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 107 Jonathan Druart 2022-05-19 05:33:00 UTC
Do you agree with this last patch, Martin?
Comment 108 Martin Renvoize 2022-05-19 06:44:20 UTC
Looks great to me Jonathan, thanks for the follow-up
Comment 109 Martin Renvoize 2022-06-24 15:18:13 UTC
Created attachment 136513 [details] [review]
Bug 21978: Add middle_name field to the database

This patch adds a new field, middle_name, to the borrowers,
deletedborrowers and borrower_modifications tables.

It also updates the DefaultPatronSearchFields preference to include the
new field if the preference is still set to it's default settings from
install.

Sponsored-by: Cheshire Libraries

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 110 Martin Renvoize 2022-06-24 15:18:19 UTC
Created attachment 136514 [details] [review]
Bug 21978: Add middle_name to api specification

This patch adds middle_name to the accaeptable fields in API requests
and responses.

Test plan
1) Search for a user using the API
2) Confirm the API responds with a 200

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 111 Martin Renvoize 2022-06-24 15:18:25 UTC
Created attachment 136515 [details] [review]
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 sysprefs `BorrowerMandatoryFields`, `BorrowerUnwantedFields`,
    `SelfModificationBorrowerUnwantedField`, `PatronSelfModificationMandatoryField`,
    `PatronSelfRegistrationBorrowerMandatoryField` and
    `PatronSelfRegistrationBorrowerUnwantedField` 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
15) Go to tools > patron lists and attempt to add a patron to a list
16) Patrons middle name should appear in the autocomplete here too

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 112 Martin Renvoize 2022-06-24 15:18:31 UTC
Created attachment 136516 [details] [review]
Bug 21978: Schema Update

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 113 Martin Renvoize 2022-06-24 15:18:38 UTC
Created attachment 136517 [details] [review]
Bug 21978: Add middle_name into hold request autocomplete

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 114 Martin Renvoize 2022-06-24 15:18:44 UTC
Created attachment 136518 [details] [review]
Bug 21978: Use patron-title.inc in request.tt

This patch updates all manual accurences of the patron title display
to use the patron-title.inc include (so we get middlename handling)
in request.tt.

We also add the option to hide the cardnumber from the include and set
the link_to to 'members_pay' to retain the current display format on
this page.

Test plan
You'll need to trigger the following cases to test all cases:
1) Too many holds
2) Account expired
3) Has restrictions
4) Outstanding fines
5) Already has hold on item
6) No holds allowed
7) Too many holds for this record
8) Already in possession
9) Already has a hold
10) Already has a recall
11) Pickup library doesn't many patron home library

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 115 Martin Renvoize 2022-06-24 15:18:49 UTC
Created attachment 136519 [details] [review]
Bug 21978: Use patron-title for holdfor handling in results

This patch update the catalogue search results page to use the
patron-title include to display patron titles for the 'Holds for' line
in results and dropdown list.

Test plan
1) Load patron account
2) Press search to hold
3) Perform a search which brings back 2+ items (e.g. 'street')
4) Note that on the search results it says:  Place hold for 'firstname
   (othername) surname (cardnumber)'
5) Press the Place hold button and note that the dropdown includes
   "Place hold for 'firstname (othername) surname'" and "Forget
   'firstname (othername) surname'"
6) Click through to an item from the results, press the 'Place hold'
   button and note the dropdown includes "Place hold for 'firstname
   (othername) surname'"

Signed-off-by: Sally <sally.healey@cheshiresharedservices.gov.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 116 Martin Renvoize 2022-06-24 15:18:55 UTC
Created attachment 136520 [details] [review]
Bug 21978: (follow-up) Stop passing holdfor_cardnumber

We not longer need to pass holdfor_cardnumber distinctly, we can just
refer to holdfor_patron.cardnumber instead.  This patch does that ;P

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 117 Martin Renvoize 2022-06-24 15:19:01 UTC
Created attachment 136521 [details] [review]
Bug 21978: (follow-up) Stop using C4 methods in atomicupdate

We should really only use C4::Context methods where absolutely
necessary.. in this case is was simple to replace the get_preference and
set_preference calls with SQL

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 118 Martin Renvoize 2022-06-24 15:19:06 UTC
Created attachment 136522 [details] [review]
Bug 21978: Add middle_name to sysprefs.sql

And add middle_name at the exact same places for installations with the
default value.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 119 Christopher Brannon 2022-06-24 15:28:32 UTC
Passed QA!  This is a huge step forward!  This has been needed for so long!  Thank you Martin for this much needed field!  I am really looking forward to seeing it in production!
Comment 120 Tomás Cohen Arazi 2022-06-24 15:34:07 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 121 Jonathan Druart 2022-07-12 08:33:08 UTC
Did you notice that t/db_dependent/selenium/patrons_search.t was failing?
Comment 122 Jonathan Druart 2022-07-12 08:43:05 UTC
Created attachment 137612 [details] [review]
Bug 21978: Fix Selenium tests
Comment 123 Jonathan Druart 2022-07-12 08:43:42 UTC
Is watching the CI after pushing still a thing or...? :)
Comment 124 Jonathan Druart 2022-07-12 08:44:55 UTC
(In reply to Jonathan Druart from comment #122)
> Created attachment 137612 [details] [review] [review]
> Bug 21978: Fix Selenium tests

This patch is messy but makes the tests pass. I think the behaviours are correct (tested using the UI).
Comment 125 Martin Renvoize 2022-07-12 09:16:18 UTC
I only see TestBuilder failures on Jenkins at the moment.. so hadn't spotted this no... thanks for the patch.. I'll take a look to confirm it makes sense now.
Comment 126 Martin Renvoize 2022-07-12 09:18:40 UTC
Patch makes sense.. why is this only failing on D11 though and not any of the other runs?
Comment 127 Jonathan Druart 2022-07-12 09:50:36 UTC
(In reply to Martin Renvoize from comment #126)
> Patch makes sense.. why is this only failing on D11 though and not any of
> the other runs?

D11 is the only job that has LIGHT_RUN=0 and run the selenium tests (including drop+create of the DB and run webinstaller).
Comment 128 Martin Renvoize 2022-07-12 09:56:08 UTC
Aha, I see.. I'm a little out of date then.. I tended to track D10 as I thought it was still the most complete run.
Comment 129 Tomás Cohen Arazi 2022-07-12 13:27:14 UTC
Thanks for the follow-up, Jonathan!
Comment 130 Lucas Gass 2022-07-29 15:57:53 UTC
Enhancement will not be backported to 22.05.x series
Comment 131 Martin Renvoize 2022-08-26 08:27:24 UTC
I think, beyond screenshot updates, there's nothing really to change here for documentation..