From e4b9ef4536748336201f1f781c3a7490ea1a664f Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 8 Dec 2022 09:56:31 +0800 Subject: [PATCH] * fix bug #30585. --- module/build/control.php | 2 +- module/build/model.php | 2 ++ module/testtask/control.php | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/module/build/control.php b/module/build/control.php index 021f442967..f351795698 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -428,7 +428,7 @@ class build extends control return print(html::select($varName, $builds, $build, "class='form-control'")); } - $builds = $this->build->getBuildPairs($productID, $branch, $type, 0, 'project', $build); + $builds = $this->build->getBuildPairs($productID, $branch, $type, 0, 'project', $build, false); if(strpos($extra, 'multiple') !== false) $varName .= '[]'; if($isJsonView) return print(json_encode($builds)); return print(html::select($varName, $builds, $build, "class='form-control chosen' $extra")); diff --git a/module/build/model.php b/module/build/model.php index 6f2f11d422..ad3e227710 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -256,6 +256,7 @@ class buildModel extends model ->fetchPairs(); } + $shadows = $this->dao->select('shadow')->from(TABLE_RELEASE)->where('product')->in($products)->fetchPairs('shadow', 'shadow'); $branchs = strpos($params, 'separate') === false ? "0,$branch" : $branch; $allBuilds = $this->dao->select('t1.id, t1.name, t1.execution, t1.date, t1.deleted, t2.status as objectStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName, t5.type as productType')->from(TABLE_BUILD)->alias('t1') ->beginIF($objectType === 'execution')->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id')->fi() @@ -264,6 +265,7 @@ class buildModel extends model ->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id') ->leftJoin(TABLE_PRODUCT)->alias('t5')->on('t1.product = t5.id') ->where('1=1') + ->andWhere('t1.id')->notIN($shadows) ->beginIF(strpos($params, 'hasDeleted') === false)->andWhere('t1.deleted')->eq(0)->fi() ->beginIF(strpos($params, 'hasproject') !== false)->andWhere('t1.project')->ne(0)->fi() ->beginIF(strpos($params, 'singled') !== false)->andWhere('t1.execution')->ne(0)->fi() diff --git a/module/testtask/control.php b/module/testtask/control.php index c3d4a34b99..58129d9a6d 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -250,7 +250,7 @@ class testtask extends control /* Create testtask from testtask of test.*/ $productID = $productID ? $productID : key($this->products); $executions = empty($productID) ? array() : $this->loadModel('product')->getExecutionPairsByProduct($productID, '', 'id_desc', $projectID, 'stagefilter'); - $builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'notrunk,withexecution', $projectID, 'project'); + $builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'notrunk,withexecution', $projectID, 'project', '', false); $execution = $this->loadModel('execution')->getByID($executionID); if(!empty($execution) and $execution->type == 'kanban') $this->lang->testtask->execution = str_replace($this->lang->execution->common, $this->lang->kanban->common, $this->lang->testtask->execution); @@ -816,11 +816,11 @@ class testtask extends control $executions[$executionID] = $project->name . "({$this->lang->project->disableExecution})"; } } - $builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk,withexecution', $executionID, 'execution'); + $builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk,withexecution', $executionID, 'execution', $task->build, false); } else { - $builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk,withexecution', $task->project, 'project'); + $builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk,withexecution', $task->project, 'project', $task->build, false); } $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->edit;