diff options
author | Frédéric Guillot <fred@kanboard.net> | 2018-03-09 16:13:05 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2018-03-09 16:13:05 -0800 |
commit | 67da76e7f1e0f911c20d40f8e6c16052152b6f24 (patch) | |
tree | 01dcedfb2c7734b85738f28f677551c1933634cc /app/Controller | |
parent | d34a5c50c41e1de2abfb8cfd056dbf4ce089a51d (diff) |
Fix broken daily summary export
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/ExportController.php | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/app/Controller/ExportController.php b/app/Controller/ExportController.php index 19f73a7c..a7689673 100644 --- a/app/Controller/ExportController.php +++ b/app/Controller/ExportController.php @@ -26,15 +26,13 @@ class ExportController extends BaseController $project = $this->getProject(); if ($this->request->isPost()) { - $values = $this->request->getValues(); - $from = empty($values['from']) ? '' : $values['from']; - $to = empty($values['to']) ? '' : $values['to']; + $from = $this->request->getRawValue('from'); + $to = $this->request->getRawValue('to'); if ($from && $to) { $data = $this->$model->$method($project['id'], $from, $to); $this->response->withFileDownload($filename.'.csv'); $this->response->csv($data); - return; } } else { $this->response->html($this->template->render('export/'.$action, array( @@ -77,7 +75,31 @@ class ExportController extends BaseController */ public function summary() { - $this->common('projectDailyColumnStatsModel', 'getAggregatedMetrics', t('Summary'), 'summary', t('Daily project summary export')); + $project = $this->getProject(); + + if ($this->request->isPost()) { + $from = $this->request->getRawValue('from'); + $to = $this->request->getRawValue('to'); + + if ($from && $to) { + $from = $this->dateParser->getIsoDate($from); + $to = $this->dateParser->getIsoDate($to); + $data = $this->projectDailyColumnStatsModel->getAggregatedMetrics($project['id'], $from, $to); + $this->response->withFileDownload(t('Summary').'.csv'); + $this->response->csv($data); + } + } else { + $this->response->html($this->template->render('export/summary', array( + 'values' => array( + 'project_id' => $project['id'], + 'from' => '', + 'to' => '', + ), + 'errors' => array(), + 'project' => $project, + 'title' => t('Daily project summary export'), + ))); + } } /** |