From 798878ccd2b4e098e6d700c27d7ee0336ec2ccf8 Mon Sep 17 00:00:00 2001 From: Deepak Srivastava Date: Tue, 23 Jul 2013 17:16:35 +0530 Subject: [PATCH] CRM-12915, table level filtering support in change log report ---------------------------------------- * CRM-12915: Improve layout of revision-history for multi-row CustomGroups http://issues.civicrm.org/jira/browse/CRM-12915 --- CRM/Logging/ReportSummary.php | 8 ++++++++ CRM/Report/Form/Contact/LoggingSummary.php | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/CRM/Logging/ReportSummary.php b/CRM/Logging/ReportSummary.php index 452c26f8a1..251297967a 100644 --- a/CRM/Logging/ReportSummary.php +++ b/CRM/Logging/ReportSummary.php @@ -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); diff --git a/CRM/Report/Form/Contact/LoggingSummary.php b/CRM/Report/Form/Contact/LoggingSummary.php index de85fdc7bf..e31dcee804 100644 --- a/CRM/Report/Form/Contact/LoggingSummary.php +++ b/CRM/Report/Form/Contact/LoggingSummary.php @@ -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')), -- 2.25.1