Description
Fridolin Somers
2023-04-06 07:10:47 UTC
This creates strange behaviors for example when using search field surname and searching starts with one letter. Some results are matches on patron attributes. Ich How can we tell the searching is standard fields ? https://git.koha-community.org/Koha-community/Koha/src/commit/f74a353097710cf33b3b75b9912b2b00d2aa1a30/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc#L307 Using search_fields == 'firstname,middle_name,surname,othernames,cardnumber,userid' ? Looks not very strong to me :( Created attachment 154352 [details] [review] Bug 33428: Parse search fields in buildPatronSearchQuery This patch moves the parsing of standard search_field into the buildPatronQuery subroutine and adds a check for 'standard' field before adding attributes to the search To test: 1 - Add a new attribute type and make it searchable 2 - Add a value to a patron 3 - Search for this value using 'Standard' fields, confirm you get the patron 4 - Search for the value using 'Cardnumber' field, confirm you get the patron - BAD! 5 - Apply patch 6 - Repeat cardnumebr search, confirm patron not found - Yay! 7 - Search standard, confirm patron is found 8 - Add a new field to 'DefaultPatronSearchFields 9 - Confirm it appears in patron search dropdown 10 - Confirm a search of this field with the attribute value does not return the patron Frido, I stole this, apologies, feel free to provide an alternate (In reply to Nick Clemens from comment #4) > Frido, I stole this, apologies, feel free to provide an alternate Your welcome :D Created attachment 154355 [details] [review] Bug 33428: Parse search fields in buildPatronSearchQuery This patch moves the parsing of standard search_field into the buildPatronQuery subroutine and adds a check for 'standard' field before adding attributes to the search To test: 1 - Add a new attribute type and make it searchable 2 - Add a value to a patron 3 - Search for this value using 'Standard' fields, confirm you get the patron 4 - Search for the value using 'Cardnumber' field, confirm you get the patron - BAD! 5 - Apply patch 6 - Repeat cardnumebr search, confirm patron not found - Yay! 7 - Search standard, confirm patron is found 8 - Add a new field to 'DefaultPatronSearchFields 9 - Confirm it appears in patron search dropdown 10 - Confirm a search of this field with the attribute value does not return the patron Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Works great. I signed and removed unnecessary empty line addition in staff-global.js Created attachment 154367 [details] [review] Bug 33428: Parse search fields in buildPatronSearchQuery This patch moves the parsing of standard search_field into the buildPatronQuery subroutine and adds a check for 'standard' field before adding attributes to the search To test: 1 - Add a new attribute type and make it searchable 2 - Add a value to a patron 3 - Search for this value using 'Standard' fields, confirm you get the patron 4 - Search for the value using 'Cardnumber' field, confirm you get the patron - BAD! 5 - Apply patch 6 - Repeat cardnumebr search, confirm patron not found - Yay! 7 - Search standard, confirm patron is found 8 - Add a new field to 'DefaultPatronSearchFields 9 - Confirm it appears in patron search dropdown 10 - Confirm a search of this field with the attribute value does not return the patron Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Created attachment 154368 [details] [review] Bug 33428: Adjust Unit Tests Created attachment 154528 [details] [review] Bug 33428: Parse search fields in buildPatronSearchQuery This patch moves the parsing of standard search_field into the buildPatronQuery subroutine and adds a check for 'standard' field before adding attributes to the search To test: 1 - Add a new attribute type and make it searchable 2 - Add a value to a patron 3 - Search for this value using 'Standard' fields, confirm you get the patron 4 - Search for the value using 'Cardnumber' field, confirm you get the patron - BAD! 5 - Apply patch 6 - Repeat cardnumebr search, confirm patron not found - Yay! 7 - Search standard, confirm patron is found 8 - Add a new field to 'DefaultPatronSearchFields 9 - Confirm it appears in patron search dropdown 10 - Confirm a search of this field with the attribute value does not return the patron Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 154529 [details] [review] Bug 33428: Adjust Unit Tests Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 154530 [details] [review] Bug 33428: (QA follow-up) Fix escaping in a split call We'd missed an escape case in one of the calls to .split for the pipe delimited split operations. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Nice work, Passing QA Created attachment 154638 [details] [review] Bug 33428 (follow-up): Default to searching 'standard' fields Before this patch set, a search for patrons from article requests or reserves would search the attributes by default. They were not considered 'standard' searches, however. This patch simply defaults to searching the 'standard' fields unless a value is passed To test: 1 - Apply other patches 2 - Have patrons with searchable attributes 3 - From a title, click the holds or artickle requests tab 4 - Search for the attribute values and confirm patrons are not returned 5 - Apply this patch 6 - Search again, patrons are now returned Pushed to master for 23.11. Nice work everyone, thanks! Depends on Bug 29822 not in 23.05.x |