Skip to content
Snippets Groups Projects
Commit cb22e5dc authored by eileen's avatar eileen
Browse files

#1749 Fix missing parameter in link to logging detail

parent 9c15aa5c
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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'] : '';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment