There is a syspref for checking new patrons for duplicates that is only implemented in the staff interface - it should also be respected when adding a patron via the API or the OPAC
Created attachment 182990 [details] [review] Bug 40082: Move the duplicate matching logic to the Koha::Patrons class
Created attachment 182991 [details] [review] Bug 40082: Use the new duplicate checking method in the API
Created attachment 182992 [details] [review] Bug 40082: Use the new duplicate checking method in the OPAC
Created attachment 182993 [details] [review] Bug 40082: Add unit tests Test plan: 1) Choose an existing patron and note their first and second names as well as their date of birth 2) In the interface, create a new patron and enter all of those details to be the same as your patron from step 1 3) Submit the form, you will get a warning saying that there is a duplicate 4) In the OPAC, self register a new patron using the same details again 5) The form should submit with no error or warning 6) Apply patch, yarn api:bundle and restart_all 7) Repeat steps 2 - 5 8) Step 3 should still have the same behaviour 9) Step 5 should now show a warning at the top to say that there is a duplicate, please contact a member of staff 10) Find the 'PatronDuplicateMatchingAddFields' syspref and select an extra field there, ensuring that your patron from step 1 has data for that field 11) In either the interface or the OPAC, register a new patron but this time change the data of the new field you added in step 10 12) No warning should show for a duplicate patron 13) prove t/db_dependent/api/v1/patrons.t 14) prove t/db_dependent/Koha/Patrons.t
Created attachment 182994 [details] [review] Bug 40082: Move the duplicate matching logic to the Koha::Patrons class
Created attachment 182995 [details] [review] Bug 40082: Use the new duplicate checking method in the API
Created attachment 182996 [details] [review] Bug 40082: Use the new duplicate checking method in the OPAC
Created attachment 182997 [details] [review] Bug 40082: Add unit tests Test plan: 1) Choose an existing patron and note their first and second names as well as their date of birth 2) In the interface, create a new patron and enter all of those details to be the same as your patron from step 1 3) Submit the form, you will get a warning saying that there is a duplicate 4) In the OPAC, self register a new patron using the same details again 5) The form should submit with no error or warning 6) Apply patch, yarn api:bundle and restart_all 7) Repeat steps 2 - 5 8) Step 3 should still have the same behaviour 9) Step 5 should now show a warning at the top to say that there is a duplicate, please contact a member of staff 10) Find the 'PatronDuplicateMatchingAddFields' syspref and select an extra field there, ensuring that your patron from step 1 has data for that field 11) In either the interface or the OPAC, register a new patron but this time change the data of the new field you added in step 10 12) No warning should show for a duplicate patron 13) prove t/db_dependent/api/v1/patrons.t 14) prove t/db_dependent/Koha/Patrons.t