diff --git a/module/block/control.php b/module/block/control.php index e7baea9b88..fecf665e14 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -1748,6 +1748,7 @@ class block extends control ->beginIF($objectType == 'story' or $objectType == 'requirement')->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')->fi() ->beginIF($objectType == 'bug')->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')->fi() ->beginIF($objectType == 'task')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution=t2.id')->fi() + ->beginIF($objectType == 'issue' or $objectType == 'risk')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')->fi() ->where('t1.deleted')->eq(0) ->andWhere('t1.assignedTo')->eq($this->app->user->account)->fi() ->beginIF($objectType == 'story')->andWhere('t1.type')->eq('story')->andWhere('t2.deleted')->eq('0')->fi() @@ -1757,6 +1758,7 @@ class block extends control ->beginIF($objectType == 'todo')->andWhere('t1.cycle')->eq(0)->andWhere('t1.status')->eq('wait')->andWhere('t1.vision')->eq($this->config->vision)->fi() ->beginIF($objectType != 'todo')->andWhere('t1.status')->ne('closed')->fi() ->beginIF($objectType == 'feedback')->andWhere('t1.status')->in('wait, noreview')->fi() + ->beginIF($objectType == 'issue' or $objectType == 'risk')->andWhere('t2.deleted')->eq(0)->fi() ->orderBy($orderBy) ->beginIF($limitCount)->limit($limitCount)->fi() ->fetchAll(); @@ -1813,16 +1815,18 @@ class block extends control $now = date('H:i:s', strtotime(helper::now())); $meetingCount = isset($params->meetingCount) ? isset($params->meetingCount) : 0; - $meetings = $this->dao->select('*')->from(TABLE_MEETING) - ->where('deleted')->eq('0') - ->andWhere('(date')->gt($today) - ->orWhere('(begin')->gt($now) - ->andWhere('date')->eq($today) + $meetings = $this->dao->select('*')->from(TABLE_MEETING)->alias('t1') + ->leftjoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') + ->where('t1.deleted')->eq('0') + ->andWhere('t2.deleted')->eq('0') + ->andWhere('(t1.date')->gt($today) + ->orWhere('(t1.begin')->gt($now) + ->andWhere('t1.date')->eq($today) ->markRight(2) - ->andwhere('(host')->eq($this->app->user->account) - ->orWhere('participant')->in($this->app->user->account) + ->andwhere('(t1.host')->eq($this->app->user->account) + ->orWhere('t1.participant')->in($this->app->user->account) ->markRight(1) - ->orderBy('id_desc') + ->orderBy('t1.id_desc') ->beginIF($meetingCount)->limit($meetingCount)->fi() ->fetchAll(); diff --git a/module/block/model.php b/module/block/model.php index 1c9b01f470..837f4435f7 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -185,9 +185,11 @@ class blockModel extends model $data['tasks'] = isset($tasks->tasks) ? $tasks->tasks : 0; $data['doneTasks'] = isset($tasks->doneTasks) ? $tasks->doneTasks : 0; - $data['bugs'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_BUG) - ->where('assignedTo')->eq($this->app->user->account) - ->andWhere('deleted')->eq(0) + $data['bugs'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_BUG)->alias('t1') + ->leftJoin(TABLE_PRODUCT)->alias('t2')->on("t1.product = t2.id") + ->where('t1.assignedTo')->eq($this->app->user->account) + ->andWhere('t1.deleted')->eq(0) + ->andWhere('t2.deleted')->eq(0) ->fetch('count'); $data['stories'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_STORY)->alias('t1') ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id') diff --git a/module/bug/model.php b/module/bug/model.php index d68d6e40da..69f4486fdc 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1691,6 +1691,7 @@ class bugModel extends model return $this->dao->select('t1.*,t2.name as productName')->from(TABLE_BUG)->alias('t1') ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') ->where('t1.deleted')->eq(0) + ->andWhere('t2.deleted')->eq('0') ->beginIF($type == 'bySearch')->andWhere($query)->fi() ->beginIF($executionID)->andWhere('t1.execution')->eq($executionID)->fi() ->beginIF($type != 'closedBy' and $this->app->moduleName == 'block')->andWhere('t1.status')->ne('closed')->fi() diff --git a/module/my/control.php b/module/my/control.php index f9b16e7c7a..e03cf44f96 100755 --- a/module/my/control.php +++ b/module/my/control.php @@ -993,7 +993,7 @@ EOF; * @access public * @return void */ - public function nc($browseType = 'assignedToMe', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function nc($browseType = 'assignedToMe', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $this->loadModel('nc'); $this->session->set('ncList', $this->app->getURI(true)); @@ -1015,6 +1015,7 @@ EOF; $this->view->projects = $this->loadModel('project')->getPairsByProgram(); $this->view->pager = $pager; $this->view->orderBy = $orderBy; + $this->view->param = $param; $this->view->mode = 'nc'; $this->display(); } diff --git a/module/my/model.php b/module/my/model.php index efd54ce73d..5986ff02ec 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -334,21 +334,52 @@ class myModel extends model ->fetchAll('objectID'); if(empty($objectIDList)) return array(); - $objectList = $this->dao->select('*')->from($this->config->objectTables[$module]) - ->where('deleted')->eq(0) - ->andWhere('id')->in(array_keys($objectIDList)) - ->beginIF($objectType == 'requirement' or $objectType == 'story')->andWhere('type')->eq($objectType)->fi() - ->orderBy($orderBy) - ->page($pager) - ->fetchAll('id'); + if($objectType == 'task') + { + $objectList = $this->dao->select('t1.*, t2.name as executionName')->from($this->config->objectTables[$module])->alias('t1') + ->leftJoin(TABLE_EXECUTION)->alias('t2')->on("t1.execution = t2.id") + ->where('t1.deleted')->eq(0) + ->andWhere('t2.deleted')->eq(0) + ->andWhere('t1.id')->in(array_keys($objectIDList)) + ->orderBy('t1.' . $orderBy) + ->page($pager) + ->fetchAll('id'); + } + elseif($objectType == 'requirement' or $objectType == 'story' or $objectType == 'bug') + { + $objectList = $this->dao->select('t1.*')->from($this->config->objectTables[$module])->alias('t1') + ->leftJoin(TABLE_PRODUCT)->alias('t2')->on("t1.product = t2.id") + ->where('t1.deleted')->eq(0) + ->andWhere('t2.deleted')->eq(0) + ->andWhere('t1.id')->in(array_keys($objectIDList)) + ->beginIF($objectType == 'requirement' or $objectType == 'story')->andWhere('t1.type')->eq($objectType)->fi() + ->orderBy('t1.' . $orderBy) + ->page($pager) + ->fetchAll('id'); + } + elseif($objectType == 'risk' or $objectType == 'issue' or $objectType == 'nc') + { + $objectList = $this->dao->select('t1.*')->from($this->config->objectTables[$module])->alias('t1') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on("t1.project = t2.id") + ->where('t1.deleted')->eq(0) + ->andWhere('t2.deleted')->eq(0) + ->andWhere('t1.id')->in(array_keys($objectIDList)) + ->orderBy('t1.' . $orderBy) + ->page($pager) + ->fetchAll('id'); + } + else + { + $objectList = $this->dao->select('*')->from($this->config->objectTables[$module]) + ->where('deleted')->eq(0) + ->andWhere('id')->in(array_keys($objectIDList)) + ->orderBy($orderBy) + ->page($pager) + ->fetchAll('id'); + } if($objectType == 'task') { - $executionList = array(); - foreach($objectList as $task) $executionList[$task->execution] = $task->execution; - $objectPairs = $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($executionList)->fetchPairs('id'); - foreach($objectList as $task) $task->executionName = zget($objectPairs, $task->execution, ''); - if($objectList) return $this->loadModel('task')->processTasks($objectList); return $objectList; } diff --git a/module/task/model.php b/module/task/model.php index dca249864d..6b51e33d4c 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2559,6 +2559,7 @@ class taskModel extends model ->leftjoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id') ->where('t1.assignedTo')->eq($account) ->andWhere('t1.deleted')->eq(0) + ->andWhere('t2.deleted')->eq(0) ->beginIF($this->config->vision)->andWhere('t1.vision')->eq($this->config->vision)->fi() ->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi() ->beginIF(!empty($skipExecutionIDList))->andWhere('t1.execution')->notin($skipExecutionIDList)->fi() diff --git a/module/testtask/model.php b/module/testtask/model.php index 26ed83ef72..0e9a9dbb14 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -292,7 +292,9 @@ class testtaskModel extends model ->from(TABLE_TESTTASK)->alias('t1') ->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id') ->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build = t3.id') + ->leftJoin(TABLE_PRODUCT)->alias('t4')->on('t1.product = t4.id') ->where('t1.deleted')->eq(0) + ->andWhere('t4.deleted')->eq(0) ->andWhere('t1.auto')->ne('unit') ->andWhere('t1.owner')->eq($account) ->andWhere('t2.id')->in($this->app->user->view->sprints) @@ -1109,8 +1111,10 @@ class testtaskModel extends model $stmt = $this->dao->select('t1.id, t1.name, t2.name as execution') ->from(TABLE_TESTTASK)->alias('t1') ->leftjoin(TABLE_EXTENSION)->alias('t2')->on('t1.execution = t2.id') + ->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t1.product=t3.id') ->where('t1.owner')->eq($account) ->andWhere('t1.deleted')->eq(0) + ->andWhere('t3.deleted')->eq(0) ->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi() ->beginIF(!empty($skipProductIDList))->andWhere('t1.product')->notin($skipProductIDList)->fi() ->beginIF(!empty($skipExecutionIDList))->andWhere('t1.execution')->notin($skipExecutionIDList)->fi() diff --git a/module/user/model.php b/module/user/model.php index 034d190f21..b5e0db6f1d 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -2813,25 +2813,29 @@ class userModel extends model { if(empty($account)) $account = $this->app->user->account; $count = 'count(id) AS count'; + $t1Count = 'count(t1.id) AS count'; $personalData = array(); $personalData['createdTodos'] = $this->dao->select($count)->from(TABLE_TODO)->where('account')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); - $personalData['createdRequirements'] = $this->dao->select($count)->from(TABLE_STORY)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->andWhere('type')->eq('requirement')->fetch('count'); - $personalData['createdStories'] = $this->dao->select($count)->from(TABLE_STORY)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->andWhere('type')->eq('story')->fetch('count'); - $personalData['createdBugs'] = $this->dao->select($count)->from(TABLE_BUG)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); - $personalData['resolvedBugs'] = $this->dao->select($count)->from(TABLE_BUG)->where('resolvedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); + $personalData['createdRequirements'] = $this->dao->select($t1Count)->from(TABLE_STORY)->alias('t1')->leftjoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')->where('t1.openedBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->andWhere('t1.type')->eq('requirement')->fetch('count'); + $personalData['createdStories'] = $this->dao->select($t1Count)->from(TABLE_STORY)->alias('t1')->leftjoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')->where('t1.openedBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->andWhere('t1.type')->eq('story')->fetch('count'); + $personalData['createdBugs'] = $this->dao->select($t1Count)->from(TABLE_BUG)->alias('t1')->leftjoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')->where('t1.openedBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->fetch('count'); + $personalData['resolvedBugs'] = $this->dao->select($t1Count)->from(TABLE_BUG)->alias('t1')->leftjoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')->where('t1.resolvedBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->fetch('count'); $personalData['createdCases'] = $this->dao->select($count)->from(TABLE_CASE)->where('openedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); if($this->config->edition == 'max') { - $personalData['createdRisks'] = $this->dao->select($count)->from(TABLE_RISK)->where('createdBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); - $personalData['resolvedRisks'] = $this->dao->select($count)->from(TABLE_RISK)->where('resolvedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); - $personalData['createdIssues'] = $this->dao->select($count)->from(TABLE_ISSUE)->where('createdBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); - $personalData['resolvedIssues'] = $this->dao->select($count)->from(TABLE_ISSUE)->where('resolvedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); + $personalData['createdRisks'] = $this->dao->select($t1Count)->from(TABLE_RISK)->alias('t1')->leftjoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')->where('t1.createdBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->fetch('count'); + $personalData['resolvedRisks'] = $this->dao->select($t1Count)->from(TABLE_RISK)->alias('t1')->leftjoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')->where('t1.resolvedBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->fetch('count'); + $personalData['createdIssues'] = $this->dao->select($t1Count)->from(TABLE_ISSUE)->alias('t1')->leftjoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')->where('t1.createdBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->fetch('count'); + $personalData['resolvedIssues'] = $this->dao->select($t1Count)->from(TABLE_ISSUE)->alias('t1')->leftjoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')->where('t1.resolvedBy')->eq($account)->andWhere('t1.deleted')->eq('0')->andWhere('t2.deleted')->eq('0')->fetch('count'); } $personalData['createdDocs'] = $this->dao->select($count)->from(TABLE_DOC)->where('addedBy')->eq($account)->andWhere('deleted')->eq('0')->fetch('count'); - $personalData['finishedTasks'] = $this->dao->select($count)->from(TABLE_TASK)->where('deleted')->eq('0') - ->andWhere('finishedBy', true)->eq($account) - ->orWhere('finishedList')->like("%,{$account},%") + $personalData['finishedTasks'] = $this->dao->select($t1Count)->from(TABLE_TASK)->alias('t1') + ->leftjoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id') + ->where('t1.deleted')->eq('0') + ->andWhere('t2.deleted')->eq('0') + ->andWhere('t1.finishedBy', true)->eq($account) + ->orWhere('t1.finishedList')->like("%,{$account},%") ->markRight(1) ->fetch('count'); diff --git a/module/user/view/task.html.php b/module/user/view/task.html.php index d8c609f963..afd669394d 100644 --- a/module/user/view/task.html.php +++ b/module/user/view/task.html.php @@ -41,15 +41,15 @@ id}&type=$type&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"; ?> - idAB;?> + idAB);?> priAB);?> task->execution);?> task->name);?> - task->estimateAB;?> - task->consumedAB;?> - task->leftAB;?> - task->deadlineAB;?> - statusAB;?> + task->estimateAB);?> + task->consumedAB);?> + task->leftAB);?> + task->deadlineAB);?> + statusAB);?>