From 46974915b328d90a140dc9c27229d10742343b00 Mon Sep 17 00:00:00 2001 From: Olivier Maridat Date: Tue, 11 Jul 2017 12:51:28 +0200 Subject: Add "Create another link" checkbox for internal link as in sub-task creation --- app/Controller/TaskInternalLinkController.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'app/Controller') diff --git a/app/Controller/TaskInternalLinkController.php b/app/Controller/TaskInternalLinkController.php index a140f1ff..7c800165 100644 --- a/app/Controller/TaskInternalLinkController.php +++ b/app/Controller/TaskInternalLinkController.php @@ -44,6 +44,13 @@ class TaskInternalLinkController extends BaseController { $task = $this->getTask(); + if (empty($values)) { + $values = array( + 'another_tasklink' => $this->request->getIntegerParam('another_tasklink', 0) + ); + $values = $this->hook->merge('controller:tasklink:form:default', $values, array('default_values' => $values)); + } + $this->response->html($this->template->render('task_internal_link/create', array( 'values' => $values, 'errors' => $errors, @@ -65,8 +72,18 @@ class TaskInternalLinkController extends BaseController list($valid, $errors) = $this->taskLinkValidator->validateCreation($values); if ($valid) { - if ($this->taskLinkModel->create($values['task_id'], $values['opposite_task_id'], $values['link_id'])) { + if ($this->taskLinkModel->create($values['task_id'], $values['opposite_task_id'], $values['link_id']) !== false) { $this->flash->success(t('Link added successfully.')); + + if (isset($values['another_tasklink']) && $values['another_tasklink'] == 1) { + return $this->create(array( + 'project_id' => $task['project_id'], + 'task_id' => $task['id'], + 'link_id' => $values['link_id'], + 'another_tasklink' => 1 + )); + } + return $this->response->redirect($this->helper->url->to('TaskViewController', 'show', array('task_id' => $task['id'], 'project_id' => $task['project_id'])), true); } -- cgit v1.2.3