diff --git a/module/bug/zen.php b/module/bug/zen.php index 66dec83d04..b6ef1fd45b 100644 --- a/module/bug/zen.php +++ b/module/bug/zen.php @@ -1147,7 +1147,7 @@ class bugZen extends bug $this->view->releasedBuilds = $this->loadModel('release')->getReleasedBuilds($bug->productID, $bug->branch); $this->view->resultFiles = (!empty($resultID) and !empty($stepIdList)) ? $this->loadModel('file')->getByObject('stepResult', $resultID, str_replace('_', ',', $stepIdList)) : array(); $this->view->product = $currentProduct; - $this->view->contactList = $this->loadModel('user')->getContactLists($this->app->user->account, 'withnote'); + $this->view->contactList = $this->loadModel('user')->getContactLists(); $this->view->projectID = isset($projectID) ? $projectID : $bug->projectID; $this->view->executionID = isset($executionID) ? $executionID : (!empty($bug->execution->id) ? $bug->execution->id : ''); } @@ -1262,7 +1262,7 @@ class bugZen extends bug $this->view->cases = $this->loadModel('testcase')->getPairsByProduct($bug->product, array(0, $bug->branch)); $this->view->users = $this->user->getPairs('noclosed', "$bug->assignedTo,$bug->resolvedBy,$bug->closedBy,$bug->openedBy"); $this->view->actions = $this->loadModel('action')->getList('bug', $bug->id); - $this->view->contactList = $this->loadModel('user')->getContactLists($this->app->user->account, 'withnote'); + $this->view->contactList = $this->loadModel('user')->getContactLists(); $this->view->assignedToList = $assignedToList; $this->view->execution = $this->loadModel('execution')->getByID($bug->execution); } diff --git a/module/my/control.php b/module/my/control.php index e1efeb4fb5..71b9bad63c 100755 --- a/module/my/control.php +++ b/module/my/control.php @@ -1324,7 +1324,7 @@ EOF; $users = $this->user->getPairs($userParams, $mode == 'new' ? '' : $userList, $this->config->maxCount); $this->view->title = $this->lang->my->common . $this->lang->colon . $label; - $this->view->lists = $this->user->getContactLists($this->app->user->account, '', 'list'); + $this->view->lists = $this->user->getContactLists($this->app->user->account, 'list'); $this->view->users = $users; $this->view->mode = $mode; $this->view->label = $label; @@ -1357,7 +1357,7 @@ EOF; */ public function buildContactLists(string $dropdownName = 'mailto', string $attr = '') { - $this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote'); + $this->view->contactLists = $this->user->getContactLists(); $this->view->dropdownName = $dropdownName; $this->view->attr = $attr; $this->display(); diff --git a/module/task/zen.php b/module/task/zen.php index 4b677815c0..f7ab63f6fb 100644 --- a/module/task/zen.php +++ b/module/task/zen.php @@ -279,7 +279,7 @@ class taskZen extends task $this->view->showAllModule = isset($this->config->execution->task->allModule) ? $this->config->execution->task->allModule : ''; $this->view->modules = $this->tree->getTaskOptionMenu($task->execution, 0, $this->view->showAllModule ? 'allModule' : ''); $this->view->executions = $executions; - $this->view->contactLists = $this->loadModel('user')->getContactLists($this->app->user->account, 'withnote'); + $this->view->contactLists = $this->loadModel('user')->getContactLists(); $this->display(); } diff --git a/module/testtask/control.php b/module/testtask/control.php index 827b297072..1d25777646 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -624,7 +624,7 @@ class testtask extends control $this->view->title = $testtask->name . $this->lang->colon . $this->lang->close; $this->view->actions = $this->loadModel('action')->getList('testtask', $taskID); $this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted|qdfirst'); - $this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote'); + $this->view->contactLists = $this->user->getContactLists(); $this->view->testtask = $testtask; $this->display(); } diff --git a/module/testtask/zen.php b/module/testtask/zen.php index 7c9246a1e0..6728dff799 100644 --- a/module/testtask/zen.php +++ b/module/testtask/zen.php @@ -393,7 +393,7 @@ class testtaskZen extends testtask $this->view->builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs(array($productID), 'all', 'noempty,notrunk,withexecution', $executionID ? $executionID : $task->project, $executionID ? 'execution' : 'project', $task->build, false); $this->view->testreports = $this->loadModel('testreport')->getPairs($task->product, $task->testreport); $this->view->users = $this->loadModel('user')->getPairs('nodeleted|noclosed', $task->owner); - $this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote'); + $this->view->contactLists = $this->user->getContactLists(); } /** diff --git a/module/user/control.php b/module/user/control.php index 67f00be44a..081239568f 100755 --- a/module/user/control.php +++ b/module/user/control.php @@ -1037,7 +1037,7 @@ class user extends control */ public function ajaxGetContactList() { - $contactList = $this->user->getContactLists($this->app->user->account, 'withnote'); + $contactList = $this->user->getContactLists(); $items = array(); foreach($contactList as $contactID => $contactName) $items[] = array('text' => $contactName, 'value' => $contactID); diff --git a/module/user/model.php b/module/user/model.php index cb9b608c80..e1da1809fc 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -1258,28 +1258,26 @@ class userModel extends model } /** - * Get contact list of a user. + * 获取某个用户可以查看的联系人列表。 + * Get the contact list of a user. * * @param string $account - * @param string $params withempty|withnote * @param string $mode pairs|list * @access public * @return array */ - public function getContactLists(string $account, string $params = '', string $mode = 'pairs'): array + public function getContactLists(string $account = '', string $mode = 'pairs'): array { + if(!$account) $account = $this->app->user->account; + $this->dao->select('*')->from(TABLE_USERCONTACT) ->where('account')->eq($account) ->orWhere('public')->eq(1) ->orderBy('public, id_desc'); - $contacts = $mode == 'pairs' ? $this->dao->fetchPairs('id', 'listName') : $this->dao->fetchAll(); - if(empty($contacts)) return array(); + if($mode == 'pairs') return $this->dao->fetchPairs('id', 'listName'); - if(strpos($params, 'withempty') !== false) $contacts = array('' => '') + $contacts; - if(strpos($params, 'withnote') !== false) $contacts = array('' => $this->lang->user->contacts->common) + $contacts; - - return $contacts; + return $this->dao->fetchAll(); } /**