diff --git a/module/task/control.php b/module/task/control.php index efe0fd01dc..8fa8b9b497 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -1038,12 +1038,9 @@ class task extends control return print(js::error(dao::getError())); } - if($this->post->comment != '' or !empty($changes)) - { - $act = $this->post->left == 0 ? 'Finished' : 'Started'; - $actionID = $this->action->create('task', $taskID, $act, $this->post->comment); - $this->action->logHistory($actionID, $changes); - } + $act = $this->post->left == 0 ? 'Finished' : 'Started'; + $actionID = $this->action->create('task', $taskID, $act, $this->post->comment); + if(!empty($changes)) $this->action->logHistory($actionID, $changes); $this->executeHooks($taskID); $this->loadModel('common')->syncPPEStatus($taskID); @@ -1447,12 +1444,9 @@ class task extends control $changes = $this->task->start($taskID); if(dao::isError()) return print(js::error(dao::getError())); - if($this->post->comment != '' or !empty($changes)) - { - $act = $this->post->left == 0 ? 'Finished' : 'Restarted'; - $actionID = $this->action->create('task', $taskID, $act, $this->post->comment); - $this->action->logHistory($actionID, $changes); - } + $act = $this->post->left == 0 ? 'Finished' : 'Restarted'; + $actionID = $this->action->create('task', $taskID, $act, $this->post->comment); + if(!empty($changes)) $this->action->logHistory($actionID, $changes); $this->executeHooks($taskID); diff --git a/module/task/model.php b/module/task/model.php index 532e03dc2d..bddc847af4 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -1744,7 +1744,7 @@ class taskModel extends model $estimate->account = $this->app->user->account; $estimate->consumed = (!empty($oldTask->team) and $currentTeam) ? $estimate->consumed - $currentTeam->consumed : $estimate->consumed - $oldTask->consumed; if($this->post->comment) $estimate->work = $this->post->comment; - $estimateID = $this->addTaskEstimate($estimate); + if($estimate->consumed > 0) $estimateID = $this->addTaskEstimate($estimate); if(!empty($oldTask->team) and $currentTeam) { @@ -1754,7 +1754,7 @@ class taskModel extends model $team->status = empty($team->left) ? 'done' : 'doing'; $this->dao->update(TABLE_TASKTEAM)->data($team)->where('id')->eq($currentTeam->id)->exec(); - if($oldTask->mode == 'linear') $this->updateEstimateOrder($estimateID, $currentTeam->order); + if($oldTask->mode == 'linear' and !empty($estimateID)) $this->updateEstimateOrder($estimateID, $currentTeam->order); $task = $this->computeHours4Multiple($oldTask, $task); if($team->status == 'done') @@ -2885,7 +2885,7 @@ class taskModel extends model $today = helper::today(); if($estimate->date > $today) return dao::$errors[] = $this->lang->task->error->date; - if($estimate->consumed < 0) return dao::$errors[] = sprintf($this->lang->error->ge, $this->lang->task->record, '0'); + if($estimate->consumed <= 0) return dao::$errors[] = sprintf($this->lang->error->ge, $this->lang->task->record, '0'); if($estimate->left < 0) return dao::$errors[] = sprintf($this->lang->error->ge, $this->lang->task->left, '0'); $task = $this->getById($oldEstimate->objectID);