From: monishdeb Date: Mon, 23 Mar 2015 15:04:56 +0000 (+0530) Subject: CRM-16151 fix - Deleted contacts are included in advanced search results when using... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0619ff2f467ad28637e231caea5cb5c324bb6d60;p=civicrm-core.git CRM-16151 fix - Deleted contacts are included in advanced search results when using Display As - Related Contacts option https://issues.civicrm.org/jira/browse/CRM-16151 --- diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 1cd5f00faf..4a439ae97e 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -1375,7 +1375,7 @@ class CRM_Contact_BAO_Query { $where = "WHERE {$this->_whereClause}"; } - if (!empty($this->_permissionWhereClause)) { + if (!empty($this->_permissionWhereClause) && empty($this->_displayRelationshipType)) { if (empty($where)) { $where = "WHERE $this->_permissionWhereClause"; } @@ -5331,6 +5331,10 @@ AND displayRelType.is_active = 1 $this->_qill[0][] = $qillMessage . "'" . $relationshipTypeLabel . "'"; } + if (!empty($this->_permissionWhereClause)) { + $_rTypeWhere .= "AND $this->_permissionWhereClause"; + } + if (strpos($from, $_rTypeFrom) === FALSE) { // lets replace all the INNER JOIN's in the $from so we dont exclude other data // this happens when we have an event_type in the quert (CRM-7969)