summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-10-07 20:06:28 -0400
committerFrederic Guillot <fred@kanboard.net>2015-10-07 20:06:28 -0400
commit9d56525c4b3d63426ab38b9372a659a72a21926c (patch)
tree27bf5e6d97edc02cc02eb97f0e934a847b4b5ac4 /app/Controller
parent735c99e4ae360000254710c631cc201290df331a (diff)
When duplicating a task redirect to the new task
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Taskduplication.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/app/Controller/Taskduplication.php b/app/Controller/Taskduplication.php
index aebbcfc1..8d329ca4 100644
--- a/app/Controller/Taskduplication.php
+++ b/app/Controller/Taskduplication.php
@@ -26,7 +26,7 @@ class Taskduplication extends Base
if ($task_id > 0) {
$this->session->flash(t('Task created successfully.'));
- $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])));
+ $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task_id)));
} else {
$this->session->flashError(t('Unable to create this task.'));
$this->response->redirect($this->helper->url->to('taskduplication', 'duplicate', array('project_id' => $task['project_id'], 'task_id' => $task['id'])));
@@ -83,15 +83,16 @@ class Taskduplication extends Base
$values = $this->request->getValues();
list($valid,) = $this->taskValidator->validateProjectModification($values);
- if ($valid && $this->taskDuplication->duplicateToProject($task['id'],
- $values['project_id'],
- $values['swimlane_id'],
- $values['column_id'],
- $values['category_id'],
- $values['owner_id'])) {
+ if ($valid) {
+ $task_id = $this->taskDuplication->duplicateToProject(
+ $task['id'], $values['project_id'], $values['swimlane_id'],
+ $values['column_id'], $values['category_id'], $values['owner_id']
+ );
- $this->session->flash(t('Task created successfully.'));
- $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])));
+ if ($task_id > 0) {
+ $this->session->flash(t('Task created successfully.'));
+ $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $values['project_id'], 'task_id' => $task_id)));
+ }
}
$this->session->flashError(t('Unable to create your task.'));