diff --git a/module/branch/model.php b/module/branch/model.php
index 1e717a78bb..15850e37b2 100644
--- a/module/branch/model.php
+++ b/module/branch/model.php
@@ -81,19 +81,37 @@ class branchModel extends model
*
* @param int $productID
* @param string $params
+ * @param int $executionID
* @access public
* @return array
*/
- public function getPairs($productID, $params = '')
+ public function getPairs($productID, $params = '', $executionID = 0)
{
+ $executionBranches = array();
+ if($executionID)
+ {
+ $executionBranches = $this->dao->select('branch')->from(TABLE_PROJECTPRODUCT)
+ ->where('project')->eq($executionID)
+ ->andWhere('product')->eq($productID)
+ ->fetchAll();
+ if(empty($executionBranches)) return array();
+ }
+
$branches = $this->dao->select('*')->from(TABLE_BRANCH)
->where('deleted')->eq(0)
->beginIF($productID)->andWhere('product')->eq($productID)->fi()
+ ->beginIF($productID and $executionID)->andWhere('id')->in(array_keys($executionBranches))->fi()
->beginIF(strpos($params, 'active') !== false)->andWhere('status')->eq('active')->fi()
->orderBy('`order`')
->fetchPairs('id', 'name');
foreach($branches as $branchID => $branchName) $branches[$branchID] = htmlspecialchars_decode($branchName);
+ if($executionID)
+ {
+ if(isset($executionBranches['0'])) $branches = array('0' => $this->lang->branch->main) + $branches;
+ return $branches;
+ }
+
if(strpos($params, 'noempty') === false)
{
$product = $this->loadModel('product')->getById($productID);
@@ -358,6 +376,7 @@ class branchModel extends model
}
else
{
+ $branchGroups[$branch->product][0] = $this->lang->branch->main;
$branchGroups[$branch->product][$branch->id] = htmlspecialchars_decode($branch->name);
}
}
@@ -369,7 +388,6 @@ class branchModel extends model
if(!isset($branchGroups[$product->id])) $branchGroups[$product->id] = array();
if(strpos($params, 'noempty') === false) $branchGroups[$product->id] = array('0' => $this->lang->branch->main) + $branchGroups[$product->id];
}
-
return $branchGroups;
}
diff --git a/module/branch/view/manage.html.php b/module/branch/view/manage.html.php
index 16cc1bf75a..886365b2ab 100644
--- a/module/branch/view/manage.html.php
+++ b/module/branch/view/manage.html.php
@@ -99,7 +99,7 @@
id&productID=$productID", $branch, 'list', '', '', "$disabled iframe", true);
+ common::printIcon('branch', 'edit', "branchID=$branch->id&productID=$productID", $branch, 'list', '', '', "$disabled iframe", true, '', sprintf($lang->branch->edit, $lang->product->branchName[$product->type]));
if($branch->status == 'active')
{
common::printIcon('branch', 'close', "branchID=$branch->id", $branch, 'list', 'off', 'hiddenwin', $disabled);
diff --git a/module/execution/control.php b/module/execution/control.php
index 985804a92b..1dce3dc299 100644
--- a/module/execution/control.php
+++ b/module/execution/control.php
@@ -1382,7 +1382,7 @@ class execution extends control
$this->view->name = $name;
$this->view->code = $code;
$this->view->team = $team;
- $this->view->teams = array(0 => '') + $this->execution->getTeamPairsByProject((int)$projectID);
+ $this->view->teams = array(0 => '') + $this->execution->getCanCopyObjects((int)$projectID);
$this->view->allProjects = array(0 => '') + $this->project->getPairsByModel('all', 0, 'noclosed');
$this->view->executionID = $executionID;
$this->view->productID = $productID;
@@ -1393,7 +1393,7 @@ class execution extends control
$this->view->productPlans = array(0 => '') + $productPlans;
$this->view->whitelist = $whitelist;
$this->view->copyExecutionID = $copyExecutionID;
- $this->view->branchGroups = isset($branchGroups) ? $branchGroups : $this->execution->getBranchByProduct(array_keys($products), $projectID);
+ $this->view->branchGroups = isset($branchGroups) ? $branchGroups : $this->execution->getBranchByProduct(array_keys($products), $this->config->systemMode == 'new' ? $projectID : 0);
$this->view->poUsers = $poUsers;
$this->view->pmUsers = $pmUsers;
$this->view->qdUsers = $qdUsers;
@@ -1550,7 +1550,7 @@ class execution extends control
$this->view->unmodifiableBranches = $unmodifiableBranches;
$this->view->multiBranchProducts = $this->product->getMultiBranchPairs();
$this->view->productPlans = $productPlans;
- $this->view->branchGroups = $this->execution->getBranchByProduct(array_keys($linkedProducts), $execution->project);
+ $this->view->branchGroups = $this->execution->getBranchByProduct(array_keys($linkedProducts), $this->config->systemMode == 'new' ? $execution->project : 0);
$this->display();
}
@@ -2324,7 +2324,7 @@ class execution extends control
$this->view->unmodifiableProducts = $unmodifiableProducts;
$this->view->unmodifiableBranches = $unmodifiableBranches;
$this->view->linkedBranches = $linkedBranches;
- $this->view->branchGroups = $this->execution->getBranchByProduct(array_keys($allProducts), $execution->project);
+ $this->view->branchGroups = $this->execution->getBranchByProduct(array_keys($allProducts), $this->config->systemMode == 'new' ? $execution->project : 0);
$this->display();
}
diff --git a/module/execution/js/common.js b/module/execution/js/common.js
index 51c95e3fc4..a5c97acf63 100644
--- a/module/execution/js/common.js
+++ b/module/execution/js/common.js
@@ -152,7 +152,8 @@ function loadBranches(product)
if($inputgroup.find('select').size() >= 2) $inputgroup.removeClass('has-branch').find('select:last').remove();
if($inputgroup.find('.chosen-container').size() >= 2) $inputgroup.find('.chosen-container:last').remove();
- var projectID = $('#project').val();
+ var projectID = (typeof(systemMode) != 'undefined' && systemMode == 'new') ? $('#project').val() : 0;
+
var index = $inputgroup.find('select:first').attr('id').replace('products' , '');
$.get(createLink('branch', 'ajaxGetBranches', "productID=" + $(product).val() + "&oldBranch=0¶m=active&projectID=" + projectID), function(data)
{
diff --git a/module/execution/model.php b/module/execution/model.php
index 54d47cfb8c..cd4dbeb8ec 100644
--- a/module/execution/model.php
+++ b/module/execution/model.php
@@ -362,10 +362,11 @@ class executionModel extends model
$this->lang->project->code = $this->lang->execution->execCode;
}
+ $sprintProject = isset($sprint->project) ? $sprint->project : '';
$this->dao->insert(TABLE_EXECUTION)->data($sprint)
->autoCheck($skipFields = 'begin,end')
->batchcheck($this->config->execution->create->requiredFields, 'notempty')
- ->checkIF(!empty($sprint->name), 'name', 'unique', "`type` in ('sprint','stage') and `project` = $sprint->project")
+ ->checkIF((!empty($sprint->name) and $this->config->systemMode == 'new'), 'name', 'unique', "`type` in ('sprint','stage') and `project` = $sprintProject")
->checkIF(!empty($sprint->code), 'code', 'unique', "`type` in ('sprint','stage')")
->checkIF($sprint->begin != '', 'begin', 'date')
->checkIF($sprint->end != '', 'end', 'date')
@@ -513,13 +514,14 @@ class executionModel extends model
}
/* Update data. */
+ $executionProject = isset($execution->project) ? $execution->project : '';
$this->dao->update(TABLE_EXECUTION)->data($execution)
->autoCheck($skipFields = 'begin,end')
->batchcheck($this->config->execution->edit->requiredFields, 'notempty')
->checkIF($execution->begin != '', 'begin', 'date')
->checkIF($execution->end != '', 'end', 'date')
->checkIF($execution->end != '', 'end', 'ge', $execution->begin)
- ->checkIF(!empty($execution->name), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $execution->project")
+ ->checkIF((!empty($execution->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $executionProject")
->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')")
->where('id')->eq($executionID)
->limit(1)
@@ -545,7 +547,7 @@ class executionModel extends model
$changedAccounts[$owner] = $owner;
$teamMembers[$ownerField] = $member;
}
- if($execution->project) $this->addProjectMembers($execution->project, $teamMembers);
+ if(isset($execution->project) and $execution->project) $this->addProjectMembers($execution->project, $teamMembers);
$whitelist = explode(',', $execution->whitelist);
$this->loadModel('personnel')->updateWhitelist($whitelist, 'sprint', $executionID);
@@ -652,7 +654,7 @@ class executionModel extends model
->checkIF($execution->begin != '', 'begin', 'date')
->checkIF($execution->end != '', 'end', 'date')
->checkIF($execution->end != '', 'end', 'gt', $execution->begin)
- ->checkIF(!empty($execution->name), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $projectID")
+ ->checkIF((!empty($execution->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $projectID")
->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')")
->where('id')->eq($executionID)
->limit(1)
@@ -1636,15 +1638,19 @@ class executionModel extends model
* @access public
* @return array
*/
- public function getBranchByProduct($products, $projectID)
+ public function getBranchByProduct($products, $projectID = 0)
{
- $branchGroups = $this->loadModel('branch')->getByProducts($products, 'noclosed');
- $projectProducts = $this->loadModel('project')->getBranchesByProject($projectID);
- foreach($branchGroups as $productID => $branchPairs)
+ $branchGroups = $this->loadModel('branch')->getByProducts($products, 'noclosed');
+
+ if($projectID)
{
- foreach($branchPairs as $branchID => $branchName)
+ $projectProducts = $this->loadModel('project')->getBranchesByProject($projectID);
+ foreach($branchGroups as $productID => $branchPairs)
{
- if(!isset($projectProducts[$productID][$branchID])) unset($branchGroups[$productID][$branchID]);
+ foreach($branchPairs as $branchID => $branchName)
+ {
+ if(!isset($projectProducts[$productID][$branchID])) unset($branchGroups[$productID][$branchID]);
+ }
}
}
return $branchGroups;
@@ -2496,17 +2502,17 @@ class executionModel extends model
}
/**
- * Get team of the project and its executions by projectID.
+ * Get projects and executions that copy the team.
*
* @param int $projectID
* @access public
* @return array
*/
- public function getTeamPairsByProject($projectID = 0)
+ public function getCanCopyObjects($projectID = 0)
{
if(empty($projectID) and $this->config->systemMode == 'new') return array();
- $teamPairs = $this->dao->select('id,name')->from(TABLE_PROJECT)
+ $objectPairs = $this->dao->select('id,name')->from(TABLE_PROJECT)
->where('deleted')->eq(0)
->andWhere('(project')->eq($projectID)
->orWhere('id')->eq($projectID)
@@ -2514,7 +2520,7 @@ class executionModel extends model
->orderBy('project_asc')
->fetchPairs();
- return $teamPairs;
+ return $objectPairs;
}
/**
diff --git a/module/execution/view/create.html.php b/module/execution/view/create.html.php
index faef2a3cba..a8d70a5385 100644
--- a/module/execution/view/create.html.php
+++ b/module/execution/view/create.html.php
@@ -41,6 +41,7 @@
systemMode);?>
project->common);?>
+systemMode);?>
diff --git a/module/execution/view/edit.html.php b/module/execution/view/edit.html.php
index 5a057a030a..97ad55a0d4 100644
--- a/module/execution/view/edit.html.php
+++ b/module/execution/view/edit.html.php
@@ -187,4 +187,5 @@
execution->notAllowRemoveProducts);?>
execution->confirmSyncStories);?>
+systemMode);?>
diff --git a/module/execution/view/manageproducts.html.php b/module/execution/view/manageproducts.html.php
index fa2acb3c1c..775536c289 100644
--- a/module/execution/view/manageproducts.html.php
+++ b/module/execution/view/manageproducts.html.php
@@ -11,6 +11,7 @@
*/
?>
+systemMode);?>
execution->manageProducts;?>
diff --git a/module/my/view/story.html.php b/module/my/view/story.html.php
index 912373715c..029b2dfe62 100644
--- a/module/my/view/story.html.php
+++ b/module/my/view/story.html.php
@@ -142,11 +142,11 @@
if($canBeChanged)
{
$vars = "story={$child->id}";
- common::printIcon('story', 'change', $vars, $child, 'list', 'alter');
- common::printIcon('story', 'review', $vars, $child, 'list', 'search');
+ common::printIcon('story', 'change', $vars, $child, 'list', 'alter', '', 'iframe', true);
+ common::printIcon('story', 'review', $vars, $child, 'list', 'search', '', 'iframe', true);
common::printIcon('story', 'close', $vars, $child, 'list', '', '', 'iframe', true);
common::printIcon('story', 'edit', $vars, $child, 'list', '', '', 'iframe', true, "data-width='95%'");
- common::printIcon('story', 'createCase', "productID=$child->product&branch=$child->branch&module=0&from=¶m=0&$vars", $child, 'list', 'sitemap');
+ common::printIcon('story', 'createCase', "productID=$child->product&branch=$child->branch&module=0&from=¶m=0&$vars", $child, 'list', 'sitemap', '', 'iframe', true, "data-width='95%'");
}
?>
|
diff --git a/module/product/control.php b/module/product/control.php
index 74632d8d8b..552215e3e3 100644
--- a/module/product/control.php
+++ b/module/product/control.php
@@ -127,6 +127,7 @@ class product extends control
{
$productID = $this->app->tab != 'project' ? $this->product->saveState($productID, $this->products) : $productID;
$branch = ($this->cookie->preBranch !== '' and $branch === '') ? $this->cookie->preBranch : $branch;
+ $branchID = $branch;
/* Set menu. */
if($this->app->tab == 'product')
@@ -224,12 +225,13 @@ class product extends control
$projectProducts = $this->product->getProducts($projectID);
$productPlans = $this->execution->getPlans($projectProducts);
- if($browseType == 'bybranch') $param = $branch;
- $stories = $this->story->getExecutionStories($projectID, $productID, $branch, $sort, $browseType, $param, 'story', '', $pager);
+ if($browseType == 'bybranch') $param = $branchID;
+ $stories = $this->story->getExecutionStories($projectID, $productID, $branchID, $sort, $browseType, $param, 'story', '', $pager);
}
else
{
- $stories = $this->product->getStories($productID, $branch, $browseType, $queryID, $moduleID, $storyType, $sort, $pager);
+ $branchID = $browseType == 'bymodule' ? 'all' : $branchID;
+ $stories = $this->product->getStories($productID, $branchID, $browseType, $queryID, $moduleID, $storyType, $sort, $pager);
}
/* Process the sql, get the conditon partion, save it to session. */
@@ -293,10 +295,11 @@ class product extends control
$this->view->users = $this->user->getPairs('noletter|pofirst|nodeleted');
$this->view->orderBy = $orderBy;
$this->view->browseType = $browseType;
- $this->view->modules = $this->tree->getOptionMenu($productID, 'story', 0, $branch);
+ $this->view->modules = $this->tree->getOptionMenu($productID, 'story', 0, $branchID);
$this->view->moduleID = $moduleID;
$this->view->moduleName = ($moduleID and $moduleID !== 'all') ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
$this->view->branch = $branch;
+ $this->view->branchID = $branchID;
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
$this->view->storyStages = $this->product->batchGetStoryStage($stories);
$this->view->setModule = true;
diff --git a/module/product/model.php b/module/product/model.php
index 6c22f6da08..5b4b11f951 100644
--- a/module/product/model.php
+++ b/module/product/model.php
@@ -592,10 +592,11 @@ class productModel extends model
$product->line = $lineID;
}
- $product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->create['id'], $this->post->uid);
+ $product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->create['id'], $this->post->uid);
+ $programID = isset($product->program) ? $product->program : '';
$this->dao->insert(TABLE_PRODUCT)->data($product)->autoCheck()
->batchCheck($this->config->product->create->requiredFields, 'notempty')
- ->checkIF(!empty($product->name), 'name', 'unique', "`program` = $product->program")
+ ->checkIF((!empty($product->name) and $this->config->systemMode == 'new'), 'name', 'unique', "`program` = $programID")
->checkIF(!empty($product->code), 'code', 'unique')
->exec();
@@ -662,10 +663,11 @@ class productModel extends model
}
}
- $product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->edit['id'], $this->post->uid);
+ $product = $this->loadModel('file')->processImgURL($product, $this->config->product->editor->edit['id'], $this->post->uid);
+ $programID = isset($product->program) ? $product->program : '';
$this->dao->update(TABLE_PRODUCT)->data($product)->autoCheck()
->batchCheck($this->config->product->edit->requiredFields, 'notempty')
- ->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $product->program")
+ ->checkIF((!empty($product->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $productID and `program` = $programID")
->checkIF(!empty($product->code), 'code', 'unique', "id != $productID")
->where('id')->eq($productID)
->exec();
@@ -719,13 +721,13 @@ class productModel extends model
foreach($products as $productID => $product)
{
$oldProduct = $oldProducts[$productID];
- $programID = !isset($product->program) ? $oldProduct->program : (empty($product->program) ? 0 : $product->program);
+ if($this->config->systemMode == 'new') $programID = !isset($product->program) ? $oldProduct->program : (empty($product->program) ? 0 : $product->program);
$this->dao->update(TABLE_PRODUCT)
->data($product)
->autoCheck()
->batchCheck($this->config->product->edit->requiredFields , 'notempty')
- ->checkIF(!empty($product->name), 'name', 'unique', "id != $productID and `program` = $programID")
+ ->checkIF((!empty($product->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $productID and `program` = $programID")
->where('id')->eq($productID)
->exec();
if(dao::isError()) die(js::error('product#' . $productID . dao::getError(true)));
@@ -1932,6 +1934,10 @@ class productModel extends model
{
$link = helper::createLink('testsuite', 'browse', "productID=%s");
}
+ elseif(($module == 'testcase' and $method == 'groupCase') or ($module == 'story' and $method == 'zeroCase') and $this->app->tab == 'project')
+ {
+ $link = helper::createLink($module, $method, "productID=%s" . ($branch ? "&branch=%s" : '')) . "#app=project";
+ }
else
{
$link = helper::createLink($module, $method, "productID=%s" . ($branch ? "&branch=%s" : ''));
diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php
index 0a9b6dce0b..631aa7e937 100644
--- a/module/product/view/browse.html.php
+++ b/module/product/view/browse.html.php
@@ -401,10 +401,10 @@ $projectIDParam = $isProjectStory ? "projectID=$projectID&" : '';
echo html::a('javascript:;', $lang->product->branchName[$this->session->currentProductType], '', "id='branchItem'");
echo "
-
+ app->tab == 'project' and $browseType != 'bybranch') ? false : true;?>
+
8;?>
diff --git a/module/productplan/model.php b/module/productplan/model.php
index 10ae438b12..225f2c9116 100644
--- a/module/productplan/model.php
+++ b/module/productplan/model.php
@@ -344,14 +344,16 @@ class productplanModel extends model
* Get branch plan pairs.
*
* @param int $productID
+ * @param array $branches
* @access public
* @return array
*/
- public function getBranchPlanPairs($productID)
+ public function getBranchPlanPairs($productID, $branches = '')
{
$plans = $this->dao->select('branch,id,title,begin,end')->from(TABLE_PRODUCTPLAN)
- ->where('deleted')->eq(0)
- ->andWhere('product')->eq($productID)
+ ->where('product')->eq($productID)
+ ->andWhere('deleted')->eq(0)
+ ->beginIF(!empty($branches))->andWhere('branch')->in($branches)->fi()
->fetchAll('id');
$planPairs = array();
diff --git a/module/project/view/build.html.php b/module/project/view/build.html.php
index f1c2bf24f9..78c38c3cd6 100644
--- a/module/project/view/build.html.php
+++ b/module/project/view/build.html.php
@@ -62,7 +62,7 @@
| id"), sprintf('%03d', $build->id), '', "data-app='project'");?> |
productName;?> |
-
+ |
branchName) echo "{$build->branchName}"?>
createLink('build', 'view', "build=$build->id"), $build->name, '', "data-app='project'");?>
|
diff --git a/module/projectrelease/control.php b/module/projectrelease/control.php
index b2011200bf..d96de77174 100644
--- a/module/projectrelease/control.php
+++ b/module/projectrelease/control.php
@@ -472,14 +472,14 @@ class projectrelease extends control
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product));
$this->config->product->search['params']['module']['values'] = $this->tree->getOptionMenu($release->product, $viewType = 'story', $startModuleID = 0);
$this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $this->lang->story->statusList);
- if($this->session->currentProductType == 'normal')
+ if($release->productType == 'normal')
{
unset($this->config->product->search['fields']['branch']);
unset($this->config->product->search['params']['branch']);
}
else
{
- $this->config->product->search['fields']['branch'] = $this->lang->product->branch;
+ $this->config->product->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$release->productType]);
$branches = array('' => '') + $this->loadModel('branch')->getPairs($release->product, 'noempty');
if($release->branch) $branches = array('' => '', $release->branch => $branches[$release->branch]);
$this->config->product->search['params']['branch']['values'] = $branches;
@@ -592,14 +592,14 @@ class projectrelease extends control
$this->config->bug->search['params']['execution']['values'] = $this->loadModel('product')->getExecutionPairsByProduct($release->product, 0, 'id_desc', $release->project);
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($release->product, $branch = 0, $params = '');
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->config->bug->search['params']['openedBuild']['values'];
- if($this->session->currentProductType == 'normal')
+ if($release->productType == 'normal')
{
unset($this->config->bug->search['fields']['branch']);
unset($this->config->bug->search['params']['branch']);
}
else
{
- $this->config->bug->search['fields']['branch'] = $this->lang->product->branch;
+ $this->config->bug->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$release->productType]);
$branches = array('' => '') + $this->loadModel('branch')->getPairs($release->product, 'noempty');
if($release->branch) $branches = array('' => '', $release->branch => $branches[$release->branch]);
$this->config->bug->search['params']['branch']['values'] = $branches;
diff --git a/module/projectrelease/view/view.html.php b/module/projectrelease/view/view.html.php
index 19a2b34524..0ebf95a796 100644
--- a/module/projectrelease/view/view.html.php
+++ b/module/projectrelease/view/view.html.php
@@ -343,7 +343,7 @@
productType != 'normal'):?>
- | product->branch;?> |
+ product->branch, $lang->product->branchName[$product->type]);?> |
|
diff --git a/module/story/control.php b/module/story/control.php
index 4d21a7daf6..69fefb222f 100644
--- a/module/story/control.php
+++ b/module/story/control.php
@@ -501,6 +501,16 @@ class story extends control
$showFields = str_replace('plan', '', $showFields);
}
+ if($executionID != 0)
+ {
+ $productBranches = $product->type != 'normal' ? $this->loadModel('execution')->getBranchByProduct($productID, $executionID) : array();
+ $branches = isset($productBranches[$productID]) ? $productBranches[$productID] : array();
+ }
+ else
+ {
+ $branches = $product->type != 'normal' ? $this->loadModel('branch')->getPairs($productID, 'active') : array();
+ }
+
$this->view->customFields = $customFields;
$this->view->showFields = $showFields;
@@ -526,7 +536,7 @@ class story extends control
$this->view->spec = $spec;
$this->view->type = $type;
$this->view->branch = $branch;
- $this->view->branches = $this->loadModel('branch')->getPairs($productID, 'active');
+ $this->view->branches = $branches;
/* When the user is product owner or add story in project or not set review, the default is not to review. */
$this->view->needReview = ($this->app->user->account == $product->PO || $executionID > 0 || $this->config->story->needReview == 0) ? 0 : 1;
@@ -637,6 +647,17 @@ class story extends control
$reviewedReviewer = array();
foreach($reviewedBy as $reviewer) $reviewedReviewer[] = zget($users, $reviewer);
+ if($this->app->tab == 'project' or $this->app->tab == 'execution')
+ {
+ $objectID = $this->app->tab == 'project' ? $this->session->project : $this->session->execution;
+ $productBranches = $product->type != 'normal' ? $this->loadModel('execution')->getBranchByProduct($story->product, $objectID) : array();
+ $branches = isset($productBranches[$story->product]) ? $productBranches[$story->product] : array();
+ }
+ else
+ {
+ $branches = $product->type != 'normal' ? $this->loadModel('branch')->getPairs($product->id, 'active') : array();
+ }
+
$this->story->replaceURLang($story->type);
$this->view->title = $this->lang->story->edit . "STORY" . $this->lang->colon . $this->view->story->title;
@@ -647,7 +668,7 @@ class story extends control
$this->view->product = $product;
$this->view->plans = $this->loadModel('productplan')->getPairsForStory($story->product, $story->branch, true);
$this->view->products = $myProducts + $othersProducts;
- $this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($story->product);
+ $this->view->branches = $branches;
$this->view->reviewers = implode(',', $reviewerList);
$this->view->reviewedReviewer = $reviewedReviewer;
$this->view->isShowReviewer = $isShowReviewer;
@@ -719,53 +740,44 @@ class story extends control
/* Get edited stories. */
$stories = $this->story->getByList($storyIdList);
- /* The stories of a product. */
- if($productID)
+ $this->loadModel('branch');
+ if($productID or $executionID)
{
- $product = $this->product->getByID($productID);
- $branchProduct = $product->type == 'normal' ? false : true;
-
- /* Set branches and modules. */
- $branches = array();
- $modules = array();
- if($product->type != 'normal')
+ if(!$executionID)
{
- $branches = $this->loadModel('branch')->getPairs($productID);
- foreach($branches as $branchID => $branchName)
- {
- $modules[$productID][$branchID] = $this->tree->getOptionMenu($productID, 'story', 0, $branchID);
- }
+ $branches = $this->branch->getPairs($productID);
+ $product = $this->product->getByID($productID);
+ $branchProduct = $product->type == 'normal' ? false : true;
+ $modules = array($productID => $this->tree->getOptionMenu($productID, 'story', 0, array_keys($branches)));
+ $plans = array($productID => $this->productplan->getBranchPlanPairs($productID));
+ $products = array($productID => $product);
+ $branches = array($productID => $branches);
}
else
{
- $modules[$productID][0] = $this->tree->getOptionMenu($productID, 'story');
- }
-
- $this->view->modules = $modules;
- $this->view->branches = $branches;
- $this->view->plans = $this->productplan->getBranchPlanPairs($productID);
- $this->view->position[] = html::a($this->createLink('product', 'browse', "product=$product->id&branch=$branch"), $product->name);
- $this->view->title = $product->name . $this->lang->colon . $this->lang->story->batchEdit;
- }
- elseif($executionID)
- {
- /* The stories of a execution. */
- $execution = $this->execution->getByID($executionID);
-
- $branchProduct = false;
- $linkedProducts = $this->loadModel('product')->getProducts($executionID);
- foreach($linkedProducts as $linkedProduct)
- {
- if($linkedProduct->type != 'normal')
+ $modules = array();
+ $branches = array();
+ $execution = $this->execution->getByID($executionID);
+ $branchProduct = false;
+ $linkedProducts = $this->loadModel('product')->getProducts($executionID);
+ foreach($linkedProducts as $linkedProduct)
{
- $branchProduct = true;
- break;
+ $branchList = $this->branch->getPairs($linkedProduct->id, '', $executionID);
+ $branches[$linkedProduct->id] = $branchList;
+ $modules[$linkedProduct->id] = $this->tree->getOptionMenu($linkedProduct->id, 'story', 0, array_keys($branchList));
+ $plans[$linkedProduct->id] = $this->productplan->getBranchPlanPairs($linkedProduct->id, array_keys($branchList));
+ if(empty($plans[$linkedProduct->id])) $plans[$linkedProduct->id][0] = $plans[$linkedProduct->id];
+
+ if($linkedProduct->type != 'normal') $branchProduct = true;
}
+
+ $products = $linkedProducts;
}
- $this->view->position[] = html::a($this->createLink('execution', 'story', "execution=$execution->id"), $execution->name);
- $this->view->title = $execution->name . $this->lang->colon . $this->lang->story->batchEdit;
- $this->view->resetActive = true;
+ $this->view->title = (isset($product) ? $product->name : $execution->name) . $this->lang->colon . $this->lang->story->batchEdit;
+ $this->view->branches = $branches;
+ $this->view->modules = $modules;
+ $this->view->productName = isset($product) ? $product->name : '';
}
else
{
@@ -776,15 +788,22 @@ class story extends control
$products = $this->product->getByIdList($productIdList);
foreach($products as $storyProduct)
{
- if($storyProduct->type != 'normal')
- {
- $branchProduct = true;
- break;
- }
+ $branchList = $this->branch->getPairs($storyProduct->id);
+ $branchIdList = array_keys($branchList) ? array_keys($branchList) : 0;
+ $branches[$storyProduct->id] = $branchList;
+
+ $modules[$storyProduct->id] = $this->tree->getOptionMenu($storyProduct->id, 'story', 0, $branchIdList);
+ if($storyProduct->type == 'normal') $modules[$storyProduct->id][0] = $modules[$storyProduct->id];
+
+ $plans[$storyProduct->id] = $this->productplan->getBranchPlanPairs($storyProduct->id, array_keys($branchList));
+ if(empty($plans[$storyProduct->id])) $plans[$storyProduct->id][0] = $plans[$storyProduct->id];
+
+ if($storyProduct->type != 'normal') $branchProduct = true;
}
- $this->view->position[] = html::a($this->createLink('my', 'story'), $this->lang->my->story);
- $this->view->title = $this->lang->story->batchEdit;
+ $this->view->title = $this->lang->story->batchEdit;
+ $this->view->branches = $branches;
+ $this->view->modules = $modules;
}
/* Set ditto option for users. */
@@ -817,12 +836,13 @@ class story extends control
$this->view->reasonList = array('' => '', 'ditto' => $this->lang->story->ditto) + $this->lang->story->reasonList;
$this->view->stageList = array('' => '', 'ditto' => $this->lang->story->ditto) + $this->lang->story->stageList;
$this->view->productID = $productID;
+ $this->view->products = $products;
$this->view->branchProduct = $branchProduct;
$this->view->storyIdList = $storyIdList;
$this->view->branch = $branch;
+ $this->view->plans = array('' => '') + $plans;
$this->view->storyType = $storyType;
$this->view->stories = $stories;
- $this->view->productName = isset($product) ? $product->name : '';
$this->view->executionID = $executionID;
$this->display();
}
@@ -1680,7 +1700,7 @@ class story extends control
$this->lang->project->menu->qa['subMenu']->testcase['subModule'] = 'story';
$products = $this->product->getProducts($this->session->project, 'all', '', false);
$productID = $this->product->saveState($productID, $products);
- $this->lang->modulePageNav = $this->product->select($products, $productID, 'story', 'zeroCase');
+ $this->lang->modulePageNav = $this->product->select($products, $productID, 'story', 'zeroCase', '', $branchID);
}
else
{
diff --git a/module/story/model.php b/module/story/model.php
index 8bd0091efa..a8754ba8d6 100644
--- a/module/story/model.php
+++ b/module/story/model.php
@@ -2590,9 +2590,9 @@ class storyModel extends model
else
{
$productParam = ($type == 'byproduct' and $param) ? $param : $this->cookie->storyProductParam;
- $branchParam = $branchID = ($type == 'bybranch' and $param) ? $param : $this->cookie->storyBranchParam;
+ $branchParam = $branchID = ($type == 'bybranch' and $param !== '') ? $param : $this->cookie->storyBranchParam;
$moduleParam = ($type == 'bymodule' and $param) ? $param : $this->cookie->storyModuleParam;
- $modules = empty($moduleParam) ? array() : $this->dao->select('*')->from(TABLE_MODULE)->where('path')->like("%,$moduleParam,%")->andWhere('type')->eq('story')->andWhere('deleted')->eq(0)->fetchPairs('id', 'id');
+ $modules = (empty($moduleParam) or $type != 'bymodule') ? array() : $this->dao->select('*')->from(TABLE_MODULE)->where('path')->like("%,$moduleParam,%")->andWhere('type')->eq('story')->andWhere('deleted')->eq(0)->fetchPairs('id', 'id');
if(strpos($branchParam, ',') !== false) list($productParam, $branchParam) = explode(',', $branchParam);
$unclosedStatus = $this->lang->story->statusList;
@@ -2606,6 +2606,8 @@ class storyModel extends model
$storyIdList = $this->dao->select('story')->from(TABLE_PROJECTSTORY)->where('project')->in(array_keys($executions))->fetchPairs();
}
+ $type = ($type == 'bymodule' and $this->session->storyBrowseType) ? $this->session->storyBrowseType : $type;
+
$stories = $this->dao->select('distinct t1.*, t2.*,t3.branch as productBranch,t4.type as productType,t2.version as version')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t3')->on('t1.project = t3.project')
@@ -2615,7 +2617,7 @@ class storyModel extends model
->beginIF($excludeStories)->andWhere('t2.id')->notIN($excludeStories)->fi()
->beginIF($execution->type == 'project')
->beginIF(!empty($productID))->andWhere('t1.product')->eq($productID)
- ->beginIF($type == 'bybranch' and strpos($branchID, ',') !== false)->andWhere('t2.branch')->eq($branchParam)->fi()
+ ->beginIF($type == 'bybranch' and $branchParam !== '')->andWhere('t2.branch')->eq($branchParam)->fi()
->beginIF(strpos('changed|closed', $type) !== false)->andWhere('t2.status')->eq($type)->fi()
->beginIF($type == 'unclosed')->andWhere('t2.status')->in(array_keys($unclosedStatus))->fi()
->beginIF($type == 'linkedexecution')->andWhere('t2.id')->in($storyIdList)->fi()
diff --git a/module/story/view/batchedit.html.php b/module/story/view/batchedit.html.php
index 686e75a97a..7a3eab3f8c 100644
--- a/module/story/view/batchedit.html.php
+++ b/module/story/view/batchedit.html.php
@@ -67,33 +67,12 @@ foreach(explode(',', $showFields) as $field)
$story):?>
- product->getByID($story->product);
-
- $branches = $product->type == 'normal' ? array('' => '') : $this->loadModel('branch')->getPairs($product->id);
- if($product->type != 'normal')
- {
- foreach($branches as $branchID => $branchName) $branches[$branchID] = '/' . $product->name . '/' . $branchName;
- }
-
- if(!isset($modules[$story->product][$story->branch]))
- {
- $modules[$story->product][$story->branch] = $this->tree->getOptionMenu($story->product, 'story', 0, $story->branch);
- foreach($modules[$story->product][$story->branch] as $moduleID => $moduleName) $modules[$story->product][$story->branch][$moduleID] = '/' . $product->name . $moduleName;
- }
-
- $productPlans = $this->productplan->getPairs($story->product, $branch);
- }
- ?>
|
'>
- id;?>
- type == 'normal') ? "disabled='disabled'" : '';?>
- branch, "class='form-control chosen' onchange='loadBranches($branchProductID, this.value, $storyID);' $disabled");?>
+ product]->type == 'normal' ? "disabled='disabled'" : '';?>
+ product], $story->branch, "class='form-control chosen' onchange='loadBranches($story->product, this.value, $storyID);' $disabled");?>
|
'>
@@ -116,7 +95,7 @@ foreach(explode(',', $showFields) as $field)
}
?>
session->currentProductType == 'normal') $productPlans = array('' => '', 'ditto' => $this->lang->story->ditto) + $productPlans;?>
- plan, "class='form-control chosen'");?>
+ product][$story->branch]) ? array('' => '') + $plans[$story->product][$story->branch] : '', $story->plan, "class='form-control chosen'");?>
|
diff --git a/module/story/view/edit.html.php b/module/story/view/edit.html.php
index c6db99463f..7fba2b462d 100644
--- a/module/story/view/edit.html.php
+++ b/module/story/view/edit.html.php
@@ -87,7 +87,7 @@
|
type != 'normal'):?>
- | product->branch;?> |
+ product->branch = sprintf($lang->product->branch, $lang->product->branchName['branch']);?> |
type != 'normal') echo html::select('branch', $branches, $story->branch, "onchange='loadBranch();' class='form-control chosen control-branch'");?>
|
diff --git a/module/testcase/control.php b/module/testcase/control.php
index 157c5e8451..a609f61a80 100644
--- a/module/testcase/control.php
+++ b/module/testcase/control.php
@@ -182,7 +182,7 @@ class testcase extends control
}
else
{
- $moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createCaseLink'), array('projectID' => $projectID, 'productID' => $productID), $branch);
+ $moduleTree = $this->tree->getTreeMenu($productID, 'case', 0, array('treeModel', 'createCaseLink'), array('projectID' => $projectID, 'productID' => $productID), $projectID ? 0 : $branch);
}
$product = $this->product->getById($productID);
diff --git a/module/testcase/model.php b/module/testcase/model.php
index c8e4a53949..e4d51d810c 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -1472,7 +1472,8 @@ class testcaseModel extends model
}
else
{
- $this->config->testcase->search['fields']['branch'] = $this->lang->product->branch;
+ $productInfo = $this->loadModel('product')->getByID($productID);
+ $this->config->testcase->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$productInfo->type]);
$this->config->testcase->search['params']['branch']['values'] = array('' => '', '0' => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($productID, 'noempty') + array('all' => $this->lang->branch->all);
}
if(!$this->config->testcase->needReview) unset($this->config->testcase->search['params']['status']['values']['wait']);
diff --git a/module/testsuite/control.php b/module/testsuite/control.php
index 2fd00bc077..390877abcd 100644
--- a/module/testsuite/control.php
+++ b/module/testsuite/control.php
@@ -189,7 +189,7 @@ class testsuite extends control
$this->view->cases = $this->testsuite->getLinkedCases($suiteID, $sort, $pager);
$this->view->orderBy = $orderBy;
$this->view->pager = $pager;
- $this->view->modules = $this->loadModel('tree')->getOptionMenu($suite->product, 'case');
+ $this->view->modules = $this->loadModel('tree')->getOptionMenu($suite->product, 'case', 0, 'all');
$this->view->branches = $this->loadModel('branch')->getPairs($suite->product, 'noempty');
$this->view->canBeChanged = common::canBeChanged('testsuite', $suite);
diff --git a/module/testtask/control.php b/module/testtask/control.php
index 98b1864063..70fd5cd2d3 100644
--- a/module/testtask/control.php
+++ b/module/testtask/control.php
@@ -766,7 +766,8 @@ class testtask extends control
$productID = $productID ? $productID : key($this->products);
$projectID = $this->lang->navGroup->testtask == 'qa' ? 0 : $this->session->project;
$executions = empty($productID) ? array() : $this->product->getExecutionPairsByProduct($productID, 0, 'id_desc', $projectID);
- $builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk', true);
+ $executionID = $task->execution;
+ $builds = empty($productID) ? array() : $this->loadModel('build')->getExecutionBuildPairs($executionID, $productID, 'all', 'noempty,notrunk');
$testreports = $this->testtask->getTestReportPairsByBuild($task->build);
$this->view->task = $task;
@@ -1039,14 +1040,14 @@ class testtask extends control
$this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case');
$this->config->testcase->search['actionURL'] = inlink('linkcase', "taskID=$taskID&type=$type¶m=$param");
$this->config->testcase->search['style'] = 'simple';
- if($this->session->currentProductType == 'normal')
+ if($task->productType == 'normal')
{
unset($this->config->testcase->search['fields']['branch']);
unset($this->config->testcase->search['params']['branch']);
}
else
{
- $this->config->testcase->search['fields']['branch'] = $this->lang->product->branch;
+ $this->config->testcase->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$task->productType]);
$branches = array('' => '') + $this->loadModel('branch')->getPairs($task->product, 'noempty');
if($task->branch) $branches = array('' => '', $task->branch => $branches[$task->branch]);
$this->config->testcase->search['params']['branch']['values'] = $branches;
diff --git a/module/tree/model.php b/module/tree/model.php
index 578f344282..80cc42458b 100644
--- a/module/tree/model.php
+++ b/module/tree/model.php
@@ -118,6 +118,15 @@ class treeModel extends model
{
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getModulePairs();
+ /* If type of $branch is array, get modules of these branches. */
+ if(gettype($branch) == 'array')
+ {
+ $modules = array();
+ foreach($branch as $b) $modules[$b] = $this->getOptionMenu($rootID, $type, $startModule, $b);
+
+ return $modules;
+ }
+
if($type == 'line') $rootID = 0;
$branches = array($branch => '');
@@ -373,7 +382,8 @@ class treeModel extends model
if($type == 'line') $rootID = 0;
$this->loadModel('branch');
- $branches = array($branch => '');
+ $projectID = zget($extra, 'projectID', 0);
+ $branches = array($branch => '');
if($branch)
{
$branchName = $this->branch->getById($branch);
@@ -389,7 +399,6 @@ class treeModel extends model
}
elseif(($type == 'story' and $this->app->rawModule == 'projectstory') or ($type == 'case' and $this->app->tab == 'project'))
{
- $projectID = zget($extra, 'projectID', 0);
if($product->type != 'normal' and $projectID)
{
$projectBranches = $this->dao->select('branch')->from(TABLE_PROJECTPRODUCT)
@@ -397,6 +406,7 @@ class treeModel extends model
->andWhere('product')->eq($product->id)
->fetchPairs();
+ $branches = array();
if(isset($projectBranches[BRANCH_MAIN])) $branches = array(BRANCH_MAIN => $this->lang->branch->main);
$branches += $this->dao->select('id, name')->from(TABLE_BRANCH)
->where('id')->in($projectBranches)