Rename subtask model
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Controller;
|
||||
|
||||
use Model\SubTask as SubTaskModel;
|
||||
use Model\Subtask as SubTaskModel;
|
||||
|
||||
/**
|
||||
* Application controller
|
||||
@@ -55,7 +55,7 @@ class App extends Base
|
||||
->setUrl('app', $action, array('pagination' => 'subtasks'))
|
||||
->setMax(10)
|
||||
->setOrder('tasks.id')
|
||||
->setQuery($this->subTask->getUserQuery($user_id, $status))
|
||||
->setQuery($this->subtask->getUserQuery($user_id, $status))
|
||||
->calculateOnlyIf($this->request->getStringParam('pagination') === 'subtasks');
|
||||
|
||||
$project_paginator = $this->paginator
|
||||
|
||||
@@ -40,7 +40,7 @@ use Symfony\Component\EventDispatcher\Event;
|
||||
* @property \Model\ProjectAnalytic $projectAnalytic
|
||||
* @property \Model\ProjectActivity $projectActivity
|
||||
* @property \Model\ProjectDailySummary $projectDailySummary
|
||||
* @property \Model\SubTask $subTask
|
||||
* @property \Model\Subtask $subtask
|
||||
* @property \Model\Swimlane $swimlane
|
||||
* @property \Model\Task $task
|
||||
* @property \Model\TaskCreation $taskCreation
|
||||
@@ -168,7 +168,7 @@ abstract class Base
|
||||
$this->handleAuthentication();
|
||||
$this->handleAuthorization($controller, $action);
|
||||
|
||||
$this->session['has_subtask_inprogress'] = $this->subTask->hasSubtaskInProgress($this->userSession->getId());
|
||||
$this->session['has_subtask_inprogress'] = $this->subtask->hasSubtaskInProgress($this->userSession->getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -410,7 +410,7 @@ class Board extends Base
|
||||
{
|
||||
$task = $this->getTask();
|
||||
$this->response->html($this->template->render('board/subtasks', array(
|
||||
'subtasks' => $this->subTask->getAll($task['id']),
|
||||
'subtasks' => $this->subtask->getAll($task['id']),
|
||||
'task' => $task,
|
||||
)));
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace Controller;
|
||||
|
||||
use Model\SubTask as SubtaskModel;
|
||||
use Model\Subtask as SubtaskModel;
|
||||
|
||||
/**
|
||||
* SubTask controller
|
||||
* Subtask controller
|
||||
*
|
||||
* @package controller
|
||||
* @author Frederic Guillot
|
||||
@@ -20,7 +20,7 @@ class Subtask extends Base
|
||||
*/
|
||||
private function getSubtask()
|
||||
{
|
||||
$subtask = $this->subTask->getById($this->request->getIntegerParam('subtask_id'));
|
||||
$subtask = $this->subtask->getById($this->request->getIntegerParam('subtask_id'));
|
||||
|
||||
if (! $subtask) {
|
||||
$this->notfound();
|
||||
@@ -63,11 +63,11 @@ class Subtask extends Base
|
||||
$task = $this->getTask();
|
||||
$values = $this->request->getValues();
|
||||
|
||||
list($valid, $errors) = $this->subTask->validateCreation($values);
|
||||
list($valid, $errors) = $this->subtask->validateCreation($values);
|
||||
|
||||
if ($valid) {
|
||||
|
||||
if ($this->subTask->create($values)) {
|
||||
if ($this->subtask->create($values)) {
|
||||
$this->session->flash(t('Sub-task added successfully.'));
|
||||
}
|
||||
else {
|
||||
@@ -98,7 +98,7 @@ class Subtask extends Base
|
||||
'values' => empty($values) ? $subtask : $values,
|
||||
'errors' => $errors,
|
||||
'users_list' => $this->projectPermission->getMemberList($task['project_id']),
|
||||
'status_list' => $this->subTask->getStatusList(),
|
||||
'status_list' => $this->subtask->getStatusList(),
|
||||
'subtask' => $subtask,
|
||||
'task' => $task,
|
||||
)));
|
||||
@@ -115,11 +115,11 @@ class Subtask extends Base
|
||||
$this->getSubtask();
|
||||
|
||||
$values = $this->request->getValues();
|
||||
list($valid, $errors) = $this->subTask->validateModification($values);
|
||||
list($valid, $errors) = $this->subtask->validateModification($values);
|
||||
|
||||
if ($valid) {
|
||||
|
||||
if ($this->subTask->update($values)) {
|
||||
if ($this->subtask->update($values)) {
|
||||
$this->session->flash(t('Sub-task updated successfully.'));
|
||||
}
|
||||
else {
|
||||
@@ -159,7 +159,7 @@ class Subtask extends Base
|
||||
$task = $this->getTask();
|
||||
$subtask = $this->getSubtask();
|
||||
|
||||
if ($this->subTask->remove($subtask['id'])) {
|
||||
if ($this->subtask->remove($subtask['id'])) {
|
||||
$this->session->flash(t('Sub-task removed successfully.'));
|
||||
}
|
||||
else {
|
||||
@@ -180,14 +180,14 @@ class Subtask extends Base
|
||||
$subtask = $this->getSubtask();
|
||||
$redirect = $this->request->getStringParam('redirect', 'task');
|
||||
|
||||
$this->subTask->toggleStatus($subtask['id']);
|
||||
$this->subtask->toggleStatus($subtask['id']);
|
||||
|
||||
if ($redirect === 'board') {
|
||||
|
||||
$this->session['has_subtask_inprogress'] = $this->subTask->hasSubtaskInProgress($this->userSession->getId());
|
||||
$this->session['has_subtask_inprogress'] = $this->subtask->hasSubtaskInProgress($this->userSession->getId());
|
||||
|
||||
$this->response->html($this->template->render('board/subtasks', array(
|
||||
'subtasks' => $this->subTask->getAll($task['id']),
|
||||
'subtasks' => $this->subtask->getAll($task['id']),
|
||||
'task' => $task,
|
||||
)));
|
||||
}
|
||||
@@ -210,7 +210,7 @@ class Subtask extends Base
|
||||
SubtaskModel::STATUS_TODO => t('Todo'),
|
||||
SubtaskModel::STATUS_DONE => t('Done'),
|
||||
),
|
||||
'subtask_inprogress' => $this->subTask->getSubtaskInProgress($this->userSession->getId()),
|
||||
'subtask_inprogress' => $this->subtask->getSubtaskInProgress($this->userSession->getId()),
|
||||
'subtask' => $subtask,
|
||||
'task' => $task,
|
||||
'redirect' => $this->request->getStringParam('redirect'),
|
||||
@@ -229,13 +229,13 @@ class Subtask extends Base
|
||||
$values = $this->request->getValues();
|
||||
|
||||
// Change status of the previous in progress subtask
|
||||
$this->subTask->update(array(
|
||||
$this->subtask->update(array(
|
||||
'id' => $values['id'],
|
||||
'status' => $values['status'],
|
||||
));
|
||||
|
||||
// Set the current subtask to in pogress
|
||||
$this->subTask->update(array(
|
||||
$this->subtask->update(array(
|
||||
'id' => $subtask['id'],
|
||||
'status' => SubtaskModel::STATUS_INPROGRESS,
|
||||
));
|
||||
|
||||
@@ -35,7 +35,7 @@ class Task extends Base
|
||||
$this->response->html($this->template->layout('task/public', array(
|
||||
'project' => $project,
|
||||
'comments' => $this->comment->getAll($task['id']),
|
||||
'subtasks' => $this->subTask->getAll($task['id']),
|
||||
'subtasks' => $this->subtask->getAll($task['id']),
|
||||
'task' => $task,
|
||||
'columns_list' => $this->board->getColumnsList($task['project_id']),
|
||||
'colors_list' => $this->color->getList(),
|
||||
@@ -54,7 +54,7 @@ class Task extends Base
|
||||
public function show()
|
||||
{
|
||||
$task = $this->getTask();
|
||||
$subtasks = $this->subTask->getAll($task['id']);
|
||||
$subtasks = $this->subtask->getAll($task['id']);
|
||||
|
||||
$values = array(
|
||||
'id' => $task['id'],
|
||||
|
||||
@@ -29,7 +29,7 @@ use Pimple\Container;
|
||||
* @property \Model\Project $project
|
||||
* @property \Model\ProjectDuplication $projectDuplication
|
||||
* @property \Model\ProjectPermission $projectPermission
|
||||
* @property \Model\SubTask $subTask
|
||||
* @property \Model\Subtask $subtask
|
||||
* @property \Model\SubtaskHistory $subtaskHistory
|
||||
* @property \Model\Swimlane $swimlane
|
||||
* @property \Model\Task $task
|
||||
|
||||
@@ -162,9 +162,9 @@ class ProjectActivity extends Base
|
||||
return t('%s moved the task #%d to the column "%s"', $event['author'], $event['task']['id'], $event['task']['column_title']);
|
||||
case Task::EVENT_MOVE_POSITION:
|
||||
return t('%s moved the task #%d to the position %d in the column "%s"', $event['author'], $event['task']['id'], $event['task']['position'], $event['task']['column_title']);
|
||||
case SubTask::EVENT_UPDATE:
|
||||
case Subtask::EVENT_UPDATE:
|
||||
return t('%s updated a subtask for the task #%d', $event['author'], $event['task']['id']);
|
||||
case SubTask::EVENT_CREATE:
|
||||
case Subtask::EVENT_CREATE:
|
||||
return t('%s created a subtask for the task #%d', $event['author'], $event['task']['id']);
|
||||
case Comment::EVENT_UPDATE:
|
||||
return t('%s updated a comment on the task #%d', $event['author'], $event['task']['id']);
|
||||
|
||||
@@ -12,7 +12,7 @@ use SimpleValidator\Validators;
|
||||
* @package model
|
||||
* @author Frederic Guillot
|
||||
*/
|
||||
class SubTask extends Base
|
||||
class Subtask extends Base
|
||||
{
|
||||
/**
|
||||
* SQL table name
|
||||
@@ -93,16 +93,16 @@ class SubTask extends Base
|
||||
*/
|
||||
public function getUserQuery($user_id, array $status)
|
||||
{
|
||||
return $this->db->table(SubTask::TABLE)
|
||||
return $this->db->table(Subtask::TABLE)
|
||||
->columns(
|
||||
SubTask::TABLE.'.*',
|
||||
Subtask::TABLE.'.*',
|
||||
Task::TABLE.'.project_id',
|
||||
Task::TABLE.'.color_id',
|
||||
Project::TABLE.'.name AS project_name'
|
||||
)
|
||||
->eq('user_id', $user_id)
|
||||
->eq(Project::TABLE.'.is_active', Project::ACTIVE)
|
||||
->in(SubTask::TABLE.'.status', $status)
|
||||
->in(Subtask::TABLE.'.status', $status)
|
||||
->join(Task::TABLE, 'id', 'task_id')
|
||||
->join(Project::TABLE, 'id', 'project_id', Task::TABLE)
|
||||
->filter(array($this, 'addStatusName'));
|
||||
@@ -283,7 +283,7 @@ class SubTask extends Base
|
||||
{
|
||||
return $this->db->transaction(function ($db) use ($src_task_id, $dst_task_id) {
|
||||
|
||||
$subtasks = $db->table(SubTask::TABLE)
|
||||
$subtasks = $db->table(Subtask::TABLE)
|
||||
->columns('title', 'time_estimated')
|
||||
->eq('task_id', $src_task_id)
|
||||
->asc('id') // Explicit sorting for postgresql
|
||||
@@ -293,7 +293,7 @@ class SubTask extends Base
|
||||
|
||||
$subtask['task_id'] = $dst_task_id;
|
||||
|
||||
if (! $db->table(SubTask::TABLE)->save($subtask)) {
|
||||
if (! $db->table(Subtask::TABLE)->save($subtask)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class SubtaskExport extends Base
|
||||
*/
|
||||
public function export($project_id, $from, $to)
|
||||
{
|
||||
$this->subtask_status = $this->subTask->getStatusList();
|
||||
$this->subtask_status = $this->subtask->getStatusList();
|
||||
$subtasks = $this->getSubtasks($project_id, $from, $to);
|
||||
$results = array($this->getColumns());
|
||||
|
||||
@@ -101,10 +101,10 @@ class SubtaskExport extends Base
|
||||
$to = $this->dateParser->removeTimeFromTimestamp(strtotime('+1 day', $this->dateParser->getTimestamp($to)));
|
||||
}
|
||||
|
||||
return $this->db->table(SubTask::TABLE)
|
||||
return $this->db->table(Subtask::TABLE)
|
||||
->eq('project_id', $project_id)
|
||||
->columns(
|
||||
SubTask::TABLE.'.*',
|
||||
Subtask::TABLE.'.*',
|
||||
User::TABLE.'.username AS assignee_username',
|
||||
User::TABLE.'.name AS assignee_name',
|
||||
Task::TABLE.'.title AS task_title'
|
||||
@@ -113,7 +113,7 @@ class SubtaskExport extends Base
|
||||
->lte('date_creation', $to)
|
||||
->join(Task::TABLE, 'id', 'task_id')
|
||||
->join(User::TABLE, 'id', 'user_id')
|
||||
->asc(SubTask::TABLE.'.id')
|
||||
->asc(Subtask::TABLE.'.id')
|
||||
->findAll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,13 +33,13 @@ class SubtaskTimeTracking extends Base
|
||||
self::TABLE.'.subtask_id',
|
||||
self::TABLE.'.end',
|
||||
self::TABLE.'.start',
|
||||
SubTask::TABLE.'.task_id',
|
||||
SubTask::TABLE.'.title AS subtask_title',
|
||||
Subtask::TABLE.'.task_id',
|
||||
Subtask::TABLE.'.title AS subtask_title',
|
||||
Task::TABLE.'.title AS task_title',
|
||||
Task::TABLE.'.project_id'
|
||||
)
|
||||
->join(SubTask::TABLE, 'id', 'subtask_id')
|
||||
->join(Task::TABLE, 'id', 'task_id', SubTask::TABLE)
|
||||
->join(Subtask::TABLE, 'id', 'subtask_id')
|
||||
->join(Task::TABLE, 'id', 'task_id', Subtask::TABLE)
|
||||
->eq(self::TABLE.'.user_id', $user_id);
|
||||
}
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ class TaskDuplication extends Base
|
||||
$new_task_id = $this->taskCreation->create($values);
|
||||
|
||||
if ($new_task_id) {
|
||||
$this->subTask->duplicate($task_id, $new_task_id);
|
||||
$this->subtask->duplicate($task_id, $new_task_id);
|
||||
}
|
||||
|
||||
return $new_task_id;
|
||||
|
||||
@@ -31,7 +31,7 @@ class ClassProvider implements ServiceProviderInterface
|
||||
'ProjectDuplication',
|
||||
'ProjectDailySummary',
|
||||
'ProjectPermission',
|
||||
'SubTask',
|
||||
'Subtask',
|
||||
'SubtaskExport',
|
||||
'SubtaskTimeTracking',
|
||||
'Swimlane',
|
||||
|
||||
@@ -18,7 +18,7 @@ use Pimple\Container;
|
||||
* @property \Model\ProjectPermission $projectPermission
|
||||
* @property \Model\ProjectAnalytic $projectAnalytic
|
||||
* @property \Model\ProjectDailySummary $projectDailySummary
|
||||
* @property \Model\SubTask $subTask
|
||||
* @property \Model\Subtask $subtask
|
||||
* @property \Model\Task $task
|
||||
* @property \Model\TaskExport $taskExport
|
||||
* @property \Model\TaskFinder $taskFinder
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Subscriber;
|
||||
use Event\GenericEvent;
|
||||
use Model\Task;
|
||||
use Model\Comment;
|
||||
use Model\SubTask;
|
||||
use Model\Subtask;
|
||||
use Model\File;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
@@ -19,8 +19,8 @@ class NotificationSubscriber extends Base implements EventSubscriberInterface
|
||||
Task::EVENT_MOVE_COLUMN => 'task_move_column',
|
||||
Task::EVENT_MOVE_POSITION => 'task_move_position',
|
||||
Task::EVENT_ASSIGNEE_CHANGE => 'task_assignee_change',
|
||||
SubTask::EVENT_CREATE => 'subtask_creation',
|
||||
SubTask::EVENT_UPDATE => 'subtask_update',
|
||||
Subtask::EVENT_CREATE => 'subtask_creation',
|
||||
Subtask::EVENT_UPDATE => 'subtask_update',
|
||||
Comment::EVENT_CREATE => 'comment_creation',
|
||||
Comment::EVENT_UPDATE => 'comment_update',
|
||||
File::EVENT_CREATE => 'file_creation',
|
||||
@@ -36,8 +36,8 @@ class NotificationSubscriber extends Base implements EventSubscriberInterface
|
||||
Task::EVENT_MOVE_COLUMN => array('execute', 0),
|
||||
Task::EVENT_MOVE_POSITION => array('execute', 0),
|
||||
Task::EVENT_ASSIGNEE_CHANGE => array('execute', 0),
|
||||
SubTask::EVENT_CREATE => array('execute', 0),
|
||||
SubTask::EVENT_UPDATE => array('execute', 0),
|
||||
Subtask::EVENT_CREATE => array('execute', 0),
|
||||
Subtask::EVENT_UPDATE => array('execute', 0),
|
||||
Comment::EVENT_CREATE => array('execute', 0),
|
||||
Comment::EVENT_UPDATE => array('execute', 0),
|
||||
File::EVENT_CREATE => array('execute', 0),
|
||||
@@ -63,7 +63,7 @@ class NotificationSubscriber extends Base implements EventSubscriberInterface
|
||||
$values['task'] = $this->taskFinder->getDetails($event['task_id']);
|
||||
break;
|
||||
case 'Event\SubtaskEvent':
|
||||
$values['subtask'] = $this->subTask->getById($event['id'], true);
|
||||
$values['subtask'] = $this->subtask->getById($event['id'], true);
|
||||
$values['task'] = $this->taskFinder->getDetails($event['task_id']);
|
||||
break;
|
||||
case 'Event\FileEvent':
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Subscriber;
|
||||
use Event\GenericEvent;
|
||||
use Model\Task;
|
||||
use Model\Comment;
|
||||
use Model\SubTask;
|
||||
use Model\Subtask;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
class ProjectActivitySubscriber extends Base implements EventSubscriberInterface
|
||||
@@ -22,8 +22,8 @@ class ProjectActivitySubscriber extends Base implements EventSubscriberInterface
|
||||
Task::EVENT_MOVE_POSITION => array('execute', 0),
|
||||
Comment::EVENT_UPDATE => array('execute', 0),
|
||||
Comment::EVENT_CREATE => array('execute', 0),
|
||||
SubTask::EVENT_UPDATE => array('execute', 0),
|
||||
SubTask::EVENT_CREATE => array('execute', 0),
|
||||
Subtask::EVENT_UPDATE => array('execute', 0),
|
||||
Subtask::EVENT_CREATE => array('execute', 0),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ class ProjectActivitySubscriber extends Base implements EventSubscriberInterface
|
||||
|
||||
switch (get_class($event)) {
|
||||
case 'Event\SubtaskEvent':
|
||||
$values['subtask'] = $this->subTask->getById($event['id'], true);
|
||||
$values['subtask'] = $this->subtask->getById($event['id'], true);
|
||||
break;
|
||||
case 'Event\CommentEvent':
|
||||
$values['comment'] = $this->comment->getById($event['id']);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Subscriber;
|
||||
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
use Model\SubTask;
|
||||
use Model\Subtask;
|
||||
use Event\SubtaskEvent;
|
||||
|
||||
class SubtaskTimesheetSubscriber extends Base implements EventSubscriberInterface
|
||||
@@ -11,7 +11,7 @@ class SubtaskTimesheetSubscriber extends Base implements EventSubscriberInterfac
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
SubTask::EVENT_UPDATE => array('log', 0),
|
||||
Subtask::EVENT_UPDATE => array('log', 0),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ class SubtaskTimesheetSubscriber extends Base implements EventSubscriberInterfac
|
||||
{
|
||||
if (isset($event['status'])) {
|
||||
|
||||
$subtask = $this->subTask->getById($event['id']);
|
||||
$subtask = $this->subtask->getById($event['id']);
|
||||
|
||||
if ($subtask['status'] == SubTask::STATUS_INPROGRESS) {
|
||||
if ($subtask['status'] == Subtask::STATUS_INPROGRESS) {
|
||||
$this->subtaskTimeTracking->logStartTime($subtask['id'], $subtask['user_id']);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user