Bug 40245 - Support option to display firstname in patron search results when different than preferred_name
Summary: Support option to display firstname in patron search results when different t...
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: CJ Lynce
QA Contact: Nick Clemens (kidclamp)
URL:
Keywords:
: 40484 (view as bug list)
Depends on: 40995
Blocks:
  Show dependency treegraph
 
Reported: 2025-06-25 18:20 UTC by Chip Halvorsen
Modified: 2025-11-19 01:30 UTC (History)
12 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: Sponsored
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Small patch
Documentation contact: David Nind
Documentation submission: https://gitlab.com/koha-community/koha-manual/-/merge_requests/1118
Text to go in the release notes:
A new system preference 'ShowFirstIfDifferentThanPreferred' toggles the ability for a patron's documented first name to be displayed alongside their Preferred name, when different, during patron search. This allows for library staff to easier identify and distinguish between patron record with similar names or when an ID does not match the patron's preferred name.
Version(s) released in:
25.11.00
Circulation function:


Attachments
Bug 40245: Add new system preference ShowFirstIfDifferentThanPreferred (3.75 KB, patch)
2025-07-22 18:56 UTC, CJ Lynce
Details | Diff | Splinter Review
Bug 40245: Show firstname in patron search results when different than preferred_name (7.96 KB, patch)
2025-07-22 18:57 UTC, CJ Lynce
Details | Diff | Splinter Review
Bug 40245: Show firstname in patron search results when different than preferred_name (8.03 KB, patch)
2025-07-25 14:06 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 40245: Add new system preference ShowFirstIfDifferentThanPreferred (3.82 KB, patch)
2025-07-25 14:07 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 40245: Show firstname in patron search results when different than preferred_name (8.03 KB, patch)
2025-07-25 14:08 UTC, Emily Lamancusa (emlam)
Details | Diff | Splinter Review
Bug 40245: Show firstname in patron search results when different than preferred_name (8.08 KB, patch)
2025-08-20 17:23 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 40245: Add new system preference ShowFirstIfDifferentThanPreferred (3.88 KB, patch)
2025-08-20 17:26 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 40245: Show firstname in patron search results when different than preferred_name (8.08 KB, patch)
2025-08-20 17:26 UTC, Biblibre Sandboxes
Details | Diff | Splinter Review
Bug 40245: Add new system preference ShowFirstIfDifferentThanPreferred (3.95 KB, patch)
2025-09-22 15:45 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 40245: Show firstname in patron search results when different than preferred_name (8.15 KB, patch)
2025-09-22 15:45 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 40245: Add new system preference ShowPatronFirstnameIfDifferentThanPreferredname (4.00 KB, patch)
2025-10-14 15:19 UTC, CJ Lynce
Details | Diff | Splinter Review
Bug 40245: Show firstname in patron search results when different than preferred_name (6.01 KB, patch)
2025-10-14 15:19 UTC, CJ Lynce
Details | Diff | Splinter Review
Bug 40245: Update cypress test to handle ShowPatronFirstnameIfDifferentThanPreferredname (2.52 KB, patch)
2025-10-14 15:20 UTC, CJ Lynce
Details | Diff | Splinter Review
Bug 40245: Update cypress tests to handle ShowPatronFirstnameIfDifferentThanPreferredname (10.06 KB, patch)
2025-10-15 18:51 UTC, CJ Lynce
Details | Diff | Splinter Review
Bug 40245: Add new system preference ShowPatronFirstnameIfDifferentThanPreferredname (4.07 KB, patch)
2025-10-17 17:59 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 40245: Show firstname in patron search results when different than preferred_name (6.08 KB, patch)
2025-10-17 17:59 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 40245: Update cypress test to handle ShowPatronFirstnameIfDifferentThanPreferredname (10.13 KB, patch)
2025-10-17 17:59 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 40245: Add new system preference ShowPatronFirstnameIfDifferentThanPreferredname (4.12 KB, patch)
2025-10-31 11:31 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 40245: Show firstname in patron search results when different than preferred_name (6.14 KB, patch)
2025-10-31 11:31 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 40245: Update cypress test to handle ShowPatronFirstnameIfDifferentThanPreferredname (10.19 KB, patch)
2025-10-31 11:31 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Chip Halvorsen 2025-06-25 18:20:06 UTC
Circulation staff would find it very useful to see firstname in addition to preferred_name in the patron search results table (memberresultst). Currently at 24.11+, only the preferred name is displayed.

