CRM-12915, table level filtering support in change log report
authorDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Tue, 23 Jul 2013 11:46:35 +0000 (17:16 +0530)
committerDeepak Srivastava <deepak.srivastava@webaccess.co.in>
Tue, 23 Jul 2013 11:46:35 +0000 (17:16 +0530)
----------------------------------------
* CRM-12915: Improve layout of revision-history for multi-row CustomGroups
  http://issues.civicrm.org/jira/browse/CRM-12915

CRM/Logging/ReportSummary.php
CRM/Report/Form/Contact/LoggingSummary.php

index 452c26f8a14e11313a6fb98e2eb744cc9d11eab1..251297967af2df6c5dc62129c19f1c4f79ca616d 100644 (file)
@@ -197,6 +197,13 @@ class CRM_Logging_ReportSummary extends CRM_Report_Form {
       }
     }
 
+    $logTypeTableClause = '(1)';
+    if ($logTypeTableValue = CRM_Utils_Array::value("log_type_table_value", $this->_params)) {
+      $logTypeTableClause = $this->whereClause($this->_columns['log_civicrm_entity']['filters']['log_type_table'], 
+                            $this->_params['log_type_table_op'], $logTypeTableValue, NULL, NULL);
+      unset($this->_params['log_type_table_value']);
+    }
+    
     foreach ( $this->_logTables as $entity => $detail ) {
       if ((in_array($this->getLogType($entity), $logTypes) &&
         CRM_Utils_Array::value('log_type_op', $this->_params) == 'in') ||
@@ -238,6 +245,7 @@ class CRM_Logging_ReportSummary extends CRM_Report_Form {
     $this->limit();
     $sql = "{$this->_select}
 FROM civicrm_temp_civireport_logsummary entity_log_civireport
+WHERE {$logTypeTableClause}
 GROUP BY log_civicrm_entity_log_date, log_civicrm_entity_log_type_label, log_civicrm_entity_log_conn_id, log_civicrm_entity_log_user_id, log_civicrm_entity_altered_contact_id
 ORDER BY log_civicrm_entity_log_date DESC {$this->_limit}";
     $sql = str_replace('modified_contact_civireport.display_name', 'entity_log_civireport.altered_contact',   $sql);
index de85fdc7bf0cb6373084a319defbd024e3c32008..e31dcee8049e1db5d41ab054769580c86782497a 100644 (file)
@@ -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')),