From d64e31ab3d19755de9c34139b60d118ec5be5023 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 2 Dec 2014 10:44:03 +0530 Subject: [PATCH] Advanced Search does not filter relationships with deleted contacts Fix --- CRM/Contact/BAO/Query.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 21dfd712d8..5e14140555 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -4160,6 +4160,12 @@ civicrm_relationship.start_date > {$today} $this->_qill[$grouping][] = ts('Relationship - Inactive or not Current'); } + $onlyDeleted = 0; + if (in_array(array('deleted_contacts', '=', '1', '0', '0'), $this->_params)) { + $onlyDeleted = 1; + } + $where[$grouping][] = "(contact_b.is_deleted = {$onlyDeleted})"; + //check for permissioned, non-permissioned and all permissioned relations if ($relPermission[2] == 1) { $where[$grouping][] = "( -- 2.25.1