Merge branch dev/bug-64529 of zentao/zentaopms (#10993)
This commit is contained in:
@@ -22,26 +22,10 @@ class count_of_assigned_task_in_user extends baseCalc
|
||||
{
|
||||
public $dataset = 'getTasksWithTeam';
|
||||
|
||||
public $fieldList = array('t1.id', "case when t1.mode != '' and t4.status != 'done' then t4.account when t1.mode != '' and t4.status = 'done' then '' else t1.assignedTo end as assignedTo", 't1.status', 't1.mode', 't4.account', 't3.status as projectStatus', 't2.status as executionStatus', 't4.status as teamStatus');
|
||||
public $fieldList = array('t1.id', "CASE WHEN t1.mode != '' AND t4.status != 'done' THEN t4.account ELSE t1.assignedTo END AS assignedTo", 't1.status', 't1.mode', 't4.account', 't3.status AS projectStatus', 't2.status AS executionStatus', 't4.status AS teamStatus');
|
||||
|
||||
public $result = array();
|
||||
|
||||
public $supportSingleQuery = true;
|
||||
|
||||
public function singleQuery()
|
||||
{
|
||||
$select = "`assignedTo` as `user`, count(`assignedTo`) as `value`";
|
||||
return $this->dao->select($select)->from($this->getSingleSql())
|
||||
->where('`status`')->notin('closed,cancel')
|
||||
->andWhere('`projectStatus`', true)->ne('suspended')
|
||||
->orWhere('`executionStatus`')->ne('suspended')->markRight(1)
|
||||
->andWhere("(`mode` = 'multi' and `teamStatus` != 'done')", true)
|
||||
->orWhere('`mode`')->ne('multi')
|
||||
->markRight(1)
|
||||
->groupBy('`assignedTo`')
|
||||
->fetchAll();
|
||||
}
|
||||
|
||||
public function calculate($row)
|
||||
{
|
||||
$assignedTo = $row->assignedTo;
|
||||
@@ -54,11 +38,7 @@ class count_of_assigned_task_in_user extends baseCalc
|
||||
|
||||
if($status == 'closed' || $status == 'cancel') return false;
|
||||
|
||||
if($mode == 'multi')
|
||||
{
|
||||
if($teamStatus == 'done') return false;
|
||||
$assignedTo = $row->account;
|
||||
}
|
||||
if($mode == 'multi' && $teamStatus != 'done') $assignedTo = $row->account;
|
||||
|
||||
/* 如果执行和项目都是挂起的,不计算。*/
|
||||
if($projectStatus == 'suspended' && $executionStatus == 'suspended') return false;
|
||||
|
||||
+2
-2
@@ -545,7 +545,7 @@ class taskTao extends taskModel
|
||||
$orderBy = str_replace('pri_', 'priOrder_', $orderBy);
|
||||
$orderBy = str_replace('project_', 't1.project_', $orderBy);
|
||||
|
||||
return $this->dao->select("t1.*, t4.id as project, t2.id as executionID, t2.name as executionName, t4.name as projectName, t2.multiple as executionMultiple, t2.type as executionType, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder")
|
||||
return $this->dao->select("t1.*, t4.id AS project, t2.id AS executionID, t2.name AS executionName, t4.name AS projectName, t2.multiple AS executionMultiple, t2.type AS executionType, t3.id AS storyID, t3.title AS storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) AS priOrder")
|
||||
->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id')
|
||||
->leftJoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id')
|
||||
@@ -566,7 +566,7 @@ class taskTao extends taskModel
|
||||
->fi()
|
||||
->beginIF($type == 'assignedTo' && ($this->app->rawModule == 'my' || $this->app->rawModule == 'block'))->andWhere('t2.status', true)->ne('suspended')->orWhere('t4.status')->ne('suspended')->markRight(1)->fi()
|
||||
->beginIF(!in_array($type, array('all', 'finishedBy', 'assignedTo', 'myInvolved')))->andWhere("t1.`$type`")->eq($account)->fi()
|
||||
->beginIF($type == 'assignedTo')->andWhere("((t1.assignedTo = '{$account}' and t1.mode != 'multi') or (t1.mode = 'multi' and t5.`account` = '{$account}' and t1.status != 'closed' and t5.status != 'done') )")->fi()
|
||||
->beginIF($type == 'assignedTo')->andWhere("((t1.assignedTo = '{$account}') or (t1.mode = 'multi' and t5.`account` = '{$account}' and t1.status != 'closed' and t5.status != 'done') )")->fi()
|
||||
->beginIF($type == 'assignedTo' && $this->app->rawModule == 'my' && $this->app->rawMethod == 'work')->andWhere('t1.status')->notin('closed,cancel')->fi()
|
||||
->beginIF($type == 'myInvolved')
|
||||
->andWhere("((t5.`account` = '{$this->app->user->account}') OR t1.`assignedTo` = '{$this->app->user->account}' OR t1.`finishedby` = '{$this->app->user->account}')")
|
||||
|
||||
Regular → Executable
+3
-3
@@ -67,7 +67,7 @@ timeout=0
|
||||
cid=1
|
||||
|
||||
- 查看指派给用户1的任务第20条的name属性 @任务20
|
||||
- 检查指派给用户1的任务数量 @8
|
||||
- 检查指派给用户1的任务数量 @10
|
||||
- 查看由用户1关闭的任务第16条的name属性 @任务16
|
||||
- 检查由用户1关闭的任务数量 @2
|
||||
- 查看由用户1完成的任务第20条的name属性 @任务20
|
||||
@@ -82,7 +82,7 @@ cid=1
|
||||
$task = new taskTest();
|
||||
|
||||
r($task->fetchUserTasksByTypeTest('user1', 'assignedTo')) && p('20:name') && e('任务20'); // 查看指派给用户1的任务
|
||||
r(count($task->fetchUserTasksByTypeTest('user1', 'assignedTo'))) && p() && e('8'); // 检查指派给用户1的任务数量
|
||||
r(count($task->fetchUserTasksByTypeTest('user1', 'assignedTo'))) && p() && e('10'); // 检查指派给用户1的任务数量
|
||||
r($task->fetchUserTasksByTypeTest('user1', 'closedBy')) && p('16:name') && e('任务16'); // 查看由用户1关闭的任务
|
||||
r(count($task->fetchUserTasksByTypeTest('user1', 'closedBy'))) && p() && e('2'); // 检查由用户1关闭的任务数量
|
||||
r($task->fetchUserTasksByTypeTest('user1', 'finishedBy')) && p('20:name') && e('任务20'); // 查看由用户1完成的任务
|
||||
@@ -91,4 +91,4 @@ r(count($task->fetchUserTasksByTypeTest('user1', 'assignedTo', 'id_desc', 0, 8))
|
||||
r($task->fetchUserTasksByTypeTest('user1', 'finishedBy', 'id_desc', 1, 0, null)) && p('20:name') && e('任务20'); // 查看项目1下由用户1完成的任务
|
||||
r(count($task->fetchUserTasksByTypeTest('user1', 'finishedBy', 'id_desc', 1, 0, null))) && p() && e('11'); // 查看项目1下由用户1完成的任务数量
|
||||
r($task->fetchUserTasksByTypeTest('user1', 'finishedBy', 'id_desc', 2, 0, null)) && p() && e('0'); // 查看不存在的项目下由用户1完成的任务
|
||||
r(count($task->fetchUserTasksByTypeTest('user1', 'finishedBy', 'id_desc', 2, 0, null))) && p() && e('0'); // 查看不存在的项目下由用户1完成的任务数量
|
||||
r(count($task->fetchUserTasksByTypeTest('user1', 'finishedBy', 'id_desc', 2, 0, null))) && p() && e('0'); // 查看不存在的项目下由用户1完成的任务数量
|
||||
Reference in New Issue
Block a user