Searching from the header search for patrons in the staff client no longer takes notice of the DefaultPatronSearchFields preference... and 'Standard' search once on the member search page, also doesn't reflect the preference either. To replicate: 1) Remove a field or two from the preference, but ensure at least some fields are present 2) Submit a patron search 3) Note that the search appears to user the 'Standard' option in the search 4) Inspect the network traffic and note that the fields searched upon do not reflect the preference.
Created attachment 133543 [details] [review] Bug 30576: Use DefaultPatronSearchFields in patron search This patch corrects the handling of the 'Standard' search field in patron searches such that it accurately reflects the contents of the DefaultPatronSearchFields system preference and falls back to a hard coded list instead of always using the hard coded list. To test: 1) Empty the contents of DefaultPatronSearchFields systempreference 2) Perform a patron search from the header search 3) Inspect the patrons API request and note that we search on the default fallback fields of firstname, surname, othernames, cardnumber and userid (and some extended attributes which are historically hard coded). 4) Navigate to the memebers-home by clicking the 'Patrons' button from the main page 5) Perform another search using the filters on the left with 'Standard' selected. 6) Note the same list of search fields used as above in the patrons API request. 7) Update the DefaultPatronSearchFields systempreference adding one or more borrower fields in a comma delimited list. 8) Repeat steps 2 -> 6 but this time upon inspecting the API request you should find that only the fields in your DefaultPatronSearchFields list are searched (along with the hard coded extended attributes list). 9) Signoff
Created attachment 133555 [details] [review] Bug 30576: Use DefaultPatronSearchFields in patron search This patch corrects the handling of the 'Standard' search field in patron searches such that it accurately reflects the contents of the DefaultPatronSearchFields system preference and falls back to a hard coded list instead of always using the hard coded list. To test: 1) Empty the contents of DefaultPatronSearchFields systempreference 2) Perform a patron search from the header search 3) Inspect the patrons API request and note that we search on the default fallback fields of firstname, surname, othernames, cardnumber and userid (and some extended attributes which are historically hard coded). 4) Navigate to the memebers-home by clicking the 'Patrons' button from the main page 5) Perform another search using the filters on the left with 'Standard' selected. 6) Note the same list of search fields used as above in the patrons API request. 7) Update the DefaultPatronSearchFields systempreference adding one or more borrower fields in a comma delimited list. 8) Repeat steps 2 -> 6 but this time upon inspecting the API request you should find that only the fields in your DefaultPatronSearchFields list are searched (along with the hard coded extended attributes list). 9) Signoff Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/selenium/patrons_search.t should pass after this patch. We are fixing a bug but introducing a regression. Double check the syspref's description.
Behaviour on 21.11.x: 1. DefaultPatronSearchFields has the default value (surname,firstname,othernames,cardnumber,userid) => standard will search "standard" (retrieved from the pref in the pm) 2. DefaultPatronSearchFields=surname,initials,borrowernotes => standard will search "standard" (retrieved from the pref in the pm) => 2 new options are added to the dropdown, "Initials" and "Circulation note"
Created attachment 133684 [details] [review] Bug 30576: Use DefaultPatronSearchFields in patron search This patch corrects the handling of the 'Standard' search field in patron searches such that it accurately reflects the contents of the DefaultPatronSearchFields system preference and falls back to a hard coded list instead of always using the hard coded list. To test: 1) Empty the contents of DefaultPatronSearchFields systempreference 2) Perform a patron search from the header search 3) Inspect the patrons API request and note that we search on the default fallback fields of firstname, surname, othernames, cardnumber and userid (and some extended attributes which are historically hard coded). 4) Navigate to the memebers-home by clicking the 'Patrons' button from the main page 5) Perform another search using the filters on the left with 'Standard' selected. 6) Note the same list of search fields used as above in the patrons API request. 7) Update the DefaultPatronSearchFields systempreference adding one or more borrower fields in a comma delimited list. 8) Repeat steps 2 -> 6 but this time upon inspecting the API request you should find that only the fields in your DefaultPatronSearchFields list are searched (along with the hard coded extended attributes list). 9) Signoff Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 133685 [details] [review] Bug 30576: (follow-up) Corrections to behaviour to reflect unit tests The unit tests highlighted my original patch didn't cover the full preference description. We now replace the 'standard' option with the fields from the preference and we also add those fields as options to the field selection in advanced searches. This patch also adjusts the tests to test for that and reflects the expected changes to the number of options displayed in the select boxes.
As discussed, there is still an issue should someone add a bad field into the system preference.. but we decided that was out of scope for here. I'm also still stuck with one last test failure.. I have no idea how this patchset causes it.. hopefully it'll be something obvious for Jonathan to spot.
Ho.. that last failure is also on master.. I'll fix it on master
Created attachment 134059 [details] [review] Bug 30576: Use DefaultPatronSearchFields in patron search This patch corrects the handling of the 'Standard' search field in patron searches such that it accurately reflects the contents of the DefaultPatronSearchFields system preference and falls back to a hard coded list instead of always using the hard coded list. To test: 1) Empty the contents of DefaultPatronSearchFields systempreference 2) Perform a patron search from the header search 3) Inspect the patrons API request and note that we search on the default fallback fields of firstname, surname, othernames, cardnumber and userid (and some extended attributes which are historically hard coded). 4) Navigate to the memebers-home by clicking the 'Patrons' button from the main page 5) Perform another search using the filters on the left with 'Standard' selected. 6) Note the same list of search fields used as above in the patrons API request. 7) Update the DefaultPatronSearchFields systempreference adding one or more borrower fields in a comma delimited list. 8) Repeat steps 2 -> 6 but this time upon inspecting the API request you should find that only the fields in your DefaultPatronSearchFields list are searched (along with the hard coded extended attributes list). 9) Signoff Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 134060 [details] [review] Bug 30576: (follow-up) Corrections to behaviour to reflect unit tests The unit tests highlighted my original patch didn't cover the full preference description. We now replace the 'standard' option with the fields from the preference and we also add those fields as options to the field selection in advanced searches. This patch also adjusts the tests to test for that and reflects the expected changes to the number of options displayed in the select boxes. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(In reply to Martin Renvoize from comment #8) > Ho.. that last failure is also on master.. I'll fix it on master Fixed on bug 30626.
Created attachment 134084 [details] [review] Bug 30576: Use DefaultPatronSearchFields in patron search This patch corrects the handling of the 'Standard' search field in patron searches such that it accurately reflects the contents of the DefaultPatronSearchFields system preference and falls back to a hard coded list instead of always using the hard coded list. To test: 1) Empty the contents of DefaultPatronSearchFields systempreference 2) Perform a patron search from the header search 3) Inspect the patrons API request and note that we search on the default fallback fields of firstname, surname, othernames, cardnumber and userid (and some extended attributes which are historically hard coded). 4) Navigate to the memebers-home by clicking the 'Patrons' button from the main page 5) Perform another search using the filters on the left with 'Standard' selected. 6) Note the same list of search fields used as above in the patrons API request. 7) Update the DefaultPatronSearchFields systempreference adding one or more borrower fields in a comma delimited list. 8) Repeat steps 2 -> 6 but this time upon inspecting the API request you should find that only the fields in your DefaultPatronSearchFields list are searched (along with the hard coded extended attributes list). 9) Signoff Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 134085 [details] [review] Bug 30576: (follow-up) Corrections to behaviour to reflect unit tests The unit tests highlighted my original patch didn't cover the full preference description. We now replace the 'standard' option with the fields from the preference and we also add those fields as options to the field selection in advanced searches. This patch also adjusts the tests to test for that and reflects the expected changes to the number of options displayed in the select boxes. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Tiny rebase after setting dependencies to make sure these two are pushed in order :)
Created attachment 134211 [details] [review] Bug 30576: Use DefaultPatronSearchFields in patron search This patch corrects the handling of the 'Standard' search field in patron searches such that it accurately reflects the contents of the DefaultPatronSearchFields system preference and falls back to a hard coded list instead of always using the hard coded list. To test: 1) Empty the contents of DefaultPatronSearchFields systempreference 2) Perform a patron search from the header search 3) Inspect the patrons API request and note that we search on the default fallback fields of firstname, surname, othernames, cardnumber and userid (and some extended attributes which are historically hard coded). 4) Navigate to the memebers-home by clicking the 'Patrons' button from the main page 5) Perform another search using the filters on the left with 'Standard' selected. 6) Note the same list of search fields used as above in the patrons API request. 7) Update the DefaultPatronSearchFields systempreference adding one or more borrower fields in a comma delimited list. 8) Repeat steps 2 -> 6 but this time upon inspecting the API request you should find that only the fields in your DefaultPatronSearchFields list are searched (along with the hard coded extended attributes list). 9) Signoff Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 134212 [details] [review] Bug 30576: (follow-up) Corrections to behaviour to reflect unit tests The unit tests highlighted my original patch didn't cover the full preference description. We now replace the 'standard' option with the fields from the preference and we also add those fields as options to the field selection in advanced searches. This patch also adjusts the tests to test for that and reflects the expected changes to the number of options displayed in the select boxes. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Pushed to master for 22.05, thanks to everybody involved [U+1F984]