From: Justin Freeman Date: Tue, 6 Nov 2018 01:15:35 +0000 (+1100) Subject: Add two more instances for civicrm_relationship.is_active X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=211fe7644a06dda8da5ee66c67dd4dab520be085;p=civicrm-core.git Add two more instances for civicrm_relationship.is_active --- diff --git a/CRM/Case/BAO/Case.php b/CRM/Case/BAO/Case.php index 11f3ffcf69..a0d9a5704e 100644 --- a/CRM/Case/BAO/Case.php +++ b/CRM/Case/BAO/Case.php @@ -857,7 +857,7 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c IF(rel.contact_id_a = %1, "a_b", "b_a") as relationship_direction FROM civicrm_relationship rel INNER JOIN civicrm_relationship_type ON rel.relationship_type_id = civicrm_relationship_type.id - INNER JOIN civicrm_contact con ON ((con.id <> %1 AND con.id IN (rel.contact_id_a, rel.contact_id_b)) OR (con.id = %1 AND rel.contact_id_b = rel.contact_id_a AND rel.contact_id_a = %1)) + INNER JOIN civicrm_contact con ON ((con.id <> %1 AND con.id IN (rel.contact_id_a, rel.contact_id_b)) OR (con.id = %1 AND rel.contact_id_b = rel.contact_id_a AND rel.contact_id_a = %1 AND rel.is_active)) LEFT JOIN civicrm_phone ON (civicrm_phone.contact_id = con.id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_email ON (civicrm_email.contact_id = con.id AND civicrm_email.is_primary = 1) WHERE (rel.contact_id_a = %1 OR rel.contact_id_b = %1) AND rel.case_id = %2 @@ -1916,7 +1916,7 @@ SELECT case_status.label AS case_status, status_id, civicrm_case_type.title AS c SELECT civicrm_contact.id as casemanager_id, civicrm_contact.sort_name as casemanager FROM civicrm_contact - LEFT JOIN civicrm_relationship ON (civicrm_relationship.contact_id_b = civicrm_contact.id AND civicrm_relationship.relationship_type_id = %1) + LEFT JOIN civicrm_relationship ON (civicrm_relationship.contact_id_b = civicrm_contact.id AND civicrm_relationship.relationship_type_id = %1) AND civicrm_relationship.is_active LEFT JOIN civicrm_case ON civicrm_case.id = civicrm_relationship.case_id WHERE civicrm_case.id = %2 AND is_active = 1";