From 25da8484bb1720ec405a5085db4639a007a44010 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 12 Feb 2025 13:55:08 +0800 Subject: [PATCH] * [misc,done,0.1h] change method position. --- module/bug/control.php | 38 ++++++++++++++++++++++++++++++++++++++ module/bug/zen.php | 38 -------------------------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index e9554b170e..c6a42059b3 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1659,4 +1659,42 @@ class bug extends control $project = $this->loadModel('project')->fetchByID($projectID); return print(json_encode($project)); } + + /** + * 获取项目型项目关联产品的ID。 + * Get product id by project. + * + * @param int $projectID + * @access public + * @return void + */ + public function ajaxGetProductIDByProject(int $projectID) + { + $productID = $this->loadModel('product')->getProductIDByProject($projectID); + return print($productID); + } + + /** + * 获取关联产品的项目下拉数据。 + * AJAX: get projects of a product in html select. + * + * @param int $productID + * @param string $branch ''|'all'|int + * @param int $projectID + * @param string $pageType old + * @access public + * @return void + */ + public function ajaxGetProjects(int $productID, string $branch = '', int $projectID = 0, string $pageType = '') + { + $product = $this->loadModel('product')->fetchByID($productID); + $projectPairs = $product->shadow ? $this->loadModel('project')->getPairs(false, 'noproduct,noclosed') : array(); + $projects = $this->product->getProjectPairsByProduct($productID, $branch, array_keys($projectPairs)); + if($this->app->getViewType() == 'json') return print(json_encode($projects)); + if($pageType == 'old') return print(html::select('project', array(0 => '') + $projects, $projectID, "class='form-control' onchange='loadProductExecutions({$productID}, this.value)'")); + + $items = array(); + foreach($projects as $projectID => $projectName) $items[] = array('text' => $projectName, 'value' => $projectID, 'keys' => $projectName); + return print(json_encode($items)); + } } diff --git a/module/bug/zen.php b/module/bug/zen.php index 18f17082b0..9ccaa6dcd9 100644 --- a/module/bug/zen.php +++ b/module/bug/zen.php @@ -2469,42 +2469,4 @@ class bugZen extends bug $this->config->bug->actions->view['mainActions'] = array('confirm', 'assignTo', 'resolve', 'close', 'activate'); $this->config->bug->actions->view['suffixActions'] = array('delete'); } - - /** - * 获取项目型项目关联产品的ID。 - * Get product id by project. - * - * @param int $projectID - * @access public - * @return void - */ - public function ajaxGetProductIDByProject(int $projectID) - { - $productID = $this->loadModel('product')->getProductIDByProject($projectID); - return print($productID); - } - - /** - * 获取关联产品的项目下拉数据。 - * AJAX: get projects of a product in html select. - * - * @param int $productID - * @param string $branch ''|'all'|int - * @param int $projectID - * @param string $pageType old - * @access public - * @return void - */ - public function ajaxGetProjects(int $productID, string $branch = '', int $projectID = 0, string $pageType = '') - { - $product = $this->loadModel('product')->fetchByID($productID); - $projectPairs = $product->shadow ? $this->loadModel('project')->getPairs(false, 'noproduct,noclosed') : array(); - $projects = $this->product->getProjectPairsByProduct($productID, $branch, array_keys($projectPairs)); - if($this->app->getViewType() == 'json') return print(json_encode($projects)); - if($pageType == 'old') return print(html::select('project', array(0 => '') + $projects, $projectID, "class='form-control' onchange='loadProductExecutions({$productID}, this.value)'")); - - $items = array(); - foreach($projects as $projectID => $projectName) $items[] = array('text' => $projectName, 'value' => $projectID, 'keys' => $projectName); - return print(json_encode($items)); - } }