The patron search can be very slow when the number of patrons becomes sufficiently large. At our we routinely search for social security number for example (which is a unique extended patron attribute), and this could be so much faster if unique attributes where first queried in the same manner as librarycard is in member.pl (when quicksearch is set).
Created attachment 178892 [details] [review] Bug 39229: Search unique extended attributes on patron quicksearch
Forgot to add how to test etc in commit message, will do so tomorrow.
Created attachment 178932 [details] [review] Bug 39229: Search unique extended attributes on patron quicksearch To test: 1) Apply patch 2) Create a unique extended patron attribute, set it to "Searchable" and and "Searched by default" 3) Edit a patron and set a value for the created attribute. 4) Enable UniqueExtendedAttributesQuickSearch syspref 5) Edit memebers/member.pl, after the if (@attributes_conditinos) block, around line 93, write "exit;" and save the file. 6) Perforn a search on the patron attribute value 7) A redirect to the patron page should occur 8) Search for something else not matching the attribute 9) You should now recieve a 500 error (since the script exits prematurely, and the normal search is never run) Sponsored-by: Gothenburg University Library
I now created a test plan, but it's unfortunately pretty convoluted. If one has access to a koha instance with at least tens of thousands of patrons, preferably more, there would be a clear difference in response time. But if the number is smaller, it is very hard to notice a difference and hard to test. Exiting the script after the unique attributes quicksearch has been performed was the only way I could figure out, but other suggestions are welcome.
Created attachment 178970 [details] [review] Bug 39229: Search unique extended attributes on patron quicksearch To test: 1) Apply patch 2) Create a unique extended patron attribute, set it to "Searchable" and and "Searched by default" 3) Edit a patron and set a value for the created attribute. 4) Enable UniqueExtendedAttributesQuickSearch syspref 5) Edit memebers/member.pl, before "my $searchfieldstype = ..." around line 94, write "exit;" and save the file. 6) Perform a search on the patron attribute value 7) A redirect to the patron page should occur 8) Search for something else not matching the attribute 9) You should now recieve a 500 error (since the script exits prematurely, and the normal search is never run) Sponsored-by: Gothenburg University Library
Created attachment 178971 [details] [review] Bug 39229: Also try to find patron by borrowernumber
Created attachment 178972 [details] [review] Bug 39229: Search unique extended attributes on patron quicksearch To test: 1) Apply patch 2) Create a unique extended patron attribute, set it to "Searchable" and and "Searched by default" 3) Edit a patron and set a value for the created attribute. 4) Enable UniqueExtendedAttributesQuickSearch syspref 5) Edit memebers/member.pl, before "my $searchfieldstype = ..." around line 94, write "exit;" and save the file. 6) Perform a search on the patron attribute value 7) A redirect to the patron page should occur 8) Search for something else not matching the attribute 9) You should now recieve a 500 error (since the script exits prematurely, and the normal search is never run) 10) Repeat steps 6 to 9 using borrowernumber instead of extended attribute value Sponsored-by: Gothenburg University Library
Created attachment 178973 [details] [review] Bug 39229: Also try to find patron by borrowernumber
I also added quicksearch using borrowernumber.
I also added finding patron by borrowernumber quicksearch and edited the bug name to reflect the change.
Created attachment 178974 [details] [review] Bug 39229: Search unique extended attributes on patron quicksearch To test: 1) Apply patch 2) Create a unique extended patron attribute, set it to "Searchable" and and "Searched by default" 3) Edit a patron and set a value for the created attribute. 4) Enable UniqueExtendedAttributesQuickSearch syspref 5) Edit memebers/member.pl, before "my $searchfieldstype = ..." around line 94, write "exit;" and save the file. 6) Perform a search on the patron attribute value 7) A redirect to the patron page should occur 8) Search for something else not matching the attribute 9) You should now recieve a 500 error (since the script exits prematurely, and the normal search is never run) 10) Repeat steps 6 to 9 using borrowernumber instead of extended attribute value Sponsored-by: Gothenburg University Library
Created attachment 178975 [details] [review] Bug 39229: Also try to find patron by borrowernumber
Created attachment 178995 [details] [review] Bug 39229: Also try to find patron by userid
My mistake, should have been userid.
Created attachment 178996 [details] [review] Bug 39229: Search unique extended attributes on patron quicksearch To test: 1) Apply patch 2) Create a unique extended patron attribute, set it to "Searchable" and and "Searched by default" 3) Edit a patron and set a value for the created attribute. 4) Enable UniqueExtendedAttributesQuickSearch syspref 5) Edit memebers/member.pl, before "my $searchfieldstype = ..." around line 94, write "exit;" and save the file. 6) Perform a search on the patron attribute value 7) A redirect to the patron page should occur 8) Search for something else not matching the attribute 9) You should now recieve a 500 error (since the script exits prematurely, and the normal search is never run) 10) Repeat steps 6 to 9 using userid instead of extended attribute value Sponsored-by: Gothenburg University Library
Created attachment 178997 [details] [review] Bug 39229: Also try to find patron by userid
Created attachment 180780 [details] [review] Bug 39229: Also handle the case when performing a patron checkout
I tested this and got to step 6. Is the quicksearch done in the green tool bar at top? If that is the case, I did not get a redirect to the patron page and received a 500 error. Searches for other terms that were not an attribute also returned a 500 error. I also did the search from the Patron module using the search form on the left side of the page. I searched for the attribute using the standard parameter.The patron was in the patron search results list. Searching for other terms gave blank results and no 500 error. I stopped at this point because I wasn't sure if I was following the test plan correctly. I did edit the members/member.pl file as instructed.