*
* @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
$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.
}
$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');
}
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;
}
$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);
}
$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;
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'] : '';