* adjust code.

This commit is contained in:
wangyidong
2014-08-19 06:16:41 +00:00
parent 1cb49786a9
commit d75f0eb1eb
2 changed files with 7 additions and 16 deletions
+5 -14
View File
@@ -918,8 +918,7 @@ class taskModel extends model
*/
public function getTaskEstimate($taskID)
{
return $this->dao->select('*')
->from(TABLE_TASKESTIMATE)
return $this->dao->select('*')->from(TABLE_TASKESTIMATE)
->where('task')->eq($taskID)
->orderBy('id')
->fetchAll();
@@ -934,14 +933,12 @@ class taskModel extends model
*/
public function getEstimateById($estimateID)
{
$estimate = $this->dao->select('*')
->from(TABLE_TASKESTIMATE)
$estimate = $this->dao->select('*')->from(TABLE_TASKESTIMATE)
->where('id')->eq($estimateID)
->fetch();
/* If the estimate is the last of its task, status of task will be checked. */
$lastID = $this->dao->select('id')
->from(TABLE_TASKESTIMATE)
$lastID = $this->dao->select('id')->from(TABLE_TASKESTIMATE)
->where('task')->eq($estimate->task)
->andWhere('id')->gt($estimate->id)
->fetch('id');
@@ -967,16 +964,10 @@ class taskModel extends model
->check('consumed', 'notempty')
->where('id')->eq((int)$estimateID)
->exec();
$consumed = $task->consumed + $estimate->consumed - $oldEstimate->consumed;
$lastEstimate = $this->dao->select('*')->from(TABLE_TASKESTIMATE)->where('task')->eq($task->id)->orderBy('id desc')->fetch();
if($lastEstimate and $estimateID == $lastEstimate->id)
{
$left = $estimate->left;
}
else
{
$left = $task->left;
}
$left = ($lastEstimate and $estimateID == $lastEstimate->id) ? $estimate->left : $task->left;
if($left == 0) $task->status = 'done';
$now = helper::now();
+2 -2
View File
@@ -43,7 +43,7 @@
<td class="text-left"><?php echo $estimate->work;?></td>
<td align='center'>
<?php
if($task->status == 'wait' or $task->status == 'doing')
if($task->status == 'wait' or $task->status == 'pause' or $task->status == 'doing')
{
common::printIcon('task', 'editEstimate', "estimateID=$estimate->id", '', 'list', 'pencil', '', 'showinonlybody', true);
common::printIcon('task', 'deleteEstimate', "estimateID=$estimate->id", '', 'list', 'remove', 'hiddenwin', 'showinonlybody');
@@ -53,7 +53,7 @@
</tr>
<?php endforeach;?>
<?php endif;?>
<?php if($task->status == 'wait' or $task->status == 'doing'):?>
<?php if($task->status == 'wait' or $task->status =='pause' or $task->status == 'doing'):?>
<thead>
<tr class='text-center'>
<th class="w-id"><?php echo $lang->idAB;?></th>