diff --git a/module/branch/control.php b/module/branch/control.php index 5eb63fae30..4f0bb89663 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -258,22 +258,19 @@ class branch extends control */ public function ajaxGetBranches($productID, $oldBranch = 0, $param = '', $projectID = 0) { + $param = $param ? $param : 'all'; $product = $this->loadModel('product')->getById($productID); if(empty($product) or $product->type == 'normal') die(); - $branches = $this->branch->getPairs($productID, $param); - - /* Remove unlinked branches of the project. */ - if($projectID) + $branches = $this->loadModel('branch')->getList($productID, $projectID, $param); + $branchOption = array(); + $branchTagOption = array(); + foreach($branches as $branchInfo) { - $projectProducts = $this->loadModel('project')->getBranchesByProject($projectID); - foreach($branches as $branchID => $branchName) - { - if(!isset($projectProducts[$productID][$branchID])) unset($branches[$branchID]); - } + $branchOption[$branchInfo->id] = $branchInfo->name; + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); } - - die(html::select('branch', $branches, $oldBranch, "class='form-control' onchange='loadBranch(this)'")); + die(html::select('branch', strpos($param, 'active') !== false ? $branchOption : $branchTagOption, $oldBranch, "class='form-control' onchange='loadBranch(this)'")); } /** diff --git a/module/branch/model.php b/module/branch/model.php index 4d27e1ed7e..4b1a59861d 100644 --- a/module/branch/model.php +++ b/module/branch/model.php @@ -85,6 +85,8 @@ class branchModel extends model $mainBranch->desc = sprintf($this->lang->branch->mainBranch, $this->lang->product->branchName[$product->type]); $mainBranch->order = 0; + if($productID) $product = $this->loadModel('product')->getById($productID); + if(isset($product) and $product->type == 'normal') return $branchList; return array($mainBranch) + $branchList; } diff --git a/module/bug/control.php b/module/bug/control.php index ae7ec573e1..b8d1a5fe28 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -965,13 +965,17 @@ class bug extends control if($this->app->tab == 'execution' or $this->app->tab == 'project') { - $objectID = $this->app->tab == 'project' ? $bug->project : $bug->execution; - $productBranches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('execution')->getBranchByProduct($productID, $objectID, 'all') : array(); - $branches = isset($productBranches[$productID]) ? array(BRANCH_MAIN => $this->lang->branch->main) + $productBranches[$productID] : array(); + $objectID = $this->app->tab == 'project' ? $bug->project : $bug->execution; } - else + + /* Display status of branch. */ + $branches = $this->loadModel('branch')->getList($productID, isset($objectID) ? $objectID : 0, 'all'); + $branchOption = array(); + $branchTagOption = array(); + foreach($branches as $branchInfo) { - $branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID) : array(); + $branchOption[$branchInfo->id] = $branchInfo->name; + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); } $this->view->bug = $bug; @@ -984,7 +988,8 @@ class bug extends control $this->view->currentModuleID = $currentModuleID; $this->view->executions = array(0 => '') + $this->product->getExecutionPairsByProduct($bug->product, $bug->branch, 'id_desc', $bug->project); $this->view->stories = $bug->execution ? $this->story->getExecutionStoryPairs($bug->execution) : $this->story->getProductStoryPairs($bug->product, $bug->branch); - $this->view->branches = $branches; + $this->view->branchOption = $branchOption; + $this->view->branchTagOption = $branchTagOption; $this->view->tasks = $this->task->getExecutionTaskPairs($bug->execution); $this->view->testtasks = $this->loadModel('testtask')->getPairs($bug->product, $bug->execution, $bug->testtask); $this->view->users = $this->user->getPairs('nodeleted', "$bug->assignedTo,$bug->resolvedBy,$bug->closedBy,$bug->openedBy"); @@ -1053,12 +1058,17 @@ class bug extends control $plans = array('' => '', 'ditto' => $this->lang->bug->ditto) + $plans; /* Set branches and modules. */ - $branches = array(); + $branches = array(); + $branchTagOption = array(); $modules = array(); if($product->type != 'normal') { - $branches = $this->loadModel('branch')->getPairs($productID); - foreach($branches as $branchID => $branchName) + $branches = $this->loadModel('branch')->getList($productID, 0 ,'all'); + foreach($branches as $branchInfo) + { + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } + foreach($branchTagOption as $branchID => $branchName) { $modules[$productID][$branchID] = $this->tree->getOptionMenu($productID, 'bug', 0, $branchID); } @@ -1071,11 +1081,11 @@ class bug extends control /* Set product menu. */ $this->qa->setMenu($this->products, $productID, $branch); - $this->view->title = $product->name . $this->lang->colon . "BUG" . $this->lang->bug->batchEdit; - $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]); - $this->view->plans = $plans; - $this->view->branches = $branches; - $this->view->modules = $modules; + $this->view->title = $product->name . $this->lang->colon . "BUG" . $this->lang->bug->batchEdit; + $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]); + $this->view->plans = $plans; + $this->view->branchTagOption = $branchTagOption; + $this->view->modules = $modules; } /* The bugs of my. */ else diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php index caad3f41c6..90affd48f8 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -76,14 +76,19 @@ if(!empty($this->config->user->moreLink)) $this->config->moreLinks["assignedTos[$bugID]"] = $this->config->user->moreLink; if(!$productID) { - $product = $this->product->getByID($bug->product); - $plans = $this->loadModel('productplan')->getPairs($bug->product, $branch); - $branches = $product->type == 'normal' ? array('' => '') : $this->loadModel('branch')->getPairs($product->id); + $branchTagOption = array(); + $product = $this->product->getByID($bug->product); + $plans = $this->loadModel('productplan')->getPairs($bug->product, $branch); + $branches = $product->type == 'normal' ? array('' => '') : $this->loadModel('branch')->getList($product->id, 0 ,'all');; + foreach($branches as $branchInfo) + { + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } $modules[$bug->product][0] = $this->tree->getOptionMenu($bug->product, 'bug'); if($product->type != 'normal') { - foreach($branches as $branchID => $branchName) $branches[$branchID] = '/' . $product->name . '/' . $branchName; + foreach($branchTagOption as $branchID => $branchName) $branchTagOption[$branchID] = '/' . $product->name . '/' . $branchName; $modules[$bug->product][$bug->branch] = $this->tree->getOptionMenu($bug->product, 'bug', 0, $bug->branch); } } @@ -111,7 +116,7 @@ id;?> type == 'normal') ? "disabled='disabled'" : '';?> - branch, "class='form-control chosen' $disabled onchange='setBranchRelated(this.value, $bug->product, $bug->id)'");?> + branch, "class='form-control chosen' $disabled onchange='setBranchRelated(this.value, $bug->product, $bug->id)'");?> product][$bug->branch], $bug->module, "class='form-control chosen'");?> diff --git a/module/bug/view/edit.html.php b/module/bug/view/edit.html.php index 1c1d21ae3e..6e35f16513 100644 --- a/module/bug/view/edit.html.php +++ b/module/bug/view/edit.html.php @@ -95,7 +95,7 @@ if($this->app->tab == 'project') js::set('objectID', $bug->project);
- type != 'normal') echo html::select('branch', $branches, $bug->branch, "onchange='loadBranch();' class='form-control'");?> + type != 'normal') echo html::select('branch', $branchTagOption, $bug->branch, "onchange='loadBranch();' class='form-control'");?>
diff --git a/module/productplan/control.php b/module/productplan/control.php index 3661cf7fac..a2b22d0268 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -31,10 +31,20 @@ class productplan extends control $this->product->setMenu($productID, $branch); $this->session->set('currentProductType', $product->type); - $this->view->product = $product; - $this->view->branch = $branch; - $this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID); - $this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$productID}&branch=$branch"), $product->name); + $branches = $this->loadModel('branch')->getList($productID, 0, 'all'); + $branchOption = array(); + $branchTagOption = array(); + foreach($branches as $branchInfo) + { + $branchOption[$branchInfo->id] = $branchInfo->name; + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } + + $this->view->product = $product; + $this->view->branch = $branch; + $this->view->branchOption = $branchOption; + $this->view->branchTagOption = $branchTagOption; + $this->view->position[] = html::a($this->createLink('product', 'browse', "productID={$productID}&branch=$branch"), $product->name); } /** diff --git a/module/productplan/view/batchedit.html.php b/module/productplan/view/batchedit.html.php index ceb1320f8c..1ae2d1b8d5 100644 --- a/module/productplan/view/batchedit.html.php +++ b/module/productplan/view/batchedit.html.php @@ -45,7 +45,7 @@ id . html::hidden("id[$plan->id]", $plan->id);?> - id]", $branches, $plan->branch, "onchange='getConflictStories($plan->id, this.value); 'class='form-control chosen' ");?> + id]", $branchTagOption, $plan->branch, "onchange='getConflictStories($plan->id, this.value); 'class='form-control chosen' ");?> id]", $plan->title, "class='form-control'")?> diff --git a/module/productplan/view/browse.html.php b/module/productplan/view/browse.html.php index c91b87623b..0e1488ae10 100644 --- a/module/productplan/view/browse.html.php +++ b/module/productplan/view/browse.html.php @@ -115,7 +115,7 @@ ?> session->currentProductType != 'normal'):?> - branch];?> + branch];?> begin == '2030-01-01' ? $lang->productplan->future : $plan->begin;?> end == '2030-01-01' ? $lang->productplan->future : $plan->end;?> diff --git a/module/productplan/view/edit.html.php b/module/productplan/view/edit.html.php index dec563d8bd..e36e484e1b 100644 --- a/module/productplan/view/edit.html.php +++ b/module/productplan/view/edit.html.php @@ -31,7 +31,7 @@ type != 'normal'):?> product->branch;?> - branch, "onchange='getConflictStories($plan->id, this.value); 'class='form-control'");?> + branch, "onchange='getConflictStories($plan->id, this.value); 'class='form-control'");?> diff --git a/module/story/control.php b/module/story/control.php index c03158e02e..6eda829b32 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -668,8 +668,8 @@ class story extends control if($this->app->tab == 'project' or $this->app->tab == 'execution') { - $objectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution; - $products = $this->product->getProductPairsByProject($objectID); + $objectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution; + $products = $this->product->getProductPairsByProject($objectID); $this->view->objectID = $objectID; } diff --git a/module/testcase/control.php b/module/testcase/control.php index 106c116573..f0c9b2396e 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -864,18 +864,19 @@ class testcase extends control $product = $this->product->getById($productID); if($this->app->tab == 'execution' or $this->app->tab == 'project') { - $objectID = $this->app->tab == 'project' ? $case->project : $executionID; - $productBranches = (isset($product->type) and $product->type != 'normal') ? $this->execution->getBranchByProduct($productID, $objectID, 'all') : array(); - $branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array(); - } - else - { - $branches = (isset($product->type) and $product->type != 'normal') ? $this->loadModel('branch')->getPairs($productID) : array(); + $objectID = $this->app->tab == 'project' ? $case->project : $executionID; } + /* Display status of branch. */ + $branches = $this->loadModel('branch')->getList($productID, isset($objectID) ? $objectID : 0, 'all'); + $branchTagOption = array(); + foreach($branches as $branchInfo) + { + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } $this->view->productID = $productID; $this->view->product = $product; - $this->view->branches = $branches; + $this->view->branchTagOption = $branchTagOption; $this->view->productName = $this->products[$productID]; $this->view->moduleOptionMenu = $moduleOptionMenu; $this->view->stories = $this->story->getProductStoryPairs($productID, $case->branch); @@ -959,28 +960,32 @@ class testcase extends control if($product->type != 'normal') $branchProduct = true; /* Set branches and modules. */ - $branches = array(); + $branches = array(); + $branchTagOption = array(); $modules = array(); if($product->type != 'normal') { - $branches = $this->loadModel('branch')->getPairs($productID); - + $branches = $this->loadModel('branch')->getList($productID, 0, 'all'); + foreach($branches as $branchInfo) + { + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } if($this->app->tab == 'project') { - $branches = $this->loadModel('branch')->getPairsByProjectProduct($this->session->project, $productID); + $branchTagOption = $this->loadModel('branch')->getPairsByProjectProduct($this->session->project, $productID); } - foreach($branches as $branchID => $branchName) $modules[$productID][$branchID] = $this->tree->getOptionMenu($productID, 'case', 0, $branchID); + foreach($branchTagOption as $branchID => $branchName) $modules[$productID][$branchID] = $this->tree->getOptionMenu($productID, 'case', 0, $branchID); } else { $modules[$productID][BRANCH_MAIN] = $this->tree->getOptionMenu($productID, 'case'); } - $this->view->branches = $branches; - $this->view->modules = $modules; - $this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]); - $this->view->title = $product->name . $this->lang->colon . $this->lang->testcase->batchEdit; - $this->view->product = $product; + $this->view->branchTagOption = $branchTagOption; + $this->view->modules = $modules; + $this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]); + $this->view->title = $product->name . $this->lang->colon . $this->lang->testcase->batchEdit; + $this->view->product = $product; } } else diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php index cfd189d6aa..40762934a6 100644 --- a/module/testcase/view/batchedit.html.php +++ b/module/testcase/view/batchedit.html.php @@ -71,13 +71,18 @@ $caseBranch = isset($cases[$caseID]->branch) ? $cases[$caseID]->branch : 0; if(!$productID and !$cases[$caseID]->lib) { - $caseProductID = $cases[$caseID]->product; - $product = $products[$caseProductID]; - $branches = isset($branches) ? $branches : array('' => ''); + $caseProductID = $cases[$caseID]->product; + $product = $products[$caseProductID]; + $branchTagOption = isset($branches) ? $branches : array('' => ''); if($product->type != 'normal') { - $branches = isset($productBranches[$product->id]) ? $productBranches[$product->id] : $branches; - foreach($branches as $branchID => $branchName) $branches[$branchID] = '/' . $product->name . '/' . $branchName; + //$branchTagOption = isset($productBranches[$product->id]) ? $productBranches[$product->id] : $branchTagOption; + $branches = $this->loadModel('branch')->getList($product->id, 0, 'all'); + foreach($branches as $branchInfo) + { + $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : ''); + } + foreach($branchTagOption as $branchID => $branchName) $branchTagOption[$branchID] = '/' . $product->name . '/' . $branchName; } $modules[$caseProductID][$caseBranch] = $this->tree->getOptionMenu($cases[$caseID]->product, 'case', 0, $caseBranch); @@ -103,7 +108,7 @@ id;?> type == 'normal') ? "disabled='disabled'" : '';?> - type == 'normal' ? '' : $cases[$caseID]->branch, "class='form-control chosen' onchange='loadBranches($branchProductID, this.value, $caseID)', $disabled");?> + type == 'normal' ? '' : $cases[$caseID]->branch, "class='form-control chosen' onchange='loadBranches($branchProductID, this.value, $caseID)', $disabled");?> diff --git a/module/testcase/view/edit.html.php b/module/testcase/view/edit.html.php index ca6d349c47..14e52afea3 100644 --- a/module/testcase/view/edit.html.php +++ b/module/testcase/view/edit.html.php @@ -173,7 +173,7 @@
- type) and $product->type != 'normal') echo html::select('branch', $branches, $case->branch, "onchange='loadBranch();' class='form-control'");?> + type) and $product->type != 'normal') echo html::select('branch', $branchTagOption, $case->branch, "onchange='loadBranch();' class='form-control'");?>