From 26da1c72cb5f210c0579df41a6eec7b6297fff0f Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 25 Nov 2021 15:52:15 +0800 Subject: [PATCH 01/17] * Finish task#45157. --- module/my/control.php | 1 + module/task/model.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/module/my/control.php b/module/my/control.php index 36e5c00177..d8f53a4f8b 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -304,6 +304,7 @@ class my extends control $task->parentName = $parent->name; } } + if($task->isSuspened) unset($tasks[$task->id]); } /* Get the story language configuration. */ diff --git a/module/task/model.php b/module/task/model.php index 52acee0b86..0ca43d3a79 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2158,6 +2158,24 @@ class taskModel extends model $projectPairs = $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($projectList)->fetchPairs('id'); foreach($tasks as $task) $task->projectName = zget($projectPairs, $task->project); + $suspendedLists = $this->dao->select('id')->from(TABLE_PROJECT) + ->where('deleted')->eq(0) + ->andWhere('status')->eq('suspended') + ->andWhere('type')->in('project,sprint') + ->fetchAll('id'); + foreach($tasks as $task) + { + foreach($suspendedLists as $suspendedList) + { + if($task->project == $suspendedList->id || $task->execution == $suspendedList->id) + { + $task->isSuspened = 1; + break; + } + } + if(!isset($task->isSuspened)) $task->isSuspened = 0; + } + if($tasks) return $this->processTasks($tasks); return array(); } @@ -2478,6 +2496,7 @@ class taskModel extends model } } } + return $tasks; } From fb843381ca36daf7519dac776e6c401fcaecccbb Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 26 Nov 2021 08:55:04 +0800 Subject: [PATCH 02/17] * Finish task #45157. --- module/block/control.php | 4 +++- module/block/model.php | 4 +++- module/my/control.php | 1 - module/task/control.php | 2 ++ module/task/model.php | 22 ++++------------------ module/todo/model.php | 1 + 6 files changed, 13 insertions(+), 21 deletions(-) diff --git a/module/block/control.php b/module/block/control.php index 8847d27b8e..0476dd28b2 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -586,7 +586,7 @@ class block extends control $this->session->set('todoList', $uri, 'my'); $this->session->set('bugList', $uri, 'qa'); - $this->session->set('taskList', $uri, 'execution'); + //$this->session->set('taskList', $uri, 'execution'); $this->session->set('storyList', $uri, 'product'); $this->session->set('testtaskList', $uri, 'qa'); @@ -1736,6 +1736,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'); diff --git a/module/block/model.php b/module/block/model.php index 78066e4746..bed5ed690d 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -166,7 +166,9 @@ 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'); + $getTaskCount = "SELECT count(*) AS count FROM `zt_task` WHERE assignedTo = 'admin' AND deleted = '0'" + . " AND (project not in (select id from zt_project where deleted = '0' and status ='suspended') AND execution not in (select id from zt_project where deleted = '0' and status ='suspended'))"; + $data['tasks'] = (int)$this->dao->query($getTaskCount)->fetchAll(); $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) diff --git a/module/my/control.php b/module/my/control.php index d8f53a4f8b..36e5c00177 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -304,7 +304,6 @@ class my extends control $task->parentName = $parent->name; } } - if($task->isSuspened) unset($tasks[$task->id]); } /* Get the story language configuration. */ diff --git a/module/task/control.php b/module/task/control.php index a6890a14d0..5087ecf26d 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1349,6 +1349,8 @@ class task extends control $account = $user->account; $tasks = $this->task->getUserTaskPairs($account, $status); + //$tasks = $this->task->getUserTasks($account, 'assignedTo'); + //foreach($tasks as $task) if($task->status != 'wait' and $task->status != 'doing') unset($tasks[$task->id]); if($id) die(html::select("tasks[$id]", $tasks, '', 'class="form-control"')); die(html::select('task', $tasks, '', 'class=form-control')); diff --git a/module/task/model.php b/module/task/model.php index 0ca43d3a79..c621f3c326 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -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' || $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() @@ -2158,24 +2160,6 @@ class taskModel extends model $projectPairs = $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($projectList)->fetchPairs('id'); foreach($tasks as $task) $task->projectName = zget($projectPairs, $task->project); - $suspendedLists = $this->dao->select('id')->from(TABLE_PROJECT) - ->where('deleted')->eq(0) - ->andWhere('status')->eq('suspended') - ->andWhere('type')->in('project,sprint') - ->fetchAll('id'); - foreach($tasks as $task) - { - foreach($suspendedLists as $suspendedList) - { - if($task->project == $suspendedList->id || $task->execution == $suspendedList->id) - { - $task->isSuspened = 1; - break; - } - } - if(!isset($task->isSuspened)) $task->isSuspened = 0; - } - if($tasks) return $this->processTasks($tasks); return array(); } @@ -2194,10 +2178,12 @@ class taskModel extends model $stmt = $this->dao->select('t1.id, t1.name, t2.name as execution') ->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($account) ->andWhere('t1.deleted')->eq(0) ->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi() ->beginIF(!empty($skipExecutionIDList))->andWhere('t1.execution')->notin($skipExecutionIDList)->fi() + ->andWhere('t2.status')->ne('suspended')->andWhere('t3.status')->ne('suspended')->fi() ->query(); $tasks = array(); diff --git a/module/todo/model.php b/module/todo/model.php index cb5f8782d3..96726339dd 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -51,6 +51,7 @@ class todoModel extends model if($todo->pri == 'low') $todo->pri = 3; } + a($todo->type . '11111'); if($todo->type != 'custom') { $type = $todo->type; From 99b52e6b7e333e0bde28e318557abb96ef67a720 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 26 Nov 2021 08:59:55 +0800 Subject: [PATCH 03/17] * Finish task #45157. --- module/block/control.php | 2 +- module/task/control.php | 2 -- module/task/model.php | 1 - module/todo/model.php | 1 - 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/module/block/control.php b/module/block/control.php index 0476dd28b2..d020db7c8c 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -586,7 +586,7 @@ class block extends control $this->session->set('todoList', $uri, 'my'); $this->session->set('bugList', $uri, 'qa'); - //$this->session->set('taskList', $uri, 'execution'); + $this->session->set('taskList', $uri, 'execution'); $this->session->set('storyList', $uri, 'product'); $this->session->set('testtaskList', $uri, 'qa'); diff --git a/module/task/control.php b/module/task/control.php index 5087ecf26d..a6890a14d0 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1349,8 +1349,6 @@ class task extends control $account = $user->account; $tasks = $this->task->getUserTaskPairs($account, $status); - //$tasks = $this->task->getUserTasks($account, 'assignedTo'); - //foreach($tasks as $task) if($task->status != 'wait' and $task->status != 'doing') unset($tasks[$task->id]); if($id) die(html::select("tasks[$id]", $tasks, '', 'class="form-control"')); die(html::select('task', $tasks, '', 'class=form-control')); diff --git a/module/task/model.php b/module/task/model.php index c621f3c326..fc077faa04 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2482,7 +2482,6 @@ class taskModel extends model } } } - return $tasks; } diff --git a/module/todo/model.php b/module/todo/model.php index 96726339dd..cb5f8782d3 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -51,7 +51,6 @@ class todoModel extends model if($todo->pri == 'low') $todo->pri = 3; } - a($todo->type . '11111'); if($todo->type != 'custom') { $type = $todo->type; From c6e4ff62d68c8b396c1c56a69dd7a411f2b5af7d Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 26 Nov 2021 09:07:28 +0800 Subject: [PATCH 04/17] * Finish task #45157. --- module/task/model.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/task/model.php b/module/task/model.php index fc077faa04..9b4268659c 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2140,7 +2140,7 @@ class taskModel extends model ->orWhere('t1.finishedList')->like("%,{$account},%") ->markRight(1) ->fi() - ->beginIF($this->app->rawModule == 'my' || $this->app->rawModule == 'block')->andWhere('t2.status')->ne('suspended')->andWhere('t4.status')->ne('suspended')->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() @@ -2181,9 +2181,10 @@ class taskModel extends model ->leftjoin(TABLE_PROJECT)->alias('t3')->on('t1.project = t3.id') ->where('t1.assignedTo')->eq($account) ->andWhere('t1.deleted')->eq(0) + ->andWhere('t2.status')->ne('suspended') + ->andWhere('t3.status')->ne('suspended') ->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi() ->beginIF(!empty($skipExecutionIDList))->andWhere('t1.execution')->notin($skipExecutionIDList)->fi() - ->andWhere('t2.status')->ne('suspended')->andWhere('t3.status')->ne('suspended')->fi() ->query(); $tasks = array(); From 508b73fea675ee0d1266605eb0b12b3d89814646 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 26 Nov 2021 09:09:48 +0800 Subject: [PATCH 05/17] * Finish task #45157. --- module/block/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/block/model.php b/module/block/model.php index bed5ed690d..205d777a80 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -167,7 +167,7 @@ class blockModel extends model $data = array(); $getTaskCount = "SELECT count(*) AS count FROM `zt_task` WHERE assignedTo = 'admin' AND deleted = '0'" - . " AND (project not in (select id from zt_project where deleted = '0' and status ='suspended') AND execution not in (select id from zt_project where deleted = '0' and status ='suspended'))"; + . " AND (project not in (select id from zt_project where deleted = '0' and status ='suspended' and type = 'project') AND execution not in (select id from zt_project where deleted = '0' and status ='suspended' and type ='sprint'))"; $data['tasks'] = (int)$this->dao->query($getTaskCount)->fetchAll(); $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) From 542369e382cded43008ab2d919672ae288853ae8 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 26 Nov 2021 09:13:24 +0800 Subject: [PATCH 06/17] * Finish task #45157. --- module/block/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/block/model.php b/module/block/model.php index 205d777a80..5954eeb143 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -166,7 +166,7 @@ class blockModel extends model { $data = array(); - $getTaskCount = "SELECT count(*) AS count FROM `zt_task` WHERE assignedTo = 'admin' AND deleted = '0'" + $getTaskCount = "SELECT count(*) AS count FROM `zt_task` WHERE assignedTo = 'admin' AND deleted = '0'" . " AND (project not in (select id from zt_project where deleted = '0' and status ='suspended' and type = 'project') AND execution not in (select id from zt_project where deleted = '0' and status ='suspended' and type ='sprint'))"; $data['tasks'] = (int)$this->dao->query($getTaskCount)->fetchAll(); $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'); From 4d8b54a0b1f75e41f621033102fe46394cdf1eec Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 26 Nov 2021 10:08:56 +0800 Subject: [PATCH 07/17] * Finish task #45157. --- module/block/control.php | 21 +++++++++++++++++++++ module/block/model.php | 15 ++++++++++++--- module/task/model.php | 3 --- 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/module/block/control.php b/module/block/control.php index d020db7c8c..775c4a25b3 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -1719,6 +1719,19 @@ class block extends control { $this->app->loadClass('date'); $this->app->loadLang('todo'); + $tasks = $this->dao->select('t1.name') + ->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('name'); + foreach($objects as $key => $todo) { if($todo->status == 'done' and $todo->finishedBy == $this->app->user->account) @@ -1726,6 +1739,14 @@ class block extends control unset($objects[$key]); continue; } + foreach($tasks as $task) + { + if($todo->type == 'task' and $todo->name == $task->name) + { + unset($objects[$key]); + break; + } + } $todo->begin = date::formatTime($todo->begin); $todo->end = date::formatTime($todo->end); diff --git a/module/block/model.php b/module/block/model.php index 5954eeb143..8b10e43f16 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -166,9 +166,18 @@ class blockModel extends model { $data = array(); - $getTaskCount = "SELECT count(*) AS count FROM `zt_task` WHERE assignedTo = 'admin' AND deleted = '0'" - . " AND (project not in (select id from zt_project where deleted = '0' and status ='suspended' and type = 'project') AND execution not in (select id from zt_project where deleted = '0' and status ='suspended' and type ='sprint'))"; - $data['tasks'] = (int)$this->dao->query($getTaskCount)->fetchAll(); + $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); + $data['tasks'] = count($tasks); $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) diff --git a/module/task/model.php b/module/task/model.php index 9b4268659c..4dc784ede4 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2178,11 +2178,8 @@ class taskModel extends model $stmt = $this->dao->select('t1.id, t1.name, t2.name as execution') ->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($account) ->andWhere('t1.deleted')->eq(0) - ->andWhere('t2.status')->ne('suspended') - ->andWhere('t3.status')->ne('suspended') ->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi() ->beginIF(!empty($skipExecutionIDList))->andWhere('t1.execution')->notin($skipExecutionIDList)->fi() ->query(); From 2c8777ebe9325e732b1ca1dd79c80e8481d1605a Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 26 Nov 2021 10:26:43 +0800 Subject: [PATCH 08/17] * Finish task #45157. --- module/block/control.php | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/module/block/control.php b/module/block/control.php index 775c4a25b3..c0065f4b2f 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -590,9 +590,33 @@ class block extends control $this->session->set('storyList', $uri, 'product'); $this->session->set('testtaskList', $uri, 'qa'); + $tasks = $this->dao->select('t1.name') + ->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('name'); foreach($todos as $key => $todo) { - if($todo->date == '2030-01-01') unset($todos[$key]); + if($todo->date == '2030-01-01') + { + unset($todos[$key]); + continue; + } + foreach($tasks as $task) + { + if($todo->type == 'task' and $todo->name == $task->name) + { + unset($todos[$key]); + break; + } + } } $this->view->todos = $todos; From df2f48128a7a9009ff7178f1538059d1f80c529e Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 26 Nov 2021 10:31:47 +0800 Subject: [PATCH 09/17] * Finish task #45157. --- module/block/control.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/module/block/control.php b/module/block/control.php index c0065f4b2f..992ca3494e 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -1722,6 +1722,18 @@ class block extends control $objectCountList += array('risk' => 'riskCount', 'issue' => 'issueCount'); } + $tasks = $this->dao->select('t1.name') + ->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('name'); foreach($objectCountList as $objectType => $objectCount) { if(!isset($hasViewPriv[$objectType])) continue; @@ -1743,18 +1755,6 @@ class block extends control { $this->app->loadClass('date'); $this->app->loadLang('todo'); - $tasks = $this->dao->select('t1.name') - ->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('name'); foreach($objects as $key => $todo) { From 0c2b88ae38c6050ed835f1e0db0245b21154ebff Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 26 Nov 2021 15:04:47 +0800 Subject: [PATCH 10/17] * Finish task #45157. --- module/block/control.php | 31 ++++--------------------------- module/task/model.php | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/module/block/control.php b/module/block/control.php index 992ca3494e..26da592ad3 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -590,18 +590,7 @@ class block extends control $this->session->set('storyList', $uri, 'product'); $this->session->set('testtaskList', $uri, 'qa'); - $tasks = $this->dao->select('t1.name') - ->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('name'); + $tasks = $this->loadModel('task')->getUserSuspendedTasks($this->app->user->account); foreach($todos as $key => $todo) { if($todo->date == '2030-01-01') @@ -611,7 +600,7 @@ class block extends control } foreach($tasks as $task) { - if($todo->type == 'task' and $todo->name == $task->name) + if($todo->type == 'task' and $todo->idvalue == $task->id) { unset($todos[$key]); break; @@ -1722,18 +1711,7 @@ class block extends control $objectCountList += array('risk' => 'riskCount', 'issue' => 'issueCount'); } - $tasks = $this->dao->select('t1.name') - ->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('name'); + $tasks = $this->loadModel('task')->getUserSuspendedTasks($this->app->user->account); foreach($objectCountList as $objectType => $objectCount) { if(!isset($hasViewPriv[$objectType])) continue; @@ -1755,7 +1733,6 @@ class block extends control { $this->app->loadClass('date'); $this->app->loadLang('todo'); - foreach($objects as $key => $todo) { if($todo->status == 'done' and $todo->finishedBy == $this->app->user->account) @@ -1765,7 +1742,7 @@ class block extends control } foreach($tasks as $task) { - if($todo->type == 'task' and $todo->name == $task->name) + if($todo->type == 'task' and $todo->idvalue == $task->id) { unset($objects[$key]); break; diff --git a/module/task/model.php b/module/task/model.php index 4dc784ede4..c6f68a55cf 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2192,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. * From e5f3e87ea1f593f13066c2c90263e560819c9baa Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 26 Nov 2021 15:08:17 +0800 Subject: [PATCH 11/17] * Finish task #45157. --- module/task/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/task/model.php b/module/task/model.php index c6f68a55cf..3ce29cb28d 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2193,7 +2193,7 @@ class taskModel extends model } /** - * get suspended tasks of a user + * Get suspended tasks of a user. * * @param string $account * @access public From f77c484548e67ebeb97859a893bf2e230c599114 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Mon, 29 Nov 2021 08:21:29 +0800 Subject: [PATCH 12/17] * Finish task #45157. --- module/my/control.php | 18 +++++++++++++++++- module/task/control.php | 13 ++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/module/my/control.php b/module/my/control.php index 36e5c00177..4ac22b9ba1 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -147,8 +147,24 @@ 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) + { + foreach($tasks as $task) + { + if($todo->type == 'task' and $todo->idvalue = $task->id) + { + unset($todos[$key]); + break; + } + } + } + + $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; diff --git a/module/task/control.php b/module/task/control.php index a6890a14d0..f21f70d066 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1348,7 +1348,18 @@ 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) + { + foreach($suspendedTasks as $suspendedTask) + { + if($taskid == $suspendedTask->id) + { + unset($tasks[$taskid]); + } + } + } if($id) die(html::select("tasks[$id]", $tasks, '', 'class="form-control"')); die(html::select('task', $tasks, '', 'class=form-control')); From 2cfb89f72770a6a29936a06a59b2727a394e381a Mon Sep 17 00:00:00 2001 From: liumengyi Date: Mon, 29 Nov 2021 09:47:04 +0800 Subject: [PATCH 13/17] * Finish task #45157. --- module/block/model.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/block/model.php b/module/block/model.php index 8b10e43f16..ab34ff2761 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -176,8 +176,9 @@ class blockModel extends model ->andWhere('t3.type')->eq('sprint') ->andWhere('t1.deleted')->eq(0) ->andWhere('t2.deleted')->eq(0) - ->andWhere('t3.deleted')->eq(0); - $data['tasks'] = count($tasks); + ->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) From 41d073f19d7f31abc2412c8ea2b6146e2c05dab1 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Mon, 29 Nov 2021 10:37:56 +0800 Subject: [PATCH 14/17] * Finish task #45157. --- module/block/control.php | 18 ++++-------------- module/my/control.php | 14 ++------------ 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/module/block/control.php b/module/block/control.php index 26da592ad3..b239a039b5 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -598,14 +598,7 @@ class block extends control unset($todos[$key]); continue; } - foreach($tasks as $task) - { - if($todo->type == 'task' and $todo->idvalue == $task->id) - { - unset($todos[$key]); - break; - } - } + if($todo->type == 'task' and isset($tasks[$todo->idvalue])) unset($todos[$key]); } $this->view->todos = $todos; @@ -1740,13 +1733,10 @@ class block extends control unset($objects[$key]); continue; } - foreach($tasks as $task) + if($todo->type == 'task' and isset($tasks[$todo->idvalue])) { - if($todo->type == 'task' and $todo->idvalue == $task->id) - { - unset($objects[$key]); - break; - } + unset($objects[$key]); + continue; } $todo->begin = date::formatTime($todo->begin); diff --git a/module/my/control.php b/module/my/control.php index 4ac22b9ba1..35e7b20172 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -148,18 +148,8 @@ class my extends control $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) - { - foreach($tasks as $task) - { - if($todo->type == 'task' and $todo->idvalue = $task->id) - { - unset($todos[$key]); - break; - } - } - } + $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); From 235d7bbc0a7bc052a37704f72838f91cd987852e Mon Sep 17 00:00:00 2001 From: liumengyi Date: Mon, 29 Nov 2021 10:43:05 +0800 Subject: [PATCH 15/17] * Finish task #45157. --- module/task/control.php | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index f21f70d066..4ba9a1ab9d 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1350,16 +1350,7 @@ class task extends control $tasks = $this->task->getUserTaskPairs($account, $status); $suspendedTasks = $this->task->getUserSuspendedTasks($account); - foreach($tasks as $taskid => $task) - { - foreach($suspendedTasks as $suspendedTask) - { - if($taskid == $suspendedTask->id) - { - unset($tasks[$taskid]); - } - } - } + 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')); From cd62501f36d25a2aeb89d47b3fc729bd440008dd Mon Sep 17 00:00:00 2001 From: liumengyi Date: Mon, 29 Nov 2021 10:49:56 +0800 Subject: [PATCH 16/17] * minor refactor. --- module/my/control.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/my/control.php b/module/my/control.php index 35e7b20172..949d479cca 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -149,7 +149,10 @@ class my extends control $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]); + foreach($todos as $key => $todo) + { + if($todo->type == 'task' and isset($tasks[$todo->idvalue])) unset($todos[$key]); + } $pager->recTotal = count($todos); From 3e1fc7ad5a9bd1b51469f0d40d92623aef246c73 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Mon, 29 Nov 2021 10:52:29 +0800 Subject: [PATCH 17/17] * minor refactor. --- module/task/control.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/module/task/control.php b/module/task/control.php index 4ba9a1ab9d..f218f60c79 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1350,7 +1350,10 @@ class task extends control $tasks = $this->task->getUserTaskPairs($account, $status); $suspendedTasks = $this->task->getUserSuspendedTasks($account); - foreach($tasks as $taskid => $task) if(isset($suspendedTasks[$taskid])) unset($tasks[$taskid]); + 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'));