Merge pull request #2758 from pratik-joshi/CRM-14278
[civicrm-core.git] / CRM / Report / Form / Contact / LoggingSummary.php
index de85fdc7bf0cb6373084a319defbd024e3c32008..ce553a0d2f3d0e3f4b53d0fe54c1ab3bb4d28a1e 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.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -116,6 +116,11 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary {
             'title' => ts('Log Type'),
             'type' => CRM_Utils_Type::T_STRING,
           ),
+          'log_type_table' => array(
+            'name'  => 'log_type',
+            'title' => ts('Log Type Table'),
+            'type' => CRM_Utils_Type::T_STRING,
+          ),
           'log_action' => array(
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
             'options' => array('Insert' => ts('Insert'), 'Update' => ts('Update'), 'Delete' => ts('Delete')),
@@ -160,7 +165,7 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary {
           CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $row['log_civicrm_entity_altered_contact_id'], 'is_deleted') !== '0';
       }
 
-      if (CRM_Utils_Array::value('log_civicrm_entity_altered_contact', $row) &&
+      if (!empty($row['log_civicrm_entity_altered_contact']) &&
         !$isDeleted[$row['log_civicrm_entity_altered_contact_id']]) {
         $row['log_civicrm_entity_altered_contact_link'] =
           CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $row['log_civicrm_entity_altered_contact_id']);
@@ -196,6 +201,12 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary {
         if ($this->cid) {
           $q .= '&cid=' . $this->cid;
         }
+        $q .= (!empty($row['log_civicrm_entity_altered_contact'])) ?
+          '&alteredName='.$row['log_civicrm_entity_altered_contact'] : '';
+        $q .= (!empty($row['altered_by_contact_display_name'])) ?
+          '&alteredBy='.$row['altered_by_contact_display_name'] : '';
+        $q .= (!empty($row['log_civicrm_entity_log_user_id'])) ?
+          '&alteredById='.$row['log_civicrm_entity_log_user_id'] : '';
 
         $url1 = CRM_Report_Utils_Report::getNextUrl('logging/contact/detail', "{$q}&snippet=4&section=2&layout=overlay", FALSE, TRUE);
         $url2 = CRM_Report_Utils_Report::getNextUrl('logging/contact/detail', "{$q}&section=2", FALSE, TRUE);
@@ -232,7 +243,7 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary {
 INNER JOIN civicrm_contact modified_contact_civireport
         ON (entity_log_civireport.{$detail['fk']} = modified_contact_civireport.id {$clause})";
 
-    if (CRM_Utils_Array::value('joins', $detail)) {
+    if (!empty($detail['joins'])) {
       $clause = CRM_Utils_Array::value('entity_table', $detail);
       $clause = $clause ? "AND fk_table.entity_table = 'civicrm_contact'" : null;
       $joinClause = "