From aa1aa08e913e8cb3102ca7ed649366ac9d5675b5 Mon Sep 17 00:00:00 2001 From: Deepak Srivastava Date: Wed, 4 Dec 2013 13:12:56 +0530 Subject: [PATCH] Allow custom table join clause to override --- CRM/Report/Form.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php index e8805f9693..6174970821 100644 --- a/CRM/Report/Form.php +++ b/CRM/Report/Form.php @@ -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) { -- 2.25.1