Merge branch 'sprint_201_56459' into 'master'

Sprint 201 56459

See merge request easycorp/zentaopms!3802
This commit is contained in:
孙广明
2022-06-09 00:35:28 +00:00
6 changed files with 134 additions and 32 deletions
+37 -30
View File
@@ -75,18 +75,19 @@ class my extends control
/**
* My work view.
*
* @param string $mode
* @param string $type
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @param string $mode
* @param string $type
* @param string|int $param
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function work($mode = 'task', $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function work($mode = 'task', $type = 'assignedTo', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
echo $this->fetch('my', $mode, "type=$type&orderBy=$orderBy&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID");
echo $this->fetch('my', $mode, "type=$type&param=$param&orderBy=$orderBy&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID");
$this->showWorkCount($recTotal, $recPerPage, $pageID);
}
@@ -210,20 +211,21 @@ EOF;
/**
* My contribute view.
*
* @param string $mode
* @param string $type
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @param string $mode
* @param string $type
* @param string|int $param
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function contribute($mode = 'task', $type = 'openedBy', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function contribute($mode = 'task', $type = 'openedBy', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
if(($mode == 'issue' or $mode == 'risk') and $type == 'openedBy') $type = 'createdBy';
echo $this->fetch('my', $mode, "type=$type&orderBy=$orderBy&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID");
echo $this->fetch('my', $mode, "type=$type&param=$param&orderBy=$orderBy&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID");
}
/**
@@ -596,15 +598,16 @@ EOF;
/**
* My test case.
*
* @param string $type assigntome|openedbyme
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @param string $type assigntome|openedbyme
* @param string|int $param
* @param string $orderBy
* @param int $recTotal
* @param int $recPerPage
* @param int $pageID
* @access public
* @return void
*/
public function testcase($type = 'assigntome', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
public function testcase($type = 'assigntome', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->loadModel('testcase');
$this->loadModel('testtask');
@@ -620,20 +623,24 @@ EOF;
/* Append id for secend sort. */
$sort = common::appendOrder($orderBy);
$queryID = ($type == 'bysearch') ? (int)$param : 0;
$cases = array();
if($type == 'assigntome')
{
$cases = $this->testcase->getByAssignedTo($this->app->user->account, $sort, $pager, 'skip');
}
elseif($type == 'openedbyme')
{
$cases = $this->testcase->getByOpenedBy($this->app->user->account, $sort, $pager, 'skip');
}
if($type == 'assigntome') $cases = $this->testcase->getByAssignedTo($this->app->user->account, $sort, $pager, 'skip');
if($type == 'openedbyme') $cases = $this->testcase->getByOpenedBy($this->app->user->account, $sort, $pager, 'skip');
if($type == 'bysearch' and $this->app->rawMethod == 'contribute') $cases = $this->my->getTestcasesBySearch($queryID, 'openedbyme', $orderBy, $pager);
if($type == 'bysearch' and $this->app->rawMethod == 'work') $cases = $this->my->getTestcasesBySearch($queryID, 'assigntome', $orderBy, $pager);
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', $type == 'assigntome' ? false : true);
$cases = $this->testcase->appendData($cases, $type == 'assigntome' ? 'run' : 'case');
/* Build the search form. */
$currentMethod = $this->app->rawMethod;
$actionURL = $this->createLink('my', $currentMethod, "mode=testcase&type=bysearch&param=myQueryID&orderBy={$orderBy}&recTotal={$recTotal}&recPerPage={$recPerPage}&pageID={$pageID}");
$this->config->testcase->search['onMenuBar'] = 'yes';
$this->my->buildTestcaseSearchForm($queryID, $actionURL, $currentMethod);
/* Assign. */
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->myTestCase;
$this->view->position[] = $this->lang->my->myTestCase;
+1
View File
@@ -43,6 +43,7 @@ $lang->my->testcase = 'My Case';
$lang->my->storyConcept = 'Story Concept';
$lang->my->pri = 'Priority';
$lang->my->alert = 'You can click on your profile at the top right and select "Preference" to modify your information. ';
$lang->my->assignedToMe = 'AssignedToMe';
$lang->my->indexAction = 'My Index';
$lang->my->calendarAction = 'My Calendar';
+1
View File
@@ -43,6 +43,7 @@ $lang->my->testcase = '我的用例';
$lang->my->storyConcept = $config->URAndSR ? '默认需求概念组合' : '默认需求概念';
$lang->my->pri = '优先级';
$lang->my->alert = '后续您可以点击右上方的头像,选择“个性化设置”修改信息。';
$lang->my->assignedToMe = '指派给我';
$lang->my->indexAction = '地盘仪表盘';
$lang->my->calendarAction = '我的日程';
+84
View File
@@ -374,4 +374,88 @@ class myModel extends model
}
return $objectList;
}
/**
* Build search form.
*
* @param int $queryID
* @param string $actionURL
* @param string $type
* @access public
* @return void
*/
public function buildTestCaseSearchForm($queryID, $actionURL, $type)
{
$products = $this->dao->select('id,name')->from(TABLE_PRODUCT)
->where('deleted')->eq(0)
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->products)->fi()
->orderBy('order_asc')
->fetchPairs();
$queryName = $type == 'contribute' ? 'contributeTestcase' : 'workTestcase';
$this->app->loadConfig('testcase');
$this->config->testcase->search['module'] = $queryName;
$this->config->testcase->search['queryID'] = $queryID;
$this->config->testcase->search['actionURL'] = $actionURL;
$this->config->testcase->search['params']['product']['values'] = $products;
$this->config->testcase->search['params']['lib']['values'] = $this->loadModel('caselib')->getLibraries();
unset($this->config->testcase->search['fields']['module']);
$this->loadModel('search')->setSearchParams($this->config->testcase->search);
}
/**
* Get testcases by search.
*
* @param int $queryID
* @param string $type
* @param string $orderBy
* @param int $pager
* @access public
* @return array
*/
public function getTestcasesBySearch($queryID, $type, $orderBy, $pager)
{
$queryName = $type == 'openedbyme' ? 'contributeTestcaseQuery' : 'workTestcaseQuery';
if($queryID)
{
$query = $this->loadModel('search')->getQuery($queryID);
if($query)
{
$this->session->set($queryName, $query->sql);
$this->session->set($queryName . 'Form', $query->form);
}
else
{
$this->session->set($queryName, ' 1 = 1');
}
}
else
{
if($this->session->$queryName == false) $this->session->set($queryName, ' 1 = 1');
}
$myTestcaseQuery = $this->session->$queryName;
$myTestcaseQuery = preg_replace('/`(\w+)`/', 't1.`$1`', $myTestcaseQuery);
if($type == 'openedbyme')
{
$cases = $this->dao->select('*')->from(TABLE_CASE)->alias('t1')
->where($myTestcaseQuery)
->andWhere('t1.openedBy')->eq($this->app->user->account)
->andWhere('t1.deleted')->eq(0)
->orderBy($orderBy)->page($pager)->fetchAll('id');
}
else
{
$cases = $this->dao->select('t1.*')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_TESTRUN)->alias('t2')->on('t1.id = t2.case')
->where($myTestcaseQuery)
->andWhere('t2.assignedTo')->eq($this->app->user->account)
->andWhere('t1.deleted')->eq(0)
->orderBy($orderBy)->page($pager)->fetchAll('id');
}
return $cases;
}
}
+10 -1
View File
@@ -19,11 +19,20 @@
<div class="btn-toolbar pull-left">
<?php
$recTotalLabel = " <span class='label label-light label-badge'>{$pager->recTotal}</span>";
if($app->rawMethod == 'contribute') echo html::a(inlink($app->rawMethod, "mode=$mode&type=openedbyme"), "<span class='text'>{$lang->testcase->openedByMe}</span>" . ($type == 'openedbyme' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'openedbyme' ? ' btn-active-text' : '') . "'");
if($app->rawMethod == 'contribute')
{
echo html::a(inlink($app->rawMethod, "mode=$mode&type=openedbyme"), "<span class='text'>{$lang->testcase->openedByMe}</span>" . ($type == 'openedbyme' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'openedbyme' ? ' btn-active-text' : '') . "'");
}
else
{
echo html::a(inlink($app->rawMethod, "mode=$mode&type=assigntome"), "<span class='text'>{$lang->my->assignedToMe}</span>" . ($type == 'assigntome' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'assigntome' ? ' btn-active-text' : '') . "'");
}
?>
<a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i><?php $this->loadModel('search');echo $lang->search->common;?></a>
</div>
</div>
<div id="mainContent">
<div class="cell<?php if($type == 'bysearch') echo ' show';?>" id="queryBox" data-module=<?php echo ($app->rawMethod == 'contribute' ? 'contributeTestcase' : 'workTestcase');?>></div>
<?php if(empty($cases)):?>
<div class="table-empty-tip">
<p><span class="text-muted"><?php echo $lang->testcase->noCase;?></span></p>
+1 -1
View File
@@ -609,7 +609,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,t3.name as taskName')->from(TABLE_TESTRUN)->alias('t1')
return $this->dao->select('t1.task,t1.case,t1.version,t1.assignedTo,t1.lastRunner,t1.lastRunDate,t1.lastRunResult,t1.status,t2.id as id,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)