From: eileen Date: Fri, 11 Dec 2020 05:04:25 +0000 (+1300) Subject: dev/core#2246 Fix failure to filter exports X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b78652dddbd07e5801dc599659bf7e6048294b4f;hp=5458ce21b63f5c059fed751239525985c7e16da7;p=civicrm-core.git dev/core#2246 Fix failure to filter exports This fixes regression caused by us more consistently setting componentTable. The short version here is that the presence of a componentClause should take precedences over the inner join intended as a blunt, and maybe unnecessary, measure to limit the export to the entity in question --- diff --git a/CRM/Export/BAO/ExportProcessor.php b/CRM/Export/BAO/ExportProcessor.php index ab63f36eea..11e26f65ed 100644 --- a/CRM/Export/BAO/ExportProcessor.php +++ b/CRM/Export/BAO/ExportProcessor.php @@ -797,12 +797,12 @@ class CRM_Export_BAO_ExportProcessor { list($select, $from, $where, $having) = $query->query(); $this->setQueryFields($query->_fields); $whereClauses = ['trash_clause' => "contact_a.is_deleted != 1"]; - if ($this->getRequestedFields() && $this->getComponentTable() && $this->getComponentTable() !== 'civicrm_contact') { - $from .= " INNER JOIN " . $this->getComponentTable() . " ctTable ON ctTable.contact_id = contact_a.id "; - } - elseif ($this->getComponentClause()) { + if ($this->getComponentClause()) { $whereClauses[] = $this->getComponentClause(); } + elseif ($this->getRequestedFields() && $this->getComponentTable() && $this->getComponentTable() !== 'civicrm_contact') { + $from .= " INNER JOIN " . $this->getComponentTable() . " ctTable ON ctTable.contact_id = contact_a.id "; + } // CRM-13982 - check if is deleted foreach ($params as $value) {