diff --git a/module/bug/control.php b/module/bug/control.php index 337f06075d..97765bc417 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -116,7 +116,6 @@ class bug extends control $actionURL = $this->createLink('bug', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID"); $this->config->bug->search['onMenuBar'] = 'yes'; $this->bug->buildSearchForm($productID, $this->products, $queryID, $actionURL); - $this->loadModel('search')->mergeFeatureBar('bug', 'browse'); $showModule = !empty($this->config->datatable->bugBrowse->showModule) ? $this->config->datatable->bugBrowse->showModule : ''; $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'bug', $showModule) : array(); diff --git a/module/common/model.php b/module/common/model.php index 5df0d9bec3..d9b4104d74 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -634,7 +634,6 @@ class commonModel extends model } else { - $orderBy = "" . trim($fieldName, '`') . "" . '_' . 'asc'; $className = 'header'; } diff --git a/module/custom/control.php b/module/custom/control.php index 76f26ac7a3..c0d95cb0d2 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -253,7 +253,7 @@ class custom extends control if($method) { $this->app->loadLang($module); - $this->loadModel('search')->mergeFeatureBar($module, $method); + customModel::mergeFeatureBar($module, $method); /* Mark search query item. */ if(isset($this->lang->$module->featureBar[$method])) { diff --git a/module/custom/model.php b/module/custom/model.php index 96f7ef845b..93fae85e94 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -301,6 +301,7 @@ class customModel extends model { global $app, $lang, $config; $app->loadLang($module); + customModel::mergeFeatureBar($module, $method); $configKey = 'feature_' . $module . '_' . $method; $allMenu = isset($lang->$module->featureBar[$method]) ? $lang->$module->featureBar[$method] : null; @@ -310,6 +311,27 @@ class customModel extends model return $allMenu ? self::setMenuByConfig($allMenu, $customMenu) : null; } + /** + * Merge shortcut query in featureBar. + * + * @param string $module + * @param string $method + * @access public + * @return void + */ + public static function mergeFeatureBar($module, $method) + { + global $lang, $app, $dbh; + if(!isset($lang->$module->featureBar[$method])) return; + $queryModule = $module == 'project' ? 'task' : ($module == 'product' ? 'story' : $module); + $shortcuts = $dbh->query('select id, title from ' . TABLE_USERQUERY . " where `account` = '{$app->user->account}' AND `module` = '{$queryModule}' order by id")->fetchAll(); + foreach($shortcuts as $shortcut) + { + $shortcutID = 'QUERY' . $shortcut->id; + $lang->$module->featureBar[$method][$shortcutID] = $shortcut->title; + } + } + /** * Save custom menu to config * @param string $menu diff --git a/module/project/control.php b/module/project/control.php index 52c97f5b72..3cb97b71f5 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -191,7 +191,6 @@ class project extends control $actionURL = $this->createLink('project', 'task', "projectID=$projectID&status=bySearch¶m=myQueryID"); $this->config->project->search['onMenuBar'] = 'yes'; $this->project->buildSearchForm($projectID, $this->projects, $queryID, $actionURL); - $this->loadModel('search')->mergeFeatureBar('project', 'task'); /* team member pairs. */ $memberPairs = array(); diff --git a/module/search/model.php b/module/search/model.php index b0124f2247..b6ceed5eb9 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -428,24 +428,4 @@ class searchModel extends model } return $query; } - - /** - * Merge shortcut query in featureBar. - * - * @param string $module - * @param string $method - * @access public - * @return void - */ - public function mergeFeatureBar($module, $method) - { - if(!isset($this->lang->$module->featureBar[$method])) return; - $queryModule = $module == 'project' ? 'task' : ($module == 'product' ? 'story' : $module); - $shortcuts = $this->dao->select('id, title')->from(TABLE_USERQUERY)->where('account')->eq($this->app->user->account)->andWhere('module')->eq($queryModule)->orderBy('id_asc')->fetchPairs(); - foreach($shortcuts as $id => $name) - { - $shortcutID = 'QUERY' . $id; - $this->lang->$module->featureBar[$method][$shortcutID] = $name; - } - } } diff --git a/module/story/control.php b/module/story/control.php index e8c2ccf70b..c3c050ae32 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -936,7 +936,6 @@ class story extends control $this->lang->story->menuOrder = $this->lang->testcase->menuOrder; $this->lang->story->menu->testcase['subModule'] = 'story'; $this->loadModel('testcase')->setMenu($products, $productID); - $this->loadModel('search')->mergeFeatureBar('testcase', 'browse'); /* Append id for secend sort. */ $sort = $this->loadModel('common')->appendOrder($orderBy); diff --git a/module/testcase/control.php b/module/testcase/control.php index bd73a7090c..3330d67646 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -106,7 +106,6 @@ class testcase extends control $actionURL = $this->createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID"); $this->config->testcase->search['onMenuBar'] = 'yes'; $this->testcase->buildSearchForm($productID, $this->products, $queryID, $actionURL); - $this->loadModel('search')->mergeFeatureBar('testcase', 'browse'); $showModule = !empty($this->config->datatable->testcaseBrowse->showModule) ? $this->config->datatable->testcaseBrowse->showModule : ''; $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule) : array(); @@ -157,7 +156,6 @@ class testcase extends control $cases = $this->testcase->getModuleCases($productID, $branch, 0, $groupBy); $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false); - $this->loadModel('search')->mergeFeatureBar('testcase', 'browse'); $groupCases = array(); $groupByList = array(); diff --git a/module/testtask/control.php b/module/testtask/control.php index 909bc368d3..3dff73ae44 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -269,7 +269,6 @@ class testtask extends control unset($this->config->testcase->search['fields']['branch']); unset($this->config->testcase->search['params']['branch']); $this->loadModel('search')->setSearchParams($this->config->testcase->search); - $this->search->mergeFeatureBar('testtask', 'cases'); $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases; $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]);