Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
wangyidong
2017-03-14 11:33:36 +08:00
10 changed files with 282 additions and 69 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ function setTemplate(templateID)
function deleteTemplate(templateID)
{
if(!templateID) return;
if (confirm(TemplateDelete)){
if (confirm(templateDelete)){
hiddenwin.location.href = createLink('bug', 'deleteTemplate', 'templateID=' + templateID);
$('#tplBox' + templateID).addClass('hidden');
}
+1 -1
View File
@@ -145,7 +145,7 @@ $lang->bug->setTemplateTitle = '请输入bug模板标题';
$lang->bug->remindTask = '该Bug已经转化为任务,是否更新任务(编号:%s)状态 ?';
$lang->bug->skipClose = 'Bug %s 不是已解决状态,不能关闭。';
$lang->bug->applyTemplate = '应用模板';
$lang->bug->TemplateDelete = '您确认要删除该模板吗?';
$lang->bug->templateDelete = '您确认要删除该模板吗?';
/* 模板。*/
$lang->bug->tplStep = "<p>[步骤]</p>\n";
+1 -1
View File
@@ -19,7 +19,7 @@ js::set('page', 'create');
js::set('createRelease', $lang->release->create);
js::set('createBuild', $lang->build->create);
js::set('refresh', $lang->refresh);
js::set('TemplateDelete',$lang->bug->TemplateDelete);
js::set('templateDelete',$lang->bug->templateDelete);
?>
<div class='container mw-1400px'>
<div id='titlebar'>
+1 -1
View File
@@ -17,7 +17,7 @@
<strong class='pull-left'><small class='text-muted'><?php echo html::icon($lang->icons['import']);?></small> <?php echo $lang->testcase->importFromLib;?></strong>
<div class='input-group pull-left' style='font-weight:normal;'>
<span class='input-group-addon'><?php echo $lang->testcase->selectLib;?></span>
<?php echo html::select('fromlib', $libraries, $libID, "onchange='reload(this.value)' class='form-control chosen'");?>
<?php echo html::select('fromlib', $libraries, $libID, "onchange='reload(this.value)' class='form-control chosen'");?>
</div>
</div>
</div>
+4 -64
View File
@@ -655,75 +655,15 @@ class testtask extends control
$this->view->position[] = $this->lang->testtask->common;
$this->view->position[] = $this->lang->testtask->linkCase;
$testTask = $this->testtask->getTestTask($productID,$taskID);
/* Get cases. */
if($this->session->testcaseQuery == false) $this->session->set('testcaseQuery', ' 1 = 1');
$query = $this->session->testcaseQuery;
$allProduct = "`product` = 'all'";
if(strpos($query, '`product` =') === false) $query .= " AND `product` = $productID";
if(strpos($query, $allProduct) !== false) $query = str_replace($allProduct, '1', $query);
$cases = $this->testtask->getCases($productID, $task, $taskID, $type, $param, $pager);
$linkedCases = $this->dao->select('`case`')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->fetchPairs('case');
if($type == 'all')
{
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
->andWhere('id')->notIN($linkedCases)
->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
->andWhere('deleted')->eq(0)
->orderBy('id desc')
->page($pager)
->fetchAll();
}
elseif($type == 'bystory')
{
$stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('stories');
$cases = array();
if($stories)
{
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
->andWhere('product')->eq($productID)
->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi()
->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
->andWhere('story')->in(trim($stories, ','))
->andWhere('deleted')->eq(0)
->orderBy('id desc')
->page($pager)
->fetchAll();
}
}
elseif($type == 'bybug')
{
$bugs = $this->dao->select('bugs')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('bugs');
$cases = array();
if($bugs)
{
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
->andWhere('product')->eq($productID)
->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi()
->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
->andWhere('fromBug')->in(trim($bugs, ','))
->andWhere('deleted')->eq(0)
->orderBy('id desc')
->page($pager)
->fetchAll();
}
}
if($type == 'bysuite')
{
$cases = $this->dao->select('t1.*,t2.version as version')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_SUITECASE)->alias('t2')->on('t1.id=t2.case')
->where($query)
->andWhere('t2.suite')->eq((int)$param)
->andWhere('t1.product')->eq($productID)
->beginIF($linkedCases)->andWhere('t1.id')->notIN($linkedCases)->fi()
->beginIF($task->branch)->andWhere('t1.branch')->in("0,$task->branch")->fi()
->andWhere('deleted')->eq(0)
->orderBy('id_desc')
->page($pager)
->fetchAll();
}
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->cases = $cases;
$this->view->taskID = $taskID;
$this->view->testTask = $testTask;
$this->view->pager = $pager;
$this->view->task = $task;
$this->view->type = $type;
+2
View File
@@ -16,6 +16,7 @@ $lang->testtask->view = "概况";
$lang->testtask->edit = "编辑版本";
$lang->testtask->browse = "版本列表";
$lang->testtask->linkCase = "关联用例";
$lang->testtask->selectVersion = "选择版本";
$lang->testtask->unlinkCase = "移除";
$lang->testtask->batchUnlinkCases = "批量移除用例";
$lang->testtask->batchAssign = "批量指派";
@@ -73,6 +74,7 @@ $lang->testtask->priList[2] = '2';
$lang->testtask->priList[4] = '4';
$lang->testtask->unlinkedCases = '未关联';
$lang->testtask->linkByVersion = '按版本关联';
$lang->testtask->linkByStory = '按需求关联';
$lang->testtask->linkByBug = '按Bug关联';
$lang->testtask->linkBySuite = '按套件关联';
+168
View File
@@ -331,6 +331,174 @@ class testtaskModel extends model
}
}
/**
* Get all cases.
*
* @param string $query
* @param array $linkedCases
* @param object $pager
* @access public
* @return void
*/
public function getAllCases($query,$linkedCases,$pager)
{
return $this->dao->select('*')->from(TABLE_CASE)->where($query)
->andWhere('id')->notIN($linkedCases)
->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
->andWhere('deleted')->eq(0)
->orderBy('id desc')
->page($pager)
->fetchAll();
}
/**
* Get cases by story.
*
* @param array $task
* @param int $productID
* @param string $query
* @param array $linkedCases
* @param object $pager
* @access public
* @return array
*/
public function getCasesByStory($task,$productID,$query,$linkedCases,$pager)
{
$stories = $this->dao->select('stories')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('stories');
$cases = array();
if($stories)
{
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
->andWhere('product')->eq($productID)
->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi()
->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
->andWhere('story')->in(trim($stories, ','))
->andWhere('deleted')->eq(0)
->orderBy('id desc')
->page($pager)
->fetchAll();
}
return $cases;
}
/**
* Get cases by bug.
*
* @param array $task
* @param int $productID
* @param string $query
* @param array $linkedCases
* @param object $pager
* @access public
* @return array
*/
public function getCasesByBug($task,$productID,$query,$linkedCases,$pager)
{
$bugs = $this->dao->select('bugs')->from(TABLE_BUILD)->where('id')->eq($task->build)->fetch('bugs');
$cases = array();
if($bugs)
{
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
->andWhere('product')->eq($productID)
->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi()
->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi()
->andWhere('fromBug')->in(trim($bugs, ','))
->andWhere('deleted')->eq(0)
->orderBy('id desc')
->page($pager)
->fetchAll();
}
return $cases;
}
/**
* Get cases by suite.
*
* @param int $productID
* @param string $query
* @param array $linkedCases
* @param string $param
* @param object $pager
* @access public
* @return array
*/
public function getCasesBySuite($productID,$query,$linkedCases,$pager,$param)
{
return $this->dao->select('t1.*,t2.version as version')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_SUITECASE)->alias('t2')->on('t1.id=t2.case')
->where($query)
->andWhere('t2.suite')->eq((int)$param)
->andWhere('t1.product')->eq($productID)
->beginIF($linkedCases)->andWhere('t1.id')->notIN($linkedCases)->fi()
->beginIF($task->branch)->andWhere('t1.branch')->in("0,$task->branch")->fi()
->andWhere('deleted')->eq(0)
->orderBy('id desc')
->page($pager)
->fetchAll();
}
/**
* Get cases by version.
*
* @param string $param
* @param object $pager
* @access public
* @return array
*/
public function getCasesByVersion($pager, $param)
{
$runListValue = array();
$runList = $this->dao->select("`case`")->from(TABLE_TESTRUN)->where("task = '$param'")->fetchPairs('case');
$caseList = $this->dao->select("*")->from(TABLE_CASE)->where('id')->in($runList)->page($pager)->fetchAll();
return $caseList;
}
/**
* Get cases.
*
* @param int $productID
* @param array $task
* @param int $taskID
* @param string $type
* @param string $param
* @param object $pager
* @access public
* @return array
*/
public function getCases($productID, $task, $taskID, $type, $param, $pager)
{
if($this->session->testcaseQuery == false) $this->session->set('testcaseQuery', ' 1 = 1');
$query = $this->session->testcaseQuery;
$allProduct = "`product` = 'all'";
if(strpos($query, '`product` =') === false && $type != 'bysuite') $query .= " AND `product` = $productID";
if(strpos($query, $allProduct) !== false) $query = str_replace($allProduct, '1', $query);
$linkedCases = $this->dao->select('`case`')->from(TABLE_TESTRUN)->where('task')->eq($taskID)->fetchPairs('case');
if($type == 'all') $cases = $this->getAllCases($query,$linkedCases,$pager);
else if($type == 'bystory') $cases = $this->getCasesByStory($task,$productID,$query,$linkedCases,$pager);
else if($type == 'bybug') $cases = $this->getCasesByBug($task,$productID,$query,$linkedCases,$pager);
else if($type == 'bysuite') $cases = $this->getCasesBySuite($productID,$query,$linkedCases,$pager,$param);
else if($type == 'byversion') $cases = $this->getCasesByVersion($pager,$param);
return $cases;
}
/**
* Get test tasks.
*
* @param int $productID
* @param int $taskID
* @access public
* @return array
*/
public function getTestTask($productID,$taskID)
{
return $this->dao->select('id,name')->from(TABLE_TESTTASK)->where("product = '$productID'")->orderBy('id desc')->fetchPairs('id', 'name');
}
/**
* Get test runs of a test task.
*
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* The start file of testtask module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang<wwccss@gmail.com>
* @package testtask
* @version $Id: start.html.php 935 2013-01-16 07:49:24Z wwccss@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<div class='container mw-800px'>
<div id='titlebar'>
<div class='heading'>
<span class='prefix'><?php echo html::icon($lang->icons['testtask']);?> <strong><?php echo $testtask->id;?></strong></span>
<strong><?php echo html::a($this->createLink('testtask', 'view', 'taskID=' . $testtask->id), $testtask->name, '_blank');?></strong>
<small class='text-success'> <?php echo $lang->testtask->blocked;?> <?php echo html::icon($lang->icons['pause']);?></small>
</div>
</div>
<form class='form-condensed' method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th class='text-left'><?php echo $lang->comment;?></th>
</tr>
<tr>
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control'");?></td>
</tr>
<tr>
<td class='text-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
</form>
<div class='main'>
<?php include '../../common/view/action.html.php';?>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+42
View File
@@ -0,0 +1,42 @@
<?php
/**
* The start file of testtask module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang<wwccss@gmail.com>
* @package testtask
* @version $Id: start.html.php 935 2013-01-16 07:49:24Z wwccss@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php include '../../common/view/datepicker.html.php';?>
<div class='container mw-800px'>
<div id='titlebar'>
<div class='heading'>
<span class='prefix'><?php echo html::icon($lang->icons['testtask']);?> <strong><?php echo $testtask->id;?></strong></span>
<strong><?php echo html::a($this->createLink('testtask', 'view', 'taskID=' . $testtask->id), $testtask->name, '_blank');?></strong>
<small class='text-success'> <?php echo $lang->testtask->doing;?> <?php echo html::icon($lang->icons['start']);?></small>
</div>
</div>
<form class='form-condensed' method='post' target='hiddenwin'>
<table class='table table-form'>
<tr>
<th class='text-left'><?php echo $lang->comment;?></th>
</tr>
<tr>
<td><?php echo html::textarea('comment', '', "rows='6' class='form-control'");?></td>
</tr>
<tr>
<td class='text-center'><?php echo html::submitButton() . html::linkButton($lang->goback, $this->session->taskList); ?></td>
</tr>
</table>
</form>
<div class='main'>
<?php include '../../common/view/action.html.php';?>
</div>
</div>
<?php include '../../common/view/footer.html.php';?>
+20 -1
View File
@@ -21,6 +21,17 @@
<div class='actions'>
<?php
echo "<div class='btn-group'>";
echo "<span class='dropdown'>";
echo "<button class='btn' type='button' data-toggle='dropdown'><i class='icon icon-link'></i> {$lang->testtask->linkByVersion} <span class='caret'></span></button>";
echo "<ul class='dropdown-menu' style='max-height:240px;overflow-y:auto'>";
foreach($testTask as $tmpID => $tmpTitle)
{
$active = ($type == 'byversion' and (int)$param == $tmpID) ? "class='active'" : '';
echo "<li $active>" . html::a(inlink('linkCase', "taskID=$taskID&type=byversion&param=$tmpID"), $tmpTitle) . "</li>";
}
echo "</ul></span>";
echo "<span class='dropdown'>";
echo "<button class='btn' type='button' data-toggle='dropdown'><i class='icon icon-link'></i> {$lang->testtask->linkBySuite} <span class='caret'></span></button>";
echo "<ul class='dropdown-menu' style='max-height:240px;overflow-y:auto'>";
@@ -32,10 +43,12 @@
echo "<li $active>" . html::a(inlink('linkCase', "taskID=$taskID&type=bysuite&param=$suiteID"), $suiteName) . "</li>";
}
echo "</ul></span>";
$lang->testtask->linkCase = $lang->testtask->linkByStory;
common::printIcon('testtask', 'linkCase', "taskID=$taskID&type=bystory", '', 'button', 'link');
$lang->testtask->linkCase = $lang->testtask->linkByBug;
common::printIcon('testtask', 'linkCase', "taskID=$taskID&type=bybug", '', 'button', 'link');
echo '</div>';
echo "<div class='btn-group'>";
common::printRPN($this->session->testtaskList);
@@ -57,6 +70,9 @@
<th><?php echo $lang->testcase->title;?></th>
<th class='w-type'><?php echo $lang->testcase->type;?></th>
<th class='w-user'><?php echo $lang->openedByAB;?></th>
<th class='w-80px'><?php echo $lang->testtask->lastRunAccount;?></th>
<th class='w-120px'><?php echo $lang->testtask->lastRunTime;?></th>
<th class='w-80px'><?php echo $lang->testtask->lastRunResult;?></th>
<th class='w-status'><?php echo $lang->statusAB;?></th>
</tr>
</thead>
@@ -81,13 +97,16 @@
</td>
<td><?php echo $lang->testcase->typeList[$case->type];?></td>
<td><?php echo $users[$case->openedBy];?></td>
<td><?php echo $case->lastRunner;?></td>
<td><?php if(!helper::isZeroDate($case->lastRunDate)) echo date(DT_MONTHTIME1, strtotime($case->lastRunDate));?></td>
<td class='<?php echo $case->lastRunResult;?>'><?php if($case->lastRunResult) echo $lang->testcase->resultList[$case->lastRunResult];?></td>
<td class='case-<?php echo $case->status?>'><?php echo $lang->testcase->statusList[$case->status];?></td>
</tr>
<?php endforeach;?>
</tbody>
<tfoot>
<tr>
<td colspan='7'>
<td colspan='10'>
<?php if($cases):?>
<div class='table-actions pd-0 clearfix'><?php echo html::selectButton() . html::submitButton();?></div>
<?php endif;?>