One way to handle this might be to add firstname as a line at between address and email address. 

SMITH, KAT 
  123 MAIN ST.
  ANYTOWN, STATE/PROVINCE POSTCODE
Firstname: KATELYNN
Email: X@Y.Z

Or we might want to put the firstname in parenthesis.
SMITH, KAT (Firstname: KATELYNN)
  123 MAIN ST.
  ANYTOWN, STATE/PROVINCE POSTCODE
Email: X@Y.Z

Having the firstname appear somewhere would help disambiguate similar patron names in the search results. Even better would be logic that only displayed the Firstname when it differs from the Preferred_name.

This should be made optional. Some libraries might not want firstname to appear here, to avoid accidentally deadnaming a patron.
Comment 1 CJ Lynce 2025-07-22 18:56:41 UTC
Created attachment 184501 [details] [review]
Bug 40245: Add new system preference ShowFirstIfDifferentThanPreferred

Adds a new system preference ShowFirstIfDifferentThanPreferred to allow a
    patron's firstname to be shown in search results when different than
    their preferred name.
Comment 2 CJ Lynce 2025-07-22 18:57:26 UTC
Created attachment 184502 [details] [review]
Bug 40245: Show firstname in patron search results when different than preferred_name

This patch shows the patron's firstname in search results and autosuggestions when
    thier preferred_name is different than their first name. Requires that sysprep
    ShowFirstIfDifferentThanPreferred is enabled. When disabled, only the preferred
    name shows in results.

Test plan:
0. Apply patches and login to the staff interface.
1. Edit a patron to give a different preferred name than first.
2. Return to home page and search for the patron in the quick-search bar.
3. Verify patron shows up in autosuggest list, showing preferred name only.
4. Verify patron shows up in regular list (member.pl) with preferred name showing only.
5. Change syspref ShowFirstIfDifferentThanPreferred to "Show" and save.
6. Return to home page and search for the patron in the quick-search bar.
7. Verify patron shows up in autosuggest list, showing preferred name, and firstname in brackets.
8. Verify patron shows up in regular list (member.pl) with preferred name, and firstname in brackets.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Comment 3 CJ Lynce 2025-07-24 19:36:17 UTC
*** Bug 40484 has been marked as a duplicate of this bug. ***
Comment 4 Emily Lamancusa (emlam) 2025-07-25 14:06:04 UTC
Created attachment 184637 [details] [review]
Bug 40245: Show firstname in patron search results when different than preferred_name

This patch shows the patron's firstname in search results and autosuggestions when
    thier preferred_name is different than their first name. Requires that sysprep
    ShowFirstIfDifferentThanPreferred is enabled. When disabled, only the preferred
    name shows in results.

Test plan:
0. Apply patches and login to the staff interface.
1. Edit a patron to give a different preferred name than first.
2. Return to home page and search for the patron in the quick-search bar.
3. Verify patron shows up in autosuggest list, showing preferred name only.
4. Verify patron shows up in regular list (member.pl) with preferred name showing only.
5. Change syspref ShowFirstIfDifferentThanPreferred to "Show" and save.
6. Return to home page and search for the patron in the quick-search bar.
7. Verify patron shows up in autosuggest list, showing preferred name, and firstname in brackets.
8. Verify patron shows up in regular list (member.pl) with preferred name, and firstname in brackets.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 5 Emily Lamancusa (emlam) 2025-07-25 14:07:57 UTC
Created attachment 184638 [details] [review]
Bug 40245: Add new system preference ShowFirstIfDifferentThanPreferred

Adds a new system preference ShowFirstIfDifferentThanPreferred to allow a
    patron's firstname to be shown in search results when different than
    their preferred name.

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 6 Emily Lamancusa (emlam) 2025-07-25 14:08:03 UTC
Created attachment 184639 [details] [review]
Bug 40245: Show firstname in patron search results when different than preferred_name

