From da6816b494932389fb10272b04439c31c895aed2 Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Mon, 18 Feb 2013 02:44:32 +0000 Subject: [PATCH] * fix workhour record. --- module/task/control.php | 1 - module/task/model.php | 17 +++-------------- module/task/view/record.html.php | 2 +- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index e12658ba97..a95d282add 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -446,7 +446,6 @@ class task extends control } $this->view->title = $this->lang->task->record; - $this->view->beforeConsumed = $this->task->getBeforeConsumed($taskID); $this->display(); } diff --git a/module/task/model.php b/module/task/model.php index 3bd4b4206a..25125ae708 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -412,6 +412,7 @@ class taskModel extends model ->setDefault('task', $taskID) ->setDefault('date', date(DT_DATE1)) ->remove('realStarted,comment')->get(); + $estimate->consumed = $estimate->consumed - $oldTask->consumed; $this->dao->insert(TABLE_TASKESTIMATE)->data($estimate) ->autoCheck() @@ -442,7 +443,7 @@ class taskModel extends model ->autoCheck() ->exec(); - $consumed = $this->getBeforeConsumed($taskID); + $consumed = $oldTask->consumed + $estimate->consumed; $this->dao->update(TABLE_TASK) ->set('consumed')->eq($consumed) ->set('`left`')->eq($estimate->left) @@ -481,6 +482,7 @@ class taskModel extends model ->setDefault('date', date(DT_DATE1)) ->setDefault('left', 0) ->remove('finishedDate,comment')->get(); + $estimate->consumed = $estimate->consumed - $oldTask->consumed; $this->dao->insert(TABLE_TASKESTIMATE)->data($estimate) ->autoCheck() @@ -809,19 +811,6 @@ class taskModel extends model return $taskCounts; } - /** - * Get before consumed. - * - * @param int $taskID - * @access public - * @return int - */ - public function getBeforeConsumed($taskID) - { - $task = $this->dao->select('SUM(consumed) as beforeConsumed')->from(TABLE_TASKESTIMATE)->where('task')->eq($taskID)->fetch(); - return $task->beforeConsumed; - } - /** * Batch process tasks. * diff --git a/module/task/view/record.html.php b/module/task/view/record.html.php index 0e7bd1b174..2ea33d1e31 100644 --- a/module/task/view/record.html.php +++ b/module/task/view/record.html.php @@ -17,7 +17,7 @@ name;?> task->beforeConsumed;?> - task->hour;?> + consumed . ' ' . $lang->task->hour;?> task->consumedThisTime;?>