* @var null
*/
protected $_customGroupExtends = NULL;
+ protected $_customGroupExtendsJoin = array();
protected $_customGroupFilters = TRUE;
protected $_customGroupGroupBy = FALSE;
protected $_customGroupJoin = 'LEFT JOIN';
if (!$this->isFieldSelected($prop)) {
continue;
}
+ $baseJoin = CRM_Utils_Array::value($prop['extends'], $this->_customGroupExtendsJoin, "{$this->_aliases[$extendsTable]}.id");
$customJoin = is_array($this->_customGroupJoin) ? $this->_customGroupJoin[$table] : $this->_customGroupJoin;
$this->_from .= "
-{$customJoin} {$table} {$this->_aliases[$table]} ON {$this->_aliases[$table]}.entity_id = {$this->_aliases[$extendsTable]}.id";
+{$customJoin} {$table} {$this->_aliases[$table]} ON {$this->_aliases[$table]}.entity_id = {$baseJoin}";
// handle for ContactReference
if (array_key_exists('fields', $prop)) {
foreach ($prop['fields'] as $fieldName => $field) {