}
}
+ /*
+ * CRM-17793 - Alter DateTime section header to group by date from the datetime field.
+ * @param $tempTable
+ * @param $columnName
+ */
+ public function alterSectionHeaderForDateTime($tempTable, $columnName) {
+ $tempQuery = "ALTER TABLE {$tempTable} ADD COLUMN {$columnName}_date VARCHAR(128)";
+ CRM_Core_DAO::executeQuery($tempQuery);
+ $updateQuery = "UPDATE {$tempTable} SET {$columnName}_date = date({$columnName})";
+ CRM_Core_DAO::executeQuery($updateQuery);
+ $this->_select .= ", {$columnName}_date";
+ $this->_sections["{$columnName}_date"] = $this->_sections["{$columnName}"];
+ unset($this->_sections["{$columnName}"]);
+ $this->assign('sections', $this->_sections);
+ }
+
}
$this->_having = "HAVING " . implode(' AND ', $nullFilters);
}
$this->orderBy();
- if (!empty($this->_sections) && key($this->_sections) == 'civicrm_activity_activity_date_time') {
- $this->alterSectionHeaderForDateTime();
+ foreach ($this->_sections as $alias => $section) {
+ if (!empty($section) && $section['name'] == 'activity_date_time') {
+ $this->alterSectionHeaderForDateTime('civireport_activity_temp_target', $section['tplField']);
+ }
}
$this->limit();
$sql = "{$this->_select}
}
}
- /*
- * Alter DateTime section header to group by date from the datetime field.
- *
- */
- public function alterSectionHeaderForDateTime() {
- $tempQuery = "ALTER TABLE civireport_activity_temp_target ADD COLUMN civicrm_activity_activity_date VARCHAR(128)";
- CRM_Core_DAO::executeQuery($tempQuery);
- $updateQuery = "UPDATE civireport_activity_temp_target SET civicrm_activity_activity_date = date(civicrm_activity_activity_date_time)";
- CRM_Core_DAO::executeQuery($updateQuery);
- $this->_select .= ', civicrm_activity_activity_date';
- $this->_sections['civicrm_activity_activity_date'] = $this->_sections['civicrm_activity_activity_date_time'];
- unset($this->_sections['civicrm_activity_activity_date_time']);
- $this->assign('sections', $this->_sections);
- }
-
}