From: Deepak Srivastava Date: Sun, 11 Aug 2013 07:40:13 +0000 (+0530) Subject: CRM-12910, extend log reports to support injected job tables, via report query-hook... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c3e3dd658a7cbb82aeb742131efc8a83c89fde6a;p=civicrm-core.git CRM-12910, extend log reports to support injected job tables, via report query-hook-objects --- diff --git a/CRM/Contact/BAO/Query/Hook.php b/CRM/Contact/BAO/Query/Hook.php index 419b5aad0e..d791b626ec 100644 --- a/CRM/Contact/BAO/Query/Hook.php +++ b/CRM/Contact/BAO/Query/Hook.php @@ -66,7 +66,7 @@ class CRM_Contact_BAO_Query_Hook { public function getSearchQueryObjects() { if ($this->_queryObjects === NULL) { $this->_queryObjects = array(); - CRM_Utils_Hook::queryObjects($this->_queryObjects); + CRM_Utils_Hook::queryObjects($this->_queryObjects, 'Contact'); } return $this->_queryObjects; } diff --git a/CRM/Logging/ReportSummary.php b/CRM/Logging/ReportSummary.php index 203f336b2e..fea2b82d5e 100644 --- a/CRM/Logging/ReportSummary.php +++ b/CRM/Logging/ReportSummary.php @@ -176,6 +176,9 @@ class CRM_Logging_ReportSummary extends CRM_Report_Form { $this->_logTables[$table] = array('fk' => 'entity_id', 'log_type' => 'Contact'); } + // allow log tables to be extended via report hooks + CRM_Report_BAO_Hook::singleton()->alterLogTables($this->_logTables); + parent::__construct(); } diff --git a/CRM/Report/BAO/Hook.php b/CRM/Report/BAO/Hook.php new file mode 100644 index 0000000000..12bbbf95f0 --- /dev/null +++ b/CRM/Report/BAO/Hook.php @@ -0,0 +1,81 @@ +_queryObjects === NULL) { + $this->_queryObjects = array(); + CRM_Utils_Hook::queryObjects($this->_queryObjects, 'Report'); + } + CRM_Core_Error::debug( '$this->_queryObjects', $this->_queryObjects ); + return $this->_queryObjects; + } + + public function alterLogTables(&$logTables) { + foreach (self::getSearchQueryObjects() as $obj) { + $obj->alterLogTables($logTables); + } + } +} \ No newline at end of file diff --git a/CRM/Report/BAO/HookInterface.php b/CRM/Report/BAO/HookInterface.php new file mode 100644 index 0000000000..af3b33f02a --- /dev/null +++ b/CRM/Report/BAO/HookInterface.php @@ -0,0 +1,44 @@ +invoke(1, $queryObjects, self::$_nullObject, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_queryObjects'); + static function queryObjects(&$queryObjects, $type = 'Contact') { + return self::singleton()->invoke(2, $queryObjects, $type, self::$_nullObject, self::$_nullObject, self::$_nullObject, 'civicrm_queryObjects'); } }