Merge branch 'sprint/239_liuruogu_task_69015' into 'zentaopms_239'
* Fix bug #27576. See merge request easycorp/zentaopms!5421
This commit is contained in:
@@ -91,7 +91,7 @@
|
||||
$canCreateStory = ($productID and common::hasPriv('story', 'create'));
|
||||
$canBatchCreateStory = ($productID and common::hasPriv('story', 'batchCreate'));
|
||||
$canLinkStory = ($productID and common::hasPriv('execution', 'linkStory'));
|
||||
$canLinkStoryByPlan = ($productID and common::hasPriv('execution', 'importplanstories'));
|
||||
$canLinkStoryByPlan = ($productID and common::hasPriv('execution', 'importplanstories') and !empty($execution->hasProduct));
|
||||
$hasStoryButton = ($canCreateStory or $canBatchCreateStory or $canLinkStory or $canLinkStoryByPlan);
|
||||
$hasTaskButton = ($canCreateTask or $canBatchCreateTask or $canImportBug);
|
||||
$hasBugButton = ($canCreateBug or $canBatchCreateBug);
|
||||
|
||||
@@ -340,9 +340,10 @@ class productModel extends model
|
||||
* @param string $mode
|
||||
* @param string $programID
|
||||
* @param string|array $append
|
||||
* @param number|bool $shadow
|
||||
* @return array
|
||||
*/
|
||||
public function getPairs($mode = '', $programID = 0, $append = '')
|
||||
public function getPairs($mode = '', $programID = 0, $append = '', $shadow = false)
|
||||
{
|
||||
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProductPairs();
|
||||
|
||||
@@ -359,6 +360,7 @@ class productModel extends model
|
||||
->beginIF($programID)->andWhere('t1.program')->eq($programID)->fi()
|
||||
->beginIF(strpos($mode, 'noclosed') !== false)->andWhere('t1.status')->ne('closed')->fi()
|
||||
->beginIF(!$this->app->user->admin and $this->config->vision == 'rnd')->andWhere('t1.id')->in($views)->fi()
|
||||
->beginIF(is_numeric($shadow))->andWHere('t1.shadow')->eq($shadow)->fi()
|
||||
->andWhere('t1.vision')->eq($this->config->vision)
|
||||
->orderBy('isClosed, t2.order_asc, t1.line_desc, t1.order_asc')
|
||||
->fetchPairs('id', 'name');
|
||||
@@ -373,6 +375,7 @@ class productModel extends model
|
||||
->beginIF($programID)->andWhere('program')->eq($programID)->fi()
|
||||
->beginIF(strpos($mode, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi()
|
||||
->beginIF(!$this->app->user->admin and $this->config->vision == 'rnd')->andWhere('id')->in($views)->fi()
|
||||
->beginIF(is_numeric($shadow))->andWHere('t1.shadow')->eq($shadow)->fi()
|
||||
->andWhere('vision')->eq($this->config->vision)
|
||||
->orderBy($orderBy)
|
||||
->fetchPairs('id', 'name');
|
||||
|
||||
@@ -683,32 +683,34 @@ class programplanModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
$project = $this->loadModel('project')->getByID($projectID);
|
||||
|
||||
$datas = array();
|
||||
foreach($names as $key => $name)
|
||||
{
|
||||
if(empty($name)) continue;
|
||||
|
||||
$plan = new stdclass();
|
||||
$plan->id = isset($planIDList[$key]) ? $planIDList[$key] : '';
|
||||
$plan->type = 'stage';
|
||||
$plan->project = $projectID;
|
||||
$plan->parent = $parentID ? $parentID : $projectID;
|
||||
$plan->name = $names[$key];
|
||||
$plan->percent = $percents[$key];
|
||||
$plan->attribute = empty($parentID) ? $attributes[$key] : $parentAttribute;
|
||||
$plan->milestone = $milestone[$key];
|
||||
$plan->begin = empty($begin[$key]) ? '0000-00-00' : $begin[$key];
|
||||
$plan->end = empty($end[$key]) ? '0000-00-00' : $end[$key];
|
||||
$plan->realBegan = empty($realBegan[$key]) ? '0000-00-00' : $realBegan[$key];
|
||||
$plan->realEnd = empty($realEnd[$key]) ? '0000-00-00' : $realEnd[$key];
|
||||
$plan->output = empty($output[$key]) ? '' : implode(',', $output[$key]);
|
||||
$plan->acl = empty($parentID) ? $acl[$key] : $parentACL;
|
||||
$plan->PM = empty($PM[$key]) ? '' : $PM[$key];
|
||||
$plan->id = isset($planIDList[$key]) ? $planIDList[$key] : '';
|
||||
$plan->type = 'stage';
|
||||
$plan->project = $projectID;
|
||||
$plan->parent = $parentID ? $parentID : $projectID;
|
||||
$plan->name = $names[$key];
|
||||
$plan->percent = $percents[$key];
|
||||
$plan->attribute = empty($parentID) ? $attributes[$key] : $parentAttribute;
|
||||
$plan->milestone = $milestone[$key];
|
||||
$plan->begin = empty($begin[$key]) ? '0000-00-00' : $begin[$key];
|
||||
$plan->end = empty($end[$key]) ? '0000-00-00' : $end[$key];
|
||||
$plan->realBegan = empty($realBegan[$key]) ? '0000-00-00' : $realBegan[$key];
|
||||
$plan->realEnd = empty($realEnd[$key]) ? '0000-00-00' : $realEnd[$key];
|
||||
$plan->output = empty($output[$key]) ? '' : implode(',', $output[$key]);
|
||||
$plan->acl = empty($parentID) ? $acl[$key] : $parentACL;
|
||||
$plan->PM = empty($PM[$key]) ? '' : $PM[$key];
|
||||
$plan->hasProduct = $project->hasProduct;
|
||||
|
||||
$datas[] = $plan;
|
||||
}
|
||||
|
||||
$project = $this->loadModel('project')->getByID($projectID);
|
||||
|
||||
$totalPercent = 0;
|
||||
$totalDevType = 0;
|
||||
|
||||
@@ -502,17 +502,9 @@ class story extends control
|
||||
$this->view->execution = $execution;
|
||||
/* Hidden some fields of projects without products. */
|
||||
|
||||
if($execution->type === 'project' || $execution->type === 'kanban')
|
||||
if(in_array($execution->type, array('project', 'kanban', 'stage'), true))
|
||||
{
|
||||
if($execution->type === 'project')
|
||||
{
|
||||
$project = $this->dao->findById((int)$executionID)->from(TABLE_PROJECT)->fetch();
|
||||
}
|
||||
else
|
||||
{
|
||||
$projectID = $execution->project;
|
||||
$project = $this->dao->findById((int)$projectID)->from(TABLE_PROJECT)->fetch();
|
||||
}
|
||||
$project = $this->dao->findById((int)$executionID)->from(TABLE_PROJECT)->fetch();
|
||||
|
||||
if(empty($project->hasProduct))
|
||||
{
|
||||
|
||||
@@ -102,7 +102,7 @@ class tree extends control
|
||||
if($viewType == 'story')
|
||||
{
|
||||
/* Set menu.*/
|
||||
$products = $this->product->getPairs();
|
||||
$products = $this->product->getPairs($mode = '', $programID = 0, $append = '', $shadow = 0);
|
||||
$this->product->saveState($rootID, $products);
|
||||
|
||||
unset($products[$rootID]);
|
||||
|
||||
Reference in New Issue
Block a user