diff --git a/module/project/control.php b/module/project/control.php index 450064cd14..e1bff6f47e 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1116,7 +1116,7 @@ class project extends control if($task->status == 'doing') $testingCount ++; if($task->status == 'blocked') $blockedCount ++; if($task->status == 'done') $doneCount ++; - + if($task->build == 'trunk' || empty($task->buildName)) $task->buildName = $this->lang->trunk; } $this->view->title = $project->name . $this->lang->colon . $this->lang->project->common; diff --git a/module/project/ui/testtask.html.php b/module/project/ui/testtask.html.php index 4f4bfc5e1f..8978496d9c 100644 --- a/module/project/ui/testtask.html.php +++ b/module/project/ui/testtask.html.php @@ -9,17 +9,6 @@ declare(strict_types=1); * @link https://www.zentao.net */ namespace zin; -$this->testtask->buildOperateMenu(null, 'browse'); -foreach($tasks as $task) -{ - $actions = array(); - foreach($this->config->testtask->dtable->fieldList['actions']['actionsMap'] as $actionCode => $actionMap) - { - $isClickable = $this->testtask->isClickable($task, $actionCode); - $actions[] = $isClickable ? $actionCode : array('name' => $actionCode, 'disabled' => true); - } - $task->actions = $actions; -} featureBar ( @@ -27,22 +16,22 @@ featureBar set::linkParams("projectID={$projectID}") ); -$cols = array_values($config->testtask->dtable->fieldList); -$data = array_values($tasks); toolbar ( - btngroup + common::canModify('project', $project) && common::hasPriv('testtask', 'create') ? btn ( - btn - ( - setClass('btn primary'), - set::icon('plus'), - set::url(helper::createLink('testtask', 'create', "product=$productID")), - $lang->testtask->create - ) - ) + setClass('btn primary'), + set::icon('plus'), + set::url(helper::createLink('testtask', 'create', "product=0&executionID=0&build=0&projectID={$projectID}")), + $lang->testtask->create + ) : null ); +if(!$project->hasProduct) unset($config->testtask->dtable->fieldList['product']); + +$tasks = initTableData($tasks, $config->testtask->dtable->fieldList, $this->testtask); +$cols = array_values($config->testtask->dtable->fieldList); +$data = array_values($tasks); $footerHTML = sprintf($lang->testtask->allSummary, count($tasks), $waitCount, $testingCount, $blockedCount, $doneCount); dtable ( diff --git a/module/testtask/model.php b/module/testtask/model.php index c5d2e6d935..8896df02b8 100755 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -189,15 +189,34 @@ class testtaskModel extends model */ public function getProjectTasks($projectID, $orderBy = 'id_desc', $pager = null) { - return $this->dao->select('t1.*, t2.name AS buildName') + $tasks = $this->dao->select('t1.*, t2.name AS buildName, t3.name as executionName, t4.name AS productName') ->from(TABLE_TESTTASK)->alias('t1') ->leftJoin(TABLE_BUILD)->alias('t2')->on('t1.build = t2.id') + ->leftJoin(TABLE_EXECUTION)->alias('t3')->on('t1.execution = t3.id') + ->leftJoin(TABLE_PRODUCT)->alias('t4')->on('t1.product = t4.id') ->where('t1.project')->eq((int)$projectID) ->andWhere('t1.auto')->ne('unit') ->andWhere('t1.deleted')->eq(0) ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); + + foreach($tasks as $taskID => $task) + { + if($task->multiple) + { + if($task->projectName and $task->executionName) + { + $tasks[$taskID]->executionName = $task->projectName . '/' . $task->executionName; + } + elseif(!$task->executionName) + { + $tasks[$taskID]->executionName = $task->projectName; + } + } + } + + return $tasks; } /** diff --git a/module/testtask/ui/browse.html.php b/module/testtask/ui/browse.html.php index b7f68cc1cd..145312b049 100644 --- a/module/testtask/ui/browse.html.php +++ b/module/testtask/ui/browse.html.php @@ -48,7 +48,7 @@ featureBar ) ); -if(!$product->shadow) unset($config->testtask->dtable->fieldList['product']); +if($product->shadow) unset($config->testtask->dtable->fieldList['product']); $tasks = initTableData($tasks, $config->testtask->dtable->fieldList, $this->testtask); $cols = array_values($config->testtask->dtable->fieldList);