Merge branch 'zentaopms_239'

This commit is contained in:
wangyidong
2022-11-08 08:41:28 +08:00
458 changed files with 9419 additions and 4940 deletions
+1 -1
View File
@@ -88,7 +88,7 @@ $config->testcase->datatable->fieldList['id']['required'] = 'yes';
$config->testcase->datatable->fieldList['product']['title'] = 'priAB';
$config->testcase->datatable->fieldList['product']['control'] = 'hidden';
$config->testcase->datatable->fieldList['product']['dataSource'] = array('module' => 'port', 'method' => 'getRelatedObjects', 'params' => 'testcase&product&id,name');
$config->testcase->datatable->fieldList['product']['dataSource'] = array('module' => 'product', 'method' => 'getPairs', 'params' => '&0&&all');
$config->testcase->datatable->fieldList['module']['title'] = 'module';
$config->testcase->datatable->fieldList['module']['control'] = 'select';
+39 -11
View File
@@ -60,13 +60,13 @@ class testcase extends control
else
{
$mode = ($this->app->methodName == 'create' and empty($this->config->CRProduct)) ? 'noclosed' : '';
$products = $this->product->getPairs($mode);
$products = $this->product->getPairs($mode, 0, '', 'all');
}
if(empty($products) and !helper::isAjaxRequest()) return print($this->locate($this->createLink('product', 'showErrorNone', "moduleName=$tab&activeMenu=testcase&objectID=$objectID")));
}
else
{
$products = $this->product->getPairs();
$products = $this->product->getPairs('', 0, '', 'all');
}
$this->view->products = $this->products = $products;
}
@@ -118,6 +118,8 @@ class testcase extends control
$linkedProducts = $this->product->getProducts($projectID, 'all', '', false);
$this->products = count($linkedProducts) > 1 ? array('0' => $this->lang->product->all) + $linkedProducts : $linkedProducts;
$productID = count($linkedProducts) > 1 ? $productID : key($linkedProducts);
$hasProduct = $this->dao->findById($projectID)->from(TABLE_PROJECT)->fetch('hasProduct');
if(!$hasProduct) unset($this->config->testcase->search['fields']['product']);
$this->loadModel('project')->setMenu($projectID);
}
@@ -163,7 +165,8 @@ class testcase extends control
$actionURL = $this->createLink($currentModule, $currentMethod, $projectParam . "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID");
$this->config->testcase->search['onMenuBar'] = 'yes';
$this->testcase->buildSearchForm($productID, $this->products, $queryID, $actionURL, $projectID);
$searchProducts = $this->product->getPairs('', 0, '', 'all');
$this->testcase->buildSearchForm($productID, $searchProducts, $queryID, $actionURL, $projectID);
$showModule = !empty($this->config->datatable->testcaseBrowse->showModule) ? $this->config->datatable->testcaseBrowse->showModule : '';
@@ -406,6 +409,7 @@ class testcase extends control
$this->loadModel('action');
$this->action->create('case', $caseID, 'Opened');
if($this->testcase->getStatus('create') == 'wait') $this->action->create('case', $caseID, 'submitReview');
/* If the story is linked project, make the case link the project. */
$this->testcase->syncCase2Project($caseResult['caseInfo'], $caseID);
@@ -571,6 +575,7 @@ class testcase extends control
$this->view->precondition = $precondition;
$this->view->keywords = $keywords;
$this->view->steps = $steps;
$this->view->hiddenProduct = !empty($product->shadow);
$this->view->users = $this->user->getPairs('noletter|noclosed|nodeleted');
$this->view->branch = $branch;
$this->view->product = $product;
@@ -857,6 +862,9 @@ class testcase extends control
{
$this->loadModel('story');
$case = $this->testcase->getById($caseID);
if(!$case) return print(js::error($this->lang->notFound) . js::locate('back'));
$testtasks = $this->loadModel('testtask')->getGroupByCases($caseID);
$testtasks = empty($testtasks[$caseID]) ? array() : $testtasks[$caseID];
@@ -874,6 +882,8 @@ class testcase extends control
$action = !empty($changes) ? 'Edited' : 'Commented';
$actionID = $this->action->create('case', $caseID, $action, $this->post->comment);
$this->action->logHistory($actionID, $changes);
if($case->status != 'wait' and $this->post->status == 'wait') $this->action->create('case', $caseID, 'submitReview');
}
$this->executeHooks($caseID);
@@ -888,8 +898,6 @@ class testcase extends control
}
}
$case = $this->testcase->getById($caseID);
if(!$case) return print(js::error($this->lang->notFound) . js::locate('back'));
if($case->auto == 'unit')
{
$this->lang->testcase->subMenu->testcase->feature['alias'] = '';
@@ -1392,6 +1400,8 @@ class testcase extends control
$objectID = 0;
if($this->app->tab == 'project') $objectID = $case->project;
if($this->app->tab == 'execution') $objectID = $case->execution;
unset($this->config->testcase->search['fields']['product']);
$this->testcase->buildSearchForm($case->product, $this->products, $queryID, $actionURL, $objectID);
/* Get cases to link. */
@@ -1405,7 +1415,7 @@ class testcase extends control
/* Assign. */
$this->view->title = $case->title . $this->lang->colon . $this->lang->testcase->linkCases;
$this->view->position[] = html::a($this->createLink('product', 'view', "productID=$case->product"), $this->products[$case->product]);
$this->view->position[] = html::a($this->createLink('product', 'view', "productID=$case->product"), zget($this->products, $case->product, ''));
$this->view->position[] = html::a($this->createLink('testcase', 'view', "caseID=$caseID"), $case->title);
$this->view->position[] = $this->lang->testcase->linkCases;
$this->view->case = $case;
@@ -1441,6 +1451,15 @@ class testcase extends control
$objectID = 0;
if($this->app->tab == 'project') $objectID = $case->project;
if($this->app->tab == 'execution') $objectID = $case->execution;
/* Unset search field 'plan' in single project. */
unset($this->config->bug->search['fields']['product']);
if($case->project and ($this->app->tab == 'project' or $this->app->tab == 'execution'))
{
$project = $this->loadModel('project')->getById($case->project);
if(!$project->hasProduct and $project->model == 'waterfall') unset($this->config->bug->search['fields']['plan']);
}
$this->bug->buildSearchForm($case->product, $this->products, $queryID, $actionURL, $objectID);
/* Get cases to link. */
@@ -1601,8 +1620,19 @@ class testcase extends control
$orderBy = '`' . $field . '`_' . $sort;
}
$product = $this->loadModel('product')->getById($productID);
if($product->type != 'normal') $this->lang->testcase->branch = $this->lang->product->branchName[$product->type];
$product = $this->loadModel('product')->getById($productID);
$products = $this->loadModel('product')->getPairs('', 0, '', 'all');
if($product->type != 'normal')
{
$this->lang->testcase->branch = $this->lang->product->branchName[$product->type];
}
else
{
$this->config->testcase->exportFields = str_replace('branch,', '', $this->config->testcase->exportFields);
}
if($product->shadow) $this->config->testcase->exportFields = str_replace('product,', '', $this->config->testcase->exportFields);
if($_POST)
{
$this->loadModel('file');
@@ -1664,7 +1694,6 @@ class testcase extends control
/* Get users, products and projects. */
$users = $this->loadModel('user')->getPairs('noletter');
$products = $this->loadModel('product')->getPairs();
$branches = $this->loadModel('branch')->getPairs($productID);
/* Get related objects id lists. */
@@ -1804,12 +1833,11 @@ class testcase extends control
}
$fileName = $this->lang->testcase->common;
$productName = $this->dao->findById($productID)->from(TABLE_PRODUCT)->fetch('name');
$browseType = isset($this->lang->testcase->featureBar['browse'][$browseType]) ? $this->lang->testcase->featureBar['browse'][$browseType] : '';
if($taskID) $taskName = $this->dao->findById($taskID)->from(TABLE_TESTTASK)->fetch('name');
$this->view->fileName = $productName . $this->lang->dash . ($taskID ? $taskName . $this->lang->dash : '') . $browseType . $fileName;
$this->view->fileName = zget($products, $productID, '') . $this->lang->dash . ($taskID ? $taskName . $this->lang->dash : '') . $browseType . $fileName;
$this->view->allExportFields = $this->config->testcase->exportFields;
$this->view->customExport = true;
$this->display();
+1 -1
View File
@@ -1,2 +1,2 @@
.thWidth {width: 86px !important;}
.thWidth {width: 94px !important;}
.lifeThWidth {width: 70px !important;}
+27 -14
View File
@@ -58,7 +58,7 @@ class testcaseModel extends model
->add('fromBug', $bugID)
->setDefault('openedBy', $this->app->user->account)
->setDefault('openedDate', $now)
->setIF($this->config->systemMode == 'new' and $this->app->tab == 'project', 'project', $this->session->project)
->setIF($this->app->tab == 'project', 'project', $this->session->project)
->setIF($this->app->tab == 'execution', 'execution', $this->session->execution)
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion((int)$this->post->story))
->remove('steps,expects,files,labels,stepType,forceNotReview')
@@ -163,7 +163,7 @@ class testcaseModel extends model
$data[$i] = new stdclass();
$data[$i]->product = $productID;
if($this->config->systemMode == 'new' && $this->app->tab == 'project') $data[$i]->project = $this->session->project;
if($this->app->tab == 'project') $data[$i]->project = $this->session->project;
$data[$i]->branch = $cases->branch[$i];
$data[$i]->module = $cases->module[$i];
$data[$i]->type = $cases->type[$i];
@@ -1326,10 +1326,12 @@ class testcaseModel extends model
*/
public static function isClickable($case, $action, $module = 'testcase')
{
global $config;
$action = strtolower($action);
if($module == 'testcase' && $action == 'createbug') return $case->caseFails > 0;
if($module == 'testcase' && $action == 'review') return isset($case->caseStatus) ? $case->caseStatus == 'wait' : $case->status == 'wait';
if($module == 'testcase' && $action == 'createbug') return $case->caseFails > 0;
if($module == 'testcase' && $action == 'review') return isset($case->caseStatus) ? $case->caseStatus == 'wait' : $case->status == 'wait';
return true;
}
@@ -1549,7 +1551,7 @@ class testcaseModel extends model
}
else
{
if($this->config->systemMode == 'new' && $this->app->tab == 'project') $caseData->project = $this->session->project;
if($this->app->tab == 'project') $caseData->project = $this->session->project;
$caseData->version = 1;
$caseData->openedBy = $this->app->user->account;
$caseData->openedDate = $now;
@@ -1920,14 +1922,23 @@ class testcaseModel extends model
*/
public function buildSearchForm($productID, $products, $queryID, $actionURL, $projectID = 0)
{
$product = ($this->app->tab == 'project' and empty($productID)) ? $products : array($productID => $products[$productID]) + array('all' => $this->lang->testcase->allProduct);
$this->config->testcase->search['params']['product']['values'] = $product;
$productList = array();
if($this->app->tab == 'project' and empty($productID))
{
$productList = $products;
}
else
{
$productList = array('all' => $this->lang->all);
if(isset($products[$productID])) $productList = array($productID => $products[$productID]) + $productList;
}
$this->config->testcase->search['params']['product']['values'] = array('') + $productList;
$module = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0);
if(!$productID)
{
$module = array();
foreach($products as $id => $product) $module += $this->loadModel('tree')->getOptionMenu($id, 'case', 0);
foreach($products as $id => $name) $module += $this->loadModel('tree')->getOptionMenu($id, 'case', 0);
}
$this->config->testcase->search['params']['module']['values'] = $module;
@@ -1940,8 +1951,9 @@ class testcaseModel extends model
}
else
{
$productInfo = $this->loadModel('product')->getByID($productID);
$this->config->testcase->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$productInfo->type]);
$this->app->loadLang('branch');
$product = $this->loadModel('product')->getByID($productID);
$this->config->testcase->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
$this->config->testcase->search['params']['branch']['values'] = array('' => '', '0' => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($productID, '', $projectID) + array('all' => $this->lang->branch->all);
}
if(!$this->config->testcase->needReview) unset($this->config->testcase->search['params']['status']['values']['wait']);
@@ -2257,9 +2269,10 @@ class testcaseModel extends model
$data->order = ++ $lastOrder;
$this->dao->insert(TABLE_PROJECTCASE)->data($data)->exec();
$objectType = $objectInfo[$projectID]->type;
$object = $objectInfo[$projectID];
$objectType = $object->type;
if($objectType == 'project') $this->action->create('case', $caseID, 'linked2project', '', $projectID);
if(in_array($objectType, array('sprint', 'stage'))) $this->action->create('case', $caseID, 'linked2execution', '', $projectID);
if(in_array($objectType, array('sprint', 'stage')) and $object->multiple) $this->action->create('case', $caseID, 'linked2execution', '', $projectID);
}
}
@@ -2454,7 +2467,7 @@ class testcaseModel extends model
}
if($this->config->testcase->needReview || !empty($this->config->testcase->forceReview))
{
$menu .= $this->buildMenu('testcase', 'review', $params, $case, 'view', '', '', 'iframe', '', '', $this->lang->testcase->reviewAB);
$menu .= $this->buildMenu('testcase', 'review', $params, $case, 'view', '', '', 'showinonlybody iframe', '', '', $this->lang->testcase->reviewAB);
}
}
else
@@ -2520,7 +2533,7 @@ class testcaseModel extends model
if($this->config->testcase->needReview || !empty($this->config->testcase->forceReview))
{
common::printIcon('testcase', 'review', $params, $case, 'browse', 'glasses', '', 'iframe');
common::printIcon('testcase', 'review', $params, $case, 'browse', 'glasses', '', 'showinonlybody iframe');
}
$menu .= $this->buildMenu('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=", $case, 'browse', 'bug', '', 'iframe', '', "data-width='90%'");
$menu .= $this->buildMenu('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase&param=$case->id", $case, 'browse', 'copy');
+1 -1
View File
@@ -182,7 +182,7 @@ js::set('suiteID', $suiteID);
?>
</ul>
</div>
<?php if(common::hasPriv('testcase', 'batchChangeBranch') and $this->session->currentProductType != 'normal'):?>
<?php if(common::hasPriv('testcase', 'batchChangeBranch') and $this->session->currentProductType and $this->session->currentProductType != 'normal'):?>
<div class="btn-group dropup">
<button data-toggle="dropdown" type="button" class="btn"><?php echo $lang->product->branchName[$this->session->currentProductType];?> <span class="caret"></span></button>
<?php $withSearch = count($branchTagOption) > 6;?>
+4 -4
View File
@@ -1,8 +1,8 @@
<?php js::set('flow', $config->global->flow);?>
<?php $isProjectApp = $this->app->tab == 'project'?>
<?php $currentModule = $isProjectApp ? 'project' : 'testcase';?>
<?php $currentMethod = $isProjectApp ? 'testcase' : 'browse';?>
<?php $projectParam = $isProjectApp ? "projectID={$this->session->project}&" : '';?>
<?php $isProjectApp = $this->app->tab == 'project'?>
<?php $currentModule = $isProjectApp ? 'project' : 'testcase';?>
<?php $currentMethod = $isProjectApp ? 'testcase' : 'browse';?>
<?php $projectParam = $isProjectApp ? "projectID={$this->session->project}&" : '';?>
<?php if(common::checkNotCN()):?>
<style> .btn-toolbar>.btn {margin-right: 3px !important;}</style>
<?php endif;?>
+5 -3
View File
@@ -42,16 +42,18 @@ foreach(explode(',', $config->testcase->create->requiredFields) as $field)
<table class='table table-form'>
<tbody>
<tr>
<th><?php echo $lang->testcase->product;?></th>
<td>
<th><?php echo $hiddenProduct ? $lang->testcase->module : $lang->testcase->product;?></th>
<td class='<?php if($hiddenProduct) echo 'hidden';?>'>
<div class='input-group'>
<?php echo html::select('product', $products, $productID, "onchange='loadAll(this.value);' class='form-control chosen'");?>
<?php if(isset($product->type) and $product->type != 'normal') echo html::select('branch', $branches, $branch, "onchange='loadBranch();' class='form-control' style='width:120px'");?>
</div>
</td>
<td style='padding-left:15px;'>
<td style='<?php if(!$hiddenProduct) echo 'padding-left:15px;';?>'>
<div class='input-group' id='moduleIdBox'>
<?php if(!$hiddenProduct):?>
<span class="input-group-addon w-80px"><?php echo $lang->testcase->module?></span>
<?php endif;?>
<?php
echo html::select('module', $moduleOptionMenu, $currentModuleID, "onchange='loadModuleRelated();' class='form-control chosen'");
if(count($moduleOptionMenu) == 1)
+2 -2
View File
@@ -175,7 +175,7 @@
</td>
</tr>
<?php else:?>
<tr>
<tr class="<?php if($product->shadow) echo 'hidden';?>">
<th><?php echo $lang->testcase->product;?></th>
<td>
<div class='input-group'>
@@ -185,7 +185,7 @@
</td>
</tr>
<tr>
<th><?php echo $lang->testcase->module;?></th>
<th class='w-100px'><?php echo $lang->testcase->module;?></th>
<td>
<div class='input-group' id='moduleIdBox'>
<?php
-2
View File
@@ -33,7 +33,6 @@
<?php echo $lang->idAB;?>
</th>
<th class='c-pri' title=<?php echo $lang->pri;?>><?php echo $lang->priAB;?></th>
<th><?php echo $lang->bug->product;?></th>
<th><?php echo $lang->bug->title;?></th>
<th class='c-type'><?php echo $lang->bug->type;?></th>
<th class='c-user'><?php echo $lang->openedByAB;?></th>
@@ -52,7 +51,6 @@
<?php printf('%03d', $bug2Link->id);?>
</td>
<td><span class='<?php echo 'pri' . zget($lang->bug->priList, $bug2Link->pri, $bug2Link->pri)?>'><?php echo zget($lang->bug->priList, $bug2Link->pri, $bug2Link->pri)?></span></td>
<td class='c-name'><?php echo html::a($this->createLink('product', 'browse', "productID={$bug2Link->product}&branch={$bug2Link->branch}"), $products[$bug2Link->product], '_blank');?></td>
<td class='c-name' title='<?php echo $bug2Link->title;?>'><?php echo html::a($this->createLink('bug', 'view', "bugID=$bug2Link->id"), $bug2Link->title, '_blank');?></td>
<td><?php echo zget($lang->bug->typeList, $bug2Link->type);?></td>
<td><?php echo zget($users, $bug2Link->openedBy);?></td>
-2
View File
@@ -33,7 +33,6 @@
<?php echo $lang->idAB;?>
</th>
<th class='c-pri' title=<?php echo $lang->pri;?>><?php echo $lang->priAB;?></th>
<th><?php echo $lang->testcase->product;?></th>
<th><?php echo $lang->testcase->title;?></th>
<th class='c-type'><?php echo $lang->testcase->type;?></th>
<th class='c-user'><?php echo $lang->openedByAB;?></th>
@@ -52,7 +51,6 @@
<?php printf('%03d', $case2Link->id);?>
</td>
<td><span class='<?php echo 'pri' . zget($lang->testcase->priList, $case2Link->pri, $case2Link->pri)?>'><?php echo zget($lang->testcase->priList, $case2Link->pri, $case2Link->pri)?></span></td>
<td class='c-name'><?php echo html::a($this->createLink('product', 'browse', "productID={$case2Link->product}&branch={$case2Link->branch}"), $products[$case2Link->product], '_blank');?></td>
<td class='c-name' title='<?php echo $case2Link->title;?>'><?php echo html::a($this->createLink('testcase', 'view', "caseID=$case2Link->id"), $case2Link->title, '_blank');?></td>
<td><?php echo $lang->testcase->typeList[$case2Link->type];?></td>
<td><?php echo zget($users, $case2Link->openedBy);?></td>
+3 -3
View File
@@ -146,7 +146,7 @@
<td><?php echo common::hasPriv('caselib', 'browse') ? html::a($this->createLink('caselib', 'browse', "libID=$case->lib"), $libName) : $libName;?></td>
</tr>
<?php else:?>
<tr>
<tr class='<?php if($product->shadow) echo 'hide';?>'>
<th class='thWidth'><?php echo $lang->testcase->product;?></th>
<td><?php echo (common::hasPriv('product', 'browse') and $productName) ? html::a($this->createLink('product', 'browse', "productID=$case->product"), $productName) : $productName;?></td>
</tr>
@@ -158,7 +158,7 @@
<?php endif;?>
<?php endif;?>
<tr>
<th><?php echo $lang->testcase->module;?></th>
<th class='thWidth'><?php echo $lang->testcase->module;?></th>
<td>
<?php
if(empty($modulePath))
@@ -261,7 +261,7 @@
{
echo "(<span class='warning' title={$lang->testcase->fromCaselib}>{$lang->testcase->changed}</span> ";
if(common::hasPriv('testcase', 'confirmLibcaseChange')) echo html::a($this->createLink('testcase', 'confirmLibcaseChange', "caseID=$case->id&libcaseID=$case->fromCaseID"), $lang->testcase->sync, 'hiddenwin', "class='btn btn-mini btn-info'");
if(common::hasPriv('testcase', 'ignoreLibcaseChange')) echo html::a($this->createLink('testcase', 'ignoreLibcaseChange', "caseID=$case->id"), $lang->testcase->ignore, 'hiddenwin', "class='btn btn-mini btn-info'");
if(common::hasPriv('testcase', 'ignoreLibcaseChange')) echo html::a($this->createLink('testcase', 'ignoreLibcaseChange', "caseID=$case->id"), $lang->testcase->ignore, 'hiddenwin', "class='btn btn-mini btn-info'");
echo ")";
}
?>