when formatting params for deduping, we do a case sensitive check for Primary
I've run into a problem - when I call the Profile.getfields
with api_action=submit
and a profile_id, I get a nice list of fields in that profile, notably - the primary email field name is lowercased to email-primary
.
When I fill out those fields and submit them to CRM_Contact_BAO_Contact::getDuplicateContacts
I fail to find the duplicates that should be found.
It turns out that's because getDuplicateContacts
calls Dedupe_Finder::formatParams
which does some nice magic on primary style fields by finding them with:
preg_match('/(.*)-(primary-[\d+])$|(.*)-(\d+|Primary)$/', strtolower($key), $matches)
The capital P is what causes the problem.
I think it's safe to convert that to a lowercase check.