* finish task #2569.

This commit is contained in:
chenfeiCF
2016-03-29 14:27:57 +08:00
parent e1c08416f1
commit 590afbf92e
8 changed files with 92 additions and 12 deletions
+29
View File
@@ -400,6 +400,35 @@ class taskModel extends model
return $allChanges;
}
/**
* Batch change the module of task.
*
* @param array $taskIDList
* @param int $moduleID
* @access public
* @return array
*/
public function batchChangeModule($taskIDList, $moduleID)
{
$now = helper::now();
$allChanges = array();
$oldTasks = $this->getByList($taskIDList);
foreach($taskIDList as $taskID)
{
$oldTask = $oldTasks[$taskID];
if($moduleID == $oldTask->module) continue;
$task = new stdclass();
$task->lastEditedBy = $this->app->user->account;
$task->lastEditedDate = $now;
$task->module = $moduleID;
$this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('id')->eq((int)$taskID)->exec();
if(!dao::isError()) $allChanges[$taskID] = common::createChanges($oldTask, $task);
}
return $allChanges;
}
/**
* Assign a task to a user again.
*