function postProcess() {
$this->beginPostProcess();
$rows = array();
+
+ $tempColumns = "id int(10)";
+ if (CRM_Utils_Array::value('log_action', $this->_params['fields'])) {
+ $tempColumns .= ", log_action varchar(64)";
+ }
+ $tempColumns .= ", log_type varchar(64), log_user_id int(10), log_date timestamp";
+ if (CRM_Utils_Array::value('altered_contact', $this->_params['fields'])) {
+ $tempColumns .= ", altered_contact varchar(128)";
+ }
+ $tempColumns .= ", altered_contact_id int(10), log_conn_id int(11), is_deleted tinyint(4)";
+ if (CRM_Utils_Array::value('display_name', $this->_params['fields'])) {
+ $tempColumns .= ", display_name varchar(128)";
+ }
+
// temp table to hold all altered contact-ids
- $sql = "
-CREATE TEMPORARY TABLE
- civicrm_temp_civireport_logsummary ( id int(10),
- log_action varchar(64),
- log_type varchar(64),
- log_user_id int(10),
- log_date timestamp,
- altered_contact varchar(128),
- altered_contact_id int(10),
- log_conn_id int(11),
- is_deleted tinyint(4),
- display_name varchar(128) ) ENGINE=HEAP";
+ $sql = "CREATE TEMPORARY TABLE civicrm_temp_civireport_logsummary ( {$tempColumns} ) ENGINE=HEAP";
CRM_Core_DAO::executeQuery($sql);
$logDateClause = $this->dateClause('log_date',
CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $row['log_civicrm_entity_altered_contact_id'], 'is_deleted') !== '0';
}
- if (!$isDeleted[$row['log_civicrm_entity_altered_contact_id']]) {
+ if (CRM_Utils_Array::value($row, 'log_civicrm_entity_altered_contact') &&
+ !$isDeleted[$row['log_civicrm_entity_altered_contact_id']]) {
$row['log_civicrm_entity_altered_contact_link'] =
CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $row['log_civicrm_entity_altered_contact_id']);
$row['log_civicrm_entity_altered_contact_hover'] = ts("Go to contact summary");
$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");
- if ($row['log_civicrm_entity_is_deleted'] and $row['log_civicrm_entity_log_action'] == 'Update') {
+ if ($row['log_civicrm_entity_is_deleted'] and 'Update' == CRM_Utils_Array::value($row, 'log_civicrm_entity_log_action')) {
$row['log_civicrm_entity_log_action'] = ts('Delete (to trash)');
}
$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'],
- $row['log_civicrm_entity_log_action']))
+ if (CRM_Utils_Array::value($row, 'log_civicrm_entity_log_action') &&
+ $newAction = $this->getEntityAction($row['log_civicrm_entity_id'],
+ $row['log_civicrm_entity_log_conn_id'],
+ $row['log_civicrm_entity_log_type'],
+ $row['log_civicrm_entity_log_action']))
$row['log_civicrm_entity_log_action'] = $newAction;
$row['log_civicrm_entity_log_type'] = $this->getLogType($row['log_civicrm_entity_log_type']);
$date = CRM_Utils_Date::isoToMysql($row['log_civicrm_entity_log_date']);
- if ($row['log_civicrm_entity_log_action'] == 'Update') {
+ if ('Update' == CRM_Utils_Array::value($row, 'log_civicrm_entity_log_action')) {
$q = "reset=1&log_conn_id={$row['log_civicrm_entity_log_conn_id']}&log_date=". $date;
if ($this->cid) {
$q .= '&cid=' . $this->cid;