* adjust for delete estimate.
This commit is contained in:
@@ -776,7 +776,7 @@ class task extends control
|
||||
$this->commonAction($taskID);
|
||||
$task = $this->task->getByID($taskID);
|
||||
|
||||
if(!empty($task->team) and $task->mode == 'multi')
|
||||
if(!empty($task->team) and $task->mode == 'multi' and strpos('done,cencel,closed', $task->status) === false)
|
||||
{
|
||||
return $this->editTeam($executionID, $taskID, $kanbanGroup, $from);
|
||||
}
|
||||
@@ -830,7 +830,7 @@ class task extends control
|
||||
$members = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution', 'nodeleted');
|
||||
|
||||
/* Compute next assignedTo. */
|
||||
if(!empty($task->team))
|
||||
if(!empty($task->team) and strpos('done,cencel,closed', $task->status) === false)
|
||||
{
|
||||
$task->nextUser = $this->task->getAssignedTo4Multi($task->team, $task, 'next');
|
||||
$members = $this->task->getMemberPairs($task);
|
||||
|
||||
+17
-12
@@ -833,6 +833,8 @@ class taskModel extends model
|
||||
else
|
||||
{
|
||||
$currentTask->status = 'done';
|
||||
$currentTask->assignedTo = $oldTask->openedBy;
|
||||
$currentTask->assignedDate = $now;
|
||||
$currentTask->finishedBy = $this->app->user->account;
|
||||
$currentTask->finishedDate = $task->finishedDate;
|
||||
}
|
||||
@@ -989,7 +991,7 @@ class taskModel extends model
|
||||
}
|
||||
elseif($effortID)
|
||||
{
|
||||
$efforts = $this->getTaskEstimate($taskID);
|
||||
$efforts = $this->getTaskEstimate($taskID, '', $effortID);
|
||||
|
||||
$prevTeam = null;
|
||||
$thisTeam = null;
|
||||
@@ -1003,10 +1005,7 @@ class taskModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
if(empty($currentEffort) and $effort->left == 0)
|
||||
{
|
||||
if($thisTeam->account == $effort->account) $prevTeam = array_shift($teams);
|
||||
}
|
||||
if($effort->left == 0 and $thisTeam->account == $effort->account) $prevTeam = array_shift($teams);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2906,6 +2905,7 @@ class taskModel extends model
|
||||
$lastTwoEstimates = $this->dao->select('*')->from(TABLE_TASKESTIMATE)->where('task')->eq($estimate->task)->orderBy('date desc,id desc')->limit(2)->fetchAll();
|
||||
$lastTwoEstimate = isset($lastTwoEstimates[1]) ? $lastTwoEstimates[1] : '';
|
||||
if($lastTwoEstimate) $left = $lastTwoEstimate->left;
|
||||
if(empty($lastTwoEstimate) and $left == 0) $left = $task->estimate;
|
||||
}
|
||||
|
||||
$data = new stdclass();
|
||||
@@ -2941,18 +2941,23 @@ class taskModel extends model
|
||||
$currentTeam = $this->getTeamByAccount($task->team, $estimate->account, array('effortID' => $estimateID));
|
||||
if($currentTeam)
|
||||
{
|
||||
$accountEstimates = $this->getTaskEstimate($currentTeam->task, $estimate->account);
|
||||
$lastEstimate = array_pop($accountEstimates);
|
||||
$left = $currentTeam->left;
|
||||
if($lastEstimate->id == $estimateID)
|
||||
$left = $currentTeam->left;
|
||||
if($task->mode == 'multi')
|
||||
{
|
||||
$lastTwoEstimate = array_pop($accountEstimates);
|
||||
if($lastTwoEstimate) $left = $lastTwoEstimate->left;
|
||||
$accountEstimates = $this->getTaskEstimate($currentTeam->task, $estimate->account, $estimateID);
|
||||
$lastEstimate = array_pop($accountEstimates);
|
||||
if($lastEstimate->id == $estimateID)
|
||||
{
|
||||
$lastTwoEstimate = array_pop($accountEstimates);
|
||||
if($lastTwoEstimate) $left = $lastTwoEstimate->left;
|
||||
}
|
||||
}
|
||||
|
||||
$newTeamInfo = new stdClass();
|
||||
$newTeamInfo->consumed = $currentTeam->consumed - $estimate->consumed;
|
||||
if($currentTeam->status != 'done') $newTeamInfo->left = $left;
|
||||
if($currentTeam->status == 'done' and $left > 0 and $task->mode == 'multi') $newTeamInfo->left = $left;
|
||||
|
||||
if($currentTeam->status != 'done' and $newTeamInfo->consumed > 0 and $left == 0) $newTeamInfo->status = 'done';
|
||||
if($task->mode == 'multi' and $currentTeam->status == 'done' and $left > 0) $newTeamInfo->status = 'doing';
|
||||
if($task->mode == 'multi' and $currentTeam->status == 'done' and ($newTeamInfo->consumed == 0 and $left == 0))
|
||||
@@ -3486,7 +3491,7 @@ class taskModel extends model
|
||||
global $app;
|
||||
if($task->mode == 'linear')
|
||||
{
|
||||
if($action == 'assignto') return false;
|
||||
if($action == 'assignto' and strpos('done,cencel,closed', $task->status) === false) return false;
|
||||
if($action == 'start')
|
||||
{
|
||||
if($task->assignedTo != $app->user->account) return false;
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
<form method='post' target='hiddenwin'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-80px'><?php echo empty($task->team) ? $lang->task->assign : $lang->task->transferTo;?></th>
|
||||
<td class='w-p25-f'><?php echo html::select('assignedTo', $members, empty($task->team) ? $task->assignedTo : $task->nextUser, "class='form-control chosen'");?></td><td></td>
|
||||
<th class='w-80px'><?php echo (empty($task->team) or strpos('done,cencel,closed', $task->status) !== false) ? $lang->task->assign : $lang->task->transferTo;?></th>
|
||||
<td class='w-p25-f'><?php echo html::select('assignedTo', $members, (empty($task->team) or strpos('done,cencel,closed', $task->status) !== false) ? $task->assignedTo : $task->nextUser, "class='form-control chosen'");?></td><td></td>
|
||||
</tr>
|
||||
<?php if($task->status != 'done' and $task->status != 'closed' and $task->parent >= 0):?>
|
||||
<tr>
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<?php
|
||||
$canOperateEffort = $this->task->canOperateEffort($task, $estimate);
|
||||
common::printIcon('task', 'editEstimate', "estimateID=$estimate->id", '', 'list', 'pencil', '', 'showinonlybody', true, $canOperateEffort ? '' : 'disabled');
|
||||
common::printIcon('task', 'deleteEstimate', "estimateID=$estimate->id", '', 'list', 'close', 'hiddenwin', 'showinonlybody', false, ($canOperateEffort and ($task->mode == 'multi' or ($task->mode == 'linear' and $estimate->left > 0))) ? '' : 'disabled');
|
||||
common::printIcon('task', 'deleteEstimate', "estimateID=$estimate->id", '', 'list', 'close', 'hiddenwin', 'showinonlybody', false, ($canOperateEffort and ($task->mode != 'multi' or ($task->mode == 'linear' and $estimate->left > 0))) ? '' : 'disabled');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -262,7 +262,7 @@
|
||||
<th><?php echo $lang->task->assignedTo;?></th>
|
||||
<td>
|
||||
<?php
|
||||
if(!empty($task->team) and $task->mode == 'multi' and $task->status != 'closed')
|
||||
if(!empty($task->team) and $task->mode == 'multi' and strpos('done,cencel,closed', $task->status) === false)
|
||||
{
|
||||
foreach($task->team as $member) echo ' ' . zget($users, $member->account);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user