+ adjust code for task #623.

This commit is contained in:
shiyangyangwork@yahoo.cn
2011-12-07 03:01:02 +00:00
parent 6b7e292ceb
commit 1f53475050
7 changed files with 83 additions and 30 deletions
+28
View File
@@ -204,6 +204,34 @@ class taskModel extends model
if(!dao::isError()) return common::createChanges($oldTask, $task);
}
/**
* Assign a task to a user again.
*
* @param int $taskID
* @access public
* @return void
*/
public function assignedTo($taskID)
{
$now = helper::now();
$oldTask = $this->getById($taskID);
$this->dao->update(TABLE_TASK)
->set('assignedTo')->eq($this->post->assignedTo)
->set('lastEditedBy')->eq($this->app->user->account)
->set('lastEditedDate')->eq($now)
->where('id')->eq($taskID)->exec();
$actionID = $this->loadModel('action')->create('task', $taskID, 'AssignedTo', $this->post->comment);
$this->dao->insert(TABLE_HISTORY)
->set('company')->eq(1)
->set('action')->eq($actionID)
->set('field')->eq('assignedTo')
->set('old')->eq($oldTask->assignedTo)
->set('new')->eq($this->post->assignedTo)
->exec();
return $actionID;
}
/**
* Start a task.
*