From 70c1dc1caaabe135a56abd1a6575c6f9e48e85cd Mon Sep 17 00:00:00 2001 From: guofeilong Date: Thu, 11 May 2023 08:30:40 +0800 Subject: [PATCH] * Change function name from getBranchGroupByProject to getBranchGroup . --- module/project/control.php | 2 +- module/project/model.php | 4 ++-- module/project/test/model/getbranchgroupbyproject.php | 8 ++++---- module/project/zen.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/module/project/control.php b/module/project/control.php index ca4800a285..8a4cb54b6a 100755 --- a/module/project/control.php +++ b/module/project/control.php @@ -504,7 +504,7 @@ class project extends control $branches = $this->project->getBranchesByProject($projectID); $linkedProductIdList = empty($branches) ? array() : array_keys($branches); $linkedProducts = $this->loadModel('product')->getProducts($projectID, 'all', '', true); - $projectBranches = $this->project->getBranchGroupByProject($projectID, array_keys($linkedProducts)); + $projectBranches = $this->project->getBranchGroup($projectID, array_keys($linkedProducts)); $allProducts = $this->program->getProductPairs($project->parent, 'all', 'noclosed', '', 0, $withProgram); $plans = $this->loadModel('productplan')->getGroupByProduct(array_keys($linkedProducts), 'skipParent|unexpired'); diff --git a/module/project/model.php b/module/project/model.php index 9ecd466fdf..448cf3aef6 100755 --- a/module/project/model.php +++ b/module/project/model.php @@ -874,7 +874,7 @@ class projectModel extends model /** * 根据项目ID获取分支分组。 - * Get branch group by project id. + * Get branch groups. * * @param int $projectID * @param array $productIdList @@ -882,7 +882,7 @@ class projectModel extends model * @access public * @return array */ - public function getBranchGroupByProject(int $projectID, array $productIdList): array + public function getBranchGroup(int $projectID, array $productIdList): array { return $this->dao->select('t1.product as productID, t1.branch as branchID, t2.*') ->from(TABLE_PROJECTPRODUCT)->alias('t1') diff --git a/module/project/test/model/getbranchgroupbyproject.php b/module/project/test/model/getbranchgroupbyproject.php index 583dbf5748..d426db54cc 100755 --- a/module/project/test/model/getbranchgroupbyproject.php +++ b/module/project/test/model/getbranchgroupbyproject.php @@ -10,7 +10,7 @@ zdTable('projectproduct')->config('projectproduct')->gen(6); /** -title=测试 projectModel->getBranchGroupByProject(); +title=测试 projectModel->getBranchGroup(); timeout=0 cid=1 pid=1 @@ -21,9 +21,9 @@ global $tester; $tester->loadModel('project'); $productIdList = array(1, 2, 3); -$project1 = $tester->project->getBranchGroupByProject(1, $productIdList); -$project2 = $tester->project->getBranchGroupByProject(2, $productIdList); -$project3 = $tester->project->getBranchGroupByProject(3, $productIdList); +$project1 = $tester->project->getBranchGroup(1, $productIdList); +$project2 = $tester->project->getBranchGroup(2, $productIdList); +$project3 = $tester->project->getBranchGroup(3, $productIdList); r(key($project1[1])) && p('') && e('1'); // 获取id为1的项目的关联产品的分支数组,获取第一个数组的键 r(count($project1[1])) && p('') && e('3'); // 获取id为1的项目的关联产品的分支数组数量,按产品分组 diff --git a/module/project/zen.php b/module/project/zen.php index 1ea0fc4f9e..2dd94707f3 100644 --- a/module/project/zen.php +++ b/module/project/zen.php @@ -773,7 +773,7 @@ class projectZen extends project $allProducts = $this->loadModel('program')->getProductPairs($project->parent, 'all', 'noclosed', $linkedProductIdList); $linkedProducts = $this->loadModel('product')->getProducts($projectID, 'all', '', true, $linkedProductIdList); $projectStories = $this->project->getStoriesByProject($projectID); - $projectBranches = $this->project->getBranchGroupByProject($projectID, array_keys($linkedProducts)); + $projectBranches = $this->project->getBranchGroup($projectID, array_keys($linkedProducts)); /* If the story of the product which linked the project,don't allow to remove the product. */ $unmodifiableProducts = array();