From 11c3ef03cccb3faa7def5dde309f40e9f272a3e3 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Fri, 26 Aug 2022 22:14:53 +0800 Subject: [PATCH] * adjust for delete estimate. --- module/task/control.php | 4 ++-- module/task/model.php | 29 ++++++++++++++---------- module/task/view/assignto.html.php | 4 ++-- module/task/view/recordestimate.html.php | 2 +- module/task/view/view.html.php | 2 +- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index 42c85cdbc0..a897c36c49 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -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); diff --git a/module/task/model.php b/module/task/model.php index 451b03ae4b..29f046c8bf 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -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; diff --git a/module/task/view/assignto.html.php b/module/task/view/assignto.html.php index 2caa9d79ae..bcf982728f 100644 --- a/module/task/view/assignto.html.php +++ b/module/task/view/assignto.html.php @@ -38,8 +38,8 @@
- - + + status != 'done' and $task->status != 'closed' and $task->parent >= 0):?> diff --git a/module/task/view/recordestimate.html.php b/module/task/view/recordestimate.html.php index dfdb0c91e1..4ea52c43a4 100644 --- a/module/task/view/recordestimate.html.php +++ b/module/task/view/recordestimate.html.php @@ -61,7 +61,7 @@ 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'); ?> diff --git a/module/task/view/view.html.php b/module/task/view/view.html.php index b5eb792012..99ef6430e5 100644 --- a/module/task/view/view.html.php +++ b/module/task/view/view.html.php @@ -262,7 +262,7 @@
team) ? $lang->task->assign : $lang->task->transferTo;?>team) ? $task->assignedTo : $task->nextUser, "class='form-control chosen'");?>team) or strpos('done,cencel,closed', $task->status) !== false) ? $lang->task->assign : $lang->task->transferTo;?>team) or strpos('done,cencel,closed', $task->status) !== false) ? $task->assignedTo : $task->nextUser, "class='form-control chosen'");?>
task->assignedTo;?> 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); }