* adjust for record estimate for linear task.

This commit is contained in:
wangyidong
2022-09-02 17:51:04 +08:00
parent 158bd704f8
commit 4635256fb9
4 changed files with 48 additions and 45 deletions
+4 -4
View File
@@ -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();
}
+10 -6
View File
@@ -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();
+23 -22
View File
@@ -5,17 +5,18 @@
#linearefforts div.caption .account{font-weight: bolder;}
</style>
<?php
$this->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)
</tr>
</thead>
<tbody>
<?php foreach($allEfforts[$order] as $estimate):?>
<?php foreach($allEfforts[$order] as $effort):?>
<tr class="text-center">
<td><?php echo $estimate->date;?></td>
<td><?php echo zget($users, $estimate->account);?></td>
<td class="text-left" title="<?php echo $estimate->work;?>"><?php echo $estimate->work;?></td>
<td title="<?php echo $estimate->consumed . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->consumed . ' ' . $lang->execution->workHourUnit;?></td>
<td title="<?php echo $estimate->left . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->left . ' ' . $lang->execution->workHourUnit;?></td>
<td><?php echo $effort->date;?></td>
<td><?php echo zget($users, $effort->account);?></td>
<td class="text-left" title="<?php echo $effort->work;?>"><?php echo $effort->work;?></td>
<td title="<?php echo $effort->consumed . ' ' . $lang->execution->workHour;?>"><?php echo $effort->consumed . ' ' . $lang->execution->workHourUnit;?></td>
<td title="<?php echo $effort->left . ' ' . $lang->execution->workHour;?>"><?php echo $effort->left . ' ' . $lang->execution->workHourUnit;?></td>
<td align='center' class='c-actions'>
<?php
$canOperateEffort = $this->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');
?>
</td>
</tr>
@@ -84,18 +85,18 @@ foreach($estimates as $estimate)
</tr>
</thead>
<tbody>
<?php foreach($allEfforts[$order] as $estimate):?>
<?php foreach($allEfforts[$order] as $effort):?>
<tr class="text-center">
<td><?php echo $estimate->date;?></td>
<td><?php echo zget($users, $estimate->account);?></td>
<td class="text-left" title="<?php echo $estimate->work;?>"><?php echo $estimate->work;?></td>
<td title="<?php echo $estimate->consumed . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->consumed . ' ' . $lang->execution->workHourUnit;?></td>
<td title="<?php echo $estimate->left . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->left . ' ' . $lang->execution->workHourUnit;?></td>
<td><?php echo $effort->date;?></td>
<td><?php echo zget($users, $effort->account);?></td>
<td class="text-left" title="<?php echo $effort->work;?>"><?php echo $effort->work;?></td>
<td title="<?php echo $effort->consumed . ' ' . $lang->execution->workHour;?>"><?php echo $effort->consumed . ' ' . $lang->execution->workHourUnit;?></td>
<td title="<?php echo $effort->left . ' ' . $lang->execution->workHour;?>"><?php echo $effort->left . ' ' . $lang->execution->workHourUnit;?></td>
<td align='center' class='c-actions'>
<?php
$canOperateEffort = $this->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');
?>
</td>
</tr>
+11 -13
View File
@@ -34,7 +34,7 @@
<small><?php echo $lang->arrow . $lang->task->logEfforts;?></small>
<?php endif;?>
</div>
<?php if(count($estimates)):?>
<?php if(!empty($efforts)):?>
<?php if(!empty($task->team) and $task->mode == 'linear'):?>
<?php include __DIR__ . '/lineareffort.html.php';?>
<?php else:?>
@@ -50,18 +50,18 @@
</tr>
</thead>
<tbody>
<?php foreach($estimates as $estimate):?>
<?php foreach($efforts as $effort):?>
<tr class="text-center">
<td><?php echo $estimate->date;?></td>
<td><?php echo zget($users, $estimate->account);?></td>
<td class="text-left" title="<?php echo $estimate->work;?>"><?php echo $estimate->work;?></td>
<td title="<?php echo $estimate->consumed . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->consumed . ' ' . $lang->execution->workHourUnit;?></td>
<td title="<?php echo $estimate->left . ' ' . $lang->execution->workHour;?>"><?php echo $estimate->left . ' ' . $lang->execution->workHourUnit;?></td>
<td><?php echo $effort->date;?></td>
<td><?php echo zget($users, $effort->account);?></td>
<td class="text-left" title="<?php echo $effort->work;?>"><?php echo $effort->work;?></td>
<td title="<?php echo $effort->consumed . ' ' . $lang->execution->workHour;?>"><?php echo $effort->consumed . ' ' . $lang->execution->workHourUnit;?></td>
<td title="<?php echo $effort->left . ' ' . $lang->execution->workHour;?>"><?php echo $effort->left . ' ' . $lang->execution->workHourUnit;?></td>
<td align='center' class='c-actions'>
<?php
$canOperateEffort = $this->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');
?>
</td>
</tr>
@@ -131,11 +131,9 @@
</td>
</tr>
<?php endfor;?>
<tr>
<td colspan='4' class='text-center form-actions'><?php echo html::submitButton() . html::backButton('', '', 'btn btn-wide');?></td>
</tr>
</tbody>
</table>
<div class='table-footer text-center form-actions'><?php echo html::submitButton() . html::backButton('', '', 'btn btn-wide');?></div>
</form>
<?php endif;?>
</div>