summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-10-08 09:55:31 -0400
committerFrederic Guillot <fred@kanboard.net>2016-10-08 09:55:31 -0400
commitcbe606cef560a711f6ae440720a80c37cecc4ea8 (patch)
treedd2a4c14a32a80791fff982d7834dcacc33ea124 /app
parentfe56fd66f49ecd2dc40d2983fa4622a14226aefd (diff)
Always apply merge hooks in task creation controller
Diffstat (limited to 'app')
-rw-r--r--app/Controller/TaskCreationController.php5
-rw-r--r--app/Controller/TaskGanttCreationController.php8
-rw-r--r--app/Controller/TaskModificationController.php20
3 files changed, 11 insertions, 22 deletions
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;
- }
}