From ab4f445f190717ce8a31148bc5e15bb2a74bace6 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 19 Dec 2017 14:00:08 +0800 Subject: [PATCH] * finish task #3475. --- module/story/model.php | 3 ++- module/tree/model.php | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index 9c49d4662e..a6141dd336 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -481,6 +481,7 @@ class storyModel extends model ->get(); if(isset($story->plan) and is_array($story->plan)) $story->plan = trim(join(',', $story->plan), ','); if(empty($_POST['product'])) $story->branch = $oldStory->branch; + if(empty($_POST['branch'])) $story->branch = 0; $this->dao->update(TABLE_STORY) ->data($story) @@ -1672,7 +1673,7 @@ class storyModel extends model ->leftJoin(TABLE_PRODUCT)->alias('t4')->on('t2.product = t4.id') ->where('t1.project')->eq((int)$projectID) ->beginIF($type == 'byProduct')->andWhere('t1.product')->eq($param)->fi() - ->beginIF($type == 'byBrach')->andWhere('t2.branch')->eq($param)->fi() + ->beginIF($type == 'byBranch')->andWhere('t2.branch')->eq($param)->fi() ->beginIF($type == 'byModule' and $param)->andWhere('t2.module')->in($modules)->fi() ->andWhere('t2.deleted')->eq(0) ->orderBy($orderBy) diff --git a/module/tree/model.php b/module/tree/model.php index f2e42571de..387b2aeab1 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -574,7 +574,12 @@ class treeModel extends model if($startModule) $startModulePath = $startModule->path . '%'; } - $projectModules = $this->getTaskTreeModules($rootID, true); + $projectModules = $this->getTaskTreeModules($rootID, true); + $projectBranches = $this->dao->select('DISTINCT t2.branch')->from(TABLE_PROJECTSTORY)->alias('t1') + ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') + ->where('t1.project')->eq($rootID) + ->andWhere('t2.deleted')->eq(0) + ->fetchPairs(); /* Get module according to product. */ $products = $this->loadModel('product')->getProductsByProject($rootID); @@ -602,12 +607,13 @@ class treeModel extends model while($module = $stmt->fetch()) { /* if not manage, ignore unused modules. */ - if(!isset($projectModules[$module->id])) continue; - $this->buildTree($treeMenu, $module, 'task', $userFunc, $extra); + if(isset($projectModules[$module->id])) $this->buildTree($treeMenu, $module, 'task', $userFunc, $extra); } - if(isset($treeMenu[0]) and $branch) + if((isset($treeMenu[0]) and $branch) or isset($projectBranches[$branch])) { - $treeMenu[0] = "
  • " . html::a($link, $branchName, '_self', "id='branch$branch'") . "
  • "; + $childMenu = isset($treeMenu[0]) ? "" : ''; + $link = helper::createLink('project', 'story', "project=$rootID&ordery=&status=byBranch&praram=$branch"); + $treeMenu[0] = "
  • " . html::a($link, $branchName, '_self', "id='branch$branch'") . "{$childMenu}
  • "; } $tree .= isset($treeMenu[0]) ? $treeMenu[0] : ''; }