From cb22e5dcfd7fa1bf41dcab167c8f32bc0cac6fb3 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 1 Jun 2020 13:02:33 +1200 Subject: [PATCH] dev/core#1749 Fix missing parameter in link to logging detail https://lab.civicrm.org/dev/core/-/issues/1749 --- CRM/Logging/ReportSummary.php | 5 +---- CRM/Report/Form/Contact/LoggingSummary.php | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CRM/Logging/ReportSummary.php b/CRM/Logging/ReportSummary.php index f7e93eeb24..5ecdcac11b 100644 --- a/CRM/Logging/ReportSummary.php +++ b/CRM/Logging/ReportSummary.php @@ -10,10 +10,7 @@ */ /** - * - * @package CRM - * @copyright CiviCRM LLC https://civicrm.org/licensing - * $Id$ + * Class CRM_Logging_ReportSummary */ class CRM_Logging_ReportSummary extends CRM_Report_Form { protected $cid; diff --git a/CRM/Report/Form/Contact/LoggingSummary.php b/CRM/Report/Form/Contact/LoggingSummary.php index c3ed3f5429..8b347fb735 100644 --- a/CRM/Report/Form/Contact/LoggingSummary.php +++ b/CRM/Report/Form/Contact/LoggingSummary.php @@ -178,6 +178,9 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { * * @param array $rows * Rows generated by SQL, with an array for each row. + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public function alterDisplay(&$rows) { // cache for id → is_deleted mapping @@ -206,9 +209,9 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { $row['log_civicrm_entity_altered_contact_hover'] = ts("Go to contact summary"); $entity = $this->getEntityValue($row['log_civicrm_entity_id'], $row['log_civicrm_entity_log_type'], $row['log_civicrm_entity_log_date']); if ($entity) { - $row['log_civicrm_entity_altered_contact'] = $row['log_civicrm_entity_altered_contact'] . " [{$entity}]"; + $row['log_civicrm_entity_altered_contact'] .= " [{$entity}]"; } - if ($entity == 'Contact Merged') { + 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. @@ -228,14 +231,14 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { } $row['altered_by_contact_display_name_link'] = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $row['log_civicrm_entity_log_user_id']); - $row['altered_by_contact_display_name_hover'] = ts("Go to contact summary"); + $row['altered_by_contact_display_name_hover'] = ts('Go to contact summary'); - if ($row['log_civicrm_entity_is_deleted'] and 'Update' == CRM_Utils_Array::value('log_civicrm_entity_log_action', $row)) { + if ($row['log_civicrm_entity_is_deleted'] && 'Update' === $row['log_civicrm_entity_log_action']) { $row['log_civicrm_entity_log_action'] = ts('Delete (to trash)'); } - if ('Contact' == CRM_Utils_Array::value('log_type', $this->_logTables[$row['log_civicrm_entity_log_type']]) && - CRM_Utils_Array::value('log_civicrm_entity_log_action', $row) == ts('Insert') + if ('Contact' === ($this->_logTables[$row['log_civicrm_entity_log_type']]['log_type'] ?? NULL) && + $row['log_civicrm_entity_log_action'] === ts('Insert') ) { $row['log_civicrm_entity_log_action'] = ts('Update'); } @@ -246,7 +249,7 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { if ($newAction = $this->getEntityAction($row['log_civicrm_entity_id'], $row['log_civicrm_entity_log_conn_id'], $row['log_civicrm_entity_log_type'], - CRM_Utils_Array::value('log_civicrm_entity_log_action', $row)) + ($row['log_civicrm_entity_log_action'] ?? NULL)) ) { $row['log_civicrm_entity_log_action'] = $newAction; } @@ -255,7 +258,7 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { $date = CRM_Utils_Date::isoToMysql($row['log_civicrm_entity_log_date']); - if (in_array(CRM_Utils_Array::value('log_civicrm_entity_log_action', $row), ['Update', 'Delete'])) { + if (in_array(($row['log_civicrm_entity_log_action'] ?? NULL), ['Update', 'Delete'])) { $row = $this->addDetailReportLinksToRow($baseQueryCriteria, $row); } @@ -293,7 +296,7 @@ class CRM_Report_Form_Contact_LoggingSummary extends CRM_Logging_ReportSummary { $entity = $this->currentLogTable; $detail = $this->_logTables[$entity]; - $tableName = CRM_Utils_Array::value('table_name', $detail, $entity); + $tableName = $detail['table_name'] ?? $entity; $clause = $detail['entity_table'] ?? NULL; $clause = $clause ? "AND entity_log_civireport.entity_table = 'civicrm_contact'" : NULL; @@ -333,6 +336,7 @@ LEFT JOIN civicrm_contact altered_by_contact_civireport protected function addDetailReportLinksToRow($baseQueryCriteria, $row) { $q = $baseQueryCriteria; $q .= (!empty($row['log_civicrm_entity_altered_contact'])) ? '&alteredName=' . $row['log_civicrm_entity_altered_contact'] : ''; + $q .= (!empty($row['log_civicrm_entity_altered_contact_id'])) ? '&cid=' . $row['log_civicrm_entity_altered_contact_id'] : ''; $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'] : ''; -- 2.25.1