Bug 33117 - Patron checkout search not working if searching with second surname
Summary: Patron checkout search not working if searching with second surname
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: 22.11
Hardware: All All
: P5 - low normal with 2 votes (vote)
Assignee: Laura Escamilla
QA Contact: Testopia
URL:
Keywords:
Depends on: 32772
Blocks:
  Show dependency treegraph
 
Reported: 2023-03-02 17:18 UTC by Isabel Pineda
Modified: 2023-03-23 18:41 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 33117: Added new syspref Patronautocompletesesarchmethod (10.94 KB, patch)
2023-03-09 17:11 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (10.95 KB, patch)
2023-03-09 19:14 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (12.72 KB, patch)
2023-03-10 16:55 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (13.15 KB, patch)
2023-03-13 17:12 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (14.91 KB, patch)
2023-03-13 19:03 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (14.90 KB, patch)
2023-03-16 17:14 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (14.87 KB, patch)
2023-03-16 17:30 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (14.84 KB, patch)
2023-03-16 17:42 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (14.88 KB, patch)
2023-03-16 18:07 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (15.04 KB, patch)
2023-03-17 12:51 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (15.37 KB, patch)
2023-03-17 18:15 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (15.32 KB, patch)
2023-03-17 19:07 UTC, ByWater Sandboxes
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (15.39 KB, patch)
2023-03-21 12:20 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (14.88 KB, patch)
2023-03-21 12:44 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (14.26 KB, patch)
2023-03-21 13:23 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 33117: Added new syspref Patronautocompletesesarchmethod (14.32 KB, patch)
2023-03-21 14:51 UTC, ByWater Sandboxes
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Isabel Pineda 2023-03-02 17:18:36 UTC
We are running Koha 22.11.03 in Spanish, and today I have found a problem if I search for a patron in the staff interface with the “checkout” search (“préstamo”). 

In Spanish speaking countries, people usually have 2 surnames. When I create a new user, I write both surnames in the “surname” field and both given names in the “First name” field.

