* Finish task #69017.

This commit is contained in:
liuruogu
2022-09-19 00:55:59 +00:00
parent cfc214c776
commit d7f589a54c
2 changed files with 47 additions and 41 deletions
+47 -2
View File
@@ -389,7 +389,31 @@ class story extends control
if(!$reviewers and $product->acl != 'open') $reviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '', '');
/* Hidden some fields of projects without products. */
list($this->view->hiddenProduct, $this->view->hiddenPlan, $this->view->hiddenURS) = $this->story->getHiddenNoProduct($this->app->tab, $objectID);
$this->view->hiddenProduct = false;
$this->view->hiddenPlan = false;
$this->view->hiddenURS = false;
if($this->app->tab === 'project' || $this->app->tab === 'execution')
{
if($this->app->tab === 'project')
{
$project = $this->dao->findById((int)$objectID)->from(TABLE_PROJECT)->fetch();
}
else
{
$execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch();
$projectID = $execution->project;
$project = $this->dao->findById((int)$projectID)->from(TABLE_PROJECT)->fetch();
}
if(empty($project->hasProduct))
{
$this->view->hiddenProduct = true;
if($project->model !== 'scrum') $this->view->hiddenPlan = true;
if($project->model === 'kanban') $this->view->hiddenURS = true;
}
}
/* Set Custom. */
foreach(explode(',', $this->config->story->list->customCreateFields) as $field) $customFields[$field] = $this->lang->story->$field;
@@ -484,7 +508,28 @@ class story extends control
}
$this->view->execution = $execution;
/* Hidden some fields of projects without products. */
list($this->view->hiddenProduct, $this->view->hiddenPlan, $this->view->hiddenURS) = $this->story->getHiddenNoProduct($execution->type == 'project' ? 'project' : 'execution', $executionID);
$this->view->hiddenProduct = false;
$this->view->hiddenPlan = false;
if($execution->type === 'project' || $execution->type === 'kanban')
{
if($execution->type === 'project')
{
$project = $this->dao->findById((int)$excutionID)->from(TABLE_PROJECT)->fetch();
}
else
{
$projectID = $execution->project;
$project = $this->dao->findById((int)$projectID)->from(TABLE_PROJECT)->fetch();
}
if(empty($project->hasProduct))
{
$this->view->hiddenProduct = true;
if($project->model !== 'scrum') $this->view->hiddenPlan = true;
}
}
}
else
{
-39
View File
@@ -5978,43 +5978,4 @@ class storyModel extends model
$reviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', '', '');
return $this->user->getPairs('noclosed|nodeleted', '', 0, $reviewers);
}
/**
* Judge whether to hide some fields when it is an project without product.
*
* @param int $objectType
* @param int $objectID
* @access public
* @return void
*/
public function getHiddenNoProduct($objectType, $objectID)
{
$hiddenProduct = false;
$hiddenPlan = false;
$hiddenURS = false;
if($objectType == 'project' || $objectType == 'execution')
{
if($objectType == 'project')
{
$project = $this->dao->findById((int)$objectID)->from(TABLE_PROJECT)->fetch();
}
else
{
$execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch();
$projectID = $execution->project;
$project = $this->dao->findById((int)$projectID)->from(TABLE_PROJECT)->fetch();
}
if(empty($project->hasProduct))
{
$hiddenProduct = true;
if($project->model !== 'scrum') $hiddenPlan = true;
if($project->model === 'kanban') $hiddenURS = true;
}
}
return array($hiddenProduct, $hiddenPlan, $hiddenURS);
}
}