* code for task#1903.

This commit is contained in:
xia0ta0
2014-06-23 14:07:32 +08:00
parent f30cfb9a70
commit b62a302b84
2 changed files with 32 additions and 0 deletions
+1
View File
@@ -450,6 +450,7 @@ class taskModel extends model
$estimates[$id]->consumed = $record->consumed[$id];
$estimates[$id]->left = $record->left[$id];
$estimates[$id]->work = $record->work[$id];
$estimates[$id]->account = $this->app->user->account;
}
}
+31
View File
@@ -104,6 +104,7 @@ class upgradeModel extends model
case '5_3':
case '6_0_beta1':
$this->fixBugOSInfo();
$this->fixTaskFinishedBy();
default: if(!$this->isError()) $this->setting->updateVersion($this->config->version);
}
@@ -833,6 +834,36 @@ class upgradeModel extends model
$this->dao->update(TABLE_BUG)->set('os')->eq('osx')->where('os')->eq('mac')->exec();
}
/**
* Fix finishedBy of task.
*
* @access public
* @return void
*/
public function fixTaskFinishedBy()
{
$tasks = $this->dao->select('t1.id,t2.actor,t2.date')->from(TABLE_TASK)->alias('t1')
->leftJoin(TABLE_ACTION)->alias('t2')
->on('t1.id = t2.objectID')
->leftJoin(TABLE_HISTORY)->alias('t3')
->on('t2.id = t3.action')
->where('t3.new')->eq(0)
->andWhere('t3.field')->eq('left')
->andWhere('t2.objectType')->eq('task')
->andWhere('t1.finishedBy')->eq('')
->andWhere('t1.status')->in('done,closed')
->andWhere('t1.deleted')->eq(0)
->fetchAll('id');
foreach($tasks as $taskID => $task)
{
$this->dao->update(TABLE_TASK)
->set('finishedBy')->eq($task->actor)
->set('finishedDate')->eq($task->date)
->where('id')->eq($taskID)
->exec();
}
}
/**
* Judge any error occers.
*