Merge branch 'sprint/175_liumengyi_45157' into 'sprint/168'
* Finish task #45157. See merge request easycorp/zentaopms!621
This commit is contained in:
@@ -590,9 +590,15 @@ class block extends control
|
||||
$this->session->set('storyList', $uri, 'product');
|
||||
$this->session->set('testtaskList', $uri, 'qa');
|
||||
|
||||
$tasks = $this->loadModel('task')->getUserSuspendedTasks($this->app->user->account);
|
||||
foreach($todos as $key => $todo)
|
||||
{
|
||||
if($todo->date == '2030-01-01') unset($todos[$key]);
|
||||
if($todo->date == '2030-01-01')
|
||||
{
|
||||
unset($todos[$key]);
|
||||
continue;
|
||||
}
|
||||
if($todo->type == 'task' and isset($tasks[$todo->idvalue])) unset($todos[$key]);
|
||||
}
|
||||
|
||||
$this->view->todos = $todos;
|
||||
@@ -1698,6 +1704,7 @@ class block extends control
|
||||
$objectCountList += array('risk' => 'riskCount', 'issue' => 'issueCount');
|
||||
}
|
||||
|
||||
$tasks = $this->loadModel('task')->getUserSuspendedTasks($this->app->user->account);
|
||||
foreach($objectCountList as $objectType => $objectCount)
|
||||
{
|
||||
if(!isset($hasViewPriv[$objectType])) continue;
|
||||
@@ -1726,6 +1733,11 @@ class block extends control
|
||||
unset($objects[$key]);
|
||||
continue;
|
||||
}
|
||||
if($todo->type == 'task' and isset($tasks[$todo->idvalue]))
|
||||
{
|
||||
unset($objects[$key]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$todo->begin = date::formatTime($todo->begin);
|
||||
$todo->end = date::formatTime($todo->end);
|
||||
@@ -1736,6 +1748,8 @@ class block extends control
|
||||
{
|
||||
$this->app->loadLang('task');
|
||||
$this->app->loadLang('execution');
|
||||
|
||||
$objects = $this->loadModel('task')->getUserTasks($this->app->user->account, 'assignedTo', $limitCount);
|
||||
}
|
||||
|
||||
if($objectType == 'bug') $this->app->loadLang('bug');
|
||||
|
||||
+13
-1
@@ -166,7 +166,19 @@ class blockModel extends model
|
||||
{
|
||||
$data = array();
|
||||
|
||||
$data['tasks'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_TASK)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->fetch('count');
|
||||
$tasks = $this->dao->select('t1.id')->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t3')->on('t1.execution=t3.id')
|
||||
->where('t1.assignedTo')->eq($this->app->user->account)
|
||||
->andWhere('t2.status')->ne('suspended')
|
||||
->andWhere('t3.status')->ne('suspended')
|
||||
->andWhere('t2.type')->eq('project')
|
||||
->andWhere('t3.type')->eq('sprint')
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->andWhere('t3.deleted')->eq(0)
|
||||
->fetchAll('id');
|
||||
$data['tasks'] = isset($tasks) ? count($tasks) : 0;
|
||||
$data['doneTasks'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_TASK)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->andWhere('status')->eq('done')->fetch('count');
|
||||
$data['bugs'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_BUG)
|
||||
->where('assignedTo')->eq($this->app->user->account)
|
||||
|
||||
+10
-1
@@ -147,8 +147,17 @@ class my extends control
|
||||
/* Append id for secend sort. */
|
||||
$sort = $this->loadModel('common')->appendOrder($orderBy);
|
||||
|
||||
$todos = $this->loadModel('todo')->getList($type, $account, $status, 0, $pager, $sort);
|
||||
$tasks = $this->loadModel('task')->getUserSuspendedTasks($account);
|
||||
foreach($todos as $key => $todo)
|
||||
{
|
||||
if($todo->type == 'task' and isset($tasks[$todo->idvalue])) unset($todos[$key]);
|
||||
}
|
||||
|
||||
$pager->recTotal = count($todos);
|
||||
|
||||
/* Assign. */
|
||||
$this->view->todos = $this->loadModel('todo')->getList($type, $account, $status, 0, $pager, $sort);
|
||||
$this->view->todos = $todos;
|
||||
$this->view->date = (int)$type == 0 ? date(DT_DATE1) : date(DT_DATE1, strtotime($type));
|
||||
$this->view->type = $type;
|
||||
$this->view->recTotal = $recTotal;
|
||||
|
||||
@@ -1348,7 +1348,12 @@ class task extends control
|
||||
$user = $this->loadModel('user')->getById($userID, 'id');
|
||||
$account = $user->account;
|
||||
|
||||
$tasks = $this->task->getUserTaskPairs($account, $status);
|
||||
$tasks = $this->task->getUserTaskPairs($account, $status);
|
||||
$suspendedTasks = $this->task->getUserSuspendedTasks($account);
|
||||
foreach($tasks as $taskid => $task)
|
||||
{
|
||||
if(isset($suspendedTasks[$taskid])) unset($tasks[$taskid]);
|
||||
}
|
||||
|
||||
if($id) die(html::select("tasks[$id]", $tasks, '', 'class="form-control"'));
|
||||
die(html::select('task', $tasks, '', 'class=form-control'));
|
||||
|
||||
@@ -2131,6 +2131,7 @@ class taskModel extends model
|
||||
->from(TABLE_TASK)->alias('t1')
|
||||
->leftjoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id')
|
||||
->leftjoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.project = t4.id')
|
||||
->where('t1.deleted')->eq(0)
|
||||
->beginIF($type != 'closedBy' and $this->app->moduleName == 'block')->andWhere('t1.status')->ne('closed')->fi()
|
||||
->beginIF($projectID)->andWhere('t1.project')->eq($projectID)->fi()
|
||||
@@ -2139,6 +2140,7 @@ class taskModel extends model
|
||||
->orWhere('t1.finishedList')->like("%,{$account},%")
|
||||
->markRight(1)
|
||||
->fi()
|
||||
->beginIF($this->app->rawModule == 'my' or $this->app->rawModule == 'block')->andWhere('t2.status')->ne('suspended')->andWhere('t4.status')->ne('suspended')->fi()
|
||||
->beginIF($type != 'all' and $type != 'finishedBy')->andWhere("t1.`$type`")->eq($account)->fi()
|
||||
->orderBy($orderBy)
|
||||
->beginIF($limit > 0)->limit($limit)->fi()
|
||||
@@ -2190,6 +2192,30 @@ class taskModel extends model
|
||||
return $tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get suspended tasks of a user.
|
||||
*
|
||||
* @param string $account
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getUserSuspendedTasks($account)
|
||||
{
|
||||
$tasks = $this->dao->select('t1.*')
|
||||
->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution=t2.id')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t3')->on('t1.project=t3.id')
|
||||
->where('t1.assignedTo')->eq($this->app->user->account)
|
||||
->andWhere('(t2.status')->eq('suspended')
|
||||
->orWhere('t3.status')->eq('suspended')
|
||||
->markRight(1)
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->andWhere('t3.deleted')->eq(0)
|
||||
->fetchAll('id');
|
||||
return $tasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get task pairs of a story.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user