diff --git a/module/bug/control.php b/module/bug/control.php index baaa43cc58..0aceaf4153 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -128,11 +128,6 @@ class bug extends control /* Get bugs. */ $bugs = $this->bug->getBugs($productID, $projects, $branch, $browseType, $moduleID, $queryID, $sort, $pager); - if(empty($bugs) and $pageID > 1) - { - $pager = pager::init(0, $recPerPage, 1); - $bugs = $this->bug->getBugs($productID, $projects, $branch, $browseType, $moduleID, $queryID, $sort, $pager); - } /* Process the sql, get the conditon partion, save it to session. */ $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'bug', $browseType == 'needconfirm' ? false : true); diff --git a/module/build/model.php b/module/build/model.php index cf090ea85a..11b09b9413 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -139,6 +139,7 @@ class buildModel extends model ->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build') ->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id') ->where('t1.product')->in($products) + ->andWhere('t1.PRJ')->eq($this->session->PRJ) ->beginIF($branch)->andWhere('t1.branch')->in("0,$branch")->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy('t1.date desc, t1.id desc')->fetchAll('id'); diff --git a/module/caselib/model.php b/module/caselib/model.php index fb18d53ba4..fc6db0159c 100644 --- a/module/caselib/model.php +++ b/module/caselib/model.php @@ -258,6 +258,7 @@ class caselibModel extends model { $cases = $this->dao->select('*')->from(TABLE_CASE) ->where('lib')->eq((int)$libID) + ->andWhere('PRJ')->eq($this->session->PRJ) ->andWhere('product')->eq(0) ->beginIF($moduleIdList)->andWhere('module')->in($moduleIdList)->fi() ->beginIF($browseType == 'wait')->andWhere('status')->eq($browseType)->fi() @@ -294,10 +295,10 @@ class caselibModel extends model $cases = $this->dao->select('*')->from(TABLE_CASE)->where($caseQuery) ->beginIF($queryLibID != 'all')->andWhere('lib')->eq((int)$libID)->fi() + ->andWhere('PRJ')->eq($this->session->PRJ) ->andWhere('product')->eq(0) ->andWhere('deleted')->eq(0) ->orderBy($sort)->page($pager)->fetchAll(); - } return $cases; } @@ -515,6 +516,7 @@ class caselibModel extends model } else { + $caseData->PRJ = $this->session->PRJ; $caseData->version = 1; $caseData->openedBy = $this->app->user->account; $caseData->openedDate = $now; @@ -608,6 +610,7 @@ class caselibModel extends model $data[$i]->openedDate = $now; $data[$i]->status = $forceNotReview ? 'normal' : 'wait'; $data[$i]->version = 1; + $data[$i]->PRJ = $this->session->PRJ; $this->dao->insert(TABLE_CASE)->data($data[$i]) ->autoCheck() diff --git a/module/common/model.php b/module/common/model.php index 5f40376b12..12fbbbbc38 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -2309,9 +2309,6 @@ EOD; if($program->model == 'waterfall') { $lang->navGroup->product = 'project'; - $lang->product->menu = $lang->waterfallproduct->menu; - $lang->productplan->menu = $lang->waterfallproduct->menu; - $lang->story->menu = $lang->waterfallproduct->menu; $lang->$moduleName->menu = self::processMenuVars($lang->$moduleName->menu); } } diff --git a/module/product/control.php b/module/product/control.php index 81946cf4f7..37cdb11ddc 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -703,7 +703,7 @@ class product extends control if($module != 'product') { - $products = $this->product->getProductIDByProject($this->session->PRJ); + $products = $this->product->getProductIDByProject($this->session->PRJ, false); $products = $this->product->getByIdList($products); } else diff --git a/module/story/control.php b/module/story/control.php index 84e52b933a..ecb9aa903a 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1368,6 +1368,9 @@ class story extends control $products = $this->product->getPairs(); $this->lang->set('menugroup.story', 'qa'); + + unset($this->lang->noMenuModule[6]); + $this->lang->navGroup->story = 'project'; $this->lang->story->menu = $this->lang->testcase->menu; $this->lang->story->menuOrder = $this->lang->testcase->menuOrder; $this->lang->story->menu->testcase['subModule'] = 'story'; diff --git a/module/story/js/common.js b/module/story/js/common.js index 8b6e317fb7..df519715db 100644 --- a/module/story/js/common.js +++ b/module/story/js/common.js @@ -1,6 +1,7 @@ $(function() { - if(typeof(storyType) == 'undefined') storyType = ''; + if(typeof(resetActive) != 'undefined') return false; + if(typeof(storyType) == 'undefined') storyType = ''; $('#navbar .nav li').removeClass('active'); $("#navbar .nav li[data-id=" + storyType + ']').addClass('active'); }) diff --git a/module/story/view/zerocase.html.php b/module/story/view/zerocase.html.php index ee04815576..8fa29edf89 100644 --- a/module/story/view/zerocase.html.php +++ b/module/story/view/zerocase.html.php @@ -12,6 +12,7 @@ ?> +
diff --git a/module/testcase/model.php b/module/testcase/model.php index 7ac6d62282..37de38b492 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -27,6 +27,7 @@ class testcaseModel extends model */ public function setMenu($products, $productID, $branch = 0, $moduleID = 0, $suiteID = 0, $orderBy = 'id_desc') { + $this->lang->product->menu = $this->lang->product->viewMenu; $this->loadModel('product')->setMenu($products, $productID, $branch, $moduleID, 'case'); $selectHtml = $this->product->select($products, $productID, 'testcase', 'browse', '', $branch, $moduleID, 'case'); @@ -304,6 +305,7 @@ class testcaseModel extends model return $this->dao->select('t1.*, t2.title as storyTitle')->from(TABLE_CASE)->alias('t1') ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id') ->where('t1.product')->eq((int)$productID) + ->andWhere('t1.PRJ')->eq($this->session->PRJ) ->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi() ->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi() ->beginIF($browseType == 'wait')->andWhere('t1.status')->eq($browseType)->fi() @@ -332,6 +334,7 @@ class testcaseModel extends model ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story=t2.id') ->leftJoin(TABLE_SUITECASE)->alias('t3')->on('t1.id=t3.case') ->where('t1.product')->eq((int)$productID) + ->andWhere('t1.PRJ')->eq($this->session->PRJ) ->andWhere('t3.suite')->eq((int)$suiteID) ->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi() ->beginIF($moduleIdList)->andWhere('t1.module')->in($moduleIdList)->fi() @@ -421,6 +424,7 @@ class testcaseModel extends model { $cases = $this->dao->select('t1.*, t2.title AS storyTitle')->from(TABLE_CASE)->alias('t1')->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->where("t2.status = 'active'") + ->andWhere('t1.PRJ')->eq($this->session->PRJ) ->andWhere('t1.deleted')->eq(0) ->andWhere('t2.version > t1.storyVersion') ->andWhere('t1.product')->eq($productID) @@ -1185,6 +1189,7 @@ class testcaseModel extends model } else { + $caseData->PRJ = $this->session->PRJ; $caseData->version = 1; $caseData->openedBy = $this->app->user->account; $caseData->openedDate = $now; diff --git a/module/testreport/model.php b/module/testreport/model.php index 8031075204..1f1ac9e563 100644 --- a/module/testreport/model.php +++ b/module/testreport/model.php @@ -157,6 +157,7 @@ class testreportModel extends model { $objectID = (int)$objectID; return $this->dao->select('*')->from(TABLE_TESTREPORT)->where('deleted')->eq(0) + ->andWhere('PRJ')->eq($this->session->PRJ) ->beginIF($objectType == 'project')->andWhere('objectID')->eq($objectID)->andWhere('objectType')->eq('project')->fi() ->beginIF($objectType == 'product' and $extra)->andWhere('objectID')->eq((int)$extra)->andWhere('objectType')->eq('testtask')->fi() ->beginIF($objectType == 'product' and empty($extra))->andWhere('product')->eq($objectID)->fi() diff --git a/module/testsuite/model.php b/module/testsuite/model.php index 015ffa71f6..fb93819b78 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -143,6 +143,7 @@ class testsuiteModel extends model { return $this->dao->select("*")->from(TABLE_TESTSUITE) ->where('product')->eq((int)$productID) + ->andWhere('PRJ')->eq($this->session->PRJ) ->andWhere('deleted')->eq(0) ->andWhere("(`type` = 'public' OR (`type` = 'private' and addedBy = '{$this->app->user->account}'))") ->orderBy($orderBy) @@ -251,6 +252,8 @@ class testsuiteModel extends model $cases = $this->dao->select('t1.*,t2.version as caseVersion')->from(TABLE_CASE)->alias('t1') ->leftJoin(TABLE_SUITECASE)->alias('t2')->on('t1.id=t2.case') ->where('t2.suite')->eq($suiteID) + ->andWhere('t1.PRJ')->eq($this->session->PRJ) + ->andWhere('t1.product')->eq($suite->product) ->andWhere('t1.product')->eq($suite->product) ->andWhere('t1.deleted')->eq(0) ->orderBy($orderBy) @@ -293,6 +296,7 @@ class testsuiteModel extends model $linkedCases = $this->getLinkedCases($suite->id, 'id_desc', null, $append = false); $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query) ->andWhere('id')->notIN(array_keys($linkedCases)) + ->andWhere('PRJ')->eq($this->session->PRJ) ->andWhere('deleted')->eq(0) ->orderBy('id desc') ->page($pager) @@ -329,6 +333,7 @@ class testsuiteModel extends model { $importedCases = $this->dao->select('fromCaseID')->from(TABLE_CASE) ->where('product')->eq($productID) + ->andWhere('PRJ')->eq($this->session->PRJ) ->andWhere('lib')->eq($libID) ->andWhere('fromCaseID')->ne('') ->andWhere('deleted')->eq(0) @@ -362,6 +367,7 @@ class testsuiteModel extends model 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('PRJ')->eq($this->session->PRJ) ->andWhere('product')->eq(0) ->andWhere('id')->notIN($importedCases) ->orderBy($orderBy) diff --git a/module/testtask/control.php b/module/testtask/control.php index 996287a1fb..043b0be9b2 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -56,7 +56,7 @@ class testtask extends control $this->session->set('testtaskList', $this->app->getURI(true)); $this->session->set('buildList', $this->app->getURI(true)); - $scopeAndStatus = explode(',',$type); + $scopeAndStatus = explode(',', $type); $this->session->set('testTaskVersionScope', $scopeAndStatus[0]); $this->session->set('testTaskVersionStatus', $scopeAndStatus[1]); @@ -153,34 +153,17 @@ class testtask extends control if(!empty($_POST)) { $taskID = $this->testtask->create(); - if(dao::isError()) die(js::error(dao::getError())); + if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->loadModel('action')->create('testtask', $taskID, 'opened'); $this->executeHooks($taskID); - - die(js::locate($this->createLink('testtask', 'browse', "productID=$productID"), 'parent')); - } - - /* Create testtask from build of project.*/ - if($projectID != 0 and $build != 0) - { - $products = $this->dao->select('t2.id, t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1') - ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') - ->where('t1.project')->eq($projectID) - ->andWhere('t2.deleted')->eq(0) - ->fetchPairs('id'); - - $productID = $productID ? $productID : key($products); - $projects = $this->dao->select('id, name')->from(TABLE_PROJECT)->where('id')->eq($projectID)->andWhere('type')->ne('ops')->andWhere('deleted')->eq(0)->fetchPairs('id'); - $builds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->eq($build)->andWhere('deleted')->eq(0)->fetchPairs('id'); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inLink('browse', "productID=$productID"))); } /* Create testtask from testtask of test.*/ - if($projectID == 0) - { - $projects = $this->loadModel('product')->getProjectPairs($productID, 0, $params = 'nodeleted'); - $builds = $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk'); - } + $productID = $productID ? $productID : key($this->products); + $projects = empty($productID) ? array() : $this->product->getProjectPairs($productID, 0, $params = 'nodeleted'); + $builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk', true); /* Set menu. */ $productID = $this->product->saveState($productID, $this->products); @@ -191,17 +174,11 @@ class testtask extends control $this->view->position[] = $this->lang->testtask->common; $this->view->position[] = $this->lang->testtask->create; - if($projectID != 0) - { - $this->app->loadLang('build'); - $this->view->products = $products; - $this->view->projectID = $projectID; - } - $this->view->projects = $projects; - $this->view->productID = $productID; - $this->view->builds = $builds; - $this->view->build = $build; - $this->view->users = $this->loadModel('user')->getPairs('noclosed|qdfirst|nodeleted'); + $this->view->projects = $projects; + $this->view->productID = $productID; + $this->view->builds = $builds; + $this->view->build = $build; + $this->view->users = $this->loadModel('user')->getPairs('noclosed|qdfirst|nodeleted'); $this->display(); } @@ -571,10 +548,14 @@ class testtask extends control */ public function edit($taskID) { + /* Get task info. */ + $task = $this->testtask->getById($taskID); + $productID = $this->product->saveState($task->product, $this->products); + if(!empty($_POST)) { $changes = $this->testtask->update($taskID); - if(dao::isError()) die(js::error(dao::getError())); + if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); if($changes or $this->post->comment) { $actionID = $this->loadModel('action')->create('testtask', $taskID, 'edited', $this->post->comment); @@ -583,13 +564,9 @@ class testtask extends control $this->executeHooks($taskID); - die(js::locate(inlink('view', "taskID=$taskID"), 'parent')); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); } - /* Get task info. */ - $task = $this->testtask->getById($taskID); - $productID = $this->product->saveState($task->product, $this->products); - /* Set menu. */ $this->testtask->setMenu($this->products, $productID, $task->branch, $taskID); @@ -598,9 +575,14 @@ class testtask extends control $this->view->position[] = $this->lang->testtask->common; $this->view->position[] = $this->lang->testtask->edit; + /* Create testtask from testtask of test.*/ + $productID = $productID ? $productID : key($this->products); + $projects = empty($productID) ? array() : $this->product->getProjectPairs($productID, 0, $params = 'nodeleted'); + $builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk', true); + $this->view->task = $task; - $this->view->projects = $this->product->getProjectPairs($productID); - $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, $params = 'notrunk'); + $this->view->projects = $projects; + $this->view->builds = $builds; $this->view->users = $this->loadModel('user')->getPairs('nodeleted', $task->owner); $this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote'); @@ -1153,13 +1135,6 @@ class testtask extends control { if($_POST) { - $file = $this->loadModel('file')->getUpload('resultFile'); - $file = $file[0]; - - $fileName = $this->file->savePath . $this->file->getSaveName($file['pathname']); - move_uploaded_file($file['tmpname'], $fileName); - $this->session->set('resultFile', $fileName); - $taskID = $this->testtask->importUnitResult($productID); if(dao::isError()) die(js::error(dao::getError())); @@ -1170,22 +1145,17 @@ class testtask extends control $this->testtask->setMenu($this->products, $productID); $this->app->loadLang('job'); - $projects = $this->dao->select('t2.id, t2.name')->from(TABLE_PROJECTPRODUCT) - ->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') - ->where('t1.product')->eq((int)$productID) - ->andWhere('t2.deleted')->eq(0) - ->beginIF('0')->andWhere('t1.branch')->in('0')->fi() - ->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->projects)->fi() - ->andWhere('t2.type')->ne('ops') - ->orderBy('t1.project desc') - ->fetchPairs('id', 'name'); - $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->importUnitResult; - $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); - $this->view->position[] = $this->lang->testtask->importUnitResult; + $productID = $productID ? $productID : key($this->products); + $projects = empty($productID) ? array() : $this->product->getProjectPairs($productID, 0, $params = 'nodeleted'); + $builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk'); - $this->view->projects = array('' => '') + $projects; - $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk'); + $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->importUnitResult; + $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); + $this->view->position[] = $this->lang->testtask->importUnitResult; + + $this->view->projects = $projects; + $this->view->builds = $builds; $this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted|noclosed'); $this->view->productID = $productID; $this->display(); diff --git a/module/testtask/lang/de.php b/module/testtask/lang/de.php index bbaf5fca68..1d85748835 100644 --- a/module/testtask/lang/de.php +++ b/module/testtask/lang/de.php @@ -128,6 +128,7 @@ $lang->testtask->checkLinked = "Please check whether the product that the $lang->testtask->noImportData = 'The imported XML does not parse the data.'; $lang->testtask->unitXMLFormat = 'Please select a file in JUnit XML format.'; $lang->testtask->titleOfAuto = "%s automated testing"; +$lang->testtask->cannotBeParsed = 'The content of the imported XML file is in the wrong format and cannot be parsed.'; $lang->testtask->assignedToMe = 'Meine'; $lang->testtask->allCases = 'Alle Fälle'; diff --git a/module/testtask/lang/en.php b/module/testtask/lang/en.php index b3378504b1..de8817615e 100644 --- a/module/testtask/lang/en.php +++ b/module/testtask/lang/en.php @@ -128,6 +128,7 @@ $lang->testtask->checkLinked = "Please check whether the product that the $lang->testtask->noImportData = 'The imported XML does not parse the data.'; $lang->testtask->unitXMLFormat = 'Please select a file in JUnit XML format.'; $lang->testtask->titleOfAuto = "%s automated testing"; +$lang->testtask->cannotBeParsed = 'The content of the imported XML file is in the wrong format and cannot be parsed.'; $lang->testtask->assignedToMe = 'AssignedToMe'; $lang->testtask->allCases = 'All Cases'; diff --git a/module/testtask/lang/fr.php b/module/testtask/lang/fr.php index 2cd349f219..7b46f4e02f 100644 --- a/module/testtask/lang/fr.php +++ b/module/testtask/lang/fr.php @@ -128,6 +128,7 @@ $lang->testtask->checkLinked = "Vérifiez si le product auquel la campagne $lang->testtask->noImportData = "Le XML importé ne parse pas les données."; $lang->testtask->unitXMLFormat = 'Veuillez sélectionner un fichier au format XML JUnit.'; $lang->testtask->titleOfAuto = "%s tests automatisés"; +$lang->testtask->cannotBeParsed = 'The content of the imported XML file is in the wrong format and cannot be parsed.'; $lang->testtask->assignedToMe = 'Affecté à Moi'; $lang->testtask->allCases = 'Tous les CasTests'; diff --git a/module/testtask/lang/vi.php b/module/testtask/lang/vi.php index 6604982e53..774ed81f3b 100644 --- a/module/testtask/lang/vi.php +++ b/module/testtask/lang/vi.php @@ -128,6 +128,7 @@ $lang->testtask->checkLinked = "Vui lòng kiểm tra sản phẩm đó mà $lang->testtask->noImportData = 'The imported XML does not parse the data.'; $lang->testtask->unitXMLFormat = 'Please select a file in JUnit XML format.'; $lang->testtask->titleOfAuto = "%s automated testing"; +$lang->testtask->cannotBeParsed = 'The content of the imported XML file is in the wrong format and cannot be parsed.'; $lang->testtask->assignedToMe = 'Giao cho bạn'; $lang->testtask->allCases = 'Tất cả tình huống'; diff --git a/module/testtask/lang/zh-cn.php b/module/testtask/lang/zh-cn.php index 06dae20fce..fe731e141d 100644 --- a/module/testtask/lang/zh-cn.php +++ b/module/testtask/lang/zh-cn.php @@ -128,6 +128,7 @@ $lang->testtask->checkLinked = '请检查测试单的产品是否与项目 $lang->testtask->noImportData = '导入的XML没有解析出数据。'; $lang->testtask->unitXMLFormat = '请选择Junit XML 格式的文件。'; $lang->testtask->titleOfAuto = "%s 自动化测试"; +$lang->testtask->cannotBeParsed = '导入的XML文件内容格式错误,无法解析。'; $lang->testtask->assignedToMe = '指派给我'; $lang->testtask->allCases = '所有用例'; diff --git a/module/testtask/lang/zh-tw.php b/module/testtask/lang/zh-tw.php index 3f3144909d..a769828c79 100644 --- a/module/testtask/lang/zh-tw.php +++ b/module/testtask/lang/zh-tw.php @@ -128,6 +128,7 @@ $lang->testtask->checkLinked = '請檢查測試單的產品是否與項目 $lang->testtask->noImportData = '導入的XML沒有解析出數據。'; $lang->testtask->unitXMLFormat = '請選擇Junit XML 格式的檔案。'; $lang->testtask->titleOfAuto = "%s 自動化測試"; +$lang->testtask->cannotBeParsed = '導入的XML文件內容格式錯誤,無法解析。'; $lang->testtask->assignedToMe = '指派給我'; $lang->testtask->allCases = '所有用例'; diff --git a/module/testtask/model.php b/module/testtask/model.php index afc9e4d2ca..a937d94cb8 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -23,12 +23,13 @@ class testtaskModel extends model */ public function setMenu($products, $productID, $branch = 0, $testtask = 0) { + $this->lang->product->menu = $this->lang->product->viewMenu; $this->loadModel('product')->setMenu($products, $productID, $branch); $selectHtml = $this->product->select($products, $productID, 'testtask', 'browse', '', $branch); if($testtask and $this->app->viewType != 'mhtml') { - $testtasks = $this->getProductTasks($productID, 0, 'id_desc', null, array('local', 'totalStatus')); + $testtasks = $this->getProductTasks($productID, 0, 'id_desc', null, array('local', 'totalStatus'), 0, 0, $this->session->PRJ); if(!isset($testtasks[$testtask])) $testtasks[$testtask] = $this->getById($testtask); $selectHtml .= "
"; @@ -186,14 +187,19 @@ class testtaskModel extends model * Get test tasks of a product. * * @param int $productID + * @param int $branch * @param string $orderBy * @param object $pager + * @param array $scopeAndStatus + * @param int $beginTime + * @param int $endTime * @access public * @return array */ public function getProductTasks($productID, $branch = 0, $orderBy = 'id_desc', $pager = null, $scopeAndStatus = array(), $beginTime = 0, $endTime = 0) { $products = $scopeAndStatus[0] == 'all' ? $this->app->user->view->products : array(); + return $this->dao->select("t1.*, t2.name AS productName, t3.name AS projectName, t4.name AS buildName, if(t4.name != '', t4.branch, t5.branch) AS branch") ->from(TABLE_TESTTASK)->alias('t1') ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') @@ -202,8 +208,9 @@ class testtaskModel extends model ->leftJoin(TABLE_PROJECTPRODUCT)->alias('t5')->on('t1.project = t5.project and t1.product = t5.product') ->where('t1.deleted')->eq(0) + ->andWhere('t1.PRJ')->eq($this->session->PRJ) ->andWhere('t1.auto')->ne('unit') - ->andWhere('t1.project')->in("0,{$this->app->user->view->sprints}") //Fix bug #3260. + ->beginIF(!$this->app->user->admin)->andWhere('t3.id')->in("0,{$this->app->user->view->sprints}")->fi() ->beginIF($scopeAndStatus[0] == 'local')->andWhere('t1.product')->eq((int)$productID)->fi() ->beginIF($scopeAndStatus[0] == 'all')->andWhere('t1.product')->in($products)->fi() ->beginIF($scopeAndStatus[1] == 'totalStatus')->andWhere('t1.status')->in('blocked,doing,wait,done')->fi() @@ -237,6 +244,7 @@ class testtaskModel extends model ->leftJoin(TABLE_BUILD)->alias('t4')->on('t1.build = t4.id') ->where('t1.deleted')->eq(0) ->andWhere('t1.product')->eq($productID) + ->andWhere('t1.PRJ')->eq($this->session->PRJ) ->andWhere('t1.auto')->eq('unit') ->beginIF($browseType != 'all' and $browseType != 'newest' and $beginAndEnd) ->andWhere('t1.end')->ge($beginAndEnd['begin']) @@ -426,6 +434,7 @@ class testtaskModel extends model { return $this->dao->select('*')->from(TABLE_CASE)->where($query) ->andWhere('id')->notIN($linkedCases) + ->andWhere('PRJ')->eq($this->session->PRJ) ->andWhere('status')->ne('wait') ->andWhere('type')->ne('unit') ->beginIF($task->branch)->andWhere('branch')->in("0,$task->branch")->fi() @@ -452,7 +461,9 @@ class testtaskModel extends model $cases = array(); if($stories) { - $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query) + $cases = $this->dao->select('*')->from(TABLE_CASE) + ->where($query) + ->andWhere('PRJ')->eq($this->session->PRJ) ->andWhere('product')->eq($productID) ->andWhere('status')->ne('wait') ->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi() @@ -485,6 +496,7 @@ class testtaskModel extends model if($bugs) { $cases = $this->dao->select('*')->from(TABLE_CASE)->where($query) + ->andWhere('PRJ')->eq($this->session->PRJ) ->andWhere('product')->eq($productID) ->andWhere('status')->ne('wait') ->beginIF($linkedCases)->andWhere('id')->notIN($linkedCases)->fi() @@ -517,6 +529,7 @@ class testtaskModel extends model return $this->dao->select('t1.*,t2.version as version')->from(TABLE_CASE)->alias('t1') ->leftJoin(TABLE_SUITECASE)->alias('t2')->on('t1.id=t2.case') ->where($query) + ->andWhere('t1.PRJ')->eq($this->session->PRJ) ->andWhere('t2.suite')->eq((int)$suite) ->andWhere('t1.product')->eq($productID) ->andWhere('status')->ne('wait') @@ -541,7 +554,12 @@ class testtaskModel extends model { $caseList = $this->dao->select("`case`")->from(TABLE_TESTRUN)->where('task')->eq($testTask)->andWhere('`case`')->notin($linkedCases)->fetchPairs('case'); - return $this->dao->select("*")->from(TABLE_CASE)->where($query)->andWhere('id')->in($caseList)->andWhere('status')->ne('wait')->page($pager)->fetchAll(); + return $this->dao->select("*")->from(TABLE_CASE)->where($query) + ->andWhere('id')->in($caseList) + ->andWhere('PRJ')->eq($this->session->PRJ) + ->andWhere('status')->ne('wait') + ->page($pager) + ->fetchAll(); } /** @@ -1595,10 +1613,25 @@ class testtaskModel extends model */ public function importUnitResult($productID) { + $file = $this->loadModel('file')->getUpload('resultFile'); + if(empty($file)) + { + dao::$errors[] = $this->lang->testtask->unitXMLFormat; + die(js::error(dao::getError())); + } + + $file = $file[0]; + $fileName = $this->file->savePath . $this->file->getSaveName($file['pathname']); + move_uploaded_file($file['tmpname'], $fileName); + if(simplexml_load_file($fileName) === false) + { + dao::$errors[] = $this->lang->testtask->cannotBeParsed; + die(js::error(dao::getError())); + } + $frame = $this->post->frame; unset($_POST['frame']); - $fileName = $this->session->resultFile; $data = $this->parseXMLResult($fileName, $productID, $frame); if($frame == 'cppunit' and empty($data['cases'])) $data = $this->parseCppXMLResult($fileName, $productID, $frame); diff --git a/module/testtask/view/create.html.php b/module/testtask/view/create.html.php index c3c118f953..1af895134c 100644 --- a/module/testtask/view/create.html.php +++ b/module/testtask/view/create.html.php @@ -19,7 +19,7 @@

testtask->create;?>

-
+ diff --git a/module/testtask/view/edit.html.php b/module/testtask/view/edit.html.php index cdbcdd81af..866e73810e 100644 --- a/module/testtask/view/edit.html.php +++ b/module/testtask/view/edit.html.php @@ -22,8 +22,8 @@ arrow . $lang->testtask->edit;?> - -
+ +
testtask->project;?>