diff --git a/module/task/model.php b/module/task/model.php index c42409119f..685c91c00a 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -2738,7 +2738,7 @@ class taskModel extends model ->fetch(); /* If the estimate is the last of its task, status of task will be checked. */ - $lastID = $this->dao->select('id')->from(TABLE_TASKESTIMATE)->where('task')->eq($estimate->task)->orderBy('date,id')->limit(1)->fetch('id'); + $lastID = $this->dao->select('id')->from(TABLE_TASKESTIMATE)->where('task')->eq($estimate->task)->orderBy('date_desc,id_desc')->limit(1)->fetch('id'); $estimate->isLast = $lastID == $estimate->id; return $estimate; } @@ -2798,7 +2798,7 @@ class taskModel extends model ->exec(); $consumed = $task->consumed + $estimate->consumed - $oldEstimate->consumed; - $lastEstimate = $this->dao->select('*')->from(TABLE_TASKESTIMATE)->where('task')->eq($task->id)->orderBy('id desc')->fetch(); + $lastEstimate = $this->dao->select('*')->from(TABLE_TASKESTIMATE)->where('task')->eq($task->id)->orderBy('date_desc,id_desc')->limit(1)->fetch(); $left = ($lastEstimate and $estimateID == $lastEstimate->id) ? $estimate->left : $task->left; $now = helper::now(); @@ -2808,7 +2808,7 @@ class taskModel extends model $data->status = $left == 0 ? 'done' : $task->status; $data->lastEditedBy = $this->app->user->account; $data->lastEditedDate = $now; - if(!$left) + if(empty($left)) { $data->finishedBy = $this->app->user->account; $data->finishedDate = $now; diff --git a/module/task/view/taskteam.html.php b/module/task/view/taskteam.html.php index 71fa7942f0..25b14fc50f 100644 --- a/module/task/view/taskteam.html.php +++ b/module/task/view/taskteam.html.php @@ -163,6 +163,7 @@ $(document).ready(function() bootbox.alert(totalLeftError); return false; } + return true; } $taskTeamEditor.on('click', '.btn-add', function()