If I enter the name or parts of it in the “checkout” search, without hitting Enter, I get a list of results where I can choose from. It used to be possible in previous versions to search for patrons using the first name and the second surname. Today I found that this is not possible anymore. For example, if there is a patron with the name “Carla María Ramírez Hernández”, I find her if I search with “Carla Ramírez”, but not if I search with “Carla Hernández”. It doesn´t work either if I search with the second given name and first surname (“María Ramírez”).
Comment 1 Jonathan Druart 2023-03-07 09:50:04 UTC
Regression caused by bug 32772.
Comment 2 Nick Clemens 2023-03-07 12:09:23 UTC
(In reply to Jonathan Druart from comment #1)
> Regression caused by bug 32772.

The previous behvaiour is still possible, it now requires entering a wildcard before your term, e.g.:
%María %Ramírez

It's a trade off, some libraries were getting too many results, now some are getting too few. We went towards a default of 'starts with' because it allowed wildcard use to replicate previous behvaiour

I would support a switch (syspref) to allow choosing 'starts with' or 'contains' as the default for patron searching.
Comment 3 Isabel Pineda 2023-03-07 13:00:29 UTC
> I would support a switch (syspref) to allow choosing 'starts with' or 'contains' as the default for patron searching.


I would like to support this too. In our library we are dealing very often with little children who don't know all of their first and last names, which makes the search very slow when the autocomplete doesn't work the way it used to.

Thank you.
Comment 4 Laura Escamilla 2023-03-09 17:11:35 UTC Comment hidden (obsolete)
Comment 5 Laura Escamilla 2023-03-09 17:15:45 UTC
Caught an error. I will work on updating the patch.
Comment 6 Laura Escamilla 2023-03-09 19:14:04 UTC Comment hidden (obsolete)
Comment 7 Laura Escamilla 2023-03-10 16:55:10 UTC Comment hidden (obsolete)
Comment 8 Laura Escamilla 2023-03-13 17:12:19 UTC Comment hidden (obsolete)
Comment 9 Tomás Cohen Arazi 2023-03-13 18:19:22 UTC
Hi, Laura. I see the ticket still 'ASSIGNED', is it ready for testers to look at it?
Comment 10 Laura Escamilla 2023-03-13 19:03:22 UTC
Created attachment 148138 [details] [review]
Bug 33117: Added new syspref Patronautocompletesesarchmethod

Added a new system preference called "PatronAutoCompleteSearchMethod"
which allows staff to choose between "Starts with" or "Contains" when
searching for patrons. The "Contains" option should be useful when
searching for patrons that have multiple surnames or when searching
using a patron's middle name.

Test Plan:
1. Create a patron that has a first name, middle name and two surnames. (i.e. Adela Maria, Hernandez Acosta).
2. Search for the patron using their first name and first surname. Confirm that a record is found.
3. Search for the patron using their first name and second surname. Confirm that no record is found.
4. Search for the patron using their middle name and first surname. Confirm that a record is found.
5. Search for the patron using their middle name and second surname. Confirm that no record is found.
6. Apply the patch.
7. Under Administration > Global System Preferences > search for “PatronAutocompleteSearchMethod”
8. Choose “Contains” instead of “Starts with” for the system preference.
9. Repeat steps 2-4. The patron record should appear for all search methods.
10. Sign off!
Comment 11 Laura Escamilla 2023-03-13 19:04:49 UTC
(In reply to Tomás Cohen Arazi from comment #9)
> Hi, Laura. I see the ticket still 'ASSIGNED', is it ready for testers to
> look at it?

Hi Tomas. Not quite yet! I haven't switched it to Needs Signoff because I'm still working on it.
Comment 12 Laura Escamilla 2023-03-16 17:14:23 UTC Comment hidden (obsolete)
Comment 13 Laura Escamilla 2023-03-16 17:30:02 UTC Comment hidden (obsolete)
Comment 14 Laura Escamilla 2023-03-16 17:42:52 UTC Comment hidden (obsolete)
Comment 15 Laura Escamilla 2023-03-16 18:07:37 UTC Comment hidden (obsolete)
Comment 16 Laura Escamilla 2023-03-17 12:51:59 UTC Comment hidden (obsolete)
Comment 17 Laura Escamilla 2023-03-17 18:15:45 UTC
Created attachment 148383 [details] [review]
Bug 33117: Added new syspref Patronautocompletesesarchmethod

Added a new system preference called "PatronAutoCompleteSearchMethod"
which allows staff to choose between "Starts with" or "Contains" when
searching for patrons. The "Contains" option should be useful when
searching for patrons that have multiple surnames or when searching
using a patron's middle name.

Test Plan:
1. Create a patron that has a first name, middle name and two surnames. (i.e. Adela Maria, Hernandez Acosta).
2. Search for the patron using their first name and first surname. Confirm that a record is found.
3. Search for the patron using their first name and second surname. Confirm that no record is found.
4. Search for the patron using their middle name and first surname. Confirm that a record is found.
5. Search for the patron using their middle name and second surname. Confirm that no record is found.
6. Apply the patch.
7. Under Administration > Global System Preferences > search for “PatronAutocompleteSearchMethod”
8. Choose “Contains” instead of “Starts with” for the system preference.
9. Repeat steps 2-4. The patron record should appear for all search methods.
10. Sign off!
Comment 18 ByWater Sandboxes 2023-03-17 19:07:49 UTC
Created attachment 148384 [details] [review]
Bug 33117: Added new syspref Patronautocompletesesarchmethod

Added a new system preference called "PatronAutoCompleteSearchMethod"
which allows staff to choose between "Starts with" or "Contains" when
searching for patrons. The "Contains" option should be useful when
searching for patrons that have multiple surnames or when searching
using a patron's middle name.

Test Plan:
1. Create a patron that has a first name, middle name and two surnames. (i.e. Adela Maria, Hernandez Acosta).
2. Search for the patron using their first name and first surname. Confirm that a record is found.
3. Search for the patron using their first name and second surname. Confirm that no record is found.
4. Search for the patron using their middle name and first surname. Confirm that a record is found.
5. Search for the patron using their middle name and second surname. Confirm that no record is found.
6. Apply the patch.
7. Under Administration > Global System Preferences > search for “PatronAutocompleteSearchMethod”
8. Choose “Contains” instead of “Starts with” for the system preference.
9. Repeat steps 2-4. The patron record should appear for all search methods.
10. Sign off!

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 19 Laura Escamilla 2023-03-21 12:20:50 UTC Comment hidden (obsolete)
Comment 20 Laura Escamilla 2023-03-21 12:44:44 UTC
Created attachment 148445 [details] [review]
Bug 33117: Added new syspref Patronautocompletesesarchmethod

*Made a few minor syntax changes*

Added a new system preference called "PatronAutoCompleteSearchMethod"
which allows staff to choose between "Starts with" or "Contains" when
searching for patrons. The "Contains" option should be useful when
searching for patrons that have multiple surnames or when searching
using a patron's middle name.

New Test Plan:
 0. Ensure system preference PatronAutoComplete is set to Try
 1. Create a patron that has a first name, middle name and two surnames. (i.e. Adela Maria, Hernandez Acosta).
 2. In patron or checkout search, enter their first name and first surname without submitting.
 3. Confirm that a record is found in the autocomplete results
 4. In patron or checkout search, enter their first name and second surname without submitting.
 5. Confirm that no record is found.
 6. Enter their middle name and first surname. Confirm that no record is found.
 7. Enter their middle name and second surname. Confirm that no record is found.
 8. Apply the patch, update database
 9. Under Administration > Global System Preferences > search for "PatronAutocompleteSearchMethod"
10. Choose "Contains" instead of "Starts with" for the system preference.
11. Repeat steps 2-4. The patron record should appear for all search methods.
12. Sign off!
Comment 21 Nick Clemens 2023-03-21 13:23:02 UTC
Created attachment 148467 [details] [review]
Bug 33117: Added new syspref Patronautocompletesesarchmethod

This patch adds a new system preference called "PatronAutoCompleteSearchMethod"
which allows staff to choose between "Starts with" or "Contains" when
searching for patrons.

The "Contains" option should be useful when
searching for patrons that have multiple surnames or when searching
using a patron's middle name.

New Test Plan:
 0. Ensure system preference PatronAutoComplete is set to Try
 1. Create a patron that has a first name, middle name and two surnames. (i.e. Adela Maria, Hernandez Acosta).
 2. In patron or checkout search, enter their first name and first surname without submitting.
 3. Confirm that a record is found in the autocomplete results
 4. In patron or checkout search, enter their first name and second surname without submitting.
 5. Confirm that no record is found.
 6. Enter their middle name and first surname. Confirm that no record is found.
 7. Enter their middle name and second surname. Confirm that no record is found.
 8. Apply the patch, update database
 9. Under Administration > Global System Preferences > search for "PatronAutocompleteSearchMethod"
10. Choose "Contains" instead of "Starts with" for the system preference, reload your search page
11. Repeat steps 2-4. The patron record should appear for all search methods.
12. Sign off!
Comment 22 ByWater Sandboxes 2023-03-21 14:51:19 UTC
Created attachment 148481 [details] [review]
Bug 33117: Added new syspref Patronautocompletesesarchmethod

This patch adds a new system preference called "PatronAutoCompleteSearchMethod"
which allows staff to choose between "Starts with" or "Contains" when
searching for patrons.

The "Contains" option should be useful when
searching for patrons that have multiple surnames or when searching
using a patron's middle name.

New Test Plan:
 0. Ensure system preference PatronAutoComplete is set to Try
 1. Create a patron that has a first name, middle name and two surnames. (i.e. Adela Maria, Hernandez Acosta).
 2. In patron or checkout search, enter their first name and first surname without submitting.
 3. Confirm that a record is found in the autocomplete results
 4. In patron or checkout search, enter their first name and second surname without submitting.
 5. Confirm that no record is found.
 6. Enter their middle name and first surname. Confirm that no record is found.
 7. Enter their middle name and second surname. Confirm that no record is found.
 8. Apply the patch, update database
 9. Under Administration > Global System Preferences > search for "PatronAutocompleteSearchMethod"
10. Choose "Contains" instead of "Starts with" for the system preference, reload your search page
11. Repeat steps 2-4. The patron record should appear for all search methods.
12. Sign off!

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 23 Andrew Fuerste-Henry 2023-03-21 14:52:35 UTC
I also confirmed that the searches in steps 5 and 6 both work with PatronAutocompleteSearchMethod set to Contains and then leaving PatronAutocompleteSearchMethod set to Starts With maintains all of the pre-patch behavior.
Comment 24 Jonathan Druart 2023-03-22 13:14:32 UTC
Why are you passing the syspref value to the patron_autocomplete JS function, instead of retrieving the value from there?

I think you should create a global JS variable (in doc-head-close.inc for instance), then use it when you need it in patron_autocomplete.

Also you are using TT syntax in 2 js files (tags-review.js and viewlog.js), it won't work.
Comment 25 Laura Escamilla 2023-03-23 18:41:34 UTC
(In reply to Jonathan Druart from comment #24)
> Why are you passing the syspref value to the patron_autocomplete JS
> function, instead of retrieving the value from there?
> 
> I think you should create a global JS variable (in doc-head-close.inc for
> instance), then use it when you need it in patron_autocomplete.
> 
> Also you are using TT syntax in 2 js files (tags-review.js and viewlog.js),
> it won't work.


Thanks for the feedback. I'll look into how to adjust this.