Bug 39427 - Searching lists table by owner can only enter firstname or surname
Summary: Searching lists table by owner can only enter firstname or surname
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Lists (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Laura Escamilla
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-23 16:55 UTC by Nick Clemens (kidclamp)
Modified: 2025-06-24 15:07 UTC (History)
5 users (show)

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


Attachments
Bug 39427: Split the argument for both name fields to be searched (1.33 KB, patch)
2025-05-20 13:13 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 39427: Unit tests (3.02 KB, patch)
2025-05-20 13:13 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 39427: Split the argument for both name fields to be searched and added regex for spacing (950 bytes, patch)
2025-06-09 13:37 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 39427: Split the argument for both name fields to be searched and added regex for spacing (950 bytes, patch)
2025-06-10 13:20 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 39427: Unit tests (3.94 KB, patch)
2025-06-10 13:21 UTC, Laura Escamilla
Details | Diff | Splinter Review
To test: (5.71 KB, patch)
2025-06-24 13:08 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 39427: Searching lists table by owner can only enter firstname or surname (5.68 KB, patch)
2025-06-24 13:09 UTC, Laura Escamilla
Details | Diff | Splinter Review
Bug 39427: Searching lists table by owner can only enter firstname or surname (5.68 KB, patch)
2025-06-24 15:06 UTC, David Flater
Details | Diff | Splinter Review
Bug 39427: (follow-up) Adjust number of tests (730 bytes, patch)
2025-06-24 15:06 UTC, David Flater
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2025-03-23 16:55:12 UTC
C4/Utils/DataTables/VirtualShelves.pm
 61     if ( defined $shelfname and $shelfname ne '' ) {
 62         push @where_strs, 'shelfname LIKE ?';
 63         push @args,       "%$shelfname%";
 64     }

We don't split the argument, so only either of the fields can be searched
Comment 1 Laura Escamilla 2025-05-20 13:13:12 UTC
Created attachment 182674 [details] [review]
Bug 39427: Split the argument for both name fields to be searched
Comment 2 Laura Escamilla 2025-05-20 13:13:15 UTC
Created attachment 182675 [details] [review]
Bug 39427: Unit tests

To test:
1. Ensure that the virtual shelves system preference is enabled
2. Create one or two lists using a patron that has both a first and last name. You don’t have to add items to the list, the list itself is enough.
3. Under the Owner column in the Lists table search using the patron’s first name. Note that the name is properly filtered.
4. Next try to search by the last name. It is also properly filtered.
5. Now search using both the first name and the last name together. Note that the results come up empty.
6. Apply the patch.
7. Repeat steps 3-5. Note that the patron shows in the results with just the first name, the last name, and the full name.
8. Run t/db_dependent/Virtualshelves.t
9. Sign off and have a great day! :D
Comment 3 Roman Dolny 2025-05-20 15:33:05 UTC
It works as described, but after typing a space character (" ") after the firstname, no results were found.

It looks like:
"F" => OK
... => OK
"Firstname" => OK
"Firstname " => NOT OK
"Firstname S" => OK
...
"Firstname Surname" => OK

I'm not sure if space is real problem (patch corrects worse one) but unfortunately, the space is an invisible character and its presence after the firstname can be confusing for a list of results.
Comment 4 Laura Escamilla 2025-06-09 13:37:48 UTC
Created attachment 183097 [details] [review]
Bug 39427: Split the argument for both name fields to be searched and added regex for spacing
Comment 5 Laura Escamilla 2025-06-10 13:20:54 UTC
Created attachment 183130 [details] [review]
Bug 39427: Split the argument for both name fields to be searched and added regex for spacing
Comment 6 Laura Escamilla 2025-06-10 13:21:00 UTC
Created attachment 183131 [details] [review]
Bug 39427: Unit tests

To test:
1. Ensure that the virtual shelves system preference is enabled
2. Create one or two lists using a patron that has both a first and last name. You don’t have to add items to the list, the list itself is enough.
3. Under the Owner column in the Lists table, search using the patron’s first name. Note that the name is properly filtered.
4. Next, try to search by the last name. It is also properly filtered.
5. Now search using both the first name and the last name together. Note that the results come up empty.
6. Apply the patch.
7. Repeat steps 3–5. Note that the patron shows in the results with just the first name, the last name, and the full name.
7.1. Additionally, try searching with extra spaces (e.g., ' Firstname Surname ' or 'Firstname Surname'). Confirm that results are still correctly shown.
8. Run t/db_dependent/Virtualshelves.t
9. Sign off and have a great day! :D
Comment 7 David Nind 2025-06-13 08:05:09 UTC
The patch no longer applies - I get a sha1/fake ancestor error.

git bz apply 39427

Bug 39427 - Searching lists table by owner can only enter firstname or surname

183130 - Bug 39427: Split the argument for both name fields to be searched and added regex for spacing
183131 - Bug 39427: Unit tests

Apply? [(y)es, (n)o, (i)nteractive] y
Applying: Bug 39427: Split the argument for both name fields to be searched and added regex for spacing
error: sha1 information is lacking or useless (C4/Utils/DataTables/VirtualShelves.pm).
error: could not build fake ancestor
Patch failed at 0001 Bug 39427: Split the argument for both name fields to be searched and added regex for spacing
Comment 8 Laura Escamilla 2025-06-24 13:08:12 UTC Comment hidden (obsolete)
Comment 9 Laura Escamilla 2025-06-24 13:09:59 UTC
Created attachment 183456 [details] [review]
Bug 39427: Searching lists table by owner can only enter firstname or surname

To test:
1. Ensure that the virtual shelves system preference is enabled
2. Create one or two lists using a patron that has both a first and last name. You don’t have to add items to the list, the list itself is enough.
3. Under the Owner column in the Lists table, search using the patron’s first name. Note that the name is properly filtered.
4. Next, try to search by the last name. It is also properly filtered.
5. Now search using both the first name and the last name together. Note that the results come up empty.
6. Apply the patch.
7. Repeat steps 3–5. Note that the patron shows in the results with just the first name, the last name, and the full name.
7.1. Additionally, try searching with extra spaces (e.g., ' Firstname Surname ' or 'Firstname Surname'). Confirm that results are still correctly shown.
8. Run t/db_dependent/Virtualshelves.t
9. Sign off and have a great day! :D
Comment 10 David Flater 2025-06-24 15:06:32 UTC
Created attachment 183465 [details] [review]
Bug 39427: Searching lists table by owner can only enter firstname or surname

To test:
1. Ensure that the virtual shelves system preference is enabled
2. Create one or two lists using a patron that has both a first and last name. You don’t have to add items to the list, the list itself is enough.
3. Under the Owner column in the Lists table, search using the patron’s first name. Note that the name is properly filtered.
4. Next, try to search by the last name. It is also properly filtered.
5. Now search using both the first name and the last name together. Note that the results come up empty.
6. Apply the patch.
7. Repeat steps 3–5. Note that the patron shows in the results with just the first name, the last name, and the full name.
7.1. Additionally, try searching with extra spaces (e.g., ' Firstname Surname ' or 'Firstname Surname'). Confirm that results are still correctly shown.
8. Run t/db_dependent/Virtualshelves.t
9. Sign off and have a great day! :D
Comment 11 David Flater 2025-06-24 15:06:34 UTC
Created attachment 183466 [details] [review]
Bug 39427: (follow-up) Adjust number of tests

Signed-off-by: David Flater <flaterdavid@gmail.com>