summaryrefslogtreecommitdiff
path: root/app/Controller/TaskImportController.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-11-14 15:39:43 -0800
committerFrederic Guillot <fred@kanboard.net>2017-11-14 15:39:43 -0800
commit95cdeed472d00cd1b2f53b4878afd7fbc39ea389 (patch)
treeaf3aebe998dd6551946eea5901e1f2249adef3a9 /app/Controller/TaskImportController.php
parentf6d7791ddc5c58cab0eedc6b290fd08b61191329 (diff)
Task CSV import is now able to handle more fields
Add support for the priority, start date, tags and one external link.
Diffstat (limited to 'app/Controller/TaskImportController.php')
-rw-r--r--app/Controller/TaskImportController.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/app/Controller/TaskImportController.php b/app/Controller/TaskImportController.php
index 2e323979..d6506880 100644
--- a/app/Controller/TaskImportController.php
+++ b/app/Controller/TaskImportController.php
@@ -3,6 +3,7 @@
namespace Kanboard\Controller;
use Kanboard\Core\Csv;
+use Kanboard\Import\TaskImport;
/**
* Task Import controller
@@ -45,14 +46,15 @@ class TaskImportController extends BaseController
if (! file_exists($filename)) {
$this->show($values, array('file' => array(t('Unable to read your file'))));
} else {
- $this->taskImport->projectId = $project['id'];
+ $taskImport = new TaskImport($this->container);
+ $taskImport->setProjectId($project['id']);
$csv = new Csv($values['delimiter'], $values['enclosure']);
- $csv->setColumnMapping($this->taskImport->getColumnMapping());
- $csv->read($filename, array($this->taskImport, 'import'));
+ $csv->setColumnMapping($taskImport->getColumnMapping());
+ $csv->read($filename, array($taskImport, 'importTask'));
- if ($this->taskImport->counter > 0) {
- $this->flash->success(t('%d task(s) have been imported successfully.', $this->taskImport->counter));
+ if ($taskImport->getNumberOfImportedTasks() > 0) {
+ $this->flash->success(t('%d task(s) have been imported successfully.', $taskImport->getNumberOfImportedTasks()));
} else {
$this->flash->failure(t('Nothing have been imported!'));
}
@@ -67,7 +69,8 @@ class TaskImportController extends BaseController
*/
public function template()
{
+ $taskImport = new TaskImport($this->container);
$this->response->withFileDownload('tasks.csv');
- $this->response->csv(array($this->taskImport->getColumnMapping()));
+ $this->response->csv(array($taskImport->getColumnMapping()));
}
}