From 7ce0103bbadcdc1c730526cde2201cb27af25e0d Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 17 May 2022 08:59:11 +0000 Subject: [PATCH 1/9] sprint_sunjun_54321 --- module/my/control.php | 10 +++++++++- module/my/lang/de.php | 2 +- module/my/lang/en.php | 1 + module/my/lang/fr.php | 1 + module/my/lang/zh-cn.php | 1 + module/my/lang/zh-tw.php | 1 + module/my/model.php | 28 ++++++++++++++++++++++++++++ module/my/view/task.html.php | 9 +++++---- 8 files changed, 47 insertions(+), 6 deletions(-) diff --git a/module/my/control.php b/module/my/control.php index 4738673f24..95aacc972f 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -392,6 +392,7 @@ EOF; */ public function task($type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { + $this->loadModel('task'); /* Save session. */ if($this->app->viewType != 'json') $this->session->set('taskList', $this->app->getURI(true), 'execution'); @@ -404,7 +405,14 @@ EOF; $sort = common::appendOrder($orderBy); /* Get tasks. */ - $tasks = $this->loadModel('task')->getUserTasks($this->app->user->account, $type, 0, $pager, $sort); + if($type == 'assignedBy') + { + $tasks = $this->my->getAssignedByMe($this->app->user->account, $type, 0, $pager, $sort, 0, 'task'); + } + else + { + $tasks = $this->task->getUserTasks($this->app->user->account, $type, 0, $pager, $sort); + } $parents = array(); $executionIDList = array(); diff --git a/module/my/lang/de.php b/module/my/lang/de.php index b558580030..ae56776df9 100644 --- a/module/my/lang/de.php +++ b/module/my/lang/de.php @@ -56,7 +56,7 @@ $lang->my->taskMenu->assignedToMe = 'AssignedToMe'; $lang->my->taskMenu->openedByMe = 'CreatedByMe'; $lang->my->taskMenu->finishedByMe = 'FinishedByMe'; $lang->my->taskMenu->closedByMe = 'ClosedByMe'; -$lang->my->taskMenu->canceledByMe = 'CancelledByMe'; +$lang->my->taskMenu->assignedByMe = 'AssignedByMe'; $lang->my->storyMenu = new stdclass(); $lang->my->storyMenu->assignedToMe = 'AssignedToMe'; diff --git a/module/my/lang/en.php b/module/my/lang/en.php index 4705823a20..f97a214255 100644 --- a/module/my/lang/en.php +++ b/module/my/lang/en.php @@ -66,6 +66,7 @@ $lang->my->taskMenu->openedByMe = 'CreatedByMe'; $lang->my->taskMenu->finishedByMe = 'FinishedByMe'; $lang->my->taskMenu->closedByMe = 'ClosedByMe'; $lang->my->taskMenu->canceledByMe = 'CancelledByMe'; +$lang->my->taskMenu->assignedByMe = 'AssignedByMe'; $lang->my->storyMenu = new stdclass(); $lang->my->storyMenu->assignedToMe = 'AssignedToMe'; diff --git a/module/my/lang/fr.php b/module/my/lang/fr.php index b558580030..a1020163b0 100644 --- a/module/my/lang/fr.php +++ b/module/my/lang/fr.php @@ -57,6 +57,7 @@ $lang->my->taskMenu->openedByMe = 'CreatedByMe'; $lang->my->taskMenu->finishedByMe = 'FinishedByMe'; $lang->my->taskMenu->closedByMe = 'ClosedByMe'; $lang->my->taskMenu->canceledByMe = 'CancelledByMe'; +$lang->my->taskMenu->assignedByMe = 'AssignedByMe'; $lang->my->storyMenu = new stdclass(); $lang->my->storyMenu->assignedToMe = 'AssignedToMe'; diff --git a/module/my/lang/zh-cn.php b/module/my/lang/zh-cn.php index 93e5ddba0d..763e49b434 100644 --- a/module/my/lang/zh-cn.php +++ b/module/my/lang/zh-cn.php @@ -66,6 +66,7 @@ $lang->my->taskMenu->openedByMe = '由我创建'; $lang->my->taskMenu->finishedByMe = '由我完成'; $lang->my->taskMenu->closedByMe = '由我关闭'; $lang->my->taskMenu->canceledByMe = '由我取消'; +$lang->my->taskMenu->assignedByMe = '由我指派'; $lang->my->storyMenu = new stdclass(); $lang->my->storyMenu->assignedToMe = '指派给我'; diff --git a/module/my/lang/zh-tw.php b/module/my/lang/zh-tw.php index 9bbe89a5ba..dc42ee55d2 100644 --- a/module/my/lang/zh-tw.php +++ b/module/my/lang/zh-tw.php @@ -65,6 +65,7 @@ $lang->my->taskMenu->openedByMe = '由我創建'; $lang->my->taskMenu->finishedByMe = '由我完成'; $lang->my->taskMenu->closedByMe = '由我關閉'; $lang->my->taskMenu->canceledByMe = '由我取消'; +$lang->my->taskMenu->assignedByMe = '由我指派'; $lang->my->storyMenu = new stdclass(); $lang->my->storyMenu->assignedToMe = '指派給我'; diff --git a/module/my/model.php b/module/my/model.php index 3941377e1e..7f059f8f9d 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -309,4 +309,32 @@ class myModel extends model return $actions; } + public function getAssignedByMe($account, $type = 'assignedBy', $limit = 0, $pager = null, $orderBy = "id_desc", $projectID = 0, $objectType = '') + { + $this->loadModel($objectType); + $objectList = $this->dao->select('t1.*') + ->from($this->config->objectTables[$objectType])->alias('t1') + ->leftJoin(TABLE_ACTION)->alias('t2')->on("t1.id = t2.objectID and t2.objectType='{$objectType}'") + ->where('t2.actor')->eq($account) + ->andWhere('t2.action')->eq('assigned') + ->andWhere('t1.deleted')->eq(0) + ->orderBy($orderBy) + ->page($pager, 't1.id') + ->fetchAll('id'); + if($objectType == 'task') + { + $projectList = array(); + foreach($objectList as $task) $projectList[$task->project] = $task->project; + $projectPairs = $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($projectList)->fetchPairs('id'); + foreach($objectList as $task) $task->projectName = zget($projectPairs, $task->project); + + $executionList = array(); + foreach($objectList as $task) $executionList[$task->execution] = $task->execution; + $executionPairs = $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($executionList)->fetchPairs('id'); + foreach($objectList as $task) $task->executionName = zget($executionPairs, $task->execution); + + if($objectList) return $this->loadModel('task')->processTasks($objectList); + return array(); + } + } } diff --git a/module/my/view/task.html.php b/module/my/view/task.html.php index 68520fe242..54b0acd24d 100644 --- a/module/my/view/task.html.php +++ b/module/my/view/task.html.php @@ -20,10 +20,11 @@ {$pager->recTotal}"; ?> rawMethod == 'contribute'):?> rawMethod, "mode=$mode&type=openedBy"), "{$lang->my->taskMenu->openedByMe}" . ($type == 'openedBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'openedBy' ? ' btn-active-text' : '') . "'"); - echo html::a(inlink($app->rawMethod, "mode=$mode&type=finishedBy"), "{$lang->my->taskMenu->finishedByMe}" . ($type == 'finishedBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'finishedBy' ? ' btn-active-text' : '') . "'"); - echo html::a(inlink($app->rawMethod, "mode=$mode&type=closedBy"), "{$lang->my->taskMenu->closedByMe}" . ($type == 'closedBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'closedBy' ? ' btn-active-text' : '') . "'"); - echo html::a(inlink($app->rawMethod, "mode=$mode&type=canceledBy"), "{$lang->my->taskMenu->canceledByMe}" . ($type == 'canceledBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'canceledBy' ? ' btn-active-text' : '') . "'"); + echo html::a(inlink($app->rawMethod, "mode=$mode&type=openedBy"), "{$lang->my->taskMenu->openedByMe}" . ($type == 'openedBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'openedBy' ? ' btn-active-text' : '') . "'"); + echo html::a(inlink($app->rawMethod, "mode=$mode&type=finishedBy"), "{$lang->my->taskMenu->finishedByMe}" . ($type == 'finishedBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'finishedBy' ? ' btn-active-text' : '') . "'"); + echo html::a(inlink($app->rawMethod, "mode=$mode&type=closedBy"), "{$lang->my->taskMenu->closedByMe}" . ($type == 'closedBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'closedBy' ? ' btn-active-text' : '') . "'"); + echo html::a(inlink($app->rawMethod, "mode=$mode&type=canceledBy"), "{$lang->my->taskMenu->canceledByMe}" . ($type == 'canceledBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'canceledBy' ? ' btn-active-text' : '') . "'"); + echo html::a(inlink($app->rawMethod, "mode=$mode&type=assignedBy"), "{$lang->my->taskMenu->assignedByMe}" . ($type == 'assignedBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'assignedBy' ? ' btn-active-text' : '') . "'"); ?> From d6bf1abf9f091ba4003c5647c53edf52990eb096 Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 17 May 2022 12:47:45 +0000 Subject: [PATCH 2/9] sprint_sunjun_54325 --- module/my/control.php | 2 +- module/my/model.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/module/my/control.php b/module/my/control.php index 95aacc972f..d18f89ca19 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -759,7 +759,7 @@ EOF; $this->view->orderBy = $orderBy; $this->view->pager = $pager; $this->view->type = $type; - $this->view->issues = $this->loadModel('issue')->getUserIssues($type, $this->app->user->account, $orderBy, $pager); + $this->view->issues = $type == 'assignedBy' ? $this->loadModel('my')->getAssignedByMe($this->app->user->account, $type, '', $pager, $orderBy, '', 'issue') : $this->loadModel('issue')->getUserIssues($type, $this->app->user->account, $orderBy, $pager); $this->view->projectList = $this->loadModel('project')->getPairsByProgram(); diff --git a/module/my/model.php b/module/my/model.php index 7f059f8f9d..1c5d75a58e 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -336,5 +336,6 @@ class myModel extends model if($objectList) return $this->loadModel('task')->processTasks($objectList); return array(); } + return $objectList; } } From 3ce847a623a76a890aac0ae9461e10425767d24e Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 17 May 2022 13:38:50 +0000 Subject: [PATCH 3/9] sprint_sunjun_54326 --- module/my/control.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/my/control.php b/module/my/control.php index d18f89ca19..a4c55fafa8 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -780,6 +780,7 @@ EOF; public function risk($type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Set the pager. */ + $this->loadModel('risk'); $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); @@ -787,7 +788,7 @@ EOF; $this->view->title = $this->lang->my->risk; $this->view->position[] = $this->lang->my->risk; - $this->view->risks = $this->loadModel('risk')->getUserRisks($type, $this->app->user->account, $orderBy, $pager); + $this->view->risks = $type == 'assignedBy' ? $this->loadModel('my')->getAssignedByMe($this->app->user->account, $type, '', $pager, $orderBy, '', 'risk') : $this->loadModel('risk')->getUserRisks($type, $this->app->user->account, $orderBy, $pager); $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); $this->view->orderBy = $orderBy; $this->view->pager = $pager; From ae9e3b7df41cbf9b2334e84764613e433750f006 Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 17 May 2022 13:54:08 +0000 Subject: [PATCH 4/9] sprint_sunjun_54327 --- module/my/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/my/control.php b/module/my/control.php index a4c55fafa8..96fcdb253e 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -856,7 +856,7 @@ EOF; $this->app->loadClass('pager', $static = true); if($this->app->getViewType() == 'mhtml') $recPerPage = 10; $pager = pager::init($recTotal, $recPerPage, $pageID); - $ncList = $this->my->getNcList($browseType, $orderBy, $pager, 'active'); + $ncList = $browseType == 'assignedBy' ? $this->loadModel('my')->getAssignedByMe($this->app->user->account, $browseType, '', $pager, $orderBy, '', 'nc') : $this->my->getNcList($browseType, $orderBy, $pager, 'active'); foreach($ncList as $nc) $ncIdList[] = $nc->id; $this->session->set('ncIdList', isset($ncIdList) ? $ncIdList : ''); From fca85b0bccca63318a08ccac4d71ea70c95e13dc Mon Sep 17 00:00:00 2001 From: sunjun Date: Wed, 18 May 2022 00:59:07 +0000 Subject: [PATCH 5/9] sprint_fixbug --- module/my/control.php | 8 ++++---- module/my/model.php | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/module/my/control.php b/module/my/control.php index 96fcdb253e..462a49dd45 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -407,7 +407,7 @@ EOF; /* Get tasks. */ if($type == 'assignedBy') { - $tasks = $this->my->getAssignedByMe($this->app->user->account, $type, 0, $pager, $sort, 0, 'task'); + $tasks = $this->my->getAssignedByMe($this->app->user->account, 0, $pager, $sort, 0, 'task'); } else { @@ -759,7 +759,7 @@ EOF; $this->view->orderBy = $orderBy; $this->view->pager = $pager; $this->view->type = $type; - $this->view->issues = $type == 'assignedBy' ? $this->loadModel('my')->getAssignedByMe($this->app->user->account, $type, '', $pager, $orderBy, '', 'issue') : $this->loadModel('issue')->getUserIssues($type, $this->app->user->account, $orderBy, $pager); + $this->view->issues = $type == 'assignedBy' ? $this->loadModel('my')->getAssignedByMe($this->app->user->account, '', $pager, $orderBy, '', 'issue') : $this->loadModel('issue')->getUserIssues($type, $this->app->user->account, $orderBy, $pager); $this->view->projectList = $this->loadModel('project')->getPairsByProgram(); @@ -788,7 +788,7 @@ EOF; $this->view->title = $this->lang->my->risk; $this->view->position[] = $this->lang->my->risk; - $this->view->risks = $type == 'assignedBy' ? $this->loadModel('my')->getAssignedByMe($this->app->user->account, $type, '', $pager, $orderBy, '', 'risk') : $this->loadModel('risk')->getUserRisks($type, $this->app->user->account, $orderBy, $pager); + $this->view->risks = $type == 'assignedBy' ? $this->loadModel('my')->getAssignedByMe($this->app->user->account, '', $pager, $orderBy, '', 'risk') : $this->loadModel('risk')->getUserRisks($type, $this->app->user->account, $orderBy, $pager); $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); $this->view->orderBy = $orderBy; $this->view->pager = $pager; @@ -856,7 +856,7 @@ EOF; $this->app->loadClass('pager', $static = true); if($this->app->getViewType() == 'mhtml') $recPerPage = 10; $pager = pager::init($recTotal, $recPerPage, $pageID); - $ncList = $browseType == 'assignedBy' ? $this->loadModel('my')->getAssignedByMe($this->app->user->account, $browseType, '', $pager, $orderBy, '', 'nc') : $this->my->getNcList($browseType, $orderBy, $pager, 'active'); + $ncList = $browseType == 'assignedBy' ? $this->loadModel('my')->getAssignedByMe($this->app->user->account, '', $pager, $orderBy, '', 'nc') : $this->my->getNcList($browseType, $orderBy, $pager, 'active'); foreach($ncList as $nc) $ncIdList[] = $nc->id; $this->session->set('ncIdList', isset($ncIdList) ? $ncIdList : ''); diff --git a/module/my/model.php b/module/my/model.php index 1c5d75a58e..d2a1170aee 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -309,7 +309,7 @@ class myModel extends model return $actions; } - public function getAssignedByMe($account, $type = 'assignedBy', $limit = 0, $pager = null, $orderBy = "id_desc", $projectID = 0, $objectType = '') + public function getAssignedByMe($account, $limit = 0, $pager = null, $orderBy = "id_desc", $projectID = 0, $objectType = '') { $this->loadModel($objectType); $objectList = $this->dao->select('t1.*') @@ -321,6 +321,7 @@ class myModel extends model ->orderBy($orderBy) ->page($pager, 't1.id') ->fetchAll('id'); + if($objectType == 'task') { $projectList = array(); From fca35134b55f191bd18aaa8e52c4430e6f9991c5 Mon Sep 17 00:00:00 2001 From: sunjun Date: Wed, 18 May 2022 01:42:09 +0000 Subject: [PATCH 6/9] sprint_sunjun_54324 --- module/my/control.php | 11 ++++++++++- module/my/model.php | 9 +++++++++ module/my/view/bug.html.php | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/module/my/control.php b/module/my/control.php index 462a49dd45..dee07e8ce4 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -487,6 +487,7 @@ EOF; public function bug($type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Save session. load Lang. */ + $this->loadModel('bug'); if($this->app->viewType != 'json') $this->session->set('bugList', $this->app->getURI(true), 'qa'); $this->app->loadLang('bug'); @@ -497,7 +498,15 @@ EOF; /* Append id for secend sort. */ $sort = common::appendOrder($orderBy); - $bugs = $this->loadModel('bug')->getUserBugs($this->app->user->account, $type, $sort, 0, $pager); + if($type == 'assignedBy') + { + $bugs = $this->loadModel('my')->getAssignedByMe($this->app->user->account, '', $pager, $orderBy, '', 'bug'); + } + else + { + $bugs = $this->loadModel('bug')->getUserBugs($this->app->user->account, $type, $sort, 0, $pager); + } + $bugs = $this->bug->checkDelayedBugs($bugs); $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'bug', false); diff --git a/module/my/model.php b/module/my/model.php index d2a1170aee..3b19a357d9 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -337,6 +337,15 @@ class myModel extends model if($objectList) return $this->loadModel('task')->processTasks($objectList); return array(); } + + if($objectType == 'bug') + { + $productList = array(); + foreach($objectList as $bug) $productList[$bug->product] = $bug->product; + $productPairs = $this->dao->select('id,name')->from(TABLE_PRODUCT)->where('id')->in($productList)->fetchPairs('id'); + foreach($objectList as $bug) $bug->productName = zget($productPairs, $bug->product); + } + return $objectList; } } diff --git a/module/my/view/bug.html.php b/module/my/view/bug.html.php index c347928130..b3705442c5 100644 --- a/module/my/view/bug.html.php +++ b/module/my/view/bug.html.php @@ -23,6 +23,7 @@ echo html::a(inlink($app->rawMethod, "mode=$mode&type=openedBy"), "{$lang->bug->openedByMe}" . ($type == 'openedBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'openedBy' ? ' btn-active-text' : '') . "'"); echo html::a(inlink($app->rawMethod, "mode=$mode&type=resolvedBy"), "{$lang->bug->resolvedByMe}" . ($type == 'resolvedBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'resolvedBy' ? ' btn-active-text' : '') . "'"); echo html::a(inlink($app->rawMethod, "mode=$mode&type=closedBy"), "{$lang->bug->closedByMe}" . ($type == 'closedBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'closedBy' ? ' btn-active-text' : '') . "'"); + echo html::a(inlink($app->rawMethod, "mode=$mode&type=assignedBy"), "{$lang->my->assignedByMe}" . ($type == 'assignedBy' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'assignedBy' ? ' btn-active-text' : '') . "'"); } ?> From 0349e86aae9df65ef71b8ba8885eee07108ef071 Mon Sep 17 00:00:00 2001 From: sunjun Date: Wed, 18 May 2022 01:47:55 +0000 Subject: [PATCH 7/9] addNotes --- module/my/model.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/module/my/model.php b/module/my/model.php index 3b19a357d9..9f7370073b 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -309,6 +309,18 @@ class myModel extends model return $actions; } + + /** + * getAssignedByMe + * + * @param string $account + * @param int $limit + * @param string $orderBy + * @param int $projectID + * @param string $objectType + * @access public + * @return array + */ public function getAssignedByMe($account, $limit = 0, $pager = null, $orderBy = "id_desc", $projectID = 0, $objectType = '') { $this->loadModel($objectType); From 428d4a6fcf8a8e517a3c5eb6f98a987f4647b909 Mon Sep 17 00:00:00 2001 From: sunjun Date: Wed, 18 May 2022 02:01:55 +0000 Subject: [PATCH 8/9] add notes --- module/my/model.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/module/my/model.php b/module/my/model.php index 9f7370073b..3379b95d5c 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -311,12 +311,13 @@ class myModel extends model } /** - * getAssignedByMe + * Get tasks/bugs/issus/risks/... assigned by me * * @param string $account - * @param int $limit + * @param int $limit * @param string $orderBy - * @param int $projectID + * @param int $pager + * @param int $projectID * @param string $objectType * @access public * @return array From 38c451370a69e69f4b1fd23e08d98422c753725c Mon Sep 17 00:00:00 2001 From: sunjun Date: Wed, 18 May 2022 02:04:49 +0000 Subject: [PATCH 9/9] add notes --- module/my/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/my/model.php b/module/my/model.php index 3379b95d5c..7ab57208a6 100644 --- a/module/my/model.php +++ b/module/my/model.php @@ -311,7 +311,7 @@ class myModel extends model } /** - * Get tasks/bugs/issus/risks/... assigned by me + * Get assigned by me objects. * * @param string $account * @param int $limit