Merge branch '15.0.beta3' of http://gitlab.zcorp.cc/easycorp/zentaopms into 15.0.beta3

This commit is contained in:
zhujinyong
2021-03-17 13:36:06 +08:00
7 changed files with 111 additions and 48 deletions
+41 -3
View File
@@ -37,15 +37,25 @@
<?php
$vars = "mode=$mode&type=$type&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID";
$this->app->loadLang('testtask');
$canBatchRun = common::hasPriv('testtask', 'batchRun');
$canBatchEdit = common::hasPriv('testcase', 'batchEdit');
$canBatchRun = (common::hasPriv('testtask', 'batchRun') and $type == 'assigntome');
$canBatchEdit = (common::hasPriv('testcase', 'batchEdit') and $type == 'assigntome');
$canBatchAction = ($canBatchRun or $canBatchEdit);
?>
<thead>
<tr>
<th class='w-50px'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class="<?php echo $canBatchAction ? 'w-100px' : 'w-50px';?>">
<?php if($canBatchAction):?>
<div class="checkbox-primary check-all" title="<?php echo $lang->selectAll?>">
<label></label>
</div>
<?php endif;?>
<?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?>
</th>
<th class='w-50px'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th> <?php common::printOrderLink('title', $orderBy, $vars, $lang->testcase->title);?></th>
<?php if($type == 'assigntome'):?>
<th class='w-100px'> <?php common::printOrderLink('task', $orderBy, $vars, $lang->testtask->common);?></th>
<?php endif;?>
<th class='w-type'> <?php common::printOrderLink('type', $orderBy, $vars, $lang->typeAB);?></th>
<th class='c-user'> <?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
<th class='w-80px'> <?php common::printOrderLink('lastRunner', $orderBy, $vars, $lang->testtask->lastRunAccount);?></th>
@@ -64,12 +74,21 @@
?>
<tr>
<td class="c-id">
<?php if($canBatchAction):?>
<div class="checkbox-primary">
<input type='checkbox' name='caseIDList[]' value='<?php echo $case->id;?>' <?php if(!$canBeChanged) echo 'disabled';?> />
<label></label>
</div>
<?php endif;?>
<?php echo sprintf('%03d', $case->id); ?>
</td>
<td><span class='label-pri <?php echo 'label-pri-' . $case->pri?>' title='<?php echo zget($lang->testcase->priList, $case->pri, $case->pri);?>'><?php echo zget($lang->testcase->priList, $case->pri, $case->pri)?></span></td>
<?php $params = "testcaseID=$caseID&version=$case->version";?>
<?php if($type == 'assigntome') $params .= "&from=testtask&taskID=$case->task";?>
<td class='text-left'><?php echo html::a($this->createLink('testcase', 'view', $params, '', '', $case->project), $case->title, null, "style='color: $case->color' data-group='project'");?></td>
<?php if($type == 'assigntome'):?>
<td><?php echo $case->taskName;?></td>
<?php endif;?>
<td><?php echo zget($lang->testcase->typeList, $case->type);?></td>
<td><?php echo zget($users, $case->openedBy);?></td>
<td><?php echo zget($users, $case->lastRunner);?></td>
@@ -93,6 +112,25 @@
</tbody>
</table>
<div class="table-footer">
<?php if($canBatchAction):?>
<div class="checkbox-primary check-all"><label><?php echo $lang->selectAll?></label></div>
<?php endif;?>
<div class="table-actions btn-toolbar">
<?php
if($canBatchEdit)
{
$actionLink = $this->createLink('testcase', 'batchEdit');
$misc = "data-form-action='$actionLink'";
echo html::commonButton($lang->edit, $misc);
}
if($canBatchRun)
{
$actionLink = $this->createLink('testtask', 'batchRun', 'productID=0');
$misc = "data-form-action='$actionLink'";
echo html::commonButton($lang->testtask->runCase, $misc);
}
?>
</div>
<?php $pager->show('right', 'pagerjs');?>
</div>
</form>
+12 -5
View File
@@ -48,8 +48,8 @@ class testcase extends control
foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
//$this->lang->noMenuModule[] = $this->app->rawModule;
}
else
{
else
{
$this->lang->testcase->menu = $this->lang->projectQa->menu;
$this->lang->testcase->subMenu = $this->lang->projectQa->subMenu;
}
@@ -746,14 +746,14 @@ class testcase extends control
$caseIDList = $this->post->caseIDList ? $this->post->caseIDList : die(js::locate($this->session->caseList));
$caseIDList = array_unique($caseIDList);
/* Get the edited cases. */
$cases = $this->testcase->getByList($caseIDList);
$branchProduct = false;
/* The cases of a product. */
if($productID)
{
/* Get the edited cases. */
$cases = $this->testcase->getByList($caseIDList);
if($type == 'lib')
{
$libID = $productID;
@@ -789,6 +789,13 @@ class testcase extends control
/* The cases of my. */
else
{
/* Get the edited cases. */
$cases = $this->dao->select('t1.*,t2.id as runID')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_TESTRUN)->alias('t2')->on('t1.id = t2.case')
->where('t2.id')->in($caseIDList)
->fetchAll('id');
$caseIDList = array_keys($cases);
$this->lang->testcase->menu = $this->lang->my->menu;
$this->lang->set('menugroup.testcase', 'my');
$this->lang->testcase->menuOrder = $this->lang->my->menuOrder;
+1 -1
View File
@@ -530,7 +530,7 @@ class testcaseModel extends model
*/
public function getByAssignedTo($account, $orderBy = 'id_desc', $pager = null, $auto = 'no')
{
return $this->dao->select('t1.*,t2.project,t2.pri,t2.title,t2.type,t2.openedBy,t2.color,t2.product,t2.branch,t2.module,t2.status')->from(TABLE_TESTRUN)->alias('t1')
return $this->dao->select('t1.*,t2.project,t2.pri,t2.title,t2.type,t2.openedBy,t2.color,t2.product,t2.branch,t2.module,t2.status,t3.name as taskName')->from(TABLE_TESTRUN)->alias('t1')
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
->leftJoin(TABLE_TESTTASK)->alias('t3')->on('t1.task = t3.id')
->where('t1.assignedTo')->eq($account)
+1 -2
View File
@@ -67,7 +67,7 @@
<?php foreach($caseIDList as $caseID):?>
<?php
if(!isset($cases[$caseID])) continue;
if(!$productID and $branchProduct)
if(!$productID)
{
$product = $this->product->getByID($cases[$caseID]->product);
@@ -79,7 +79,6 @@
}
$modules = $this->tree->getOptionMenu($cases[$caseID]->product, $viewType = 'case', 0, $cases[$caseID]->branch);
$modules = array('ditto' => $this->lang->story->ditto) + $modules;
}
?>
<tr class='text-center'>
+33 -24
View File
@@ -44,8 +44,8 @@ class testtask extends control
$this->app->loadConfig('qa');
foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
}
else
{
else
{
$this->lang->testtask->menu = $this->lang->projectQa->menu;
$this->lang->testtask->subMenu = $this->lang->projectQa->subMenu;
}
@@ -448,24 +448,24 @@ class testtask extends control
$this->view->position[] = $this->lang->testtask->common;
$this->view->position[] = $this->lang->testtask->cases;
$this->view->productID = $productID;
$this->view->productName = $this->products[$productID];
$this->view->task = $task;
$this->view->runs = $runs;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|qafirst|noletter');
$this->view->assignedToList= $assignedToList;
$this->view->moduleTree = $this->loadModel('tree')->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createTestTaskLink'), $extra = $taskID);
$this->view->browseType = $browseType;
$this->view->param = $param;
$this->view->orderBy = $orderBy;
$this->view->taskID = $taskID;
$this->view->moduleID = $moduleID;
$this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
$this->view->treeClass = $browseType == 'bymodule' ? '' : 'hidden';
$this->view->pager = $pager;
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
$this->view->setModule = false;
$this->view->canBeChanged = $canBeChanged;
$this->view->productID = $productID;
$this->view->productName = $this->products[$productID];
$this->view->task = $task;
$this->view->runs = $runs;
$this->view->users = $this->loadModel('user')->getPairs('noclosed|qafirst|noletter');
$this->view->assignedToList = $assignedToList;
$this->view->moduleTree = $this->loadModel('tree')->getTreeMenu($productID, $viewType = 'case', $startModuleID = 0, array('treeModel', 'createTestTaskLink'), $extra = $taskID);
$this->view->browseType = $browseType;
$this->view->param = $param;
$this->view->orderBy = $orderBy;
$this->view->taskID = $taskID;
$this->view->moduleID = $moduleID;
$this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
$this->view->treeClass = $browseType == 'bymodule' ? '' : 'hidden';
$this->view->pager = $pager;
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
$this->view->setModule = false;
$this->view->canBeChanged = $canBeChanged;
$this->display();
}
@@ -1077,11 +1077,14 @@ class testtask extends control
$caseIDList = $this->post->caseIDList ? $this->post->caseIDList : die(js::locate($url, 'parent'));
$caseIDList = array_unique($caseIDList);
/* The case of tasks of qa. */
if($productID)
{
$this->testtask->setMenu($this->products, $productID, $taskID);
$this->view->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0);
$this->view->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($productID, 'case');
$cases = $this->dao->select('*')->from(TABLE_CASE)->where('id')->in($caseIDList)->fetchAll('id');
}
/* The case of my. */
else
@@ -1091,9 +1094,15 @@ class testtask extends control
$this->lang->testtask->menuOrder = $this->lang->my->menuOrder;
$this->loadModel('my')->setMenu();
$this->view->title = $this->lang->testtask->batchRun;
}
$cases = $this->dao->select('*')->from(TABLE_CASE)->where('id')->in($caseIDList)->fetchAll('id');
$cases = $this->dao->select('t1.*,t2.id as runID')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_TESTRUN)->alias('t2')->on('t1.id = t2.case')
->where('t2.id')->in($caseIDList)
->fetchAll('runID');
$caseIDList = array();
foreach($cases as $case) $caseIDList[] = $case->id;
}
/* If case has changed and not confirmed, remove it. */
if($from == 'testtask')
@@ -1111,7 +1120,7 @@ class testtask extends control
$this->view->cases = $cases;
$this->view->steps = $this->dao->select('t1.*')->from(TABLE_CASESTEP)->alias('t1')
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id')
->where('t2.id')->in(array_keys($cases))
->where('t2.id')->in($caseIDList)
->andWhere('t1.version=t2.version')
->andWhere('t2.status')->ne('wait')
->fetchGroup('case', 'id');
+8 -4
View File
@@ -1272,7 +1272,7 @@ class testtaskModel extends model
{
$runs = array();
$postData = fixer::input('post')->get();
$caseIdList = array_keys($postData->results);
$caseIdList = isset($postData->caseIDList) ? array_keys($postData->caseIDList) : array_keys($postData->results);
if($runCaseType == 'testtask')
{
$runs = $this->dao->select('id, `case`')->from(TABLE_TESTRUN)
@@ -1291,7 +1291,8 @@ class testtaskModel extends model
$now = helper::now();
foreach($postData->results as $caseID => $result)
{
$runID = isset($runs[$caseID]) ? $runs[$caseID] : 0;
$runID = isset($runs[$caseID]) ? $runs[$caseID] : (isset($postData->caseIDList) ? $caseID : 0);
$version = $postData->version[$caseID];
$dbSteps = isset($stepGroups[$caseID]) ? $stepGroups[$caseID] : array();
$postSteps = isset($postData->steps[$caseID]) ? $postData->steps[$caseID] : array();
$postReals = $postData->reals[$caseID];
@@ -1313,13 +1314,16 @@ class testtaskModel extends model
$step = array();
$step['result'] = $caseResult;
$step['real'] = $caseResult == 'pass' ? '' : $postReals[0];
$stepResults[] = $step;
$stepResults[] = $step;
}
/* Replace caseID if caseID is runID. */
if(isset($postData->caseIDList[$caseID])) $caseID = $postData->caseIDList[$caseID];
$result = new stdClass();
$result->run = $runID;
$result->case = $caseID;
$result->version = $postData->version[$caseID];
$result->version = $version;
$result->caseResult = $caseResult;
$result->stepResults = serialize($stepResults);
$result->lastRunner = $this->app->user->account;
+15 -9
View File
@@ -20,7 +20,7 @@
<table class='table table-fixed table-form table-bordered'>
<thead>
<tr>
<th class='w-id'> <?php echo $lang->idAB;?></th>
<th class='w-id'> <?php echo $lang->idAB;?></th>
<th class='w-100px'><?php echo $lang->testcase->module;?></th>
<th class='w-200px'><?php echo $lang->testcase->title;?></th>
<th class='precondition w-90px'><?php echo $lang->testcase->precondition;?></th>
@@ -28,14 +28,20 @@
<th><?php echo $lang->testcase->stepDesc . '/' . $lang->testcase->stepExpect?></th>
</tr>
</thead>
<?php foreach($caseIDList as $caseID):?>
<?php if($cases[$caseID]->status == 'wait') continue;?>
<?php if(!$productID) $moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($cases[$caseID]->product, $viewType = 'case', $startModuleID = 0);?>
<?php foreach($cases as $caseID => $case):?>
<?php if($case->status == 'wait') continue;?>
<?php
if(!$productID)
{
echo html::hidden("caseIDList[$case->id]", $caseID);
$moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($case->product, $viewType = 'case', $startModuleID = 0);
}
?>
<tr class='text-center'>
<td><?php echo $caseID . html::hidden("version[$caseID]", $cases[$caseID]->version)?></td>
<td class='text-left'><?php echo "<span title='" . $moduleOptionMenu[$cases[$caseID]->module] . "'>" . $moduleOptionMenu[$cases[$caseID]->module] . "</span>"?></td>
<td class='text-left wordwrap'><?php echo "<span title='{$cases[$caseID]->title}'>{$cases[$caseID]->title}</span>"?></td>
<td class='text-left precondition wordwrap'><?php echo "<span title='{$cases[$caseID]->precondition}'>{$cases[$caseID]->precondition}</span>"?></td>
<td><?php echo $caseID . html::hidden("version[$caseID]", $case->version)?></td>
<td class='text-left'><?php echo "<span title='" . $moduleOptionMenu[$case->module] . "'>" . $moduleOptionMenu[$case->module] . "</span>"?></td>
<td class='text-left wordwrap'><?php echo "<span title='{$case->title}'>{$case->title}</span>"?></td>
<td class='text-left precondition wordwrap'><?php echo "<span title='{$case->precondition}'>{$case->precondition}</span>"?></td>
<td class='text-left'><?php echo html::radio("results[$caseID]", $this->lang->testcase->resultList, 'pass', "onclick='showAction(this.value,\".action$caseID\")'", 'block')?></td>
<td>
<?php if(!empty($steps[$caseID])):?>
@@ -66,7 +72,7 @@
<span class='hidden action<?php echo $caseID?>'><?php echo html::input("reals[$caseID][]", '', "class='form-control'");?></span>
<?php endif;?>
</td>
</tr>
</tr>
<?php endforeach;?>
<tr><td colspan='6' class='text-center'><?php echo html::submitButton();?></td></tr>
</table>