* Remove the document library of the parent stage.

This commit is contained in:
tianshujie
2023-03-29 11:28:45 +08:00
parent cc0fb576f4
commit 340228242e
3 changed files with 14 additions and 53 deletions
+6 -47
View File
@@ -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';
+7 -6
View File
@@ -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();
+1
View File
@@ -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;
}