Skip to content

Commit

Permalink
[#13] ignore disabled existing memberships
Browse files Browse the repository at this point in the history
  • Loading branch information
bjendres committed Feb 9, 2023
1 parent d0de615 commit 97a08db
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions CRM/Householdmerge/Logic/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,13 @@ protected function findCandidates($count) {

// try joining valid, active household relationships...
$RELATIONSHIP_JOIN = "
LEFT JOIN civicrm_relationship relation_ab ON contact_id = relation_ab.contact_id_a AND relation_ab.relationship_type_id IN ($relationship_id_list) AND (relation_ab.end_date IS NULL OR relation_ab.end_date > NOW())
LEFT JOIN civicrm_relationship relation_ba ON contact_id = relation_ba.contact_id_b AND relation_ba.relationship_type_id IN ($relationship_id_list) AND (relation_ba.end_date IS NULL OR relation_ba.end_date > NOW())
LEFT JOIN civicrm_relationship relation_ab ON contact_id = relation_ab.contact_id_a AND relation_ab.relationship_type_id IN ($relationship_id_list) AND (relation_ab.end_date IS NULL OR relation_ab.end_date > NOW()) AND relation_ab.is_active = 1
LEFT JOIN civicrm_relationship relation_ba ON contact_id = relation_ba.contact_id_b AND relation_ba.relationship_type_id IN ($relationship_id_list) AND (relation_ba.end_date IS NULL OR relation_ba.end_date > NOW()) AND relation_ba.is_active = 1
";

// ...and then make sure there are none
$RELATIONSHIP_CONDITION = "
AND relation_ab.id IS NULL AND relation_ba.id IS NULL
AND relation_ab.id IS NULL AND relation_ba.id IS NULL -- NO ACTIVE HH RELATIONSHIP EXISTS
";
}

Expand Down

0 comments on commit 97a08db

Please sign in to comment.