From: jitendrapurohit Date: Thu, 7 Jan 2016 13:23:28 +0000 (+0530) Subject: Alter DateTime section header to group by date from the datetime field. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e06df9afaf4d1fba345a79d5a8dda8423320ffe0;hp=f60ecdb4299cbe6fd33830b8e79c3d4e5f02d018;p=civicrm-core.git Alter DateTime section header to group by date from the datetime field. --- diff --git a/CRM/Report/Form/Activity.php b/CRM/Report/Form/Activity.php index ed9e2386cc..a7eaebf57b 100644 --- a/CRM/Report/Form/Activity.php +++ b/CRM/Report/Form/Activity.php @@ -821,6 +821,9 @@ GROUP BY civicrm_activity_id $having {$this->_orderBy}"; $this->_having = "HAVING " . implode(' AND ', $nullFilters); } $this->orderBy(); + if (!empty($this->_sections) && key($this->_sections) == 'civicrm_activity_activity_date_time') { + $this->alterSectionHeaderForDateTime(); + } $this->limit(); $sql = "{$this->_select} FROM civireport_activity_temp_target tar @@ -1059,4 +1062,19 @@ GROUP BY civicrm_activity_id {$this->_having} {$this->_orderBy} {$this->_limit}" } } + /* + * 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); + } + }