This patch shows the patron's firstname in search results and autosuggestions when
    thier preferred_name is different than their first name. Requires that sysprep
    ShowFirstIfDifferentThanPreferred is enabled. When disabled, only the preferred
    name shows in results.

Test plan:
0. Apply patches and login to the staff interface.
1. Edit a patron to give a different preferred name than first.
2. Return to home page and search for the patron in the quick-search bar.
3. Verify patron shows up in autosuggest list, showing preferred name only.
4. Verify patron shows up in regular list (member.pl) with preferred name showing only.
5. Change syspref ShowFirstIfDifferentThanPreferred to "Show" and save.
6. Return to home page and search for the patron in the quick-search bar.
7. Verify patron shows up in autosuggest list, showing preferred name, and firstname in brackets.
8. Verify patron shows up in regular list (member.pl) with preferred name, and firstname in brackets.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Comment 7 Emily Lamancusa (emlam) 2025-07-25 14:45:02 UTC
Thanks, CJ! This looks nice and works as advertised!

Testing notes:
- After applying patch, run updatedatabase and clear browser cache
Comment 8 Biblibre Sandboxes 2025-08-20 17:23:08 UTC
Created attachment 185601 [details] [review]
Bug 40245: Show firstname in patron search results when different than preferred_name

This patch shows the patron's firstname in search results and autosuggestions when
    thier preferred_name is different than their first name. Requires that sysprep
    ShowFirstIfDifferentThanPreferred is enabled. When disabled, only the preferred
    name shows in results.

Test plan:
0. Apply patches and login to the staff interface.
1. Edit a patron to give a different preferred name than first.
2. Return to home page and search for the patron in the quick-search bar.
3. Verify patron shows up in autosuggest list, showing preferred name only.
4. Verify patron shows up in regular list (member.pl) with preferred name showing only.
5. Change syspref ShowFirstIfDifferentThanPreferred to "Show" and save.
6. Return to home page and search for the patron in the quick-search bar.
7. Verify patron shows up in autosuggest list, showing preferred name, and firstname in brackets.
8. Verify patron shows up in regular list (member.pl) with preferred name, and firstname in brackets.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Chip <chip.halvorsen@westlakelibrary.org>
Comment 9 Chip Halvorsen 2025-08-20 17:25:39 UTC
Tested and everything works as expected.
Comment 10 Biblibre Sandboxes 2025-08-20 17:26:20 UTC
Created attachment 185602 [details] [review]
Bug 40245: Add new system preference ShowFirstIfDifferentThanPreferred

Adds a new system preference ShowFirstIfDifferentThanPreferred to allow a
    patron's firstname to be shown in search results when different than
    their preferred name.

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Chip <chip.halvorsen@westlakelibrary.org>
Comment 11 Biblibre Sandboxes 2025-08-20 17:26:22 UTC
Created attachment 185603 [details] [review]
Bug 40245: Show firstname in patron search results when different than preferred_name

This patch shows the patron's firstname in search results and autosuggestions when
    thier preferred_name is different than their first name. Requires that sysprep
    ShowFirstIfDifferentThanPreferred is enabled. When disabled, only the preferred
    name shows in results.

Test plan:
0. Apply patches and login to the staff interface.
1. Edit a patron to give a different preferred name than first.
2. Return to home page and search for the patron in the quick-search bar.
3. Verify patron shows up in autosuggest list, showing preferred name only.
4. Verify patron shows up in regular list (member.pl) with preferred name showing only.
5. Change syspref ShowFirstIfDifferentThanPreferred to "Show" and save.
6. Return to home page and search for the patron in the quick-search bar.
7. Verify patron shows up in autosuggest list, showing preferred name, and firstname in brackets.
8. Verify patron shows up in regular list (member.pl) with preferred name, and firstname in brackets.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Chip <chip.halvorsen@westlakelibrary.org>
Comment 12 Laura Escamilla 2025-09-22 15:45:29 UTC
Created attachment 186732 [details] [review]
Bug 40245: Add new system preference ShowFirstIfDifferentThanPreferred

Adds a new system preference ShowFirstIfDifferentThanPreferred to allow a
    patron's firstname to be shown in search results when different than
    their preferred name.

Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Chip <chip.halvorsen@westlakelibrary.org>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 13 Laura Escamilla 2025-09-22 15:45:32 UTC
Created attachment 186733 [details] [review]
Bug 40245: Show firstname in patron search results when different than preferred_name

