* [bug#58994,done,1.5h] show tips if no product/execution in doc block.

This commit is contained in:
zhouxin
2025-01-13 14:47:10 +08:00
committed by 宋辰轩
parent 534687d6b1
commit ce3311e80d
10 changed files with 54 additions and 8 deletions
+2 -1
View File
@@ -109,7 +109,8 @@ class bug extends control
*/
public function browse(int $productID = 0, string $branch = '', string $browseType = '', int $param = 0, string $orderBy = '', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $from = 'bug', int $blockID = 0)
{
if($from == 'doc' && empty($this->products)) $this->locate($this->createLink('product', 'create'));
$this->app->loadLang('doc');
if($from == 'doc' && empty($this->products)) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noProduct));
/* 把访问的产品ID等状态信息保存到session和cookie中。*/
/* Save the product id user last visited to session and cookie. */
+9 -1
View File
@@ -146,7 +146,15 @@ class caselib extends control
public function browse(int $libID = 0, string $browseType = 'all', int $param = 0, string $orderBy = 'id_desc', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, string $from = 'qa', int $blockID = 0)
{
$libraries = $this->caselib->getLibraries();
if(empty($libraries)) $this->locate(inlink('create'));
if(empty($libraries))
{
if($from == 'doc')
{
$this->app->loadLang('doc');
return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noCaselib));
}
$this->locate(inlink('create'));
}
/* Set browse type. */
$browseType = strtolower($browseType);
+5
View File
@@ -260,6 +260,11 @@ $lang->doc->emptyError = 'Not empty';
$lang->doc->caselib = 'Case Library';
$lang->doc->customSearch = 'Custom Search';
$lang->doc->tips = new stdclass();
$lang->doc->tips->noProduct = 'No product, please create first';
$lang->doc->tips->noExecution = 'No execution, please create first';
$lang->doc->tips->noCaselib = 'No caselib, please create first';
$lang->doc->zentaoList = array();
$lang->doc->zentaoList['story'] = $lang->SRCommon;
$lang->doc->zentaoList['productStory'] = $lang->productCommon . $lang->SRCommon;
+5
View File
@@ -261,6 +261,11 @@ $lang->doc->emptyError = 'Not empty';
$lang->doc->caselib = 'Case Library';
$lang->doc->customSearch = 'Custom Search';
$lang->doc->tips = new stdclass();
$lang->doc->tips->noProduct = 'No product, please create first';
$lang->doc->tips->noExecution = 'No execution, please create first';
$lang->doc->tips->noCaselib = 'No caselib, please create first';
$lang->doc->zentaoList = array();
$lang->doc->zentaoList['story'] = $lang->SRCommon;
$lang->doc->zentaoList['productStory'] = $lang->productCommon . $lang->SRCommon;
+5
View File
@@ -260,6 +260,11 @@ $lang->doc->emptyError = 'Not empty';
$lang->doc->caselib = 'Case Library';
$lang->doc->customSearch = 'Custom Search';
$lang->doc->tips = new stdclass();
$lang->doc->tips->noProduct = 'No product, please create first';
$lang->doc->tips->noExecution = 'No execution, please create first';
$lang->doc->tips->noCaselib = 'No caselib, please create first';
$lang->doc->zentaoList = array();
$lang->doc->zentaoList['story'] = $lang->SRCommon;
$lang->doc->zentaoList['productStory'] = $lang->productCommon . $lang->SRCommon;
+5
View File
@@ -261,6 +261,11 @@ $lang->doc->emptyError = '不能为空';
$lang->doc->caselib = '用例库';
$lang->doc->customSearch = '自定义搜索';
$lang->doc->tips = new stdclass();
$lang->doc->tips->noProduct = '暂时没有产品,请先创建';
$lang->doc->tips->noExecution = '暂时没有执行,请先创建';
$lang->doc->tips->noCaselib = '暂时没有用例库,请先创建';
$lang->doc->zentaoList = array();
$lang->doc->zentaoList['story'] = $lang->SRCommon;
$lang->doc->zentaoList['productStory'] = $lang->productCommon . $lang->SRCommon;
+7
View File
@@ -50,6 +50,7 @@ class execution extends control
if(in_array($this->methodName, $skipCreateStep)) return false;
if($this->executions || $this->methodName == 'index' || $this->methodName == 'create' || $this->app->getViewType() == 'mhtml') return false;
if($this->app->tab == 'project' && in_array($this->app->rawMethod, array('linkstory', 'importplanstories', 'unlinkstory', 'export'))) return false;
if(($this->methodName == 'story' || $this->methodName == 'task') && $this->app->tab == 'doc') return false;
$this->locate($this->createLink('execution', 'create'));
}
@@ -120,6 +121,9 @@ class execution extends control
*/
public function task(int $executionID = 0, string $status = 'unclosed', int $param = 0, string $orderBy = '', int $recTotal = 0, int $recPerPage = 100, int $pageID = 1, string $from = 'execution', int $blockID = 0)
{
$this->app->loadLang('doc');
if($from == 'doc' && empty($this->executions)) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noExecution));
if(!isset($_SESSION['limitedExecutions'])) $this->execution->getLimitedExecution();
/* Save to session. */
@@ -453,6 +457,9 @@ class execution extends control
$this->loadModel('requirement');
$this->loadModel('epic');
$this->loadModel('product');
$this->app->loadLang('doc');
if($from == 'doc' && empty($this->executions)) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noExecution));
/* Change for requirement story title. */
$this->lang->story->linkStory = str_replace($this->lang->URCommon, $this->lang->SRCommon, $this->lang->story->linkStory);
+4 -1
View File
@@ -32,7 +32,7 @@ class product extends control
/* Get all products, if no, goto the create page. */
$this->products = $this->product->getPairs('all', 0, '', 'all');
if($this->product->checkLocateCreate($this->products)) $this->locate($this->createLink('product', 'create'));
if($this->product->checkLocateCreate($this->products) && $this->app->tab != 'doc') $this->locate($this->createLink('product', 'create'));
$this->view->products = $this->products;
}
@@ -126,6 +126,9 @@ class product extends control
*/
public function browse(int $productID = 0, string $branch = 'all', string $browseType = '', int $param = 0, string $storyType = 'story', string $orderBy = '', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1, int $projectID = 0, string $from = 'product', int $blockID = 0)
{
$this->app->loadLang('doc');
if($from == 'doc' && empty($this->products)) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noProduct));
$browseType = strtolower($browseType);
/* Pre process. */
+10 -4
View File
@@ -18,13 +18,16 @@ class productplan extends control
*
* @param int $productID
* @param int $branch
* @param bool $isFromDoc
* @access public
* @return void
*/
public function commonAction(int $productID, int $branch = 0)
public function commonAction(int $productID, int $branch = 0, bool $isFromDoc = false)
{
$this->app->loadLang('doc');
$product = $this->loadModel('product')->getById($productID);
$products = $this->product->getPairs('all', 0, '', 'all');
if(empty($products) && $isFromDoc) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noProduct));
if(empty($product)) $this->locate($this->createLink('product', 'create'));
$this->product->checkAccess($productID, $products);
@@ -314,7 +317,7 @@ class productplan extends control
$viewType = $this->cookie->viewType ? $this->cookie->viewType : 'list';
$this->commonAction($productID, (int)$branch);
$this->commonAction($productID, (int)$branch, $from == 'doc' ? true : false);
$product = $this->view->product;
$productName = empty($product) ? '' : $product->name;
@@ -922,8 +925,9 @@ class productplan extends control
*/
public function story(int $productID = 0, int $planID = 0, int $blockID = 0, string $orderBy = 'order', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1)
{
$this->app->loadLang('doc');
$products = $this->loadModel('product')->getPairs();
if($this->app->tab == 'doc' && empty($products)) $this->locate($this->createLink('product', 'create'));
if($this->app->tab == 'doc' && empty($products)) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noProduct));
if(empty($productID) && empty($this->session->product)) $productID = (int)key($products);
@@ -981,8 +985,10 @@ class productplan extends control
*/
public function bug(int $productID = 0, int $planID = 0, int $blockID = 0, string $orderBy = 'id_desc', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1)
{
$this->app->loadLang('doc');
$products = $this->loadModel('product')->getPairs();
if($this->app->tab == 'doc' && empty($products)) $this->locate($this->createLink('product', 'create'));
if($this->app->tab == 'doc' && empty($products)) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noProduct));
if(empty($productID) && empty($this->session->product)) $productID = (int)key($products);
$idList = '';
+2 -1
View File
@@ -91,7 +91,8 @@ class testcase extends control
{
$this->testcaseZen->checkProducts(); // 如果不存在产品,则跳转到产品创建页面。
if($from == 'doc' && empty($this->products)) $this->locate($this->createLink('product', 'create'));
$this->app->loadLang('doc');
if($from == 'doc' && empty($this->products)) return $this->send(array('result' => 'fail', 'message' => $this->lang->doc->tips->noProduct));
/* 把访问的产品ID等状态信息保存到session和cookie中。*/
/* Save the product id user last visited to session and cookie. */