Skip to content
Snippets Groups Projects
Commit a74fea9d authored by deepak-srivastava's avatar deepak-srivastava
Browse files

Merge pull request #1444 from deepak-srivastava/logrev

CRM-12910 - logDetail extension for job tables, via report hook query ob...
parents 3ddd1473 6b4b11c4
No related branches found
No related tags found
No related merge requests found
......@@ -97,7 +97,12 @@ LEFT JOIN civicrm_activity_contact source ON source.activity_id = lt.id AND sour
$contactIdClause = "AND id = (select case_id FROM civicrm_case_contact WHERE contact_id = %3 LIMIT 1)";
break;
default:
$contactIdClause = "AND contact_id = %3";
// allow tables to be extended by report hook query objects
list($contactIdClause, $join) = CRM_Report_BAO_Hook::singleton()->logDiffClause($this, $table);
if (empty($contactIdClause)) {
$contactIdClause = "AND contact_id = %3";
}
if ( strpos($table, 'civicrm_value') !== false ) {
$contactIdClause = "AND entity_id = %3";
}
......@@ -272,6 +277,8 @@ WHERE log_conn_id = %1 AND
}
elseif (substr($table, 0, 14) == 'civicrm_value_') {
list($titles[$table], $values[$table]) = $this->titlesAndValuesForCustomDataTable($table);
} else {
$titles[$table] = $values[$table] = array();
}
}
......
......@@ -177,7 +177,7 @@ class CRM_Logging_ReportSummary extends CRM_Report_Form {
}
// allow log tables to be extended via report hooks
CRM_Report_BAO_Hook::singleton()->alterLogTables($this->_logTables);
CRM_Report_BAO_Hook::singleton()->alterLogTables($this, $this->_logTables);
parent::__construct();
}
......
......@@ -72,9 +72,21 @@ class CRM_Report_BAO_Hook {
return $this->_queryObjects;
}
public function alterLogTables(&$logTables) {
public function alterLogTables(&$reportObj, &$logTables) {
foreach (self::getSearchQueryObjects() as $obj) {
$obj->alterLogTables($logTables);
$obj->alterLogTables($reportObj, $logTables);
}
}
public function logDiffClause(&$reportObj, $table) {
$contactIdClause = $join = '';
foreach (self::getSearchQueryObjects() as $obj) {
list($cidClause, $joinClause) = $obj->logDiffClause($reportObj, $table);
if ($joinClause)
$join .= $joinClause;
if ($cidClause)
$contactIdClause .= $cidClause;
}
return array($contactIdClause, $join);
}
}
\ No newline at end of file
......@@ -38,7 +38,10 @@
*/
class CRM_Report_BAO_HookInterface {
public function alterLogTables(&$logTables) {
public function alterLogTables(&$reportObj, &$logTables) {
return NULL;
}
public function logDiffClause(&$reportObj, $table) {
return array();
}
}
\ No newline at end of file
......@@ -49,6 +49,9 @@ class CRM_Report_Form_Contact_LoggingDetail extends CRM_Logging_ReportDetail {
$this->tables[] = 'civicrm_activity';
$this->tables[] = 'civicrm_case';
// allow tables to be extended by report hook query objects
CRM_Report_BAO_Hook::singleton()->alterLogTables($this, $this->tables);
$this->detail = 'logging/contact/detail';
$this->summary = 'logging/contact/summary';
......
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