This patch shows the patron's firstname in search results and autosuggestions when
    thier preferred_name is different than their first name. Requires that sysprep
    ShowFirstIfDifferentThanPreferred is enabled. When disabled, only the preferred
    name shows in results.

Test plan:
0. Apply patches and login to the staff interface.
1. Edit a patron to give a different preferred name than first.
2. Return to home page and search for the patron in the quick-search bar.
3. Verify patron shows up in autosuggest list, showing preferred name only.
4. Verify patron shows up in regular list (member.pl) with preferred name showing only.
5. Change syspref ShowFirstIfDifferentThanPreferred to "Show" and save.
6. Return to home page and search for the patron in the quick-search bar.
7. Verify patron shows up in autosuggest list, showing preferred name, and firstname in brackets.
8. Verify patron shows up in regular list (member.pl) with preferred name, and firstname in brackets.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Chip <chip.halvorsen@westlakelibrary.org>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Comment 14 Lucas Gass (lukeg) 2025-10-09 20:42:35 UTC
Should we add a Cypress test?
Comment 15 Jonathan Druart 2025-10-10 03:36:54 UTC
I think we should have "Patron" and "Firstname" in the name of the pref. The current version "ShowFirstIfDifferentThanPreferred" is confusing IMO.
Comment 16 Jonathan Druart 2025-10-10 03:52:00 UTC
1. What does "showlegal" mean?

2.
  var showFirstIfDifferentThanPreferred = [% Koha.Preference('ShowFirstIfDifferentThanPreferred') | html %];

Should be 
  var showFirstIfDifferentThanPreferred = [% Koha.Preference('ShowFirstIfDifferentThanPreferred') ? 1 : 0 | html %];

To prevent a JS error if the pref is not set.

3. js-patron-format.inc is going to be removed on bug 40958, in favor of a js file, and the TT variable won't be accessible. Why don't you pass the "showFirstIfDifferentThanPreferred" flag from the patron search if the pref is set? You won't need to check the pref in the inc file

4. Commit message states that it affects "search results and autosuggestions" but it's actually all patron searches (bug title should also be adjusted)

