From cbe606cef560a711f6ae440720a80c37cecc4ea8 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 8 Oct 2016 09:55:31 -0400 Subject: Always apply merge hooks in task creation controller --- app/Controller/TaskCreationController.php | 5 +++-- app/Controller/TaskGanttCreationController.php | 8 ++++---- app/Controller/TaskModificationController.php | 20 ++++---------------- 3 files changed, 11 insertions(+), 22 deletions(-) (limited to 'app/Controller') diff --git a/app/Controller/TaskCreationController.php b/app/Controller/TaskCreationController.php index c754b029..ec53e211 100644 --- a/app/Controller/TaskCreationController.php +++ b/app/Controller/TaskCreationController.php @@ -29,6 +29,9 @@ class TaskCreationController extends BaseController $values = $this->prepareValues($swimlanes_list); } + $values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values)); + $values = $this->hook->merge('controller:task-creation:form:default', $values, array('default_values' => $values)); + $this->response->html($this->template->render('task_creation/show', array( 'project' => $project, 'errors' => $errors, @@ -125,8 +128,6 @@ class TaskCreationController extends BaseController 'owner_id' => $this->userSession->getId(), ); - $values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values)); - $values = $this->hook->merge('controller:task-creation:form:default', $values, array('default_values' => $values)); return $values; } diff --git a/app/Controller/TaskGanttCreationController.php b/app/Controller/TaskGanttCreationController.php index 0fbac8bb..c5046f60 100644 --- a/app/Controller/TaskGanttCreationController.php +++ b/app/Controller/TaskGanttCreationController.php @@ -23,10 +23,10 @@ class TaskGanttCreationController extends BaseController $project = $this->getProject(); $values = $values + array( - 'project_id' => $project['id'], - 'column_id' => $this->columnModel->getFirstColumnId($project['id']), - 'position' => 1 - ); + 'project_id' => $project['id'], + 'column_id' => $this->columnModel->getFirstColumnId($project['id']), + 'position' => 1 + ); $values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values)); $values = $this->hook->merge('controller:gantt:task:form:default', $values, array('default_values' => $values)); diff --git a/app/Controller/TaskModificationController.php b/app/Controller/TaskModificationController.php index cbc3777a..f628e923 100644 --- a/app/Controller/TaskModificationController.php +++ b/app/Controller/TaskModificationController.php @@ -37,9 +37,12 @@ class TaskModificationController extends BaseController $project = $this->projectModel->getById($task['project_id']); if (empty($values)) { - $values = $this->prepareValues($task); + $values = $task; } + $values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values)); + $values = $this->hook->merge('controller:task-modification:form:default', $values, array('default_values' => $values)); + $this->response->html($this->template->render('task_modification/show', array( 'project' => $project, 'values' => $values, @@ -71,19 +74,4 @@ class TaskModificationController extends BaseController $this->edit($values, $errors); } } - - /** - * Prepare form values - * - * @access protected - * @param array $task - * @return array - */ - protected function prepareValues(array $task) - { - $values = $task; - $values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values)); - $values = $this->hook->merge('controller:task-modification:form:default', $values, array('default_values' => $values)); - return $values; - } } -- cgit v1.2.3