From e361864ea5def90ff218fc5d5667ae725bf049c3 Mon Sep 17 00:00:00 2001
From: hufangzhou <746775970@qq.com>
Date: Wed, 24 Mar 2021 14:14:08 +0800
Subject: [PATCH 1/2] * Adjust the cases of all products.
---
module/product/control.php | 8 +++-----
module/product/model.php | 16 +++++++++++-----
module/product/view/ajaxgetdropmenu.html.php | 6 ------
module/project/control.php | 4 ++++
module/story/control.php | 2 ++
module/testcase/control.php | 8 ++++----
module/testcase/model.php | 16 ++++++++--------
module/testcase/view/batchedit.html.php | 5 ++---
module/testtask/control.php | 16 ++++++++++++----
9 files changed, 46 insertions(+), 35 deletions(-)
diff --git a/module/product/control.php b/module/product/control.php
index f19dad53df..595f290cc0 100644
--- a/module/product/control.php
+++ b/module/product/control.php
@@ -920,9 +920,7 @@ class product extends control
foreach($this->config->qa->menuList as $menu) $this->lang->navGroup->$menu = 'qa';
}
- $moduleGroup = zget($this->lang->navGroup, $module);
- $moduleGroup = in_array($moduleGroup, array('product', 'qa'))? $moduleGroup : 'project';
- $products = $moduleGroup == 'project' ? $this->product->getProducts($this->session->project) : $this->product->getList();
+ $products = $this->app->openApp == 'project' ? $this->product->getProducts($this->session->project) : $this->product->getList();
$this->view->link = $this->product->getProductLink($module, $method, $extra);
$this->view->productID = $productID;
@@ -930,10 +928,10 @@ class product extends control
$this->view->method = $method;
$this->view->extra = $extra;
$this->view->products = $products;
- $this->view->projectID = $moduleGroup == 'project' ? $this->session->project : 0;
+ $this->view->projectID = $this->app->openApp == 'project' ? $this->session->project : 0;
$this->view->programs = $this->loadModel('program')->getPairs(true);
$this->view->lines = $this->product->getLinePairs();
- $this->view->openApp = $moduleGroup;
+ $this->view->openApp = $this->app->openApp;
$this->display();
}
diff --git a/module/product/model.php b/module/product/model.php
index fb3ca82529..682db54b6a 100644
--- a/module/product/model.php
+++ b/module/product/model.php
@@ -70,10 +70,10 @@ class productModel extends model
*/
public function select($products, $productID, $currentModule, $currentMethod, $extra = '', $branch = 0, $module = 0, $moduleType = '')
{
- $isProjectBug = isset($products[0]) ? true : false;
+ $isProject = ($this->app->openApp == 'project' and strpos('bug,testcase,testtask', $this->app->rawMethod) !== false and isset($products[0])) ? true : false;
$this->app->loadLang('product');
- if(!$isProjectBug and !$productID)
+ if(!$isProject and !$productID)
{
unset($this->lang->product->menu->settings['subMenu']->branch);
return;
@@ -82,7 +82,9 @@ class productModel extends model
setCookie("lastProduct", $productID, $this->config->cookieLife, $this->config->webRoot, '', false, true);
if($productID) $currentProduct = $this->getById($productID);
- if($isProjectBug and !$productID)
+
+ if($isProject) $extra = $this->session->project;
+ if($isProject and !$productID)
{
$currentProduct = new stdclass();
$currentProduct->name = $products[$productID];
@@ -93,7 +95,7 @@ class productModel extends model
$output = '';
if(!empty($products))
{
- $dropMenuLink = helper::createLink($isProjectBug ? 'bug' : 'product', 'ajaxGetDropMenu', "objectID=$productID&module=$currentModule&method=$currentMethod&extra=$extra");
+ $dropMenuLink = helper::createLink($isProject ? 'bug' : 'product', 'ajaxGetDropMenu', "objectID=$productID&module=$currentModule&method=$currentMethod&extra=$extra");
$output = "
";
@@ -1522,7 +1524,7 @@ class productModel extends model
public function getProductLink($module, $method, $extra, $branch = false)
{
$link = '';
- if(strpos('programplan,product,roadmap,bug,testcase,testtask,story,qa,testsuite,testreport,build,projectrelease,projectstory', $module) !== false)
+ if(strpos('programplan,product,roadmap,bug,testcase,testtask,story,qa,testsuite,testreport,build,projectrelease,projectstory', ',' . $module . ',') !== false)
{
if($module == 'product' && $method == 'project')
{
@@ -1583,6 +1585,10 @@ class productModel extends model
{
return helper::createLink('design', 'browse', "productID=%s");
}
+ elseif($module == 'project')
+ {
+ return helper::createLink('project', $method, "projectID=$extra&productID=%s");
+ }
return $link;
}
diff --git a/module/product/view/ajaxgetdropmenu.html.php b/module/product/view/ajaxgetdropmenu.html.php
index f63a46f97b..6a5d10b94b 100644
--- a/module/product/view/ajaxgetdropmenu.html.php
+++ b/module/product/view/ajaxgetdropmenu.html.php
@@ -20,12 +20,6 @@ $myProductsHtml = '';
$normalProductsHtml = '';
$closedProductsHtml = '';
-if($this->app->openApp == 'project' and $this->app->rawModule == 'testcase')
-{
- $linkHtml = $this->product->setParamsForLink($module, $link, $projectID, 0);
- $myProductsHtml .= html::a($linkHtml, $this->lang->product->all, '', "class='text-important' title='{$this->lang->product->all}' data-key='" . zget($productsPinYin, $this->lang->product->all, '') . "' data-app='project'");
-}
-
foreach($products as $product)
{
$selected = $product->id == $productID ? 'selected' : '';
diff --git a/module/project/control.php b/module/project/control.php
index b679476429..00990d11c4 100644
--- a/module/project/control.php
+++ b/module/project/control.php
@@ -757,6 +757,10 @@ class project extends control
*/
public function testcase($projectID = 0, $productID = 0, $branch = 0, $browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
+ $this->loadModel('product');
+ $products = array('0' => $this->lang->product->all) + $this->project->getProducts($projectID, false);
+ $this->lang->modulePageNav = $this->product->select($products, $productID, 'project', 'testcase', '', $branch);
+
echo $this->fetch('testcase', 'browse', "productID=$productID&branch=$branch&browseType=$browseType¶m=$param&orderBy=$orderBy&recTotal=$orderBy&recPerPage=$recPerPage&pageID=$pageID&projectID=$projectID");
}
diff --git a/module/story/control.php b/module/story/control.php
index 95ac801a0d..3831fe3f94 100644
--- a/module/story/control.php
+++ b/module/story/control.php
@@ -1465,6 +1465,8 @@ class story extends control
if($this->app->openApp == 'project')
{
$this->loadModel('project')->setMenu($this->session->project);
+ $this->app->rawModule = 'qa';
+ $this->lang->project->menu->qa['subMenu']->testcase['subModule'] = 'story';
}
else
{
diff --git a/module/testcase/control.php b/module/testcase/control.php
index 3c3f60f5bb..b504f20087 100644
--- a/module/testcase/control.php
+++ b/module/testcase/control.php
@@ -567,7 +567,7 @@ class testcase extends control
if($isLibCase)
{
$libraries = $this->loadModel('caselib')->getLibraries();
- $this->caselib->setLibMenu($libraries, $case->lib);
+ $this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($this->session->project) : $this->caselib->setLibMenu($libraries, $case->lib);
$this->view->title = "CASE #$case->id $case->title - " . $libraries[$case->lib];
$this->view->position[] = html::a($this->createLink('caselib', 'browse', "libID=$case->lib"), $libraries[$case->lib]);
@@ -577,7 +577,7 @@ class testcase extends control
else
{
$productID = $case->product;
- $this->testcase->setMenu($this->products, $productID, $case->branch);
+ $this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($this->session->project) : $this->testcase->setMenu($this->products, $productID, $case->branch);
$this->view->title = "CASE #$case->id $case->title - " . $this->products[$productID];
$this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID"), $this->products[$productID]);
@@ -673,7 +673,7 @@ class testcase extends control
if($isLibCase)
{
$libraries = $this->loadModel('caselib')->getLibraries();
- $this->caselib->setLibMenu($libraries, $case->lib);
+ $this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($this->session->project) : $this->caselib->setLibMenu($libraries, $case->lib);
$title = "CASE #$case->id $case->title - " . $libraries[$case->lib];
$position[] = html::a($this->createLink('caselib', 'browse', "libID=$case->lib"), $libraries[$case->lib]);
@@ -1538,7 +1538,7 @@ class testcase extends control
die(js::reload('parent'));
}
- $this->testcase->setMenu($this->products, $productID, $branch);
+ $this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($this->session->project) : $this->testcase->setMenu($this->products, $productID, $branch);
$libraries = $this->loadModel('caselib')->getLibraries();
if(empty($libraries))
diff --git a/module/testcase/model.php b/module/testcase/model.php
index 026eb169e9..b7bc886d63 100644
--- a/module/testcase/model.php
+++ b/module/testcase/model.php
@@ -143,7 +143,7 @@ class testcaseModel extends model
$data[$i] = new stdclass();
$data[$i]->product = $productID;
- if($this->config->systemMode == 'new' && $this->lang->navGroup->testcase == 'project') $data[$i]->project = $this->session->project;
+ if($this->config->systemMode == 'new' && $this->app->openApp == 'project') $data[$i]->project = $this->session->project;
$data[$i]->branch = $cases->branch[$i];
$data[$i]->module = $cases->module[$i];
$data[$i]->type = $cases->type[$i];
@@ -224,7 +224,7 @@ class testcaseModel extends model
return $this->dao->select('t1.*, t2.title as storyTitle')->from(TABLE_CASE)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id')
->where('t1.product')->eq((int)$productID)
- ->beginIF($this->lang->navGroup->testcase != 'qa')->andWhere('t1.project')->eq($this->session->project)->fi()
+ ->beginIF($this->app->openApp = 'project')->andWhere('t1.project')->eq($this->session->project)->fi()
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi()
->beginIF($browseType == 'wait')->andWhere('t1.status')->eq($browseType)->fi()
@@ -330,7 +330,7 @@ class testcaseModel extends model
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id')
->leftJoin(TABLE_SUITECASE)->alias('t3')->on('t1.id=t3.case')
->where('t1.product')->eq((int)$productID)
- ->beginIF($this->lang->navGroup->testcase != 'qa')->andWhere('t1.project')->eq($this->session->project)->fi()
+ ->beginIF($this->app->openApp == 'project')->andWhere('t1.project')->eq($this->session->project)->fi()
->andWhere('t3.suite')->eq((int)$suiteID)
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi()
@@ -1201,7 +1201,7 @@ class testcaseModel extends model
}
else
{
- if($this->config->systemMode == 'new' && $this->lang->navGroup->testcase != 'qa') $caseData->project = $this->session->project;
+ if($this->config->systemMode == 'new' && $this->app->openApp == 'project') $caseData->project = $this->session->project;
$caseData->version = 1;
$caseData->openedBy = $this->app->user->account;
$caseData->openedDate = $now;
@@ -1317,12 +1317,12 @@ class testcaseModel extends model
}
/* If under the project module, the cases is imported need linking to the project. */
- if($this->lang->navGroup->testcase != 'qa')
+ if($this->app->openApp == 'project')
{
$lastOrder = (int)$this->dao->select('*')->from(TABLE_PROJECTCASE)->where('project')->eq($this->session->project)->orderBy('order_desc')->limit(1)->fetch('order');
$this->dao->insert(TABLE_PROJECTCASE)
- ->set('project')->eq($case->project)
+ ->set('project')->eq($this->session->project)
->set('product')->eq($case->product)
->set('case')->eq($caseID)
->set('version')->eq($case->version)
@@ -1358,8 +1358,8 @@ class testcaseModel extends model
*/
public function buildSearchForm($productID, $products, $queryID, $actionURL)
{
- $product = ($this->app->openApp == 'project' and empty($productID)) ? $products : array($productID => $products[$productID]);
- $this->config->testcase->search['params']['product']['values'] = $product + array('all' => $this->lang->testcase->allProduct);
+ $product = ($this->app->openApp == 'project' and empty($productID)) ? $products : array($productID => $products[$productID]) + array('all' => $this->lang->testcase->allProduct);
+ $this->config->testcase->search['params']['product']['values'] = $product;
$module = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0);
if(!$productID)
diff --git a/module/testcase/view/batchedit.html.php b/module/testcase/view/batchedit.html.php
index 3eb4d7942c..08c74c303a 100644
--- a/module/testcase/view/batchedit.html.php
+++ b/module/testcase/view/batchedit.html.php
@@ -67,10 +67,9 @@
lib)
{
- $product = $this->product->getByID($cases[$caseID]->product);
-
+ $product = $this->product->getByID($cases[$caseID]->product);
$branches = $product->type == 'normal' ? array('' => '') : $this->loadModel('branch')->getPairs($product->id);
if($product->type != 'normal')
{
diff --git a/module/testtask/control.php b/module/testtask/control.php
index b7d1f0550f..0ae2b7cc8b 100644
--- a/module/testtask/control.php
+++ b/module/testtask/control.php
@@ -38,7 +38,7 @@ class testtask 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->app->openApp == 'qa')
{
$this->app->loadConfig('qa');
@@ -144,6 +144,7 @@ class testtask extends control
if($this->app->openApp == 'project')
{
$this->loadModel('project')->setMenu($this->session->project);
+ $this->lang->modulePageNav = $this->product->select($this->products, $productID, 'testtask', 'browseUnits');
}
else
{
@@ -1097,7 +1098,7 @@ class testtask extends control
/* The case of tasks of qa. */
if($productID)
{
- $this->loadModel('qa')->setMenu($this->products, $productID, $taskID);
+ $this->app->openApp == 'project' ? $this->loadModel('project')->setMenu($this->session->project) : $this->loadModel('qa')->setMenu($this->products, $productID, $taskID);
$this->view->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($productID, 'case');
$cases = $this->dao->select('*')->from(TABLE_CASE)->where('id')->in($caseIDList)->fetchAll('id');
@@ -1105,8 +1106,15 @@ class testtask extends control
/* The case of my. */
else
{
- $this->lang->testtask->menu = $this->lang->my->menu->work;
- $this->lang->my->menu->work['subModule'] = 'testtask';
+ if($this->app->openApp == 'project')
+ {
+ $this->loadModel('project')->setMenu($this->session->project);
+ }
+ else
+ {
+ $this->lang->testtask->menu = $this->lang->my->menu->work;
+ $this->lang->my->menu->work['subModule'] = 'testtask';
+ }
$this->view->title = $this->lang->testtask->batchRun;
From 0849de155e65a9f4daf6f94e263990f6adacc33a Mon Sep 17 00:00:00 2001
From: hufangzhou <746775970@qq.com>
Date: Wed, 24 Mar 2021 14:18:56 +0800
Subject: [PATCH 2/2] * Delete the project testcase page.
---
module/project/view/testcase.html.php | 243 --------------------------
1 file changed, 243 deletions(-)
delete mode 100644 module/project/view/testcase.html.php
diff --git a/module/project/view/testcase.html.php b/module/project/view/testcase.html.php
deleted file mode 100644
index ab047c062f..0000000000
--- a/module/project/view/testcase.html.php
+++ /dev/null
@@ -1,243 +0,0 @@
-
- * @package project
- * @version $Id: testcase.html.php 5108 2013-07-12 01:59:04Z chencongzhi520@gmail.com $
- * @link http://www.zentao.net
- */
-?>
-session->caseBrowseType == 'bysearch') ? 'all' : $this->session->caseBrowseType);
-js::set('moduleID' , $moduleID);
-js::set('confirmDelete', $lang->testcase->confirmDelete);
-js::set('batchDelete', $lang->testcase->confirmBatchDelete);
-js::set('productID', $productID);
-js::set('branch', $branch);
-js::set('suiteID', $suiteID);
-?>
-
-
-
-
'>
-
-
-
-
- testcase->noCase;?>
-
-
- createLink('testcase', 'create', "productID=$productID&branch=$branch&moduleID=$initModule"), " " . $lang->testcase->create, '', "class='btn btn-info'");?>
-
-
-
-
- moduleName . ucfirst($this->methodName);
- $useDatatable = (isset($config->datatable->$datatableId->mode) and $config->datatable->$datatableId->mode == 'datatable');
- ?>
-