diff --git a/module/bug/control.php b/module/bug/control.php
index 1009890644..d0a4d0858b 100644
--- a/module/bug/control.php
+++ b/module/bug/control.php
@@ -47,21 +47,21 @@ class bug extends control
$this->loadModel('task');
$this->loadModel('qa');
- /* Set bug menu group. */
- $this->projectID = isset($_GET['PRJ']) ? $_GET['PRJ'] : 0;
- if(!$this->projectID)
+ /* Get product data. */
+ $projectID = 0;
+ if($this->app->openApp == 'project')
{
+ $projectID = $this->session->project;
+ $products = $this->loadModel('project')->getProducts($projectID, false);
+ }
+ if($this->app->openApp == 'qa')
+ {
+ $products = $this->product->getPairs();
$this->app->loadConfig('qa');
foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
}
- else
- {
- $this->lang->bug->menu = $this->lang->projectQa->menu;
- $this->lang->bug->subMenu = $this->lang->projectQa->subMenu;
- }
-
- $this->view->products = $this->products = $this->product->getProductPairsByProject($this->projectID);
- if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'fromModule=bug&moduleGroup=' . $this->lang->navGroup->bug . '&activeMenu=bug')));
+ $this->view->products = $this->products = $products;
+ if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName={$this->app->openApp}&activeMenu=bug&projectID=$projectID")));
}
/**
diff --git a/module/execution/control.php b/module/execution/control.php
index 5d3bb71392..2c319a8157 100644
--- a/module/execution/control.php
+++ b/module/execution/control.php
@@ -1037,18 +1037,18 @@ class execution extends control
$tasks = $this->testtask->getExecutionTasks($executionID, $orderBy, $pager);
foreach($tasks as $key => $task) $productTasks[$task->product][] = $task;
- $this->view->title = $this->executions[$executionID] . $this->lang->colon . $this->lang->testtask->common;
- $this->view->position[] = html::a($this->createLink('execution', 'testtask', "executionID=$executionID"), $this->executions[$executionID]);
- $this->view->position[] = $this->lang->testtask->common;
- $this->view->execution = $execution;
- $this->view->executionID = $executionID;
- $this->view->executionName = $this->executions[$executionID];
- $this->view->pager = $pager;
- $this->view->orderBy = $orderBy;
- $this->view->tasks = $productTasks;
- $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
- $this->view->products = $this->loadModel('product')->getPairs('', 0);
- $this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable.
+ $this->view->title = $this->executions[$executionID] . $this->lang->colon . $this->lang->testtask->common;
+ $this->view->position[] = html::a($this->createLink('execution', 'testtask', "executionID=$executionID"), $this->executions[$executionID]);
+ $this->view->position[] = $this->lang->testtask->common;
+ $this->view->execution = $execution;
+ $this->view->executionID = $executionID;
+ $this->view->executionName = $this->executions[$executionID];
+ $this->view->pager = $pager;
+ $this->view->orderBy = $orderBy;
+ $this->view->tasks = $productTasks;
+ $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter');
+ $this->view->products = $this->loadModel('product')->getPairs('', 0);
+ $this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable.
$this->display();
}
diff --git a/module/product/control.php b/module/product/control.php
index 9be40fb686..66506b710b 100644
--- a/module/product/control.php
+++ b/module/product/control.php
@@ -967,43 +967,40 @@ class product extends control
/**
* Show error no product when visit qa.
*
- * @param string $fromModule
+ * @param string $moduleName
+ * @param string $activeMenu
+ * @param int $projectID
* @access public
* @return void
*/
- public function showErrorNone($fromModule = 'bug', $moduleGroup = 'product', $activeMenu = '')
+ public function showErrorNone($moduleName = 'qa', $activeMenu = 'index', $projectID = 0)
{
- /* The module in the test menu shows the created product. */
- if($moduleGroup == 'qa')
+ $this->app->rawModule = $moduleName;
+ if($moduleName == 'project')
+ {
+ $this->loadModel('project')->setMenu($projectID);
+ $project = $this->project->getByID($projectID);
+ $this->lang->project->menu = $this->lang->{$project->model}->menu;
+ $this->lang->project->menuOrder = $this->lang->{$project->model}->menuOrder;
+ $this->app->rawModule = $activeMenu;
+
+ if($activeMenu == 'testcase') $this->lang->{$project->model}->menu->qa['subMenu']->testcase['subModule'] = 'product';
+ if($activeMenu == 'bug') $this->lang->{$project->model}->menu->qa['subMenu']->bug['subModule'] = 'product';
+ if($activeMenu == 'testcase') $this->lang->{$project->model}->menu->qa['subMenu']->testtask['subModule'] = 'product';
+ }
+ elseif($moduleName == 'qa')
{
$this->loadModel('qa')->setMenu(array(), 0);
-
- $this->app->loadLang($fromModule);
foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
- $this->lang->product->menu = $this->lang->qa->menu;
- $this->lang->product->menuOrder = $this->lang->qa->menuOrder;
+ if($activeMenu == 'testcase') $this->lang->qa->menu->testcase['subMenu']->case['subModule'] = 'product';
+ if($activeMenu == 'testsuite') $this->lang->qa->menu->testcase['subMenu']->testsuite['subModule'] = 'product';
+ if($activeMenu == 'testtask') $this->lang->qa->menu->testtask['subMenu']->testtask['subModule'] = 'product';
+ if($activeMenu == 'testreport') $this->lang->qa->menu->testtask['subMenu']->report['subModule'] = 'product';
}
- /* The module in the project menu displays related products. */
- if($moduleGroup == 'project')
- {
- $this->app->loadLang($fromModule);
-
- /* The secondary test menu processing in the project. */
- if(in_array($fromModule, array('qa', 'bug', 'testtask', 'testreport')))
- {
- $menu = $this->lang->qa->menu->$activeMenu;
- $menu['subModule'] = 'product';
- $this->lang->qa->menu->$activeMenu = $menu;
- $this->app->rawModule = 'qa';
- $this->loadModel('qa')->setMenu(array(), 0);
- }
- }
-
- $this->view->title = $this->lang->$fromModule->common;
- $this->view->fromModule = $fromModule;
- $this->view->moduleGroup = $moduleGroup;
+ $this->view->title = $this->lang->$moduleName->common;
+ $this->view->projectID = $projectID;
$this->display();
}
diff --git a/module/product/view/showerrornone.html.php b/module/product/view/showerrornone.html.php
index 21ac1d8f65..6743ed3510 100644
--- a/module/product/view/showerrornone.html.php
+++ b/module/product/view/showerrornone.html.php
@@ -11,14 +11,13 @@
*/
?>
-
+app->openApp == 'project'):?>
-
product->noProduct;?> session->project}", " " . $lang->project->manageProducts, '', "class='btn btn-info'");?>
+
product->noProduct;?> " . $lang->project->manageProducts, '', "class='btn btn-info' data-app='project'");?>
-
-
product->noProduct;?> " . $lang->product->create, '', "class='btn btn-info'");?>
+
product->noProduct;?> " . $lang->product->create, '', "class='btn btn-info' data-app='product'");?>
diff --git a/module/projectstory/control.php b/module/projectstory/control.php
index d075e37228..7251244514 100644
--- a/module/projectstory/control.php
+++ b/module/projectstory/control.php
@@ -10,22 +10,13 @@
*/
class projectStory extends control
{
- public $products = array();
-
/**
- * Get the products associated with the project.
+ * All products.
*
- * @param string $moduleName
- * @param string $methodName
+ * @var array
* @access public
- * @return void
*/
- public function __construct($moduleName = '', $methodName = '')
- {
- parent::__construct($moduleName, $methodName);
- $this->products = $this->loadModel('product')->getProductPairsByProject($this->session->project);
- if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'fromModule=projectstory&moduleGroup=' . $this->lang->navGroup->projectstory . '&activeMenu=projectstory')));
- }
+ public $products = array();
/**
* Get software requirements from product.
@@ -45,6 +36,8 @@ class projectStory extends control
*/
public function story($projectID = 0, $productID = 0, $branch = 0, $browseType = '', $param = 0, $storyType = 'story', $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
+ $this->products = $this->loadModel('product')->getProductPairsByProject($projectID);
+ if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'moduleName=project&activeMenu=story&projectID=' . $projectID)));
echo $this->fetch('product', 'browse', "productID=$productID&branch=$branch&browseType=$browseType¶m=$param&storyType=$storyType&orderBy=$orderBy&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID&projectID=$projectID");
}
diff --git a/module/qa/control.php b/module/qa/control.php
index d5263fac9b..b2b35c4e3e 100644
--- a/module/qa/control.php
+++ b/module/qa/control.php
@@ -20,7 +20,7 @@ class qa extends control
public function index($locate = 'auto', $productID = 0, $projectID = 0)
{
$products = $this->loadModel('product')->getProductPairsByProject($projectID, 'noclosed');
- if(empty($products)) die($this->locate($this->createLink('product', 'showErrorNone', 'fromModule=qa&moduleGroup=' . $this->lang->navGroup->qa . '&activeMenu=index')));
+ if(empty($products)) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName=qa&activeMenu=index")));
if($locate == 'yes') $this->locate($this->createLink('bug', 'browse'));
$productID = $this->product->saveState($productID, $products);
diff --git a/module/testcase/control.php b/module/testcase/control.php
index 078eada82f..5b45d63390 100644
--- a/module/testcase/control.php
+++ b/module/testcase/control.php
@@ -41,9 +41,16 @@ class testcase extends control
$this->loadModel('user');
$this->loadModel('qa');
- $this->view->products = $this->products = $this->product->getPairs();
- if($this->app->openApp == 'project') $this->view->products = $this->products = $this->loadModel('project')->getProducts($this->session->project, false);
- if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=testcase")));
+ /* Get product data. */
+ $projectID = 0;
+ if($this->app->openApp == 'project')
+ {
+ $projectID = $this->session->project;
+ $products = $this->loadModel('project')->getProducts($projectID, false);
+ }
+ if($this->app->openApp == 'qa') $products = $this->product->getPairs();
+ $this->view->products = $this->products = $products;
+ if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName={$this->app->openApp}&activeMenu=testcase&projectID=$projectID")));
}
/**
diff --git a/module/testreport/control.php b/module/testreport/control.php
index 708b1484f5..3dd039624f 100644
--- a/module/testreport/control.php
+++ b/module/testreport/control.php
@@ -13,6 +13,14 @@ class testreport extends control
{
public $projectID = 0;
+ /**
+ * All products.
+ *
+ * @var array
+ * @access public
+ */
+ public $products = array();
+
/**
* Construct
*
@@ -541,7 +549,7 @@ class testreport extends control
{
$projectID = $this->lang->navGroup->testreport == 'qa' ? 0 : $this->session->project;
$this->products = $this->product->getProductPairsByProject($projectID);
- if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'fromModule=testreport&moduleGroup=' . $this->lang->navGroup->bug . '&activeMenu=report')));
+ if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName=qa&activeMenu=testreport")));
$productID = $this->product->saveState($objectID, $this->products);
$this->loadModel('qa')->setMenu($this->products, $productID);
return $productID;
diff --git a/module/testsuite/control.php b/module/testsuite/control.php
index 1c9f9d6c2d..af2d0fa9e3 100644
--- a/module/testsuite/control.php
+++ b/module/testsuite/control.php
@@ -29,10 +29,13 @@ class testsuite extends control
*/
public function __construct($moduleName = '', $methodName = '')
{
- parent::__construct($moduleName, $methodName);
+ parent::__construct($moduleName, $methodName);
- $this->app->loadConfig('qa');
- foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
+ $this->app->loadConfig('qa');
+ foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
+
+ $this->view->products = $this->products = $this->loadModel('product')->getPairs();
+ if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName=qa&activeMenu=testsuite")));
}
/**
@@ -63,9 +66,6 @@ class testsuite extends control
$this->session->set('testsuiteList', $this->app->getURI(true), 'qa');
/* Set menu. */
- $this->view->products = $this->products = $this->loadModel('product')->getPairs();
- if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'fromModule=testsuite&moduleGroup=' . $this->lang->navGroup->bug . '&activeMenu=testsuite')));
-
$productID = $this->product->saveState($productID, $this->products);
$this->loadModel('qa')->setMenu($this->products, $productID);
@@ -130,7 +130,6 @@ class testsuite extends control
}
/* Set menu. */
- $this->view->products = $this->products = $this->loadModel('product')->getPairs();
$productID = $this->product->saveState($productID, $this->products);
$this->loadModel('qa')->setMenu($this->products, $productID);
@@ -164,7 +163,6 @@ 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'));
/* Set product session. */
- $this->view->products = $this->products = $this->loadModel('product')->getPairs();
$productID = $this->product->saveState($suite->product, $this->products);
$this->loadModel('qa')->setMenu($this->products, $productID);
@@ -235,7 +233,6 @@ 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'));
/* Set product session. */
- $this->view->products = $this->products = $this->loadModel('product')->getPairs();
$productID = $this->product->saveState($suite->product, $this->products);
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testsuite->edit;
@@ -314,7 +311,6 @@ class testsuite extends control
$suite = $this->testsuite->getById($suiteID);
/* Set product session. */
- $this->view->products = $this->products = $this->loadModel('product')->getPairs();
$productID = $this->product->saveState($suite->product, $this->products);
/* Load pager. */
diff --git a/module/testtask/control.php b/module/testtask/control.php
index 95470b3398..1c633af3af 100644
--- a/module/testtask/control.php
+++ b/module/testtask/control.php
@@ -37,17 +37,21 @@ class testtask extends control
{
parent::__construct($moduleName, $methodName);
- /* Set testtask menu group. */
- $this->projectID = isset($_GET['project']) ? $_GET['project'] : 0;
+ /* Get product data. */
+ $projectID = 0;
+ if($this->app->openApp == 'project')
+ {
+ $projectID = $this->session->project;
+ $products = $this->loadModel('project')->getProducts($projectID, false);
+ }
if($this->app->openApp == 'qa')
{
+ $products = $this->product->getPairs();
$this->app->loadConfig('qa');
foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa';
}
-
- $this->loadModel('product');
- $this->view->products = $this->products = $this->product->getProductPairsByProject($this->projectID);
- if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', 'fromModule=testtask&moduleGroup=' . $this->lang->navGroup->bug . '&activeMenu=testtask')));
+ $this->view->products = $this->products = $products;
+ if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "moduleName={$this->app->openApp}&activeMenu=testtask&projectID=$projectID")));
}
/**