[Bug 43831] New: Patron duplicate check matches every new patron when an existing patron is blank in all compared fields
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43831 Bug ID: 43831 Summary: Patron duplicate check matches every new patron when an existing patron is blank in all compared fields Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Patrons Assignee: nugged@gmail.com Reporter: nugged@gmail.com QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle@bywatersolutions.com Target Milestone: --- Since bug 42018, a field that is blank in an existing patron record no longer stops that record from being reported as a possible duplicate: each field in PatronDuplicateMatchingAddFields is checked as "same value, or blank in the existing record". As a side effect, an existing patron that is blank in every compared field now matches every new patron, as long as at least one configured comparison field is supplied (requests with no usable comparison values keep the bug 43069 guard). With the default PatronDuplicateMatchingAddFields (surname|firstname|dateofbirth), one record without surname, first name and date of birth (for example an account created with only a card number or a user name) is offered as the duplicate of every new patron: - staff interface: Patrons > New patron always shows "Duplicate patron record?"; - OPAC self registration reports a possible duplicate; - POST /api/v1/patrons answers 409 "A patron record matching these details already exists" unless the x-confirm-not-duplicate header is sent. Steps to reproduce: 1. Go to Administration > System preferences, search for BorrowerMandatoryField, remove "surname" (keep "cardnumber") and save. 2. Make sure PatronDuplicateMatchingAddFields is "surname|firstname|dateofbirth". 3. Go to Patrons > New patron, choose category "Patron" (or any adult category without age limits), leave Surname, First name and Date of birth empty, fill in Card number and Library, and save. 4. Go to Patrons > New patron again, choose the same category, fill in Surname "Doe", First name "Jane", Date of birth 05/05/1990, a Card number and a Library, and save. Expected result: The new patron is saved. A record that has none of the compared fields filled in cannot be a duplicate of anyone. Actual result: "Duplicate patron record?" is shown and the patron created in step 3 is offered as the existing record. The same happens for otherwise unrelated new patrons, whatever their name and date of birth. Technical note: Koha::Patrons->check_for_existing_matches builds AND(field = value OR field is blank) over the compared fields. When every compared field is blank in an existing record, all conditions are true. Partially blank records should keep matching as bug 42018 intended, but at least one compared field should hold the same value. See also bug 42018 and bug 40082. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43831 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=42018, | |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=40082 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43831 --- Comment #1 from Andrii Nugged <nugged@gmail.com> --- Created attachment 208231 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208231&action=edit Bug 43831: Do not match patrons blank in every compared duplicate field Since bug 42018, a field that is blank in an existing patron record no longer prevents that record from being reported as a possible duplicate. Every compared field is checked as "same value, or blank in the existing record". As a side effect, an existing patron that is blank in every compared field now matches every new patron. With the default PatronDuplicateMatchingAddFields value (surname|firstname|dateofbirth), a single record without surname, first name and date of birth (for example an account created only with a card number or a user name) makes every staff "New patron" save, every OPAC self registration and every POST /api/v1/patrons request report that record as a duplicate (the API answers 409 unless x-confirm-not-duplicate is sent). This patch keeps the bug 42018 behaviour for partially blank records, but additionally requires that at least one of the fields compared in the request holds the same value in the existing record. A record that is blank in all of them is no longer a duplicate of anyone. Unchanged: an empty PatronDuplicateMatchingAddFields, or data with no value in any configured field, still finds no duplicate (bug 43069), and '0' is still compared as a value. Test plan: Before applying the patch: 1. Go to Administration > System preferences and search for BorrowerMandatoryField. 2. Remove "surname" from the value (keep "cardnumber") and click Save. 3. Search for PatronDuplicateMatchingAddFields and make sure it is "surname|firstname|dateofbirth". Click Save if you changed it. 4. Go to Patrons and click New patron, then choose the category "Patron" (or any adult category without age limits). 5. Leave Surname, First name and Date of birth empty, fill in Card number and Library, and click Save. 6. Note the new patron is saved. 7. Go to Patrons and click New patron, then choose the category "Patron" (or any adult category without age limits). 8. Fill in Surname "Doe", First name "Jane", Date of birth 05/05/1990 (enter it in your date format), a Card number and a Library, and click Save. 9. Note the page shows "Duplicate patron record?" and offers the patron from step 5 as the existing record. Apply the patch. After applying the patch: 1. Repeat steps 7-8 with a different Card number. 2. Note the patron is saved without the "Duplicate patron record?" message. 3. Go to Patrons and click New patron, then choose the category "Patron" (or any adult category without age limits). 4. Fill in the same Surname, First name and Date of birth as in step 1, a new Card number and a Library, and click Save. 5. Note the page shows "Duplicate patron record?" and offers the patron saved in step 1: real duplicates are still found. 6. Restore BorrowerMandatoryField to its original value. Co-Authored-By: Loontik <loontik@nugged.team> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43831 --- Comment #2 from Andrii Nugged <nugged@gmail.com> --- Created attachment 208232 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208232&action=edit Bug 43831: Add tests Cover a patron record that is blank in every compared duplicate match field: it must not be reported as a duplicate, including when the request compares a single field and when the record holds a value only in a field that is not compared. A record that shares one compared value and is blank in the others is still reported. Only the test's own record is checked, so other patrons in the database do not affect the result. Automated tests: prove t/db_dependent/Koha/Patrons.t Co-Authored-By: Loontik <loontik@nugged.team> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43831 Andrii Nugged <nugged@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43831 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk QA Contact|testopia@bugs.koha-communit |martin.renvoize@openfifth.c |y.org |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43831 John Vinke <jvinke@austinseminary.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43831 John Vinke <jvinke@austinseminary.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #208231|0 |1 is obsolete| | Attachment #208232|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43831 --- Comment #3 from John Vinke <jvinke@austinseminary.edu> --- Created attachment 208404 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208404&action=edit Bug 43831: Do not match patrons blank in every compared duplicate field Since bug 42018, a field that is blank in an existing patron record no longer prevents that record from being reported as a possible duplicate. Every compared field is checked as "same value, or blank in the existing record". As a side effect, an existing patron that is blank in every compared field now matches every new patron. With the default PatronDuplicateMatchingAddFields value (surname|firstname|dateofbirth), a single record without surname, first name and date of birth (for example an account created only with a card number or a user name) makes every staff "New patron" save, every OPAC self registration and every POST /api/v1/patrons request report that record as a duplicate (the API answers 409 unless x-confirm-not-duplicate is sent). This patch keeps the bug 42018 behaviour for partially blank records, but additionally requires that at least one of the fields compared in the request holds the same value in the existing record. A record that is blank in all of them is no longer a duplicate of anyone. Unchanged: an empty PatronDuplicateMatchingAddFields, or data with no value in any configured field, still finds no duplicate (bug 43069), and '0' is still compared as a value. Test plan: Before applying the patch: 1. Go to Administration > System preferences and search for BorrowerMandatoryField. 2. Remove "surname" from the value (keep "cardnumber") and click Save. 3. Search for PatronDuplicateMatchingAddFields and make sure it is "surname|firstname|dateofbirth". Click Save if you changed it. 4. Go to Patrons and click New patron, then choose the category "Patron" (or any adult category without age limits). 5. Leave Surname, First name and Date of birth empty, fill in Card number and Library, and click Save. 6. Note the new patron is saved. 7. Go to Patrons and click New patron, then choose the category "Patron" (or any adult category without age limits). 8. Fill in Surname "Doe", First name "Jane", Date of birth 05/05/1990 (enter it in your date format), a Card number and a Library, and click Save. 9. Note the page shows "Duplicate patron record?" and offers the patron from step 5 as the existing record. Apply the patch. After applying the patch: 1. Repeat steps 7-8 with a different Card number. 2. Note the patron is saved without the "Duplicate patron record?" message. 3. Go to Patrons and click New patron, then choose the category "Patron" (or any adult category without age limits). 4. Fill in the same Surname, First name and Date of birth as in step 1, a new Card number and a Library, and click Save. 5. Note the page shows "Duplicate patron record?" and offers the patron saved in step 1: real duplicates are still found. 6. Restore BorrowerMandatoryField to its original value. Co-Authored-By: Loontik <loontik@nugged.team> Signed-off-by: John Vinke <jvinke@austinseminary.edu> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43831 --- Comment #4 from John Vinke <jvinke@austinseminary.edu> --- Created attachment 208405 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208405&action=edit Bug 43831: Add tests Cover a patron record that is blank in every compared duplicate match field: it must not be reported as a duplicate, including when the request compares a single field and when the record holds a value only in a field that is not compared. A record that shares one compared value and is blank in the others is still reported. Only the test's own record is checked, so other patrons in the database do not affect the result. Automated tests: prove t/db_dependent/Koha/Patrons.t Co-Authored-By: Loontik <loontik@nugged.team> Signed-off-by: John Vinke <jvinke@austinseminary.edu> -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org