diff --git a/CHANGELOG.md b/CHANGELOG.md index 4651576bb6b229836036a41e07137206320a06dc..95508a520e661edc0a584712eb81fd8ec5c45087 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Version 1.79 (not yet released) +* Fix issue with Contact Data Sources in a join. * PHP 8 and Drupal 10 compatibility. See !119 and !120 # Version 1.76 diff --git a/Civi/DataProcessor/Source/Contact/AbstractContactSource.php b/Civi/DataProcessor/Source/Contact/AbstractContactSource.php index e9b512bf5a60e258c9ec1d4c8ada188c7e811118..bd4ca8acae6114e99d9edcbbb1dbeb69557c6064 100644 --- a/Civi/DataProcessor/Source/Contact/AbstractContactSource.php +++ b/Civi/DataProcessor/Source/Contact/AbstractContactSource.php @@ -34,11 +34,12 @@ abstract class AbstractContactSource extends AbstractCivicrmEntitySource { * * @param array $contactTypes * @param string $op + * @param bool $isJoinClause * * @return void * @throws \Exception */ - protected function addContactTypeFilter(array $contactTypes, string $op = 'IN') { + protected function addContactTypeFilter(array $contactTypes, string $op = 'IN', bool $isJoinClause = false) { switch ($op) { case '=': $op = 'IN'; @@ -54,9 +55,9 @@ abstract class AbstractContactSource extends AbstractCivicrmEntitySource { $this->ensureEntity(); $tableAlias = $this->getEntityTableAlias(); if (count($contactTypes) == 1) { - $contactTypeFilter = new SimpleWhereClause($tableAlias, 'contact_type', '=', reset($contactTypes)); + $contactTypeFilter = new SimpleWhereClause($tableAlias, 'contact_type', '=', reset($contactTypes), 'String', $isJoinClause); } else { - $contactTypeFilter = new SimpleWhereClause($tableAlias, 'contact_type', 'IN', $contactTypes); + $contactTypeFilter = new SimpleWhereClause($tableAlias, 'contact_type', 'IN', $contactTypes, 'String', $isJoinClause); } $this->entityDataFlow->addWhereClause($contactTypeFilter); } @@ -77,7 +78,7 @@ abstract class AbstractContactSource extends AbstractCivicrmEntitySource { if (!is_array($contactTypes)) { $contactTypes = [$contactTypes]; } - $this->addContactTypeFilter($contactTypes, $op); + $this->addContactTypeFilter($contactTypes, $op, TRUE); } elseif ($filter_field_alias == 'contact_sub_type' && $op == 'IN') { $contactTypeClauses = []; foreach ($values as $value) {