diff --git a/module/task/model.php b/module/task/model.php index 0127a2e4a1..ca003497db 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -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(); } /** diff --git a/module/task/view/record.html.php b/module/task/view/record.html.php index 3bb280a97f..a2f6ea179d 100644 --- a/module/task/view/record.html.php +++ b/module/task/view/record.html.php @@ -45,7 +45,7 @@ - +