* fix bug for view task.

This commit is contained in:
wangyidong
2016-07-29 10:58:41 +08:00
parent 985e18282f
commit 97d050e78a

View File

@@ -872,14 +872,14 @@ class taskModel extends model
->beginIF($type == 'needconfirm')->andWhere('t2.version > t1.storyVersion')->andWhere("t2.status = 'active'")->fi()
->beginIF($type == 'assignedtome')->andWhere('t1.assignedTo')->eq($this->app->user->account)->fi()
->beginIF($type == 'finishedbyme')->andWhere('t1.finishedby')->eq($this->app->user->account)->fi()
->beginIF($type == 'delayed')->andWhere('deadline')->gt('1970-1-1')->andWhere('deadline')->lt(date(DT_DATE1))->andWhere('t1.status')->in('wait,doing')->fi()
->beginIF($type == 'delayed')->andWhere('t1.deadline')->gt('1970-1-1')->andWhere('t1.deadline')->lt(date(DT_DATE1))->andWhere('t1.status')->in('wait,doing')->fi()
->beginIF(is_array($type) or strpos(',all,undone,needconfirm,assignedtome,delayed,finishedbyme,', ",$type,") === false)->andWhere('t1.status')->in($type)->fi()
->beginIF($modules)->andWhere('t1.module')->in($modules)->fi()
->orderBy($orderBy)
->page($pager)
->fetchAll();
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task', $type == 'needconfirm' ? false : true);
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task', ($productID or $type == 'needconfirm') ? false : true);
if($tasks) return $this->processTasks($tasks);
return array();
@@ -924,10 +924,8 @@ class taskModel extends model
if(!$this->loadModel('common')->checkField(TABLE_TASK, $type)) return array();
$tasks = $this->dao->select('t1.*, t2.id as projectID, t2.name as projectName, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion')
->from(TABLE_TASK)->alias('t1')
->leftjoin(TABLE_PROJECT)->alias('t2')
->on('t1.project = t2.id')
->leftjoin(TABLE_STORY)->alias('t3')
->on('t1.story = t3.id')
->leftjoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->leftjoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id')
->where('t1.deleted')->eq(0)
->beginIF($type != 'all')->andWhere("t1.$type")->eq($account)->fi()
->orderBy($orderBy)