* adjust code for testsuite.

This commit is contained in:
wangyidong
2021-03-04 14:41:35 +08:00
parent 93cdc7c84d
commit f2ed2c6465
2 changed files with 12 additions and 12 deletions
+6 -6
View File
@@ -32,7 +32,7 @@ class testsuite extends control
parent::__construct($moduleName, $methodName);
/* Set testtask menu group. */
$this->projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0;
$this->projectID = isset($_GET['project']) ? $_GET['project'] : 0;
if(!$this->projectID)
{
$this->app->loadConfig('qa');
@@ -69,7 +69,7 @@ class testsuite extends control
$this->session->set('testsuiteList', $this->app->getURI(true));
/* Set menu. */
$projectID = $this->lang->navGroup->testreport == 'qa' ? 0 : $this->session->PRJ;
$projectID = $this->lang->navGroup->testreport == 'qa' ? 0 : $this->session->project;
$this->view->products = $this->products = $this->loadModel('product')->getProductPairsByProject($projectID);
if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=testsuite")));
$productID = $this->product->saveState($productID, $this->products);
@@ -136,7 +136,7 @@ class testsuite extends control
}
/* Set menu. */
$this->view->products = $this->products = $this->loadModel('product')->getProductPairsByProject($this->session->PRJ);
$this->view->products = $this->products = $this->loadModel('product')->getProductPairsByProject($this->session->project);
$productID = $this->product->saveState($productID, $this->products);
$this->testsuite->setMenu($this->products, $productID);
@@ -169,7 +169,7 @@ class testsuite extends control
if($suite->type == 'private' and $suite->addedBy != $this->app->user->account and !$this->app->user->admin) die(js::error($this->lang->error->accessDenied) . js::locate('back'));
$productID = $suite->product;
$this->view->products = $this->products = $this->loadModel('product')->getProductPairsByProject($this->session->PRJ);
$this->view->products = $this->products = $this->loadModel('product')->getProductPairsByProject($this->session->project);
$this->testsuite->setMenu($this->products, $productID);
/* Save session. */
@@ -239,7 +239,7 @@ class testsuite extends control
if($suite->type == 'private' and $suite->addedBy != $this->app->user->account and !$this->app->user->admin) die(js::error($this->lang->error->accessDenied) . js::locate('back'));
/* Get suite info. */
$this->view->products = $this->products = $this->loadModel('product')->getProductPairsByProject($this->session->PRJ);
$this->view->products = $this->products = $this->loadModel('product')->getProductPairsByProject($this->session->project);
$productID = $this->product->saveState($suite->product, $this->products);
/* Set menu. */
@@ -319,7 +319,7 @@ class testsuite extends control
$this->session->set('caseList', $this->app->getURI(true));
/* Get suite and product id. */
$this->view->products = $this->products = $this->loadModel('product')->getProductPairsByProject($this->session->PRJ);
$this->view->products = $this->products = $this->loadModel('product')->getProductPairsByProject($this->session->project);
$suite = $this->testsuite->getById($suiteID);
$productID = $this->product->saveState($suite->product, $this->products);
+6 -6
View File
@@ -101,7 +101,7 @@ class testsuiteModel extends model
{
$suite = fixer::input('post')
->stripTags($this->config->testsuite->editor->create['id'], $this->config->allowedTags)
->setIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa', 'PRJ', $this->session->PRJ)
->setIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa', 'project', $this->session->project)
->add('product', (int)$productID)
->add('addedBy', $this->app->user->account)
->add('addedDate', helper::now())
@@ -133,7 +133,7 @@ class testsuiteModel extends model
{
return $this->dao->select("*")->from(TABLE_TESTSUITE)
->where('product')->eq((int)$productID)
->beginIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('PRJ')->eq($this->session->PRJ)->fi()
->beginIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('project')->eq($this->session->project)->fi()
->andWhere('deleted')->eq(0)
->andWhere("(`type` = 'public' OR (`type` = 'private' and addedBy = '{$this->app->user->account}'))")
->orderBy($orderBy)
@@ -242,7 +242,7 @@ class testsuiteModel extends model
$cases = $this->dao->select('t1.*,t2.version as caseVersion')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_SUITECASE)->alias('t2')->on('t1.id=t2.case')
->where('t2.suite')->eq($suiteID)
->beginIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('t1.PRJ')->eq($this->session->PRJ)->fi()
->beginIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('t1.project')->eq($this->session->project)->fi()
->andWhere('t1.product')->eq($suite->product)
->andWhere('t1.product')->eq($suite->product)
->andWhere('t1.deleted')->eq(0)
@@ -286,7 +286,7 @@ class testsuiteModel extends model
$linkedCases = $this->getLinkedCases($suite->id, 'id_desc', null, $append = false);
$cases = $this->dao->select('*')->from(TABLE_CASE)->where($query)
->andWhere('id')->notIN(array_keys($linkedCases))
->beginIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('PRJ')->eq($this->session->PRJ)->fi()
->beginIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('project')->eq($this->session->project)->fi()
->andWhere('deleted')->eq(0)
->orderBy('id desc')
->page($pager)
@@ -323,7 +323,7 @@ class testsuiteModel extends model
{
$importedCases = $this->dao->select('fromCaseID')->from(TABLE_CASE)
->where('product')->eq($productID)
->beginIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('PRJ')->eq($this->session->PRJ)->fi()
->beginIF($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('project')->eq($this->session->project)->fi()
->andWhere('lib')->eq($libID)
->andWhere('fromCaseID')->ne('')
->andWhere('deleted')->eq(0)
@@ -357,7 +357,7 @@ class testsuiteModel extends model
return $this->dao->select('*')->from(TABLE_CASE)->where('deleted')->eq(0)
->beginIF($browseType != 'bysearch')->andWhere('lib')->eq($libID)->fi()
->beginIF($browseType == 'bysearch')->andWhere($query)->fi()
->begin($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('PRJ')->eq($this->session->PRJ)->fi()
->begin($this->config->systemMode == 'new' and $this->lang->navGroup->testsuite != 'qa')->andWhere('project')->eq($this->session->project)->fi()
->andWhere('product')->eq(0)
->andWhere('id')->notIN($importedCases)
->orderBy($orderBy)