summaryrefslogtreecommitdiff
path: root/app/Model/Task.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Model/Task.php')
-rw-r--r--app/Model/Task.php64
1 files changed, 36 insertions, 28 deletions
diff --git a/app/Model/Task.php b/app/Model/Task.php
index f08eb910..8933cb14 100644
--- a/app/Model/Task.php
+++ b/app/Model/Task.php
@@ -73,34 +73,40 @@ class Task extends Base
{
if ($more) {
- return $this->db
- ->table(self::TABLE)
- ->columns(
- self::TABLE.'.id',
- self::TABLE.'.title',
- self::TABLE.'.description',
- self::TABLE.'.date_creation',
- self::TABLE.'.date_completed',
- self::TABLE.'.date_due',
- self::TABLE.'.color_id',
- self::TABLE.'.project_id',
- self::TABLE.'.column_id',
- self::TABLE.'.owner_id',
- self::TABLE.'.position',
- self::TABLE.'.is_active',
- self::TABLE.'.score',
- self::TABLE.'.category_id',
- Category::TABLE.'.name AS category_name',
- Project::TABLE.'.name AS project_name',
- Board::TABLE.'.title AS column_title',
- User::TABLE.'.username'
- )
- ->join(Category::TABLE, 'id', 'category_id')
- ->join(Project::TABLE, 'id', 'project_id')
- ->join(Board::TABLE, 'id', 'column_id')
- ->join(User::TABLE, 'id', 'owner_id')
- ->eq(self::TABLE.'.id', $task_id)
- ->findOne();
+ $sql = '
+ SELECT
+ tasks.id,
+ tasks.title,
+ tasks.description,
+ tasks.date_creation,
+ tasks.date_completed,
+ tasks.date_modification,
+ tasks.date_due,
+ tasks.color_id,
+ tasks.project_id,
+ tasks.column_id,
+ tasks.owner_id,
+ tasks.creator_id,
+ tasks.position,
+ tasks.is_active,
+ tasks.score,
+ tasks.category_id,
+ project_has_categories.name AS category_name,
+ projects.name AS project_name,
+ columns.title AS column_title,
+ users.username AS assignee_username,
+ creators.username AS creator_username
+ FROM tasks
+ LEFT JOIN users ON users.id = tasks.owner_id
+ LEFT JOIN users AS creators ON creators.id = tasks.creator_id
+ LEFT JOIN project_has_categories ON project_has_categories.id = tasks.category_id
+ LEFT JOIN projects ON projects.id = tasks.project_id
+ LEFT JOIN columns ON columns.id = tasks.column_id
+ WHERE tasks.id = ?
+ ';
+
+ $rq = $this->db->execute($sql, array($task_id));
+ return $rq->fetch(\PDO::FETCH_ASSOC);
}
else {
@@ -385,6 +391,7 @@ class Task extends Base
}
$updated_task = $values;
+ $updated_task['date_modification'] = time();
unset($updated_task['id']);
$result = $this->db->table(self::TABLE)->eq('id', $values['id'])->update($updated_task);
@@ -514,6 +521,7 @@ class Task extends Base
new Validators\Required('column_id', t('The column is required')),
new Validators\Integer('column_id', t('This value must be an integer')),
new Validators\Integer('owner_id', t('This value must be an integer')),
+ new Validators\Integer('creator_id', t('This value must be an integer')),
new Validators\Integer('score', t('This value must be an integer')),
new Validators\Required('title', t('The title is required')),
new Validators\MaxLength('title', t('The maximum length is %d characters', 200), 200),