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
Created attachment 182674 [details] [review] Bug 39427: Split the argument for both name fields to be searched
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
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.
Created attachment 183097 [details] [review] Bug 39427: Split the argument for both name fields to be searched and added regex for spacing
Created attachment 183130 [details] [review] Bug 39427: Split the argument for both name fields to be searched and added regex for spacing
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
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
Created attachment 183455 [details] [review] 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
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
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
Created attachment 183466 [details] [review] Bug 39427: (follow-up) Adjust number of tests Signed-off-by: David Flater <flaterdavid@gmail.com>