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.