* compute consumed and left when delete estimate.
This commit is contained in:
@@ -836,6 +836,7 @@ class taskModel extends model
|
||||
$estimates = $this->dao->select('*')
|
||||
->from(TABLE_TASKESTIMATE)
|
||||
->where('task')->eq($taskID)
|
||||
->orderBy('id')
|
||||
->fetchAll();
|
||||
$comments = $this->dao->select('extra, comment')
|
||||
->from(TABLE_ACTION)
|
||||
@@ -918,7 +919,10 @@ class taskModel extends model
|
||||
*/
|
||||
public function deleteEstimate($estimateID)
|
||||
{
|
||||
$estimate = $this->getEstimateById($estimateID);
|
||||
$this->dao->delete()->from(TABLE_TASKESTIMATE)->where('id')->eq($estimateID)->exec();
|
||||
$lastEstimate = $this->dao->select('*')->from(TABLE_TASKESTIMATE)->where('task')->eq($estimate->task)->orderBy('id desc')->fetch();
|
||||
$this->dao->update(TABLE_TASK)->set("consumed = consumed - {$estimate->consumed}")->set('`left`')->eq($lastEstimate->left)->where('id')->eq($estimate->task)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<td><?php echo html::input("dates[$i]", '', "class='text-6 date'");?></td>
|
||||
<td><?php echo html::input("consumed[$i]", '', "class='text-1'");?></td>
|
||||
<td><?php echo html::input("left[$i]", '', "class='text-1'");?></td>
|
||||
<td><?php echo html::textarea("comment[$i]", '', "class='text-1' rows='1'");?></td>
|
||||
<td class="a-left"><?php echo html::textarea("comment[$i]", '', "class='text-1' rows='1'");?></td>
|
||||
<td><?php echo '';?></td>
|
||||
<td align='center'></td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user