Skip to content
Snippets Groups Projects
Commit 92ba0d01 authored by lobo's avatar lobo
Browse files

Merge pull request #2150 from deepak-srivastava/44-customextends-join-override

CRM-13903 - Allow custom table join clause to override
parents e8b08862 4c9d78ea
No related branches found
No related tags found
No related merge requests found
......@@ -135,6 +135,7 @@ class CRM_Report_Form extends CRM_Core_Form {
* @var null
*/
protected $_customGroupExtends = NULL;
protected $_customGroupExtendsJoin = array();
protected $_customGroupFilters = TRUE;
protected $_customGroupGroupBy = FALSE;
protected $_customGroupJoin = 'LEFT JOIN';
......@@ -2877,10 +2878,11 @@ ORDER BY cg.weight, cf.weight";
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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment