Fixed sub-task handling

The previous implementation of sub-tasks did not work as expected: it
was possible to mark sub-tasks as completed before the parent task's
dependencies were satisfied. In addition, it was impossible to retrieve
a task's path from the database without running a recursive query.

Full paths to sub-tasks added to views, since it is now possible to
obtain them.
This commit is contained in:
Emmanuel BENOîT 2012-02-15 10:04:11 +01:00
parent 91ae4f81fd
commit 2051303262
13 changed files with 1023 additions and 224 deletions
includes/t-tasks

View file

@ -98,16 +98,16 @@ class Ctrl_TaskDetails
$bTitle = "Active task";
}
if ( $this->task->item !== null ) {
$items = Loader::DAO( 'items' );
$items->getLineage( $this->task->item = $items->get( $this->task->item ) );
} else {
$this->task->parent_task = Loader::DAO( 'tasks' )->get( $this->task->parent_task );
$items = Loader::DAO( 'items' );
$tasks = Loader::DAO( 'tasks' );
$items->getLineage( $this->task->item = $items->get( $this->task->item ) );
if ( $this->task->parent_task !== null ) {
$this->task->parent_task = $tasks->get( $this->task->parent_task );
}
$box = Loader::View( 'box' , $bTitle , Loader::View( 'task_details' , $this->task ) );
$tasks = Loader::DAO( 'tasks' );
if ( $this->task->completed_by === null ) {
$box->addButton( BoxButton::create( 'Edit task' , 'tasks/edit?id=' . $this->task->id )
->setClass( 'icon edit' ) );
@ -138,7 +138,7 @@ class Ctrl_TaskDetails
$timestamp = strtotime( $this->task->completed_at );
}
if ( Loader::DAO( 'tasks' )->canDelete( $this->task ) ) {
if ( $tasks->canDelete( $this->task ) ) {
$box->addButton( BoxButton::create( 'Delete' , 'tasks/delete?id=' . $this->task->id )
->setClass( 'icon delete' ) );
}