Exclude shared addresses from contact dedupe
Now it is not possible. We have a lot of shared addresses between contacts (not between a household and a contact).
How to reproduce:
- Log in on http://dmaster.demo.civicrm.org/
- Go to http://dmaster.demo.civicrm.org/civicrm/contact/deduperules?reset=1&action=browse
- Add a dedupe rule http://dmaster.demo.civicrm.org/civicrm/contact/deduperules?action=add&contact_type=Individual&reset=1
- Name: test_<username>
- Usage: General
- Field: Street Address, "", 1
- Field: Postal Code, "", 1
- Field: Country, "", 1
- Threshold: 3
- Use the rule on all contacts
"Expected" result: It blindly finds all duplicate addresses.
The result I need: It only finds the real duplicates: the ones that are really unique (not the ones that are shared).
Possible fix:
After line 95 in CRM/Dedupe/BAO/Rule.php insert:
$where[] = 't1.master_id IS NULL';
$where[] = 't2.master_id IS NULL';
Implementers workaround: Does not work. Adding the field "Master Address Belong To" to dedupe fields only shows results of contacts where the master_id of its address is not empty. I assumed empty == empty in dedupe...