Merge branch '12.x'

This commit is contained in:
z
2020-11-23 20:42:59 +08:00
230 changed files with 5568 additions and 1943 deletions
+42 -27
View File
@@ -91,6 +91,7 @@ class testtask extends control
$this->view->branch = $branch;
$this->view->beginTime = $beginTime;
$this->view->endTime = $endTime;
$this->view->product = $this->product->getByID($productID);
$this->display();
}
@@ -137,6 +138,7 @@ class testtask extends control
$this->view->tasks = $this->testtask->getProductUnitTasks($productID, $browseType, $sort, $pager);
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
$this->view->pager = $pager;
$this->view->product = $this->product->getByID($productID);
$this->display();
}
@@ -340,23 +342,30 @@ class testtask extends control
$this->app->loadClass('pager', $static = true);
$pager = pager::init($recTotal, $recPerPage, $pageID);
/* Set the browseType and moduleID. */
$browseType = strtolower($browseType);
/* Get task and product info, set menu. */
$task = $this->testtask->getById($taskID);
if(!$task) die(js::error($this->lang->testtask->checkLinked) . js::locate('back'));
$productID = $task->product;
$this->testtask->setMenu($this->products, $productID, $task->branch, $taskID);
setcookie('preTaskID', $taskID, $this->config->cookieLife, $this->config->webRoot, '', false, true);
/* Determines whether an object is editable. */
$canBeChanged = common::canBeChanged('testtask', $task);
if($this->cookie->preTaskID != $taskID)
{
$_COOKIE['taskCaseModule'] = 0;
setcookie('taskCaseModule', 0, 0, $this->config->webRoot, '', false, true);
}
if($browseType == 'bymodule') setcookie('taskCaseModule', (int)$param, 0, $this->config->webRoot, '', false, true);
if($browseType != 'bymodule') $this->session->set('taskCaseBrowseType', $browseType);
/* Set the browseType, moduleID and queryID. */
$browseType = strtolower($browseType);
$moduleID = ($browseType == 'bymodule') ? (int)$param : ($browseType == 'bysearch' ? 0 : ($this->cookie->taskCaseModule ? $this->cookie->taskCaseModule : 0));
$queryID = ($browseType == 'bysearch') ? (int)$param : 0;
@@ -384,6 +393,7 @@ class testtask extends control
$this->config->testcase->search['params']['product']['values'] = array($productID => $this->products[$productID], 'all' => $this->lang->testcase->allProduct);
$this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case');
$this->config->testcase->search['params']['status']['values'] = array('' => '') + $this->lang->testtask->statusList;
$this->config->testcase->search['params']['lib']['values'] = $this->loadModel('caselib')->getLibraries();
$this->config->testcase->search['queryID'] = $queryID;
$this->config->testcase->search['fields']['assignedTo'] = $this->lang->testtask->assignedTo;
@@ -402,23 +412,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');
$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->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');
$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();
}
@@ -493,6 +504,9 @@ class testtask extends control
$productID = $task->product;
$this->testtask->setMenu($this->products, $productID, $task->branch, $taskID);
/* Determines whether an object is editable. */
$canBeChanged = common::canBeChanged('testtask', $task);
$runs = $this->testtask->getRuns($taskID, 0, $groupBy);
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false);
$runs = $this->testcase->appendData($runs, 'run');
@@ -527,15 +541,16 @@ class testtask extends control
$this->view->position[] = $this->lang->testtask->common;
$this->view->position[] = $this->lang->testtask->cases;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->productID = $productID;
$this->view->task = $task;
$this->view->taskID = $taskID;
$this->view->browseType = 'group';
$this->view->groupBy = $groupBy;
$this->view->groupByList = $groupByList;
$this->view->cases = $groupCases;
$this->view->account = 'all';
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->productID = $productID;
$this->view->task = $task;
$this->view->taskID = $taskID;
$this->view->browseType = 'group';
$this->view->groupBy = $groupBy;
$this->view->groupByList = $groupByList;
$this->view->cases = $groupCases;
$this->view->account = 'all';
$this->view->canBeChanged = $canBeChanged;
$this->display();
}
+1
View File
@@ -1,5 +1,6 @@
tbody > tr > td > .btn-icon {margin-right: 3px;}
tbody > tr > td .icon-bug {margin-left: -8px;}
tbody > tr > td .icon-share{font-size: 9px;}
.table-footer .table-actions .input-group {float: left;}
.table-footer .table-actions #assignedTo_chosen a.chosen-default{height:28px;line-height:15px}
+35 -6
View File
@@ -951,7 +951,10 @@ class testtaskModel extends model
*/
public function getRuns($taskID, $moduleID, $orderBy, $pager = null)
{
$orderBy = (strpos($orderBy, 'assignedTo') !== false or strpos($orderBy, 'lastRunResult') !== false) ? ('t1.' . $orderBy) : ('t2.' . $orderBy);
/* Select the table for these special fields. */
$specialFields = ',assignedTo,status,lastRunResult,lastRunner,lastRunDate,';
$fieldToSort = substr($orderBy, 0, strpos($orderBy, '_'));
$orderBy = strpos($specialFields, ',' . $fieldToSort . ',') !== false ? ('t1.' . $orderBy) : ('t2.' . $orderBy);
return $this->dao->select('t2.*,t1.*,t2.version as caseVersion,t3.title as storyTitle,t2.status as caseStatus')->from(TABLE_TESTRUN)->alias('t1')
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
@@ -975,7 +978,10 @@ class testtaskModel extends model
*/
public function getUserRuns($taskID, $user, $modules = '', $orderBy, $pager = null)
{
$orderBy = strpos($orderBy, 'assignedTo') !== false ? ('t1.' . $orderBy) : ('t2.' . $orderBy);
/* Select the table for these special fields. */
$specialFields = ',assignedTo,status,lastRunResult,lastRunner,lastRunDate,';
$fieldToSort = substr($orderBy, 0, strpos($orderBy, '_'));
$orderBy = strpos($specialFields, ',' . $fieldToSort . ',') !== false ? ('t1.' . $orderBy) : ('t2.' . $orderBy);
return $this->dao->select('t2.*,t1.*,t2.version as caseVersion,t3.title as storyTitle,t2.status as caseStatus')->from(TABLE_TESTRUN)->alias('t1')
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
@@ -1007,6 +1013,7 @@ class testtaskModel extends model
/* Set modules and browse type. */
$modules = $moduleID ? $this->loadModel('tree')->getAllChildId($moduleID) : '0';
$browseType = ($browseType == 'bymodule' and $this->session->taskCaseBrowseType and $this->session->taskCaseBrowseType != 'bysearch') ? $this->session->taskCaseBrowseType : $browseType;
$browseType = strtolower($browseType);
if($browseType == 'bymodule' or $browseType == 'all')
{
@@ -1042,6 +1049,12 @@ class testtaskModel extends model
$caseQuery = preg_replace('/`(\w+)`/', 't2.`$1`', $caseQuery);
$caseQuery = str_replace(array('t2.`assignedTo`', 't2.`lastRunner`', 't2.`lastRunDate`', 't2.`lastRunResult`', 't2.`status`'), array('t1.`assignedTo`', 't1.`lastRunner`', 't1.`lastRunDate`', 't1.`lastRunResult`', 't1.`status`'), $caseQuery);
/* Select the table for these special fields. */
$specialFields = ',assignedTo,status,lastRunResult,lastRunner,lastRunDate,';
$fieldToSort = substr($sort, 0, strpos($sort, '_'));
$orderBy = strpos($specialFields, ',' . $fieldToSort . ',') !== false ? ('t1.' . $sort) : ('t2.' . $sort);
$runs = $this->dao->select('t2.*,t1.*, t2.version as caseVersion,t3.title as storyTitle,t2.status as caseStatus')->from(TABLE_TESTRUN)->alias('t1')
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
->leftJoin(TABLE_STORY)->alias('t3')->on('t2.story = t3.id')
@@ -1050,7 +1063,7 @@ class testtaskModel extends model
->andWhere('t2.deleted')->eq(0)
->beginIF($queryProductID != 'all')->andWhere('t2.product')->eq($queryProductID)->fi()
->beginIF($task->branch)->andWhere('t2.branch')->in("0,{$task->branch}")->fi()
->orderBy(strpos($sort, 'assignedTo') !== false ? ('t1.' . $sort) : ('t2.' . $sort))
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
}
@@ -1349,7 +1362,7 @@ class testtaskModel extends model
if($action == 'block') return ($testtask->status == 'doing' || $testtask->status == 'wait');
if($action == 'activate') return ($testtask->status == 'blocked' || $testtask->status == 'done');
if($action == 'close') return $testtask->status != 'done';
if($action == 'runcase' and $testtask->auto == 'unit') return false;
if($action == 'runcase' and isset($testtask->auto) and $testtask->auto == 'unit') return false;
if($action == 'runcase') return isset($testtask->caseStatus) ? $testtask->caseStatus != 'wait' : $testtask->status != 'wait';
return true;
}
@@ -1379,6 +1392,8 @@ class testtaskModel extends model
$account = $this->app->user->account;
$id = $col->id;
$caseChanged = $run->version < $run->caseVersion;
$fromCaseID = $run->fromCaseID;
if($col->show)
{
$class = "c-$id ";
@@ -1410,7 +1425,21 @@ class testtaskModel extends model
break;
case 'title':
if($run->branch) echo "<span class='label label-info label-outline'>{$branches[$run->branch]}</span>";
echo $canView ? html::a($caseLink, $run->title, null, "style='color: $run->color'") : $run->title;
if($canView)
{
if($fromCaseID)
{
echo html::a($caseLink, $run->title, null, "style='color: $run->color'") . html::a(helper::createLink('testcase', 'view', "caseID=$fromCaseID"), "[<i class='icon icon-share' title='{$this->lang->testcase->fromCase}'></i>#$fromCaseID]");
}
else
{
echo html::a($caseLink, $run->title, null, "style='color: $run->color'");
}
}
else
{
echo "<span style='color: $run->color'>$run->title</span>";
}
break;
case 'branch':
echo $branches[$run->branch];
@@ -1544,7 +1573,7 @@ class testtaskModel extends model
/* Send mail. */
$this->mail->send($toList, $subject, $mailContent, $ccList);
if($this->mail->isError()) trigger_error(join("\n", $this->mail->getError()));
if($this->mail->isError()) error_log(join("\n", $this->mail->getError()));
}
/**
+3 -1
View File
@@ -45,16 +45,18 @@ $status = $this->session->testTaskVersionStatus;
<div class='datepicker-wrapper datepicker-date'><?php echo html::input('date', $endTime, "class='form-control form-date' onchange='changeDate(\"$beginTime\", this.value, \"$condition\")'");?></div>
</div>
</div>
<?php if(common::canModify('product', $product)):?>
<div class="btn-toolbar pull-right">
<?php common::printLink('testtask', 'create', "product=$productID", "<i class='icon icon-plus'></i> " . $lang->testtask->create, '', "class='btn btn-primary'");?>
</div>
<?php endif;?>
</div>
<div id='mainContent' class='main-table'>
<?php if(empty($tasks)):?>
<div class="table-empty-tip">
<p>
<span class="text-muted"><?php echo $lang->testtask->noTesttask;?></span>
<?php if(common::hasPriv('testtask', 'create')):?>
<?php if(common::canModify('product', $product) and common::hasPriv('testtask', 'create')):?>
<?php echo html::a($this->createLink('testtask', 'create', "product=$productID"), "<i class='icon icon-plus'></i> " . $lang->testtask->create, '', "class='btn btn-info'");?>
<?php endif;?>
</p>
@@ -23,9 +23,11 @@
<?php echo html::a(inlink('browseUnits', "productID=$productID&browseType=$key&orderBy=$orderBy"), "<span class='text'>$label</span>", '', "id='{$key}Tab' class='btn btn-link'");?>
<?php endforeach;?>
</div>
<?php if(common::canModify('product', $product)):?>
<div class="btn-toolbar pull-right">
<?php common::printLink('testtask', 'importUnitResult', "product=$productID", "<i class='icon icon-import'></i> " . $lang->testtask->importUnitResult, '', "class='btn btn-primary'");?>
</div>
<?php endif;?>
</div>
<div id='mainContent' class='main-table' data-ride='table'>
<?php if(empty($tasks)):?>
+1 -1
View File
@@ -36,7 +36,7 @@
</div>
<div class='btn-toolbar pull-right'>
<?php
common::printIcon('testtask', 'linkCase', "taskID=$task->id", '', 'button', 'link');
common::printIcon('testtask', 'linkCase', "taskID=$task->id", $task, 'button', 'link');
common::printIcon('testcase', 'export', "productID=$productID&orderBy=`case`_desc&taskID=$task->id", '', 'button', '', '', 'export');
common::printIcon('testtask', 'report', "productID=$productID&taskID=$task->id&browseType=$browseType&branchID=$task->branch&moduleID=" . (empty($moduleID) ? '' : $moduleID));
common::printIcon('testtask', 'view', "taskID=$task->id", '', 'button', 'list-alt');
+2 -2
View File
@@ -40,7 +40,7 @@
$canBatchAssign = common::hasPriv('testtask', 'batchAssign');
$canBatchRun = common::hasPriv('testtask', 'batchRun');
$canBatchAction = ($canBatchEdit or $canBatchUnlink or $canBatchAssign or $canBatchRun);
$canBatchAction = ($canBeChanged and ($canBatchEdit or $canBatchUnlink or $canBatchAssign or $canBatchRun));
if($useDatatable) include '../../common/view/datatable.html.php';
if(!$useDatatable) include '../../common/view/tablesorter.html.php';
@@ -141,7 +141,7 @@
</div>
<?php else:?>
<div class="table-empty-tip">
<p><span class="text-muted"><?php echo $lang->testcase->noCase;?></span> <?php common::printLink('testtask', 'linkCase', "taskID={$taskID}", "<i class='icon icon-plus'></i> " . $lang->testtask->linkCase, '', "class='btn btn-info'");?></p>
<p><span class="text-muted"><?php echo $lang->testcase->noCase;?></span> <?php if($canBeChanged) common::printLink('testtask', 'linkCase', "taskID={$taskID}", "<i class='icon icon-plus'></i> " . $lang->testtask->linkCase, '', "class='btn btn-info'");?></p>
</div>
<?php endif;?>
</form>
+4 -4
View File
@@ -85,10 +85,10 @@
<th><?php echo $lang->testtask->mailto;?></th>
<td colspan='2'>
<div id='mailtoGroup' class='input-group'>
<?php
echo html::select('mailto[]', $users, '', "multiple class='form-control chosen'");
echo $this->fetch('my', 'buildContactLists');
?>
<?php
echo html::select('mailto[]', $users, '', "multiple class='form-control chosen'");
echo $this->fetch('my', 'buildContactLists');
?>
</div>
</td>
</tr>
+2
View File
@@ -76,6 +76,7 @@
<td><?php echo (common::hasPriv('testtask', 'results') and $run->results) ? html::a($this->createLink('testtask', 'results', "runID={$run->id}&caseID={$run->case}"), $run->results, '', "class='iframe'") : $run->results;?></td>
<td><?php echo $run->stepNumber;?></td>
<td class='c-actions'>
<?php if($canBeChanged):?>
<?php common::printIcon('testtask', 'runCase', "runID=$run->id&caseID=$run->case&version=$run->caseVersion", '', 'list', 'play', '', 'runCase iframe', false, "data-width='95%'");?>
<?php common::printIcon('testcase', 'edit', "caseID=$run->case", '', 'list');?>
<?php
@@ -85,6 +86,7 @@
echo html::a("javascript:ajaxDelete(\"$unlinkURL\", \"casesForm\", confirmUnlink)", '<i class="icon-unlink"></i>', '', "title='{$this->lang->testtask->unlinkCase}' class='btn'");
}
?>
<?php endif;?>
</td>
</tr>
<?php $i++;?>
+4 -1
View File
@@ -39,7 +39,10 @@
<div class="detail-content article-content"><?php echo $task->report;?></div>
</div>
<?php endif;?>
<?php $actionFormLink = $this->createLink('action', 'comment', "objectType=testtask&objectID=$task->id");?>
<?php
$canBeChanged = common::canBeChanged('testtask', $task);
if($canBeChanged) $actionFormLink = $this->createLink('action', 'comment', "objectType=testtask&objectID=$task->id");
?>
</div>
<?php $this->printExtendFields($task, 'div', "position=left&inForm=0&inCell=1");?>
<div class='cell'><?php include '../../common/view/action.html.php';?></div>