5.
(In reply to Lucas Gass (lukeg) from comment #14)
> Should we add a Cypress test?

Yes, that would be great!
Comment 17 Jonathan Druart 2025-10-10 03:53:12 UTC
Feel free to ask if you have questions or need help!
Comment 18 CJ Lynce 2025-10-10 13:34:25 UTC
(In reply to Jonathan Druart from comment #16)
> 1. What does "showlegal" mean?
Show legal name (vs nickname or dead name), though in retrospect, 'showfirstname' would be more appropriate and match other language. 

> 2. [...]
Thanks for catching, I'll make that change (and remember for next time)

> 3. [...]
Good idea, and thanks for pointing out bug 40958. I'll adjust to incorporate those changes.

> 4. Commit message states that it affects "search results and
> autosuggestions" but it's actually all patron searches (bug title should
> also be adjusted)

Thanks and good point, I will adjust. 

> 5.
> (In reply to Lucas Gass (lukeg) from comment #14)
> > Should we add a Cypress test?

I might need some help on this one, I've not written Cypress tests before. Is there a past bug or two that has some good Koha-related examples to look at?

Thanks!
Comment 19 CJ Lynce 2025-10-10 17:16:51 UTC
(In reply to Jonathan Druart from comment #15)
> I think we should have "Patron" and "Firstname" in the name of the pref. The
> current version "ShowFirstIfDifferentThanPreferred" is confusing IMO.

Is there a limit on how long a system pref name could/should be? 
ShowPatronFirstnameIfDifferentThanPreferredname is more clear, but long (48 chr)
It is shorter than PatronSelfRegistrationExpireTemporaryAccountsDelay (51 chr)
Comment 20 Jonathan Druart 2025-10-13 13:29:43 UTC
(In reply to CJ Lynce from comment #18)
> (In reply to Jonathan Druart from comment #16)
> > 5.
> > (In reply to Lucas Gass (lukeg) from comment #14)
> > > Should we add a Cypress test?
> 
> I might need some help on this one, I've not written Cypress tests before.
> Is there a past bug or two that has some good Koha-related examples to look
> at?

I have spent some time to write some tests for main. And all the bugs in the queue should be based on it. See bug 41003.
You will see that your patch breaks it (because of the changes in autocomplete, other_name is now missing)

We already have:
Bug 40958 - Move patron_to_html (from js-patron-format.inc) to a standalone JS file
Bug 40995 - Patron search autocomplete adds extraneous spacing and punctuation when patron lacks surname

In this second one I suggested to use patron-format for the autocomplete result. I think it is good for this change (40245) actually: you won't need to adjust much patron_autocomplete, only to pass the "show first if different" flag.

(In reply to CJ Lynce from comment #19)
> (In reply to Jonathan Druart from comment #15)
> > I think we should have "Patron" and "Firstname" in the name of the pref. The
> > current version "ShowFirstIfDifferentThanPreferred" is confusing IMO.
> 
> Is there a limit on how long a system pref name could/should be? 
> ShowPatronFirstnameIfDifferentThanPreferredname is more clear, but long (48
> chr)
> It is shorter than PatronSelfRegistrationExpireTemporaryAccountsDelay (51
> chr)

The max length is 50.
And PatronSelfRegistrationExpireTemporaryAccountsDelay is 50 char length ;)
Comment 21 CJ Lynce 2025-10-14 15:19:36 UTC
Created attachment 187891 [details] [review]
Bug 40245: Add new system preference ShowPatronFirstnameIfDifferentThanPreferredname

Adds a new system preference ShowPatronFirstnameIfDifferentThanPreferredname
	to allow a patron's firstname to be shown in search results when
	different than their preferred name.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Comment 22 CJ Lynce 2025-10-14 15:19:58 UTC
Created attachment 187892 [details] [review]
Bug 40245: Show firstname in patron search results when different than preferred_name

This patch shows the patron's firstname in patron search results and autosuggestions
	when the patrons preferred_name is different than their first name. Requires that
	the ShowPatronFirstnameIfDifferentThanPreferredname system preference is enabled.

Test plan:
0. Apply patches and login to the staff interface.
1. Edit a patron to give a different preferred name than firstname.
2. Return to home page and search for the patron in the quick-search bar.
3. Verify patron shows up in autosuggest list, showing preferred name only.
4. Verify patron shows up in regular list (member.pl) with preferred name showing only.
5. Change syspref ShowFirstIfDifferentThanPreferred to "Show" and save.
6. Return to home page and search for the patron in the quick-search bar.
7. Verify patron shows up in autosuggest list, showing preferred name, and firstname in brackets.
8. Verify patron shows up in regular list (member.pl) with preferred name, and firstname in brackets.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Comment 23 CJ Lynce 2025-10-14 15:20:57 UTC
Created attachment 187893 [details] [review]
Bug 40245: Update cypress test to handle ShowPatronFirstnameIfDifferentThanPreferredname

Updates patron format cypress tests to allow for ShowPatronFirstnameIfDifferentThanPreferredname
Comment 24 CJ Lynce 2025-10-14 15:27:51 UTC
These new patches incorporate previous suggestions. Additionally, I changed the display behavior of the `Firstname` when the feature is turned on and preferred_name is different for a patron; it now displays in addition to the `othernames`, and not instead of `othernames` as it did originally. It adds slightly to the length of the overall patron name in search results, but will better accommodate organizations that use both `preferred_name` and `othernames`.

For the Cypress tests, I adjusted the existing patron displays tests from previous bugs (bug 40995, bug 32176, bug 41003), to accommodate the addition of `preferred_name`. 

I welcome any feedback! Thanks for the help and suggestions thus far.
Comment 25 CJ Lynce 2025-10-15 18:51:45 UTC
Created attachment 187943 [details] [review]
Bug 40245: Update cypress tests to handle ShowPatronFirstnameIfDifferentThanPreferredname

Updates patron format cypress tests to allow for ShowPatronFirstnameIfDifferentThanPreferredname

Test Plan:
-Install Patch
-On command line, in koha root directory, run `cypress run --spec t/cypress/integration/Patron/Format.ts`
-Check to make all tests pass
Comment 26 Andrew Fuerste-Henry 2025-10-17 17:59:48 UTC
Created attachment 188112 [details] [review]
Bug 40245: Add new system preference ShowPatronFirstnameIfDifferentThanPreferredname

Adds a new system preference ShowPatronFirstnameIfDifferentThanPreferredname
	to allow a patron's firstname to be shown in search results when
	different than their preferred name.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Comment 27 Andrew Fuerste-Henry 2025-10-17 17:59:51 UTC
Created attachment 188113 [details] [review]
Bug 40245: Show firstname in patron search results when different than preferred_name

This patch shows the patron's firstname in patron search results and autosuggestions
	when the patrons preferred_name is different than their first name. Requires that
	the ShowPatronFirstnameIfDifferentThanPreferredname system preference is enabled.

Test plan:
0. Apply patches and login to the staff interface.
1. Edit a patron to give a different preferred name than firstname.
2. Return to home page and search for the patron in the quick-search bar.
3. Verify patron shows up in autosuggest list, showing preferred name only.
4. Verify patron shows up in regular list (member.pl) with preferred name showing only.
5. Change syspref ShowFirstIfDifferentThanPreferred to "Show" and save.
6. Return to home page and search for the patron in the quick-search bar.
7. Verify patron shows up in autosuggest list, showing preferred name, and firstname in brackets.
8. Verify patron shows up in regular list (member.pl) with preferred name, and firstname in brackets.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Comment 28 Andrew Fuerste-Henry 2025-10-17 17:59:54 UTC
Created attachment 188114 [details] [review]
Bug 40245: Update cypress test to handle ShowPatronFirstnameIfDifferentThanPreferredname

Updates patron format cypress tests to allow for ShowPatronFirstnameIfDifferentThanPreferredname

Test Plan:
-Install Patch
-On command line, in koha root directory, run `cypress run --spec t/cypress/integration/Patron/Format.ts`
-Check to make all tests pass

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Comment 29 Nick Clemens (kidclamp) 2025-10-31 11:31:41 UTC
Created attachment 188811 [details] [review]
Bug 40245: Add new system preference ShowPatronFirstnameIfDifferentThanPreferredname

Adds a new system preference ShowPatronFirstnameIfDifferentThanPreferredname
	to allow a patron's firstname to be shown in search results when
	different than their preferred name.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 30 Nick Clemens (kidclamp) 2025-10-31 11:31:44 UTC
Created attachment 188812 [details] [review]
Bug 40245: Show firstname in patron search results when different than preferred_name

This patch shows the patron's firstname in patron search results and autosuggestions
	when the patrons preferred_name is different than their first name. Requires that
	the ShowPatronFirstnameIfDifferentThanPreferredname system preference is enabled.

Test plan:
0. Apply patches and login to the staff interface.
1. Edit a patron to give a different preferred name than firstname.
2. Return to home page and search for the patron in the quick-search bar.
3. Verify patron shows up in autosuggest list, showing preferred name only.
4. Verify patron shows up in regular list (member.pl) with preferred name showing only.
5. Change syspref ShowFirstIfDifferentThanPreferred to "Show" and save.
6. Return to home page and search for the patron in the quick-search bar.
7. Verify patron shows up in autosuggest list, showing preferred name, and firstname in brackets.
8. Verify patron shows up in regular list (member.pl) with preferred name, and firstname in brackets.

Sponsored-by: Westlake Porter Public Library <https://westlakelibrary.org>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 31 Nick Clemens (kidclamp) 2025-10-31 11:31:47 UTC
Created attachment 188813 [details] [review]
Bug 40245: Update cypress test to handle ShowPatronFirstnameIfDifferentThanPreferredname

Updates patron format cypress tests to allow for ShowPatronFirstnameIfDifferentThanPreferredname

Test Plan:
-Install Patch
-On command line, in koha root directory, run `cypress run --spec t/cypress/integration/Patron/Format.ts`
-Check to make all tests pass

Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 32 Lucas Gass (lukeg) 2025-11-07 17:55:54 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 33 David Nind 2025-11-19 01:30:37 UTC
I've updated the manual with the new system preference https://koha-community.org/manual/latest/en/html/patronspreferences.html#showpatronfirstnameifdifferentthanpreferredname-label