Merge pull request #3912 from eileenmcnaughton/CRM-15168
[civicrm-core.git] / CRM / Report / BAO / Hook.php
index 6c2cee9f6c87a53801024041a098bf6a6b9e3a7b..068e9c973cfbf2bb2940df539f807ee389c90c19 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
 
 /**
  * Report hooks that allow extending a particular report.
- * Example: Adding new tables to log reports 
+ * Example: Adding new tables to log reports
  */
 class CRM_Report_BAO_Hook {
 
@@ -72,9 +72,31 @@ class CRM_Report_BAO_Hook {
     return $this->_queryObjects;
   }
 
-  public function alterLogTables(&$logTables) {
+  /**
+   * @param $reportObj
+   * @param $logTables
+   */
+  public function alterLogTables(&$reportObj, &$logTables) {
+    foreach (self::getSearchQueryObjects() as $obj) {
+      $obj->alterLogTables($reportObj, $logTables);
+    }
+  }
+
+  /**
+   * @param $reportObj
+   * @param $table
+   *
+   * @return array
+   */
+  public function logDiffClause(&$reportObj, $table) {
+    $contactIdClause = $join = '';
     foreach (self::getSearchQueryObjects() as $obj) {
-      $obj->alterLogTables($logTables);
+      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
+}