Skip to content
Snippets Groups Projects
Commit aa1aa08e authored by Deepak Srivastava's avatar Deepak Srivastava
Browse files

Allow custom table join clause to override

parent 1377f461
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