From d597775c7ed2f6b93464d14276fb9fd3c51f7735 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 29 Jun 2022 08:35:21 +0800 Subject: [PATCH] * Finish task #58560. --- module/bug/control.php | 88 ++++++++++++++++-------------- module/bug/view/batchedit.html.php | 32 +++++++---- 2 files changed, 66 insertions(+), 54 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 2e11fc511c..ebd9dad1ea 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1261,56 +1261,63 @@ class bug extends control } /* Get assigned to member. */ - $this->loadModel('project'); - $this->loadModel('execution'); + if($this->app->tab == 'execution' or $this->app->tab == 'project') + { + $this->loadModel('project'); + $this->loadModel('execution'); - $productMembers = array(); - $projectMembers = array(); - $executionMembers = array(); - if($productID) - { - $branchList = zget($branchIdList, $productID, array()); - foreach($branchList as $branchID) + $productMembers = array(); + $projectMembers = array(); + $executionMembers = array(); + if($productID) { - $members = $this->bug->getProductMemberPairs($productID, $branchID); - $productMembers[$productID][$branchID] = array_filter($members); - } - } - else - { - foreach($productIdList as $id) - { - $branchList = zget($branchIdList, $id, array()); + $branchList = zget($branchIdList, $productID, array()); foreach($branchList as $branchID) { - $members = $this->bug->getProductMemberPairs($id, $branchID); - $productMembers[$id][$branchID] = array_filter($members); + $members = $this->bug->getProductMemberPairs($productID, $branchID); + $productMembers[$productID][$branchID] = array_filter($members); } } - } - - $projectMemberGroup = $this->project->getTeamMemberGroup($projectIdList); - $projectMembers = array(); - foreach($projectIdList as $projectID) - { - $projectTeam = zget($projectMemberGroup, $projectID, array()); - if(empty($projectTeam)) $projectMembers[$projectID] = array(); - foreach($projectTeam as $user) + else { - $projectMembers[$projectID][$user->account] = $user->realname; + foreach($productIdList as $id) + { + $branchList = zget($branchIdList, $id, array()); + foreach($branchList as $branchID) + { + $members = $this->bug->getProductMemberPairs($id, $branchID); + $productMembers[$id][$branchID] = array_filter($members); + } + } } - } - $executionMemberGroup = $this->execution->getMembersByIdList($executionIdList); - $executionMembers = array(); - foreach($executionIdList as $executionID) - { - $executionTeam = zget($executionMemberGroup, $executionID, array()); - if(empty($executionTeam)) $executionMemberGroup[$executionID] = array(); - foreach($executionTeam as $user) + $projectMemberGroup = $this->project->getTeamMemberGroup($projectIdList); + $projectMembers = array(); + foreach($projectIdList as $projectID) { - $executionMembers[$executionID][$user->account] = $user->realname; + $projectTeam = zget($projectMemberGroup, $projectID, array()); + if(empty($projectTeam)) $projectMembers[$projectID] = array(); + foreach($projectTeam as $user) + { + $projectMembers[$projectID][$user->account] = $user->realname; + } } + + $executionMemberGroup = $this->execution->getMembersByIdList($executionIdList); + $executionMembers = array(); + foreach($executionIdList as $executionID) + { + $executionTeam = zget($executionMemberGroup, $executionID, array()); + if(empty($executionTeam)) $executionMemberGroup[$executionID] = array(); + foreach($executionTeam as $user) + { + $executionMembers[$executionID][$user->account] = $user->realname; + } + } + + $this->view->productMembers = $productMembers; + $this->view->projectMembers = $projectMembers; + $this->view->executionMembers = $executionMembers; } /* Set users. */ @@ -1330,9 +1337,6 @@ class bug extends control $this->view->bugs = $bugs; $this->view->branch = $branch; $this->view->users = $users; - $this->view->productMembers = $productMembers; - $this->view->projectMembers = $projectMembers; - $this->view->executionMembers = $executionMembers; $this->view->modules = $modules; $this->view->branchTagOption = $branchTagOption; diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php index c15db2a9b3..423c7e9cd2 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -104,22 +104,30 @@ ' style='overflow:visible'>plan, "class='form-control picker-select' data-drop-width='auto'");?> execution) + if($app->tab == 'project' or $app->tab == 'execution') { - $assignedToList = array('' => '', 'ditto' => $this->lang->bug->ditto) + $executionMembers[$bug->execution]; - } - elseif($bug->project) - { - $assignedToList = array('' => '', 'ditto' => $this->lang->bug->ditto) + $projectMembers[$bug->project]; + if($bug->execution) + { + $assignedToList = array('' => '', 'ditto' => $this->lang->bug->ditto) + $executionMembers[$bug->execution]; + } + elseif($bug->project) + { + $assignedToList = array('' => '', 'ditto' => $this->lang->bug->ditto) + $projectMembers[$bug->project]; + } + else + { + $assignedToList = $productMembers[$bug->product][$bug->branch]; + if(empty($assignedToList)) + { + $assignedToList = $users; + unset($assignedToList['closed']); + } + } } else { - $assignedToList = $productMembers[$bug->product][$bug->branch]; - if(empty($assignedToList)) - { - $assignedToList = $users; - unset($assignedToList['closed']); - } + $assignedToList = $users; + unset($assignedToList['closed']); } ?> ' style='overflow:visible'>assignedTo, "class='form-control picker-select' data-drop-width='135px'");?>