function customDataFrom() { parent::customDataFrom(); $params = array('name' => 'HRJobContract_Summary'); CRM_Core_DAO::commonRetrieve('CRM_Core_DAO_CustomGroup', $params, $cGrp); if (!$this->isFieldSelected($this->_columns[$cGrp['table_name']])) { $mapper = CRM_Core_BAO_CustomQuery::$extendsMap; $extendsTable = $mapper[$cGrp['extends']]; $baseJoin = CRM_Utils_Array::value($cGrp['extends'], $this->_customGroupExtendsJoin, "{$this->_aliases[$extendsTable]}.id"); $this->_from .= " LEFT JOIN {$cGrp['table_name']} {$this->_aliases[$cGrp['table_name']]} ON {$this->_aliases[$cGrp['table_name']]}.entity_id = {$baseJoin}"; } }