Details
Description
Below is the spec on how would we like dupe checks to happen when "allow_same_participant_emails" ( allow multiple registrations from the same email address ) flag is turned on -
1. Introduce a form rule in the "online registration form" which ensures that:
- a default "fuzzy" dedupe rule exists for Individuals
- an additional participant profile HAS to be selected
When the "allow multiple registrations from same email" is checked, show a status message <div>:
"In order to allow multiple registrations with the same email address, the default "Fuzzy" Dedupe Rule will be used to check for matching existing contact records and prevent duplicate registrations. This rule currently uses the following fields: $dupeField1, $dupeField2, $dupeField3. First and Last Name will be used to check for matches among the multiple participants being registered."
(list all dupe field names)
2. Fix our current code to NOT bypass dupe check for additional participants.
IF allow_same_participant_emai is TRUE, use default "fuzzy" rule.
ELSE use default "strict" rule.
3. Note #2 will only do dupe checks with contacts present in DB and not among the contacts collected as additional participants. The code to check dupes among additional participants (based on email field only) already exists, but is skipped when "allow_same_participant_emails" flag is on. If this flag is on, we need to detect dupes among additional participants based on first and last name info.
4. In post confirm step when saving all contacts from session to DB, turn off any de-duping since the assumption is that - by this point all deduping would have been already done in prior steps.
Note: Check code against the "fail" cases reported by Xavier D in comments below.
======== Previous message ========
Generally, we shouldn't create duplicate contacts in the online event registration flow - and the Register Multiple Contacts with the Same Email flag was intended to support registration of different people who shared an email address during a "Register Multiple Participants" (Additional Participants screens) flow. And the expected use case is that a profile is used to collect differentiating info (first, last name etc.). However, we don't enforce this expectation - so we might just be getting repeated email address w/o additional contact fields in the Additional Participant forms.
Suggested fix:
- If we are in the online "Register Multiple Participants" flow - leave the current behavior as is (assuming we are bypassing the duplicate checking in this case). So even if the only thing we collect at the contact level is email address - we allow it and create 1 contact -> 1 participant for each registration submitted.
- Otherwise if singleton online registration, do duplicate check based on currently configured strict rule. If we find a matching contact who is already registered for that event then we redirect back to main registration form with our normal 'already registered' status:
======= Original Message =======
Step to reproduce (as anonymous)
Create an event with a first name+lastname profile and online registration
Open a browser in private browsing mode
Register to the event as John Doe jon@doe.com
civi create a new contact+participant
Open a new browser in private browsing mode
Register to the event as John Doe jon@doe.com
civi rightly see that's the same contact, but wrongly create a new participant on the same contact for the same event
Expected result:
error message: We couldn't process your registration, you were already registered.+display contact infos as set on the event