diff --git a/module/custom/js/set.js b/module/custom/js/set.js index fc82613a9e..ad196bb551 100644 --- a/module/custom/js/set.js +++ b/module/custom/js/set.js @@ -13,4 +13,3 @@ $(function() $('#' + module + 'Tab').addClass('active'); $('#' + field + 'Tab').addClass('active'); }) - diff --git a/module/testcase/control.php b/module/testcase/control.php index cac6875fdb..865a61af20 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -1313,8 +1313,11 @@ class testcase extends control * @access public * @return void */ - public function importFromLib($productID, $branch = 0, $libID = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function importFromLib($productID, $branch = 0, $libID = 0, $orderBy = 'id_desc', $browseType = '', $queryID = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1) { + $browseType = strtolower($browseType); + $queryID = (int)$queryID; + if($_POST) { $this->testcase->importFromLib($productID); @@ -1331,6 +1334,20 @@ class testcase extends control } if(empty($libID) or !isset($libraries[$libID])) $libID = key($libraries); + /* Build the search form. */ + $actionURL = $this->createLink('testcase', 'importFromLib', "productID=$productID&branch=$branch&libID=$libID&browseType=bySearch&queryID=myQueryID"); + $this->config->testcase->search['module'] = 'testsuite'; + $this->config->testcase->search['onMenuBar'] = 'no'; + $this->config->testcase->search['actionURL'] = $actionURL; + $this->config->testcase->search['queryID'] = $queryID; + $this->config->testcase->search['fields']['lib'] = $this->lang->testcase->lib; + $this->config->testcase->search['params']['lib'] = array('operator' => '=', 'control' => 'select', 'values' => array('' => '', $libID => $libraries[$libID], 'all' => $this->lang->caselib->all)); + $this->config->testcase->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case'); + if(!$this->config->testcase->needReview) unset($this->config->testcase->search['params']['status']['values']['wait']); + unset($this->config->testcase->search['fields']['product']); + unset($this->config->testcase->search['fields']['branch']); + $this->loadModel('search')->setSearchParams($this->config->testcase->search); + /* Load pager. */ $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); @@ -1342,12 +1359,14 @@ class testcase extends control $this->view->libID = $libID; $this->view->productID = $productID; $this->view->branch = $branch; - $this->view->cases = $this->testsuite->getNotImportedCases($productID, $libID, $orderBy, $pager); + $this->view->cases = $this->testsuite->getNotImportedCases($productID, $libID, $orderBy, $pager, $browseType, $queryID); $this->view->modules = $this->loadModel('tree')->getOptionMenu($productID, 'case', 0, $branch); $this->view->libModules = $this->tree->getOptionMenu($libID, 'caselib'); $this->view->pager = $pager; $this->view->orderBy = $orderBy; $this->view->branches = $this->loadModel('branch')->getPairs($productID); + $this->view->browseType = $browseType; + $this->view->queryID = $queryID; $this->display(); } diff --git a/module/testcase/js/importfromlib.js b/module/testcase/js/importfromlib.js index 6f5a944541..682a550d48 100644 --- a/module/testcase/js/importfromlib.js +++ b/module/testcase/js/importfromlib.js @@ -25,5 +25,6 @@ function setModule(obj) $(function() { + ajaxGetSearchForm('#querybox'); setTimeout(function(){fixedTfootAction('#importFromLib')}, 500); }); diff --git a/module/testcase/view/importfromlib.html.php b/module/testcase/view/importfromlib.html.php index 5d7387c4f4..e6b63da562 100644 --- a/module/testcase/view/importfromlib.html.php +++ b/module/testcase/view/importfromlib.html.php @@ -19,10 +19,11 @@ +
- recTotal}&recPerPage={$pager->recPerPage}";?> + recTotal}&recPerPage={$pager->recPerPage}";?> diff --git a/module/testsuite/lang/zh-cn.php b/module/testsuite/lang/zh-cn.php index 0881125a12..78f87a0aa9 100644 --- a/module/testsuite/lang/zh-cn.php +++ b/module/testsuite/lang/zh-cn.php @@ -50,7 +50,7 @@ $lang->testsuite->authorList['private'] = '私有'; $lang->testsuite->authorList['public'] = '公开'; $lang->caselib->common = '公共用例库'; -$lang->caselib->all = '所有公共库'; +$lang->caselib->all = '所有用例库'; $lang->testsuite->createLib = '创建库'; $lang->testsuite->editLib = '编辑库'; diff --git a/module/testsuite/model.php b/module/testsuite/model.php index 557b4231ea..a676f936fe 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -442,7 +442,7 @@ class testsuiteModel extends model * @access public * @return array */ - public function getNotImportedCases($productID, $libID, $orderBy = 'id_desc', $pager = null) + public function getNotImportedCases($productID, $libID, $orderBy = 'id_desc', $pager = null, $browseType = '', $queryID = 0) { $importedCases = $this->dao->select('fromCaseID')->from(TABLE_CASE) ->where('product')->eq($productID) @@ -450,11 +450,37 @@ class testsuiteModel extends model ->andWhere('fromCaseID')->ne('') ->andWhere('deleted')->eq(0) ->fetchPairs('fromCaseID', 'fromCaseID'); - return $this->dao->select('*')->from(TABLE_CASE) - ->where('lib')->eq($libID) + + $query = ''; + if($browseType == 'bysearch') + { + if($queryID) + { + $this->session->set('testsuiteQuery', ' 1 = 1'); + $query = $this->loadModel('search')->getQuery($queryID); + if($query) + { + $this->session->set('testsuiteQuery', $query->sql); + $this->session->set('testsuiteForm', $query->form); + } + } + else + { + if($this->session->testsuiteQuery == false) $this->session->set('testsuiteQuery', ' 1 = 1'); + } + + $query = $this->session->testsuiteQuery; + $allLib = "`lib` = 'all'"; + $withAllLib = strpos($query, $allLib) !== false; + if($withAllLib) $query = str_replace($allLib, 1, $query); + if(!$withAllLib) $query .= " AND `lib` = '$libID'"; + } + + return $this->dao->select('*')->from(TABLE_CASE)->where('deleted')->eq(0) + ->beginIF($browseType != 'bysearch')->andWhere('lib')->eq($libID)->fi() + ->beginIF($browseType == 'bysearch')->andWhere($query)->fi() ->andWhere('product')->eq(0) ->andWhere('id')->notIN($importedCases) - ->andWhere('deleted')->eq(0) ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); diff --git a/module/todo/view/batchcreate.html.php b/module/todo/view/batchcreate.html.php index 355960bf44..f7eaa180e4 100755 --- a/module/todo/view/batchcreate.html.php +++ b/module/todo/view/batchcreate.html.php @@ -41,7 +41,7 @@ - +
idAB);?> idAB;?> '>todo->type;?> '>todo->pri;?>todo->name;?>todo->name;?> >todo->desc;?> '>todo->beginAndEnd;?>