From c82113ab84dcf953d5dfaaaf07f2b557612f542d Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Sun, 21 Nov 2021 11:33:43 +0800 Subject: [PATCH] * Modify the drop-down range of versions when submitting tests. --- module/build/control.php | 30 +++++++++++++++--------------- module/build/model.php | 27 +++++++++++++-------------- module/testtask/control.php | 2 +- module/testtask/js/create.js | 2 +- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/module/build/control.php b/module/build/control.php index 9bfa8f1105..77fa967f8f 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -346,16 +346,16 @@ class build extends control /** * AJAX: get builds of a product in html select. * - * @param int $productID - * @param string $varName the name of the select object to create - * @param string $build build to selected - * @param int $branch - * @param int $index the index of batch create bug. - * @param string $type get all builds or some builds belong to normal releases and executions are not done. + * @param int $productID + * @param string $varName the name of the select object to create + * @param string $build build to selected + * @param string|int $branch + * @param int $index the index of batch create bug. + * @param string $type get all builds or some builds belong to normal releases and executions are not done. * @access public * @return string */ - public function ajaxGetProductBuilds($productID, $varName, $build = '', $branch = 0, $index = 0, $type = 'normal') + public function ajaxGetProductBuilds($productID, $varName, $build = '', $branch = 'all', $index = 0, $type = 'normal') { $isJsonView = $this->app->getViewType() == 'json'; if($varName == 'openedBuild' ) @@ -383,17 +383,17 @@ class build extends control /** * AJAX: get builds of an execution in html select. * - * @param int $executionID - * @param string $varName the name of the select object to create - * @param string $build build to selected - * @param int $branch - * @param int $index the index of batch create bug. - * @param bool $needCreate if need to append the link of create build - * @param string $type get all builds or some builds belong to normal releases and executions are not done. + * @param int $executionID + * @param string $varName the name of the select object to create + * @param string $build build to selected + * @param string|int $branch + * @param int $index the index of batch create bug. + * @param bool $needCreate if need to append the link of create build + * @param string $type get all builds or some builds belong to normal releases and executions are not done. * @access public * @return string */ - public function ajaxGetExecutionBuilds($executionID, $productID, $varName, $build = '', $branch = 0, $index = 0, $needCreate = false, $type = 'normal') + public function ajaxGetExecutionBuilds($executionID, $productID, $varName, $build = '', $branch = 'all', $index = 0, $needCreate = false, $type = 'normal') { $isJsonView = $this->app->getViewType() == 'json'; if($varName == 'openedBuild') diff --git a/module/build/model.php b/module/build/model.php index b1fae82ef8..40bc022786 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -217,17 +217,16 @@ class buildModel extends model /** * Get builds of a execution in pairs. * - * @param int $executionID - * @param int $productID - * @param int $branch - * @param string $params noempty|notrunk, can be a set of them - * @param string $buildIdList + * @param int $executionID + * @param int $productID + * @param string|int $branch + * @param string $params noempty|notrunk, can be a set of them + * @param string $buildIdList * @access public * @return array */ - public function getExecutionBuildPairs($executionID, $productID, $branch = 0, $params = '', $buildIdList = '') + public function getExecutionBuildPairs($executionID, $productID, $branch = 'all', $params = '', $buildIdList = '') { - if($branch == 'all') $branch = 0; $sysBuilds = array(); $selectedBuilds = array(); if(strpos($params, 'noempty') === false) $sysBuilds = array('' => ''); @@ -240,7 +239,7 @@ class buildModel extends model ->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id') ->where('t1.execution')->eq((int)$executionID) ->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi() - ->andWhere('t1.branch')->eq($branch) + ->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi() ->andWhere('t1.deleted')->eq(0) ->orderBy('t1.date desc, t1.id desc')->fetchAll('id'); @@ -260,15 +259,15 @@ class buildModel extends model /** * Get builds of a product in pairs. * - * @param mix $products int|array - * @param int $branch - * @param string $params noempty|notrunk, can be a set of them - * @param bool $replace + * @param mix $products int|array + * @param string|int $branch + * @param string $params noempty|notrunk, can be a set of them + * @param bool $replace * * @access public * @return array */ - public function getProductBuildPairs($products, $branch = 0, $params = 'noterminate, nodone', $replace = true) + public function getProductBuildPairs($products, $branch = 'all', $params = 'noterminate, nodone', $replace = true) { $sysBuilds = array(); if(strpos($params, 'noempty') === false) $sysBuilds = array('' => ''); @@ -302,7 +301,7 @@ class buildModel extends model $releases = $this->dao->select('build, name')->from(TABLE_RELEASE) ->where('build')->in(array_keys($builds)) ->andWhere('product')->in($products) - ->beginIF($branch)->andWhere('branch')->in("0,$branch")->fi() + ->beginIF($branch !== 'all')->andWhere('branch')->in("$branch")->fi() ->andWhere('deleted')->eq(0) ->fetchPairs(); foreach($releases as $buildID => $releaseName) diff --git a/module/testtask/control.php b/module/testtask/control.php index 6cbf9bcdb2..98b1864063 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -252,7 +252,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, 0, 'id_desc', $projectID); - $builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk', true); + $builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 'all', 'notrunk', true); $testreports = $this->testtask->getTestReportPairsByBuild($build); diff --git a/module/testtask/js/create.js b/module/testtask/js/create.js index 50a185667b..5c712f34ac 100755 --- a/module/testtask/js/create.js +++ b/module/testtask/js/create.js @@ -37,5 +37,5 @@ function loadExecutions(productID) $(function() { adjustPriBoxWidth(); - if($('#execution').val()) loadExecutionBuilds($('#execution').val()); + if($('#execution').val() != 0) loadExecutionBuilds($('#execution').val()); });