From b50b507b279cf7ed1aa471ccc9bbc3e0cd1bc97e Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 7 Feb 2023 10:50:04 +0800 Subject: [PATCH 1/2] * Finish task #83948. --- module/execution/model.php | 2 +- module/kanban/control.php | 9 ++++++++- module/kanban/model.php | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 0dcb765c03..779d9093d7 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1639,7 +1639,7 @@ class executionModel extends model if($execution->parent < 0 and $execution->type == 'stage') unset($executions[$key]); if($execution->projectName) $execution->name = $execution->projectName . ' / ' . $execution->name; } - else + elseif($param != 'importKanban') { if(isset($executions[$execution->parent]) and $execution->type == 'stage') { diff --git a/module/kanban/control.php b/module/kanban/control.php index ad818eafd1..2e2ce68024 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1379,10 +1379,17 @@ class kanban extends control $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); + $executions = $this->execution->getStatData($selectedProjectID, 'undone', 0, 0, false, 'importKanban', 'id_asc', $pager); + foreach($executions as $execution) + { + $parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs(); + $execution->name = implode('/', $parentExecutions); + } + $this->view->projects = array($this->lang->kanban->allProjects) + $this->project->getPairsByProgram('', 'all', false, '', '', '', 'multiple'); $this->view->selectedProjectID = $selectedProjectID; $this->view->lanePairs = $this->kanban->getLanePairsByGroup($groupID); - $this->view->executions2Imported = $this->execution->getStatData($selectedProjectID, 'undone', 0, 0, false, '', 'id_asc', $pager); + $this->view->executions2Imported = $executions; $this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted'); $this->view->pager = $pager; $this->view->kanbanID = $kanbanID; diff --git a/module/kanban/model.php b/module/kanban/model.php index 7b2a72261f..b9e6bbb158 100755 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -1281,6 +1281,9 @@ class kanbanModel extends model } $objectCard->execType = $object->type; $objectCard->progress = isset($executionProgress[$objectID]->progress) ? $executionProgress[$objectID]->progress : 0; + + $parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($object->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs(); + $objectCard->name = implode('/', $parentExecutions); } $objectCard->desc = strip_tags(htmlspecialchars_decode($object->desc)); From 5719c8c252bde427feb378df866211cb28e0e938 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 7 Feb 2023 11:02:46 +0800 Subject: [PATCH 2/2] * Optimize code for task #83948. --- module/execution/model.php | 7 ++++++- module/kanban/control.php | 9 +-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 779d9093d7..049d5cdb00 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1639,7 +1639,12 @@ class executionModel extends model if($execution->parent < 0 and $execution->type == 'stage') unset($executions[$key]); if($execution->projectName) $execution->name = $execution->projectName . ' / ' . $execution->name; } - elseif($param != 'importKanban') + elseif($param === 'hasParentName') + { + $parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs(); + $executions[$execution->id]->name = implode('/', $parentExecutions); + } + else { if(isset($executions[$execution->parent]) and $execution->type == 'stage') { diff --git a/module/kanban/control.php b/module/kanban/control.php index 2e2ce68024..b7d34684d0 100644 --- a/module/kanban/control.php +++ b/module/kanban/control.php @@ -1379,17 +1379,10 @@ class kanban extends control $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); - $executions = $this->execution->getStatData($selectedProjectID, 'undone', 0, 0, false, 'importKanban', 'id_asc', $pager); - foreach($executions as $execution) - { - $parentExecutions = $this->dao->select('id,name')->from(TABLE_EXECUTION)->where('id')->in(trim($execution->path, ','))->andWhere('type')->in('stage,kanban,sprint')->orderBy('grade')->fetchPairs(); - $execution->name = implode('/', $parentExecutions); - } - $this->view->projects = array($this->lang->kanban->allProjects) + $this->project->getPairsByProgram('', 'all', false, '', '', '', 'multiple'); $this->view->selectedProjectID = $selectedProjectID; $this->view->lanePairs = $this->kanban->getLanePairsByGroup($groupID); - $this->view->executions2Imported = $executions; + $this->view->executions2Imported = $this->execution->getStatData($selectedProjectID, 'undone', 0, 0, false, 'hasParentName', 'id_asc', $pager); $this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted'); $this->view->pager = $pager; $this->view->kanbanID = $kanbanID;