From 340228242eadbecde73678094fd6d178a6def608 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 29 Mar 2023 11:28:45 +0800 Subject: [PATCH] * Remove the document library of the parent stage. --- module/doc/control.php | 53 +++++--------------------------------- module/doc/model.php | 13 +++++----- module/execution/model.php | 1 + 3 files changed, 14 insertions(+), 53 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index 4500ffb376..18f7d3aa5b 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -147,43 +147,19 @@ class doc extends control if(in_array($type, array('product', 'project'))) $this->app->loadLang('api'); - $objects = array(); - $executionPairs = array(0 => ''); + $objects = array(); if($type == 'product') $objects = $this->product->getPairs(); if($type == 'project') { $objects = $this->project->getPairsByProgram(); if($this->app->tab == 'doc') { - $executions = $this->execution->getList($objectID); - $this->view->project = $this->project->getById($objectID); + $this->view->executionPairs = $this->execution->getPairs($objectID, 'all', 'multiple,leaf,noprefix'); + $this->view->project = $this->project->getById($objectID); } } - if($type == 'execution') - { - $executions = $this->execution->getList(); - $projects = $this->project->getPairsByProgram('', 'all', true); - } - /* Splice project name. */ - if(!empty($executions)) - { - foreach($executions as $id => $execution) - { - if($execution->multiple) - { - if($execution->type == 'stage' and $execution->grade > 1) - { - $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); - } - - $executionPrefix = isset($projects[$execution->project]) ? $projects[$execution->project] . '/' : ''; - $executionPairs[$id] = $executionPrefix . $execution->name; - } - } - if($type == 'execution') $objects = $executionPairs; - } + if($type == 'execution') $objects = $this->execution->getPairs(0, 'all', 'multiple,leaf,noprefix'); if($type == 'execution') { @@ -205,7 +181,6 @@ class doc extends control $this->view->groups = $this->loadModel('group')->getPairs(); $this->view->users = $this->user->getPairs('nocode|noclosed'); $this->view->objects = $objects; - $this->view->executionPairs = $executionPairs; $this->view->type = $type; $this->view->objectID = $objectID; $this->display(); @@ -1468,28 +1443,12 @@ class doc extends control * * @param int $projectID * @access public - * @return void + * @return string */ public function ajaxGetExecution($projectID) { $executions = $this->execution->getList($projectID); - $executionPairs = array(0 => ''); - if(!empty($executions)) - { - foreach($executions as $id => $execution) - { - if($execution->multiple) - { - if($execution->type == 'stage' and $execution->grade > 1) - { - $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); - } - - $executionPairs[$id] = $execution->name; - } - } - } + $executionPairs = array(0 => '') + $this->execution->getPairs($projectID, 'all', 'multiple,leaf,noprefix'); $project = $this->project->getById($projectID); $disabled = $project->multiple ? '' : 'disabled'; diff --git a/module/doc/model.php b/module/doc/model.php index 2086f9917d..7655ef55fd 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -96,7 +96,7 @@ class docModel extends model $products = $this->loadModel('product')->getPairs(); $projects = $this->loadModel('project')->getPairsByProgram(); - $executions = $this->loadModel('execution')->getPairs(0, 'all', 'multiple'); + $executions = $this->loadModel('execution')->getPairs(0, 'all', 'multiple,leaf'); $waterfalls = array(); if(empty($objectID) and $type != 'product' and $type != 'project' and $type != 'custom') { @@ -959,7 +959,7 @@ class docModel extends model $products = $this->product->getPairs(); $this->config->doc->search['params']['project']['values'] = array('' => '') + $this->loadModel('project')->getPairsByProgram() + array('all' => $this->lang->doc->allProjects); - $this->config->doc->search['params']['execution']['values'] = array('' => '') + $this->loadModel('execution')->getPairs(0, 'all', 'multiple') + array('all' => $this->lang->doc->allExecutions); + $this->config->doc->search['params']['execution']['values'] = array('' => '') + $this->loadModel('execution')->getPairs(0, 'all', 'multiple,leaf,noprefix') + array('all' => $this->lang->doc->allExecutions); $this->config->doc->search['params']['lib']['values'] = array('' => '') + $this->loadModel('doc')->getLibs('all', 'withObject') + array('all' => $this->lang->doclib->all); $this->config->doc->search['params']['product']['values'] = array('' => '') + $products + array('all' => $this->lang->doc->allProduct); @@ -980,7 +980,7 @@ class docModel extends model if($type == 'project') { - $this->config->doc->search['params']['execution']['values'] = array('' => '') + $this->loadModel('execution')->getPairs($this->session->project, 'all', 'multiple') + array('all' => $this->lang->doc->allExecutions); + $this->config->doc->search['params']['execution']['values'] = array('' => '') + $this->loadModel('execution')->getPairs($this->session->project, 'all', 'multiple,leaf,noprefix') + array('all' => $this->lang->doc->allExecutions); } else { @@ -996,7 +996,7 @@ class docModel extends model else { $products = $this->product->getPairs('nocode', $this->session->project); - $this->config->doc->search['params']['execution']['values'] = array('' => '') + $this->loadModel('execution')->getPairs($this->session->project, 'all', 'multiple') + array('all' => $this->lang->doc->allExecutions); + $this->config->doc->search['params']['execution']['values'] = array('' => '') + $this->loadModel('execution')->getPairs($this->session->project, 'all', 'multiple,leaf,noprefix') + array('all' => $this->lang->doc->allExecutions); $this->config->doc->search['params']['lib']['values'] = array('' => '', $libID => ($libID ? $libs[$libID] : 0), 'all' => $this->lang->doclib->all); $this->config->doc->search['params']['product']['values'] = array('' => '') + $products + array('all' => $this->lang->doc->allProduct); } @@ -1468,12 +1468,13 @@ class docModel extends model else { $executionIDList = array(); - if($type == 'project') $executionIDList = $this->loadModel('execution')->getPairs($objectID, 'all', 'multiple'); + if($type == 'project') $executionIDList = $this->loadModel('execution')->getPairs($objectID, 'all', 'multiple,leaf'); $objectLibs = $this->dao->select('*')->from(TABLE_DOCLIB) ->where('deleted')->eq(0) ->andWhere('vision')->eq($this->config->vision) ->andWhere($type)->eq($objectID) + ->beginIF($type == 'project')->andWhere('type')->eq('project')->fi() ->beginIF(!empty($appendLib))->orWhere('id')->eq($appendLib)->fi() ->orderBy('`order` asc, id_asc') ->fetchAll('id'); @@ -2004,7 +2005,7 @@ class docModel extends model public function getLibIdListByProject($projectID = 0) { $products = $this->loadModel('product')->getProductIDByProject($projectID, false); - $executions = $this->loadModel('execution')->getPairs($projectID, 'all', 'noclosed'); + $executions = $this->loadModel('execution')->getPairs($projectID, 'all', 'noclosed,leaf'); $executionLibs = array(); $productLibs = array(); diff --git a/module/execution/model.php b/module/execution/model.php index 849ec5ee7e..68c5586049 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1672,6 +1672,7 @@ class executionModel extends model { if(isset($allExecutions[$path])) $executionName .= '/' . $allExecutions[$path]->name; } + if(strpos($mode, 'noprefix') !== false) $executionName = ltrim($executionName, '/'); $pairs[$execution->id] = $executionName; }