From 221fa9c7b8f35f8c7d53901d80ab1cb60871e434 Mon Sep 17 00:00:00 2001 From: Elliott Eggleston Date: Tue, 19 Apr 2016 12:14:48 -0700 Subject: [PATCH] CRM-18564 (NFC) Add comments, underscore in key --- CRM/Report/Form/Contact/LoggingSummary.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CRM/Report/Form/Contact/LoggingSummary.php b/CRM/Report/Form/Contact/LoggingSummary.php index d9e2dda032..d21525d1f6 100644 --- a/CRM/Report/Form/Contact/LoggingSummary.php +++ b/CRM/Report/Form/Contact/LoggingSummary.php @@ -203,6 +203,9 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { $row['log_civicrm_entity_altered_contact'] = $row['log_civicrm_entity_altered_contact'] . " [{$entity}]"; } if ($entity == 'Contact Merged') { + // We're looking at a merge activity created against the surviving + // contact record. There should be a single activity created against + // the deleted contact record, with this activity as parent. $deletedID = CRM_Core_DAO::singleValueQuery(' SELECT GROUP_CONCAT(contact_id) FROM civicrm_activity_contact ac INNER JOIN civicrm_activity a @@ -231,6 +234,9 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { $row['log_civicrm_entity_log_action'] = ts('Update'); } + // For certain tables, we may want to look at an alternate column to + // determine which action to display, determined by the 'action_column' + // key of the entry in $this->_logTables. if ($newAction = $this->getEntityAction($row['log_civicrm_entity_id'], $row['log_civicrm_entity_log_conn_id'], $row['log_civicrm_entity_log_type'], @@ -247,13 +253,16 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { $row = $this->addDetailReportLinksToRow($baseQueryCriteria, $row); } + // In the summary, we only want to show one row per entity type, + // connection ID, contact ID, and user ID, rolling up multiple + // related actions against the same entity. $key = $date . '_' . $row['log_civicrm_entity_log_type'] . '_' . // This ensures merge activities are not 'lost' by aggregation. // I would prefer not to lose other entities either but it's a balancing act as // described in https://issues.civicrm.org/jira/browse/CRM-12867 so adding this criteria // while hackish saves us from figuring out if the original decision is still good. - $isMerge . + $isMerge . '_' . $row['log_civicrm_entity_log_conn_id'] . '_' . $row['log_civicrm_entity_log_user_id'] . '_' . $row['log_civicrm_entity_altered_contact_id']; -- 2.25.1