diff --git a/lib/zin/wg/mainnavbar/v1.php b/lib/zin/wg/mainnavbar/v1.php index 39d1debcd0..de1533595f 100644 --- a/lib/zin/wg/mainnavbar/v1.php +++ b/lib/zin/wg/mainnavbar/v1.php @@ -256,7 +256,8 @@ class mainNavbar extends nav if(in_array($moduleName, (isset($config->hasSwitcherModules) && is_array($config->hasSwitcherModules)) ? $config->hasSwitcherModules : array()) || in_array("$moduleName-$methodName", (isset($config->hasSwitcherMethods) && is_array($config->hasSwitcherMethods)) ? $config->hasSwitcherMethods : array())) { $ajaxMethod = 'ajaxSwitcherMenu'; - if($moduleName == 'testcase' && $app->tab == 'project') $moduleName = 'project'; + if($moduleName == 'testcase' && $app->tab == 'project') $moduleName = 'project'; + if($moduleName == 'testcase' && $app->tab == 'execution') $moduleName = 'execution'; if($moduleName == 'testtask') $ajaxMethod = 'ajaxGetDropMenu'; $fetcher = createLink($moduleName, $ajaxMethod, data('switcherParams')); return array(zui::dropmenu diff --git a/module/execution/control.php b/module/execution/control.php index 32fc4cb4cb..0f55c96f48 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -3352,10 +3352,14 @@ class execution extends control */ public function ajaxSwitcherMenu(int $executionID, int $productID, string $currentMethod = '') { - $this->view->link = helper::createLink('execution', $currentMethod, "executionID=$executionID&productID={id}"); - $this->view->productID = $productID; - $this->view->products = $this->loadModel('product')->getProducts($executionID); - $this->view->executionID = $executionID; + $link = helper::createLink('execution', $currentMethod, "executionID=$executionID&productID={id}"); + if($currentMethod == 'zerocase') $link = helper::createLink('testcase', 'zerocase', "productID={id}&branch=0&orderBy=id_desc&objectID=$executionID"); + + $this->view->link = $link; + $this->view->productID = $productID; + $this->view->products = $this->loadModel('product')->getProducts($executionID); + $this->view->executionID = $executionID; + $this->view->currentMethod = $currentMethod; $this->display(); } diff --git a/module/execution/ui/ajaxswitchermenu.html.php b/module/execution/ui/ajaxswitchermenu.html.php index 05c31ef277..f0b1abe2e2 100644 --- a/module/execution/ui/ajaxswitchermenu.html.php +++ b/module/execution/ui/ajaxswitchermenu.html.php @@ -17,13 +17,14 @@ namespace zin; $data = array('normal' => array(), 'closed' => array()); -if(count($products) > 1) +if(count($products) > 1 && $currentMethod != 'zerocase') { $defaultItem = array(); - $defaultItem['id'] = 0; - $defaultItem['text'] = $lang->product->all; - $defaultItem['active'] = $productID == 0; - $defaultItem['type'] = 'product'; + $defaultItem['id'] = 0; + $defaultItem['text'] = $lang->product->all; + $defaultItem['active'] = $productID == 0; + $defaultItem['type'] = 'product'; + $defaultItem['data-app'] = $app->tab; $data['normal'][] = $defaultItem; } @@ -31,11 +32,12 @@ if(count($products) > 1) foreach($products as $product) { $item = array(); - $item['id'] = $product->id; - $item['text'] = $product->name; - $item['active'] = $productID == $product->id; - $item['type'] = 'product'; - $item['keys'] = zget(common::convert2Pinyin(array($product->name)), $product->name, ''); + $item['id'] = $product->id; + $item['text'] = $product->name; + $item['active'] = $productID == $product->id; + $item['type'] = 'product'; + $item['keys'] = zget(common::convert2Pinyin(array($product->name)), $product->name, ''); + $item['data-app'] = $app->tab; if($product->status == 'closed') { diff --git a/module/testcase/control.php b/module/testcase/control.php index 8bfa3ed5fc..eb2c561873 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -194,6 +194,18 @@ class testcase extends control $this->view->switcherParams = "projectID={$this->session->project}&productID={$productID}¤tMethod=zerocase"; $this->view->switcherText = zget($productPairs, $productID, $this->lang->product->all); } + if($this->app->tab == 'execution') + { + $executionID = $objectID; + $products = $this->product->getProducts($executionID, 'all', '', false); + $productID = $this->product->checkAccess($productID, $products); + $this->config->hasSwitcherMethods[] = 'testcase-zerocase'; + + $productPairs = $this->loadModel('project')->getMultiLinkedProducts($executionID); + $this->view->executionID = $executionID; + $this->view->switcherParams = "executioID={$executionID}&productID={$productID}¤tMethod=zerocase"; + $this->view->switcherText = zget($productPairs, $productID, $this->lang->product->all); + } else { $products = $this->product->getPairs(); diff --git a/module/testcase/model.php b/module/testcase/model.php index e4dc4cd1bc..badb885fb1 100755 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -348,7 +348,7 @@ class testcaseModel extends model $caseQuery .= ')'; /* Search criteria under compatible project. */ - $sql = $this->dao->select('*')->from(TABLE_CASE)->alias('t1'); + $sql = $this->dao->select('t1.*')->from(TABLE_CASE)->alias('t1'); if($this->app->tab == 'project') $sql->leftJoin(TABLE_PROJECTCASE)->alias('t2')->on('t1.id = t2.case'); return $sql->where($caseQuery) ->beginIF($this->app->tab == 'project' && $this->config->systemMode == 'ALM')->andWhere('t2.project')->eq($this->session->project)->fi() diff --git a/module/testcase/ui/header.html.php b/module/testcase/ui/header.html.php index 4717baafae..ccdd94bc4e 100644 --- a/module/testcase/ui/header.html.php +++ b/module/testcase/ui/header.html.php @@ -105,9 +105,13 @@ if($canDisplaySuite) $linkParams = $projectParam . "productID=$productID&branch=$branch&browseType={key}¶m=0&caseType={$caseType}"; $browseLink = createLink('testcase', 'browse', $linkParams); if($app->tab == 'project') $browseLink = createLink('project', 'testcase', $linkParams); +if($app->tab == 'execution') $browseLink = createLink('execution', 'testcase', "executionID={$executionID}&productID=$productID&branch=$branch&browseType={key}"); if($rawMethod == 'browseunits') $browseLink = createLink('testtask', 'browseUnits', "productID=$productID&browseType={key}"); $queryMenuLink = createLink('testcase', 'browse', $projectParam . "productID=$productID&branch=$branch&browseType=bySearch¶m={queryID}"); +$objectID = 0; +if($app->tab == 'project') $objectID = $projectID; +if($app->tab == 'execution') $objectID = $executionID; featureBar ( set::linkParams($rawMethod == 'zerocase' || $rawMethod == 'browseunits' ? null : $linkParams), @@ -145,7 +149,7 @@ featureBar set::className('nav-item'), a ( - set::href($this->createLink('testcase', 'zeroCase', "productID=$productID&branch=$branch&orderBy=id_desc&projectID=" . ($isProjectApp ? $this->session->project : 0))), + set::href($this->createLink('testcase', 'zeroCase', "productID=$productID&branch=$branch&orderBy=id_desc&objectID=$objectID")), set('data-app', $app->tab), set('data-id', 'zerocaseTab'), set('class', $rawMethod == 'zerocase' ? 'active' : ''), diff --git a/module/testcase/ui/zerocase.html.php b/module/testcase/ui/zerocase.html.php index c8c7132153..879482ba5b 100644 --- a/module/testcase/ui/zerocase.html.php +++ b/module/testcase/ui/zerocase.html.php @@ -41,7 +41,7 @@ foreach($lang->story->stageList as $key => $stage) $stageItems[] = array('text' $footToolbar = $canBatchAction ? array('items' => array ( - array('text' => $lang->edit, 'className' => 'batch-btn' . ($canBatchEdit ? '': 'hidden'), 'data-url' => createLink('story', 'batchEdit', "productID={$productID}&projectID={$projectID}&branch={$branch}")), + array('text' => $lang->edit, 'className' => 'batch-btn' . ($canBatchEdit ? '': 'hidden'), 'data-url' => createLink('story', 'batchEdit', "productID={$productID}&objectID={$objectID}&branch={$branch}")), array('text' => $lang->story->review, 'className' => ($canBatchReview ? '' : 'hidden') , 'caret' => 'up', 'items' => $reviewItems, 'data-toggle' => 'dropdown', 'data-placement' => 'top-start'), array('text' => $lang->story->stageAB, 'className' => ($canBatchChangeStage ? '' : 'hidden'), 'caret' => 'up', 'items' => $stageItems, 'data-toggle' => 'dropdown', 'data-placement' => 'top-start'), ), 'btnProps' => array('size' => 'sm', 'btnType' => 'secondary')) : null;