From b49db103aca9ac38fd78e77bf673fb1dd11f235f Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 30 Jun 2015 23:47:08 +0000 Subject: [PATCH] Deal with ACL'ed users not getting is_deleted = 0 added on --- CRM/Contact/BAO/Contact/Permission.php | 2 +- CRM/Contact/Form/Search/Custom/Basic.php | 2 +- CRM/Contact/Form/Search/Custom/DateAdded.php | 1 - CRM/Contact/Form/Search/Custom/MultipleValues.php | 2 +- CRM/Contact/Form/Search/Custom/ZipCodeRange.php | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CRM/Contact/BAO/Contact/Permission.php b/CRM/Contact/BAO/Contact/Permission.php index 1508c8bb1e..ab361ac03a 100644 --- a/CRM/Contact/BAO/Contact/Permission.php +++ b/CRM/Contact/BAO/Contact/Permission.php @@ -230,7 +230,7 @@ AND $operationClause LIMIT 1"; } else { $fromClause = " INNER JOIN civicrm_acl_contact_cache aclContactCache ON {$contactAlias}.id = aclContactCache.contact_id "; - $whereClase = " aclContactCache.user_id = $contactID "; + $whereClase = " aclContactCache.user_id = $contactID AND $contactAlias.is_deleted = 0"; } return array($fromClause, $whereClase); diff --git a/CRM/Contact/Form/Search/Custom/Basic.php b/CRM/Contact/Form/Search/Custom/Basic.php index 71c7257cce..01a9a077a3 100644 --- a/CRM/Contact/Form/Search/Custom/Basic.php +++ b/CRM/Contact/Form/Search/Custom/Basic.php @@ -194,7 +194,7 @@ class CRM_Contact_Form_Search_Custom_Basic extends CRM_Contact_Form_Search_Custo public function where($includeContactIDs = FALSE) { if ($whereClause = $this->_query->whereClause()) { if ($this->_aclWhere) { - $whereClause .= " AND {$this->_aclWhere} AND contact_a.is_deleted = 0"; + $whereClause .= " AND {$this->_aclWhere}"; } return $whereClause; } diff --git a/CRM/Contact/Form/Search/Custom/DateAdded.php b/CRM/Contact/Form/Search/Custom/DateAdded.php index 2868318407..fac3089892 100644 --- a/CRM/Contact/Form/Search/Custom/DateAdded.php +++ b/CRM/Contact/Form/Search/Custom/DateAdded.php @@ -400,7 +400,6 @@ class CRM_Contact_Form_Search_Custom_DateAdded extends CRM_Contact_Form_Search_C $where = '(1)'; if ($this->_aclWhere) { $where .= " AND {$this->_aclWhere} "; - $where .= " AND contact_a.is_deleted = 0"; } return $where; } diff --git a/CRM/Contact/Form/Search/Custom/MultipleValues.php b/CRM/Contact/Form/Search/Custom/MultipleValues.php index d9d767c0c4..bac549225f 100644 --- a/CRM/Contact/Form/Search/Custom/MultipleValues.php +++ b/CRM/Contact/Form/Search/Custom/MultipleValues.php @@ -274,7 +274,7 @@ contact_a.sort_name as sort_name, $clause[] = "cgc.group_id = {$this->_group}"; } if ($this->_aclWhere) { - $clause[] = " {$this->_aclWhere} AND contact_a.is_deleted = 0"; + $clause[] = " {$this->_aclWhere}"; } $where = '( 1 )'; diff --git a/CRM/Contact/Form/Search/Custom/ZipCodeRange.php b/CRM/Contact/Form/Search/Custom/ZipCodeRange.php index 1af002dd77..2b5c7571fa 100644 --- a/CRM/Contact/Form/Search/Custom/ZipCodeRange.php +++ b/CRM/Contact/Form/Search/Custom/ZipCodeRange.php @@ -173,7 +173,7 @@ LEFT JOIN civicrm_email email ON ( email.contact_id = contact_a.id AND ); if ($this->_aclWhere) { - $where .= " AND {$this->_aclWhere} AND contact_a.is_deleted = 0"; + $where .= " AND {$this->_aclWhere} "; } return $this->whereClause($where, $params); } -- 2.25.1