From 2bd28233ea3e9c84bfce913bfd19df92649a86cd Mon Sep 17 00:00:00 2001 From: wangyuting <851424971@qq.com> Date: Thu, 1 Dec 2022 06:28:13 +0000 Subject: [PATCH] * Fix bug #30429. --- module/build/lang/zh-cn.php | 1 - module/build/model.php | 18 ++++++++---------- module/project/control.php | 1 + module/project/view/build.html.php | 13 ++++++++++--- module/testtask/js/common.js | 1 - 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/module/build/lang/zh-cn.php b/module/build/lang/zh-cn.php index 5761210a57..fe804daf9c 100644 --- a/module/build/lang/zh-cn.php +++ b/module/build/lang/zh-cn.php @@ -63,7 +63,6 @@ $lang->build->notice->changeBuilds = "提交测试单的版本,不能修改 $lang->build->notice->autoRelation = "相关版本下完成的需求、解决的Bug、产生的Bug将会自动关联到项目版本中"; $lang->build->notice->createTest = "该版本所属执行已删除,不能提交测试"; - $lang->build->finishStories = " 本次共完成 %s 个{$lang->SRCommon}"; $lang->build->resolvedBugs = ' 本次共解决 %s 个Bug'; $lang->build->createdBugs = ' 本次共产生 %s 个Bug'; diff --git a/module/build/model.php b/module/build/model.php index 2225863208..2dc021d654 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -275,7 +275,7 @@ class buildModel extends model ->beginIF($branch !== 'all')->andWhere('t1.branch')->in("$branchs")->fi() ->orderBy('t1.date desc, t1.id desc')->fetchAll('id'); - $executions = $this->dao->select('id, deleted')->from(TABLE_EXECUTION)->where('type')->eq('sprint')->andWhere('deleted')->eq('1')->fetchPairs(); + $deletedExecutions = $this->dao->select('id, deleted')->from(TABLE_EXECUTION)->where('type')->eq('sprint')->andWhere('deleted')->eq('1')->fetchPairs(); /* Set builds and filter done executions and terminate releases. */ $builds = array(); @@ -285,7 +285,7 @@ class buildModel extends model { if(empty($build->releaseID) and (strpos($params, 'nodone') !== false) and ($build->objectStatus === 'done')) continue; if((strpos($params, 'noterminate') !== false) and ($build->releaseStatus === 'terminate')) continue; - if((strpos($params, 'withexecution') !== false) and $build->execution and !empty($executions[$build->execution])) continue; + if((strpos($params, 'withexecution') !== false) and $build->execution and isset($executions[$build->execution])) continue; if($build->deleted == 1) $build->name .= ' (' . $this->lang->build->deleted . ')'; $branchName = $build->branchName ? $build->branchName : $this->lang->branch->main; @@ -656,6 +656,8 @@ class buildModel extends model { $action = strtolower($action); + if($module == 'testtask' and $action == 'create') return !$object->executionDeleted; + return true; } @@ -684,18 +686,14 @@ class buildModel extends model { $executionID = $tab == 'execution' ? $extraParams['executionID'] : $build->execution; $execution = $this->loadModel('execution')->getByID($executionID); + $build->executionDeleted = $execution ? $execution->deleted : 0; + $testtaskApp = (!empty($execution->type) and $execution->type == 'kanban') ? 'data-app="qa"' : "data-app='{$tab}'"; if(common::hasPriv($module, 'linkstory') and common::canBeChanged('build', $build)) $menu .= $this->buildMenu($module, 'view', "{$params}&type=story&link=true", $build, $type, 'link', '', '', '', "data-app={$tab}", $this->lang->build->linkStory); - if($execution and $execution->deleted === '1') - { - if(common::hasPriv('testtask', 'create')) $menu .= html::a(helper::createLink('testtask', 'create', "product=$build->product&execution={$executionID}&build=$build->id&projectID=$build->project"), "", '', "class='btn' title='{$this->lang->build->notice->createTest}' disabled"); - } - else - { - $menu .= $this->buildMenu('testtask', 'create', "product=$build->product&execution={$executionID}&build=$build->id&projectID=$build->project", $build, $type, 'bullhorn', '', '', '', $testtaskApp); - } + $title = ($execution and $execution->deleted === '1') ? $this->lang->build->notice->createTest : ''; + $menu .= $this->buildMenu('testtask', 'create', "product=$build->product&execution={$executionID}&build=$build->id&projectID=$build->project", $build, $type, 'bullhorn', '', '', '', $testtaskApp, $title); if($tab == 'execution' and !empty($execution->type) and $execution->type != 'kanban') $menu .= $this->buildMenu('execution', 'bug', "execution={$extraParams['executionID']}&productID={$extraParams['productID']}&branchID=all&orderBy=status&build=$build->id", $build, $type, '', '', '', '', $this->lang->execution->viewBug); if($tab == 'project' or empty($execution->type) or $execution->type == 'kanban') $menu .= $this->buildMenu($module, 'view', "{$params}&type=generatedBug", $build, $type, 'bug', '', '', '', "data-app='$tab'", $this->lang->project->bug); diff --git a/module/project/control.php b/module/project/control.php index 3f60d6c8fc..067259fdd9 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -1462,6 +1462,7 @@ class project extends control { foreach($builds as $build) { + $build->builds = $this->build->getByList($build->builds); /* If product is normal, unset branch name. */ if(isset($productList[$build->product]) and $productList[$build->product]->type == 'normal') { diff --git a/module/project/view/build.html.php b/module/project/view/build.html.php index 750854ea57..6c5358032b 100644 --- a/module/project/view/build.html.php +++ b/module/project/view/build.html.php @@ -85,9 +85,16 @@