diff --git a/CRM/ConstituentsOnly/BAO/Query.php b/CRM/ConstituentsOnly/BAO/Query.php index f3013d3..d068f6f 100644 --- a/CRM/ConstituentsOnly/BAO/Query.php +++ b/CRM/ConstituentsOnly/BAO/Query.php @@ -65,6 +65,7 @@ class CRM_ConstituentsOnly_BAO_Query extends CRM_Contact_BAO_Query_Interface { LEFT JOIN civicrm_contact cc1 ON (cr.contact_id_a = cc1.id) WHERE contact_a.do_not_trade = 1 AND (cr.id IS NULL OR cc1.is_deleted = 1 OR cc1.do_not_trade = 1) + AND contact_a.id <> cc1.id UNION SELECT contact_a.id FROM civicrm_contact contact_a @@ -74,6 +75,7 @@ class CRM_ConstituentsOnly_BAO_Query extends CRM_Contact_BAO_Query_Interface { LEFT JOIN civicrm_contact cc1 ON (cr.contact_id_b = cc1.id) WHERE contact_a.do_not_trade = 1 AND (cr.id IS NULL OR cc1.is_deleted = 1 OR cc1.do_not_trade = 1) + AND contact_a.id <> cc1.id ) AS temp GROUP BY id ) ";