From fb843381ca36daf7519dac776e6c401fcaecccbb Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 26 Nov 2021 08:55:04 +0800 Subject: [PATCH] * 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;