diff --git a/module/project/control.php b/module/project/control.php index 21578f9be9..5067caf52e 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -1016,6 +1016,7 @@ class project extends control * Project test task list. * * @param int $projectID + * @param int $productID * @param string $orderBy * @param int $recTotal * @param int $recPerPage @@ -1023,7 +1024,7 @@ class project extends control * @access public * @return void */ - public function testtask(int $projectID = 0, string $orderBy = 'id_desc', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1) + public function testtask(int $projectID = 0, int $productID = 0, string $orderBy = 'id_desc', int $recTotal = 0, int $recPerPage = 20, int $pageID = 1) { $this->session->set('testtaskList', $this->app->getURI(true), 'project'); @@ -1034,17 +1035,18 @@ class project extends control $pager = pager::init($recTotal, $recPerPage, $pageID); $project = $this->project->getByID($projectID); - $tasks = $this->loadModel('testtask')->getProjectTasks($projectID, $orderBy, $pager); + $tasks = $this->loadModel('testtask')->getProjectTasks($projectID, $productID, $orderBy, $pager); $this->projectZen->assignTesttaskVars($tasks); - $this->view->title = $project->name . $this->lang->hyphen . $this->lang->project->common; - $this->view->project = $project; - $this->view->pager = $pager; - $this->view->orderBy = $orderBy; - $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); - $this->view->products = $this->loadModel('product')->getPairs('', 0); - $this->view->actions = $this->loadModel('action')->getList('testtask', $projectID); + $this->view->title = $project->name . $this->lang->hyphen . $this->lang->project->common; + $this->view->project = $project; + $this->view->productID = $productID; + $this->view->pager = $pager; + $this->view->orderBy = $orderBy; + $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); + $this->view->products = $this->loadModel('product')->getProducts($projectID, 'all', '', false); + $this->view->actions = $this->loadModel('action')->getList('testtask', $projectID); $this->display(); } diff --git a/module/project/ui/testtask.html.php b/module/project/ui/testtask.html.php index e6881c2277..d0fb9bd564 100644 --- a/module/project/ui/testtask.html.php +++ b/module/project/ui/testtask.html.php @@ -14,6 +14,18 @@ jsVar('allTasks', $lang->testtask->allTasks); jsVar('pageSummary', sprintf($lang->testtask->allSummary, count($tasks), $waitCount, $testingCount, $blockedCount, $doneCount)); jsVar('checkedAllSummary', $lang->testtask->checkedAllSummary); +$productItems[] = array('text' => $lang->testtask->all, 'url' => createLink('project', 'testtask', array('projectID' => $project->id))); +foreach($products as $currentProductID => $productName) +{ + $productItems[] = array('text' => $productName, 'url' => createLink('project', 'testtask', array('projectID' => $project->id, 'productID' => $currentProductID))); +} + +$productDropdown = dropdown +( + to('trigger', btn($productID ? zget($products, $productID) : $lang->testtask->all, setClass('ghost'))), + set::items($productItems) +); + featureBar ( li @@ -24,7 +36,8 @@ featureBar set('class', 'active'), $lang->testtask->browse ) - ) + ), + to::before($productDropdown), ); $canModify = common::canModify('project', $project); @@ -67,7 +80,7 @@ dtable set::taskData($tasks), set::userMap($users), set::orderBy($orderBy), - set::sortLink(createLink('project', 'testtask', "projectID={$project->id}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")), + set::sortLink(createLink('project', 'testtask', "projectID={$project->id}&productID={$productID}&orderBy={name}_{sortType}&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}")), set::plugins(array('cellspan')), set::getCellSpan(jsRaw('window.getCellSpan')), set::footToolbar($footToolbar), @@ -75,7 +88,7 @@ dtable ( 'recPerPage' => $pager->recPerPage, 'recTotal' => $pager->recTotal, - 'linkCreator' => helper::createLink('project', 'testtask', "projectID={$project->id}&orderBy={$orderBy}&recTotal={$pager->recTotal}&recPerPage={recPerPage}&page={page}") + 'linkCreator' => helper::createLink('project', 'testtask', "projectID={$project->id}&productID={$productID}&orderBy={$orderBy}&recTotal={$pager->recTotal}&recPerPage={recPerPage}&page={page}") ))), set::checkInfo(jsRaw('function(checkedIDList){return window.setStatistics(this, checkedIDList);}')), set::emptyTip($lang->testtask->noTesttask), diff --git a/module/testtask/model.php b/module/testtask/model.php index 1a85a558e3..f5efeaf443 100755 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -147,12 +147,13 @@ class testtaskModel extends model * Get testtasks of a project. * * @param int $projectID + * @param int $productID * @param string $orderBy * @param object $pager * @access public * @return array */ - public function getProjectTasks(int $projectID, string $orderBy = 'id_desc', ?object $pager = null): array + public function getProjectTasks(int $projectID, int $productID = 0, string $orderBy = 'id_desc', ?object $pager = null): array { $tasks = $this->dao->select('t1.*, t1.id AS idName, t5.multiple, IF(t4.shadow = 1, t5.name, t4.name) AS productName, t3.name AS executionName, t2.name AS buildName, t2.branch AS branch, t5.name AS projectName, t4.`order` AS productOrder') ->from(TABLE_TESTTASK)->alias('t1') @@ -163,6 +164,7 @@ class testtaskModel extends model ->where('t1.project')->eq((int)$projectID) ->andWhere('t1.auto')->ne('unit') ->andWhere('t1.deleted')->eq('0') + ->beginIF($productID)->andWhere('t1.product')->eq($productID)->fi() ->orderBy('productOrder_asc, ' . $orderBy) ->page($pager) ->fetchAll('id', false);