Merge branch 'sprint/170_package_bug'

This commit is contained in:
王怡栋
2021-11-25 08:34:16 +08:00
25 changed files with 186 additions and 133 deletions
+20 -2
View File
@@ -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;
}
+1 -1
View File
@@ -99,7 +99,7 @@
<td class='c-actions'>
<?php
$disabled = $isMain ? 'disabled' : '';
common::printIcon('branch', 'edit', "branchID=$branch->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);
+4 -4
View File
@@ -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();
}
+2 -1
View File
@@ -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&param=active&projectID=" + projectID), function(data)
{
+20 -14
View File
@@ -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;
}
/**
+1
View File
@@ -41,6 +41,7 @@
<?php js::set('systemMode', $config->systemMode);?>
<?php js::set('projectCommon', $lang->project->common);?>
<?php js::set('multiBranchProducts', $multiBranchProducts);?>
<?php js::set('systemMode', $config->systemMode);?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
+1
View File
@@ -187,4 +187,5 @@
<?php js::set('multiBranchProducts', $multiBranchProducts);?>
<?php js::set('tip', $lang->execution->notAllowRemoveProducts);?>
<?php js::set('confirmSyncStories', $lang->execution->confirmSyncStories);?>
<?php js::set('systemMode', $config->systemMode);?>
<?php include '../../common/view/footer.html.php';?>
@@ -11,6 +11,7 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php js::set('systemMode', $config->systemMode);?>
<div id='mainMenu' class='clearfix'>
<div class='btn-toolbar pull-left'>
<span class='btn btn-link btn-active-text'><span class='text'><?php echo $lang->execution->manageProducts;?></span></span>
+3 -3
View File
@@ -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=&param=0&$vars", $child, 'list', 'sitemap');
common::printIcon('story', 'createCase', "productID=$child->product&branch=$child->branch&module=0&from=&param=0&$vars", $child, 'list', 'sitemap', '', 'iframe', true, "data-width='95%'");
}
?>
</td>
+7 -4
View File
@@ -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;
+12 -6
View File
@@ -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" : ''));
+5 -4
View File
@@ -401,10 +401,10 @@ $projectIDParam = $isProjectStory ? "projectID=$projectID&" : '';
echo html::a('javascript:;', $lang->product->branchName[$this->session->currentProductType], '', "id='branchItem'");
echo "<div class='dropdown-menu" . ($withSearch ? ' with-search':'') . "'>";
echo "<ul class='dropdown-list'>";
foreach($branches as $branchID => $branchName)
foreach($branches as $id => $branchName)
{
$actionLink = $this->createLink('story', 'batchChangeBranch', "branchID=$branchID");
echo "<li class='option' data-key='$branchID'>" . html::a('#', $branchName, '', "onclick=\"setFormAction('$actionLink', 'hiddenwin', '#productStoryForm')\"") . "</li>";
$actionLink = $this->createLink('story', 'batchChangeBranch', "branchID=$id");
echo "<li class='option' data-key='$id'>" . html::a('#', $branchName, '', "onclick=\"setFormAction('$actionLink', 'hiddenwin', '#productStoryForm')\"") . "</li>";
}
echo '</ul>';
if($withSearch) echo "<div class='menu-search'><div class='input-group input-group-sm'><input type='text' class='form-control' placeholder=''><span class='input-group-addon'><i class='icon-search'></i></span></div></div>";
@@ -437,7 +437,8 @@ $projectIDParam = $isProjectStory ? "projectID=$projectID&" : '';
</ul>
</div>
<?php if($canBatchChangeModule and $branch !== 'all'):?>
<?php $isShowModuleBTN = ($this->app->tab == 'project' and $browseType != 'bybranch') ? false : true;?>
<?php if($canBatchChangeModule and $productID and $branchID !== 'all' and $isShowModuleBTN):?>
<div class="btn-group dropup">
<button data-toggle="dropdown" type="button" class="btn"><?php echo $lang->story->moduleAB;?> <span class="caret"></span></button>
<?php $withSearch = count($modules) > 8;?>
+5 -3
View File
@@ -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();
+1 -1
View File
@@ -62,7 +62,7 @@
<tr data-id="<?php echo $productID;?>">
<td class="c-id-sm text-muted"><?php echo html::a(helper::createLink('build', 'view', "buildID=$build->id"), sprintf('%03d', $build->id), '', "data-app='project'");?></td>
<td class="c-name text-left" title='<?php echo $build->productName;?>'><?php echo $build->productName;?></td>
<td class="c-name">
<td class="c-name" title='<?php echo $build->name;?>'>
<?php if($build->branchName) echo "<span class='label label-outline label-badge'>{$build->branchName}</span>"?>
<?php echo html::a($this->createLink('build', 'view', "build=$build->id"), $build->name, '', "data-app='project'");?>
</td>
+4 -4
View File
@@ -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;
+1 -1
View File
@@ -343,7 +343,7 @@
</tr>
<?php if($release->productType != 'normal'):?>
<tr>
<th><?php echo $lang->product->branch;?></th>
<th><?php echo sprintf($lang->product->branch, $lang->product->branchName[$product->type]);?></th>
<td><?php echo $branchName;?></td>
</tr>
<?php endif;?>
+69 -49
View File
@@ -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
{
+5 -3
View File
@@ -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()
+3 -24
View File
@@ -67,33 +67,12 @@ foreach(explode(',', $showFields) as $field)
</thead>
<tbody>
<?php foreach($stories as $storyID => $story):?>
<?php
if(!$productID)
{
$product = $this->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);
}
?>
<tr>
<td><?php echo $storyID . html::hidden("storyIdList[$storyID]", $storyID);?></td>
<?php if($branchProduct):?>
<td class='text-left<?php echo zget($visibleFields, 'branch', ' hidden')?>'>
<?php $branchProductID = $productID ? $productID : $product->id;?>
<?php $disabled = (isset($product) and $product->type == 'normal') ? "disabled='disabled'" : '';?>
<?php echo html::select("branches[$storyID]", $branches, $story->branch, "class='form-control chosen' onchange='loadBranches($branchProductID, this.value, $storyID);' $disabled");?>
<?php $disabled = $products[$story->product]->type == 'normal' ? "disabled='disabled'" : '';?>
<?php echo html::select("branches[$storyID]", $branches[$story->product], $story->branch, "class='form-control chosen' onchange='loadBranches($story->product, this.value, $storyID);' $disabled");?>
</td>
<?php endif;?>
<td class='text-left<?php echo zget($visibleFields, 'module')?>'>
@@ -116,7 +95,7 @@ foreach(explode(',', $showFields) as $field)
}
?>
<?php if($this->session->currentProductType == 'normal') $productPlans = array('' => '', 'ditto' => $this->lang->story->ditto) + $productPlans;?>
<?php echo html::select("plans[$storyID]", $productPlans, $story->plan, "class='form-control chosen'");?>
<?php echo html::select("plans[$storyID]", isset($plans[$story->product][$story->branch]) ? array('' => '') + $plans[$story->product][$story->branch] : '', $story->plan, "class='form-control chosen'");?>
</td>
<td title='<?php echo $story->title?>'>
<div class="input-group">
+1 -1
View File
@@ -87,7 +87,7 @@
</tr>
<?php elseif($product->type != 'normal'):?>
<tr>
<th class='thWidth'><?php echo $lang->product->branch;?></th>
<th class='thWidth'><?php echo $lang->product->branch = sprintf($lang->product->branch, $lang->product->branchName['branch']);?></th>
<td>
<div class='input-group'><?php if($product->type != 'normal') echo html::select('branch', $branches, $story->branch, "onchange='loadBranch();' class='form-control chosen control-branch'");?></div>
</td>
+1 -1
View File
@@ -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);
+2 -1
View File
@@ -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']);
+1 -1
View File
@@ -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);
+4 -3
View File
@@ -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&param=$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;
+12 -2
View File
@@ -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)