* fix Bug 2671
This commit is contained in:
@@ -37,6 +37,25 @@ include '../../common/view/chart.html.php';
|
||||
<td><?php echo $task->left;?></td>
|
||||
<td><div class='progress-pie' title="<?php echo $task->progress?>%" data-value='<?php echo $task->progress;?>'></div></td>
|
||||
</tr>
|
||||
<?php if(!empty($task->children)):?>
|
||||
<?php $i = 0;?>
|
||||
<?php foreach($task->children as $key => $child):?>
|
||||
<?php $class = $i == 0 ? ' table-child-top' : '';?>
|
||||
<?php $class .= ($i + 1 == count($task->children)) ? ' table-child-bottom' : '';?>
|
||||
<tr class='text-center<?php echo $class;?> parent-<?php echo $child->parent;?>'>
|
||||
<td><?php echo $child->id;?></td>
|
||||
<td class='text-left' title="<?php echo $child->name?>"><?php echo '<span class="label label-bedge label-light" title="' . $this->lang->task->children . '">' . $this->lang->task->childrenAB . '</span>' ?><?php echo $child->name;?></td>
|
||||
<td><span class='<?php echo 'pri' . zget($lang->task->priList, $child->pri, $child->pri)?>'><?php echo $child->pri == '0' ? '' : zget($lang->task->priList, $child->pri, $child->pri);?></span></td>
|
||||
<td><?php echo $this->processStatus('task', $child);?></td>
|
||||
<td><?php echo zget($users, $child->assignedTo, $child->assignedTo);?></td>
|
||||
<td><?php echo $child->estimate;?></td>
|
||||
<td><?php echo $child->consumed;?></td>
|
||||
<td><?php echo $child->left;?></td>
|
||||
<td><div class='progress-pie' title="<?php echo $child->progress?>%" data-value='<?php echo $child->progress;?>'></div></td>
|
||||
</tr>
|
||||
<?php $i ++;?>
|
||||
<?php endforeach;?>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
|
||||
+57
-2
@@ -1832,13 +1832,49 @@ class taskModel extends model
|
||||
*/
|
||||
public function getStoryTasks($storyID, $projectID = 0)
|
||||
{
|
||||
$tasks = $this->dao->select('id, name, assignedTo, pri, status, estimate, consumed, closedReason, `left`')
|
||||
$tasks = $this->dao->select('id, parent, name, assignedTo, pri, status, estimate, consumed, closedReason, `left`')
|
||||
->from(TABLE_TASK)
|
||||
->where('story')->eq((int)$storyID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()
|
||||
->fetchAll('id');
|
||||
|
||||
$parents = array();
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
if($task->parent == -1) $parents[] = $task->id;
|
||||
}
|
||||
if(!empty($parents))
|
||||
{
|
||||
/* Select children task. */
|
||||
$children = $this->dao->select('id, parent, name, assignedTo, pri, status, estimate, consumed, closedReason, `left`')
|
||||
->from(TABLE_TASK)
|
||||
->where('story')->eq((int)$storyID)
|
||||
->andwhere('parent')->in($parents)
|
||||
->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()
|
||||
->fetchAll('id');
|
||||
|
||||
if(!empty($children))
|
||||
{
|
||||
foreach($children as $child)
|
||||
{
|
||||
$tasks[$child->parent]->children[$child->id] = $child;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
if($task->parent > 0)
|
||||
{
|
||||
if(isset($tasks[$task->parent]))
|
||||
{
|
||||
$tasks[$task->parent]->children[$task->id] = $task;
|
||||
unset($tasks[$task->id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
/* Compute task progress. */
|
||||
@@ -1854,8 +1890,27 @@ class taskModel extends model
|
||||
{
|
||||
$task->progress = round($task->consumed / ($task->consumed + $task->left), 2) * 100;
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($task->children))
|
||||
{
|
||||
foreach($task->children as $child)
|
||||
{
|
||||
/* Compute child progress. */
|
||||
if($child->consumed == 0 and $child->left == 0)
|
||||
{
|
||||
$child->progress = 0;
|
||||
}
|
||||
elseif($child->consumed != 0 and $child->left == 0)
|
||||
{
|
||||
$child->progress = 100;
|
||||
}
|
||||
else
|
||||
{
|
||||
$child->progress = round($child->consumed / ($child->consumed + $child->left), 2) * 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $tasks;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user