diff --git a/module/task/control.php b/module/task/control.php index bed70fe795..177825a892 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -1181,10 +1181,10 @@ class task extends control $orderBy = 'date,id'; if(!empty($task->team) and $task->mode == 'linear') $orderBy = 'order,date,id'; - $this->view->title = $this->lang->task->record; - $this->view->task = $task; - $this->view->estimates = $this->task->getTaskEstimate($taskID, '', '', $orderBy); - $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); + $this->view->title = $this->lang->task->record; + $this->view->task = $task; + $this->view->efforts = $this->task->getTaskEstimate($taskID, '', '', $orderBy); + $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); $this->display(); } diff --git a/module/task/model.php b/module/task/model.php index 8b223277a1..bad07c1e28 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -1830,7 +1830,7 @@ class taskModel extends model $estimates[$id]->left = $record->left[$id]; $estimates[$id]->work = $record->work[$id]; $estimates[$id]->account = $this->app->user->account; - $estimates[$id]->order = !empty($record->order[$id]) ? $record->order[$id] : 0; + if(isset($record->order[$id])) $estimates[$id]->order = $record->order[$id]; } } @@ -1863,7 +1863,14 @@ class taskModel extends model $lastDate = $estimate->date; } - if($newTask->left == 0 and strpos('done,cancel,closed', $task->status) === false) + if(!empty($task->team)) + { + $extra = array('filter' => 'done'); + if(isset($estimate->order)) $extra['order'] = $estimate->order; + $currentTeam = $this->getTeamByAccount($task->team, $this->app->user->account, $extra); + } + + if($newTask->left == 0 and ((empty($currentTeam) and strpos('done,cancel,closed', $task->status) === false) or (!empty($currentTeam) and $currentTeam->status != 'done'))) { $newTask->status = 'done'; $newTask->assignedTo = $task->openedBy; @@ -1900,10 +1907,7 @@ class taskModel extends model /* Process multi-person task. Update consumed on team table. */ if(!empty($task->team)) { - $extra = array('filter' => 'done'); - if(!empty($estimate->order)) $extra['order'] = $estimate->order; - $currentTeam = $this->getTeamByAccount($task->team, $this->app->user->account, $extra); - if($currentTeam) + if(!empty($currentTeam)) { $teamStatus = $estimate->left == 0 ? 'done' : 'doing'; $this->dao->update(TABLE_TASKTEAM)->set('left')->eq($estimate->left)->set("consumed = consumed + {$estimate->consumed}")->set('status')->eq($teamStatus)->where('id')->eq($currentTeam->id)->exec(); diff --git a/module/task/view/lineareffort.html.php b/module/task/view/lineareffort.html.php index 5ff730e48a..5458f17b57 100644 --- a/module/task/view/lineareffort.html.php +++ b/module/task/view/lineareffort.html.php @@ -5,17 +5,18 @@ #linearefforts div.caption .account{font-weight: bolder;} app->loadLang('execution'); $teamOrders = array(); foreach($task->team as $team) $teamOrders[$team->order] = $team->account; $myOrders = array(); $allEfforts = array(); $recorders = array(); -foreach($estimates as $estimate) +foreach($efforts as $effort) { - $order = $estimate->order; - $account = $estimate->account; - $allEfforts[$order][] = $estimate; + $order = $effort->order; + $account = $effort->account; + $allEfforts[$order][] = $effort; $recorders[$order][$account] = $account; if($app->user->account == $account) $myOrders[$order] = $order; } @@ -45,18 +46,18 @@ foreach($estimates as $estimate) - + - date;?> - account);?> - work;?> - consumed . ' ' . $lang->execution->workHourUnit;?> - left . ' ' . $lang->execution->workHourUnit;?> + date;?> + account);?> + work;?> + consumed . ' ' . $lang->execution->workHourUnit;?> + left . ' ' . $lang->execution->workHourUnit;?> task->canOperateEffort($task, $estimate); - common::printIcon('task', 'editEstimate', "estimateID=$estimate->id", '', 'list', 'edit', '', 'showinonlybody', true, $canOperateEffort ? '' : 'disabled'); - common::printIcon('task', 'deleteEstimate', "estimateID=$estimate->id", '', 'list', 'trash', 'hiddenwin', 'showinonlybody', false, ($canOperateEffort and $estimate->left > 0) ? '' : 'disabled'); + $canOperateEffort = $this->task->canOperateEffort($task, $effort); + common::printIcon('task', 'editEstimate', "effortID=$effort->id", '', 'list', 'edit', '', 'showinonlybody', true, $canOperateEffort ? '' : 'disabled'); + common::printIcon('task', 'deleteEstimate', "effortID=$effort->id", '', 'list', 'trash', 'hiddenwin', 'showinonlybody', false, ($canOperateEffort and $effort->left > 0) ? '' : 'disabled'); ?> @@ -84,18 +85,18 @@ foreach($estimates as $estimate) - + - date;?> - account);?> - work;?> - consumed . ' ' . $lang->execution->workHourUnit;?> - left . ' ' . $lang->execution->workHourUnit;?> + date;?> + account);?> + work;?> + consumed . ' ' . $lang->execution->workHourUnit;?> + left . ' ' . $lang->execution->workHourUnit;?> task->canOperateEffort($task, $estimate); - common::printIcon('task', 'editEstimate', "estimateID=$estimate->id", '', 'list', 'edit', '', 'showinonlybody', true, $canOperateEffort ? '' : 'disabled'); - common::printIcon('task', 'deleteEstimate', "estimateID=$estimate->id", '', 'list', 'trash', 'hiddenwin', 'showinonlybody', false, ($canOperateEffort and $estimate->left > 0) ? '' : 'disabled'); + $canOperateEffort = $this->task->canOperateEffort($task, $effort); + common::printIcon('task', 'editEstimate', "effortID=$effort->id", '', 'list', 'edit', '', 'showinonlybody', true, $canOperateEffort ? '' : 'disabled'); + common::printIcon('task', 'deleteEstimate', "effortID=$effort->id", '', 'list', 'trash', 'hiddenwin', 'showinonlybody', false, ($canOperateEffort and $effort->left > 0) ? '' : 'disabled'); ?> diff --git a/module/task/view/recordestimate.html.php b/module/task/view/recordestimate.html.php index 9ce13b6e80..3c9a424531 100644 --- a/module/task/view/recordestimate.html.php +++ b/module/task/view/recordestimate.html.php @@ -34,7 +34,7 @@ arrow . $lang->task->logEfforts;?> - + team) and $task->mode == 'linear'):?> @@ -50,18 +50,18 @@ - + - date;?> - account);?> - work;?> - consumed . ' ' . $lang->execution->workHourUnit;?> - left . ' ' . $lang->execution->workHourUnit;?> + date;?> + account);?> + work;?> + consumed . ' ' . $lang->execution->workHourUnit;?> + left . ' ' . $lang->execution->workHourUnit;?> task->canOperateEffort($task, $estimate); - common::printIcon('task', 'editEstimate', "estimateID=$estimate->id", '', 'list', 'edit', '', 'showinonlybody', true, $canOperateEffort ? '' : 'disabled'); - common::printIcon('task', 'deleteEstimate', "estimateID=$estimate->id", '', 'list', 'trash', 'hiddenwin', 'showinonlybody', false, $canOperateEffort ? '' : 'disabled'); + $canOperateEffort = $this->task->canOperateEffort($task, $effort); + common::printIcon('task', 'editEstimate', "effortID=$effort->id", '', 'list', 'edit', '', 'showinonlybody', true, $canOperateEffort ? '' : 'disabled'); + common::printIcon('task', 'deleteEstimate', "effortID=$effort->id", '', 'list', 'trash', 'hiddenwin', 'showinonlybody', false, $canOperateEffort ? '' : 'disabled'); ?> @@ -131,11 +131,9 @@ - - - +