From 496729984f3f622080c5dbfd2de068c74d9b9636 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 27 Aug 2021 13:45:01 +0800 Subject: [PATCH 1/8] * Modify the test report to report an error. --- lib/base/front/front.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/base/front/front.class.php b/lib/base/front/front.class.php index a5b6c7d305..a45a9563e9 100644 --- a/lib/base/front/front.class.php +++ b/lib/base/front/front.class.php @@ -489,7 +489,7 @@ class baseHTML { if(helper::inOnlyBodyMode()) return false; - global $lang, $app; + global $lang, $app, $config; if(empty($label)) { global $lang, $config; From 268eb0f16144e5fa534541b8c0db8b993e1c8d29 Mon Sep 17 00:00:00 2001 From: sgm0422 <976204163@qq.com> Date: Fri, 27 Aug 2021 13:52:59 +0800 Subject: [PATCH 2/8] * Finish task #41736. --- module/story/model.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index 4fe5b9df0a..6619845111 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1635,9 +1635,6 @@ class storyModel extends model if(empty($oldPlanID)) $story->plan = $planID; if($oldStory->branch) $story->plan = $planID; - /* Append the plan id to plan field if product is multi and story is all branch. */ - if($this->session->currentProductType != 'normal' and empty($story->branch)) $story->plan .= ",$planID"; - /* Change stage. */ if($planID and $oldStory->stage == 'wait') $story->stage = 'planned'; if($planID and $this->session->currentProductType != 'normal' and $oldStory->branch == 0) From b6e0911e300b89c40f2b76383516c64eb0ae03a6 Mon Sep 17 00:00:00 2001 From: zenggang Date: Fri, 27 Aug 2021 13:55:59 +0800 Subject: [PATCH 3/8] + Finish task#41824 --- api/v1/entries/testcase.php | 33 +++++++++++++++++++++++++++++++++ api/v1/entries/testcases.php | 26 ++++++++++++++++++++++++++ config/routes.php | 3 +++ module/testcase/control.php | 8 +++++++- module/testcase/model.php | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 api/v1/entries/testcase.php create mode 100644 api/v1/entries/testcases.php diff --git a/api/v1/entries/testcase.php b/api/v1/entries/testcase.php new file mode 100644 index 0000000000..7d0a7e8f42 --- /dev/null +++ b/api/v1/entries/testcase.php @@ -0,0 +1,33 @@ +loadController('testcase', 'view'); + $control->view($testcaseID, $this->param('version', 0)); + + $data = $this->getData(); + if(!$data or (isset($data->message) and $data->message == '404 Not found')) return $this->send404(); + if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); + if(!isset($data->case)) $this->sendError(400, 'error'); + + $this->send(200, $this->format($data->case, 'openedDate:time,lastEditedDate:time,lastRunDate:time')); + } + + public function delete($testcaseID) + { + $control = $this->loadController('testcase', 'delete'); + $control->delete($testcaseID, 'yes'); + + $this->getData(); + + $this->sendSuccess(200, 'success'); + } +} diff --git a/api/v1/entries/testcases.php b/api/v1/entries/testcases.php new file mode 100644 index 0000000000..9078ab60c6 --- /dev/null +++ b/api/v1/entries/testcases.php @@ -0,0 +1,26 @@ +app->loadClass('pager', $static = true); + $pager = pager::init($this->param('total', 0), $this->param('limit', 20), $this->param('page', 1)); + + $testcases = $this->loadModel('testcase')->getByStatus($this->param('productID', 0), $this->param('branch', ''), $this->param('type', 'all'), $this->param('status', 'all'), $this->param('moduleID', 0), $this->param('order', 'id_desc'), $pager, $this->param('auto', 'no')); + + $result = array(); + foreach($testcases as $testcase) + { + $result[] = $this->format($testcase, 'openedDate:time,lastEditedDate:time,lastRunDate:time'); + } + + return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'testcases' => $result)); + } +} diff --git a/config/routes.php b/config/routes.php index 99b2d4f67c..ac08ee509d 100644 --- a/config/routes.php +++ b/config/routes.php @@ -50,6 +50,9 @@ $routes['/issues/:issueID'] = 'issue'; $routes['/todos'] = 'todos'; $routes['/todos/:id'] = 'todo'; +$routes['/testcases'] = 'testcases'; +$routes['/testcases/:id'] = 'testcase'; + $routes['/projects/:projectID/testtasks'] = 'testtasks'; $routes['/testtasks'] = 'testtasks'; $routes['/testtasks/:id'] = 'testtask'; diff --git a/module/testcase/control.php b/module/testcase/control.php index 19eb265941..b6cd44016e 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -600,7 +600,11 @@ class testcase extends control { $caseID = (int)$caseID; $case = $this->testcase->getById($caseID, $version); - if(!$case) die(js::error($this->lang->notFound) . js::locate('back')); + if(!$case) + { + if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'message' => '404 Not found')); + die(js::error($this->lang->notFound) . js::locate('back')); + } if($case->auto == 'unit') { $this->lang->testcase->subMenu->testcase->feature['alias'] = ''; @@ -681,6 +685,7 @@ class testcase extends control $this->view->isLibCase = $isLibCase; $this->view->caseFails = $caseFails; + if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success', 'case' => $case)); $this->display(); } @@ -1017,6 +1022,7 @@ class testcase extends control } $locateLink = $this->session->caseList ? $this->session->caseList : inlink('browse', "productID={$case->product}"); + if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success')); die(js::locate($locateLink, 'parent')); } } diff --git a/module/testcase/model.php b/module/testcase/model.php index 18132e884b..c21a664a2c 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -571,6 +571,39 @@ class testcaseModel extends model ->orderBy($orderBy)->page($pager)->fetchAll(); } + /** + * Get cases by type + * + * @param int $productID + * @param int $branch + * @param string $type all|needconfirm + * @param string $status all|normal|blocked|investigate + * @param int $moduleID + * @param string $orderBy + * @param object $pager + * @param string $auto no|unit|skip + * @access public + * @return array + */ + public function getByStatus($productID = 0, $branch, $type = 'all', $status = 'all', $moduleID, $orderBy = 'id_desc', $pager, $auto = 'no') + { + $modules = $moduleID ? $this->loadModel('tree')->getAllChildId($moduleID) : '0'; + + $cases = $this->dao->select('t1.*, t2.title as storyTitlen')->from(TABLE_CASE)->alias('t1') + ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') + ->beginIF($productID)->where('t1.product')->eq((int) $productID)->fi() + ->beginIF($productID == 0)->where('t1.product')->in($this->app->user->view->products)->fi() + ->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi() + ->beginIF($modules)->andWhere('t1.module')->in($modules)->fi() + ->beginIF($type == 'needconfirm')->andWhere("t2.status = 'active'")->andWhere('t2.version > t1.storyVersion')->fi() + ->beginIF($status != 'all')->andWhere('t1.status')->eq($status)->fi() + ->beginIF($auto == 'unit')->andWhere('t1.auto')->eq('unit')->fi() + ->beginIF($auto != 'unit')->andWhere('t1.auto')->ne('unit')->fi() + ->andWhere('t1.deleted')->eq('0') + ->orderBy($orderBy)->page($pager)->fetchAll('id'); + return $this->appendData($cases); + } + /** * Get cases of a story. * From 77ef906b3910226aa5186137d8860db7c700c864 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 27 Aug 2021 14:36:27 +0800 Subject: [PATCH 4/8] * Set the session for the page's return link. --- module/my/control.php | 1 + module/program/control.php | 1 + module/testreport/control.php | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/module/my/control.php b/module/my/control.php index 95d1f5c1ac..da5da01193 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -402,6 +402,7 @@ class my extends control { $uri = $this->app->getURI(true); $this->session->set('testtaskList', $uri, 'qa'); + $this->session->set('reportList', $uri, 'qa'); $this->session->set('buildList', $uri, 'execution'); } diff --git a/module/program/control.php b/module/program/control.php index 6ce124db15..e7e252260d 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -70,6 +70,7 @@ class program extends control public function kanban() { $this->app->loadLang('release'); + $this->app->session->set('projectList', $this->app->getURI(true), 'project'); $this->view->title = $this->lang->program->kanban->common; $this->view->kanbanGroup = $this->program->getKanbanGroup(); diff --git a/module/testreport/control.php b/module/testreport/control.php index 58cd7b5497..754740ac3c 100644 --- a/module/testreport/control.php +++ b/module/testreport/control.php @@ -89,7 +89,6 @@ class testreport extends control public function browse($objectID = 0, $objectType = 'product', $extra = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { if(strpos('product|execution|project', $objectType) === false) die('Type Error!'); - $this->session->set('reportList', $this->app->getURI(true), $this->app->openApp); $objectID = $this->commonAction($objectID, $objectType); $object = $this->$objectType->getById($objectID); @@ -127,6 +126,8 @@ class testreport extends control if($param) $this->locate($this->createLink('testreport', 'create', $param)); } + $this->session->set('reportList', $this->app->getURI(true), $this->app->openApp); + $executions = array(); $tasks = array(); foreach($reports as $report) From 47f7d26b517ede02890482156b7e008c4132ee1d Mon Sep 17 00:00:00 2001 From: sgm0422 <976204163@qq.com> Date: Fri, 27 Aug 2021 14:36:51 +0800 Subject: [PATCH 5/8] * Remove unused code. --- module/job/view/create.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/job/view/create.html.php b/module/job/view/create.html.php index e7e0090ab5..99a6b1b54c 100644 --- a/module/job/view/create.html.php +++ b/module/job/view/create.html.php @@ -32,7 +32,7 @@ job->engine; ?> - +
job->engineList, '', "class='form-control chosen'"); ?>
From 501bb4afafba9e606524029a8169fb453a5b4e57 Mon Sep 17 00:00:00 2001 From: sgm0422 <976204163@qq.com> Date: Fri, 27 Aug 2021 14:46:44 +0800 Subject: [PATCH 6/8] * Finish task #41730. --- framework/control.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/control.class.php b/framework/control.class.php index fbff8c0488..eb79ef2e00 100644 --- a/framework/control.class.php +++ b/framework/control.class.php @@ -35,7 +35,7 @@ class control extends baseControl $this->app->setOpenApp(); - if(defined('IN_USE') or (defined('RUN_MODE') and RUN_MODE == 'api')) $this->setPreference(); + if(defined('IN_USE') or (defined('RUN_MODE') and RUN_MODE != 'api')) $this->setPreference(); if(!isset($this->config->bizVersion)) return false; From d5619ae6a50f083211e509025b518851dcab404e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Fri, 27 Aug 2021 14:53:20 +0800 Subject: [PATCH 7/8] * finish task #41528. --- framework/base/router.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/base/router.class.php b/framework/base/router.class.php index e49536f612..9049bb980b 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -612,9 +612,9 @@ class baseRouter if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https') $httpType = 'https'; if(isset($_SERVER['REQUEST_SCHEME']) and strtolower($_SERVER['REQUEST_SCHEME']) == 'https') $httpType = 'https'; - $httpHost = $_SERVER['HTTP_HOST']; - $isAPI = (defined('RUN_MODE') && RUN_MODE == 'api') || isset($_GET[$this->config->sessionVar]); - if(!$isAPI && strpos($this->server->http_referer, "$httpType://$httpHost") !== 0) $_FILES = $_POST = array(); + $httpHost = zget($_SERVER, 'HTTP_HOST', ''); + $apiMode = (defined('RUN_MODE') && RUN_MODE == 'api') || isset($_GET[$this->config->sessionVar]); + if(!$apiMode && (empty($httpHost) or strpos($this->server->http_referer, "$httpType://$httpHost") !== 0)) $_FILES = $_POST = array(); } $_FILES = validater::filterFiles(); From d5589f71571c11305269a8e83d085f7046668905 Mon Sep 17 00:00:00 2001 From: sgm0422 <976204163@qq.com> Date: Fri, 27 Aug 2021 15:01:55 +0800 Subject: [PATCH 8/8] * Finish task #41727. --- module/common/lang/de.php | 2 +- module/common/lang/en.php | 2 +- module/common/lang/fr.php | 2 +- module/common/lang/vi.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/module/common/lang/de.php b/module/common/lang/de.php index 97fb2c3b92..c40259ca43 100644 --- a/module/common/lang/de.php +++ b/module/common/lang/de.php @@ -270,7 +270,7 @@ $lang->lang = 'Sprache'; /* Theme style. */ $lang->theme = 'Theme'; $lang->themes['default'] = 'ZenTao Blau (Standard)'; -$lang->themes['blue'] = 'Blau'; +$lang->themes['blue'] = 'Young Blue'; $lang->themes['green'] = 'Grün'; $lang->themes['red'] = 'Rot'; $lang->themes['purple'] = 'Lila'; diff --git a/module/common/lang/en.php b/module/common/lang/en.php index a2ab8a9675..d1238f0a8b 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -307,7 +307,7 @@ $lang->lang = 'Language'; /* Theme style. */ $lang->theme = 'Theme'; $lang->themes['default'] = 'Default'; -$lang->themes['blue'] = 'Blue'; +$lang->themes['blue'] = 'Young Blue'; $lang->themes['green'] = 'Green'; $lang->themes['red'] = 'Red'; $lang->themes['purple'] = 'Purple'; diff --git a/module/common/lang/fr.php b/module/common/lang/fr.php index 4f382d5392..f07cec38e6 100644 --- a/module/common/lang/fr.php +++ b/module/common/lang/fr.php @@ -270,7 +270,7 @@ $lang->lang = 'Langue'; /* Theme style. */ $lang->theme = 'Theme'; $lang->themes['default'] = 'Default'; -$lang->themes['blue'] = 'Blue'; +$lang->themes['blue'] = 'Young Blue'; $lang->themes['green'] = 'Green'; $lang->themes['red'] = 'Red'; $lang->themes['purple'] = 'Purple'; diff --git a/module/common/lang/vi.php b/module/common/lang/vi.php index bf9cd0a86c..127ead28bb 100644 --- a/module/common/lang/vi.php +++ b/module/common/lang/vi.php @@ -270,7 +270,7 @@ $lang->lang = 'Ngôn ngữ'; /* Theme style. */ $lang->theme = 'Theme'; $lang->themes['default'] = 'Mặc định'; -$lang->themes['blue'] = 'Blue'; +$lang->themes['blue'] = 'Young Blue'; $lang->themes['green'] = 'Green'; $lang->themes['red'] = 'Red'; $lang->themes['purple'] = 'Purple';