diff --git a/module/bug/control.php b/module/bug/control.php index f8c540f547..6912464ccc 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -261,7 +261,7 @@ class bug extends control $this->view->productName = $this->products[$productID]; $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $rooteModuleID = 0); $this->view->stories = $stories; - $this->view->users = $this->user->getPairs('noclosed'); + $this->view->users = $this->user->getPairs('noclosed,nodeleted'); $this->view->projects = $this->product->getProjectPairs($productID); $this->view->builds = $builds; $this->view->tasks = $this->loadModel('task')->getProjectTaskPairs($projectID); @@ -353,7 +353,7 @@ class bug extends control $this->view->projects = $this->product->getProjectPairs($bug->product); $this->view->stories = $bug->project ? $this->story->getProjectStoryPairs($bug->project) : $this->story->getProductStoryPairs($bug->product); $this->view->tasks = $this->task->getProjectTaskPairs($bug->project); - $this->view->users = $this->user->getPairs(); + $this->view->users = $this->user->setDeleted($this->user->getPairs('nodeleted'), "$bug->assignedTo,$bug->resolvedBy,$bug->closedBy"); $this->view->openedBuilds = $this->loadModel('build')->getProductBuildPairs($productID, 'noempty'); $this->view->resolvedBuilds = array('' => '') + $this->view->openedBuilds; $this->view->actions = $this->action->getList('bug', $bugID); @@ -388,7 +388,7 @@ class bug extends control /* 赋值。*/ $this->view->bug = $bug; - $this->view->users = $this->user->getPairs(); + $this->view->users = $this->user->getPairs('nodeleted'); $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID); $this->view->actions = $this->action->getList('bug', $bugID); $this->display(); @@ -422,7 +422,7 @@ class bug extends control /* 赋值。*/ $this->view->bug = $bug; - $this->view->users = $this->user->getPairs(); + $this->view->users = $this->user->getPairs('nodeleted'); $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID); $this->view->actions = $this->action->getList('bug', $bugID); diff --git a/module/project/model.php b/module/project/model.php index 1670d1aa34..7fadab4be5 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -338,12 +338,15 @@ class projectModel extends model } /* 获取团队成员account=>name列表。*/ - public function getTeamMemberPairs($projectID) + public function getTeamMemberPairs($projectID, $params = '') { $users = $this->dao->select('t1.account, t2.realname')->from(TABLE_TEAM)->alias('t1') ->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account') ->where('t1.project')->eq((int)$projectID) ->andWHere('t2.company')->eq($this->app->company->id) + ->beginIF($params == 'nodeleted') + ->andWhere('t2.deleted')->eq(0) + ->fi() ->fetchPairs(); if(!$users) return array(); foreach($users as $account => $realName) diff --git a/module/story/control.php b/module/story/control.php index c5b97e284f..65e48c0e35 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -48,7 +48,7 @@ class story extends control /* 设置产品相关数据。*/ $product = $this->product->getById($productID); $products = $this->product->getPairs(); - $users = $this->user->getPairs(); + $users = $this->user->getPairs('nodeleted'); $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'product'); /* 设置菜单。*/ @@ -74,7 +74,7 @@ class story extends control $story = $this->story->getById($storyID); $product = $this->product->getById($story->product); $products = $this->product->getPairs(); - $users = $this->user->getPairs(); + $users = $this->user->getPairs('nodeleted'); $moduleOptionMenu = $this->tree->getOptionMenu($product->id, $viewType = 'product'); /* 设置菜单。*/ @@ -110,10 +110,12 @@ class story extends control } $this->commonAction($storyID); - + $story = $this->story->getById($storyID); + /* 赋值到模板。*/ $this->view->header->title = $this->view->product->name . $this->lang->colon . $this->lang->story->edit . $this->lang->colon . $this->view->story->title; $this->view->position[] = $this->lang->story->edit; + $this->view->users = $this->user->setDeleted($this->user->getPairs('nodeleted'), $story->assignedTo); $this->display(); } @@ -263,7 +265,7 @@ class story extends control $this->view->product = $product; $this->view->story = $story; $this->view->actions = $this->action->getList('story', $storyID); - $this->view->users = $this->loadModel('user')->getPairs(); + $this->view->users = $this->loadModel('user')->getPairs('nodeleted'); /* 影响范围。*/ $this->story->getAffectedScope($this->view->story); diff --git a/module/task/control.php b/module/task/control.php index b1fe785c7b..394c9eeae6 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -66,7 +66,7 @@ class task extends control } $stories = $this->story->getProjectStoryPairs($projectID); - $members = $this->project->getTeamMemberPairs($projectID); + $members = $this->project->getTeamMemberPairs($projectID, 'nodeleted'); $header['title'] = $project->name . $this->lang->colon . $this->lang->task->create; $position[] = html::a($browseProjectLink, $project->name); @@ -78,7 +78,7 @@ class task extends control $this->assign('stories', $stories); $this->assign('storyID', $storyID); $this->assign('members', $members); - $this->assign('users', $this->loadModel('user')->getPairs('noletter')); + $this->assign('users', $this->loadModel('user')->getPairs('noletter, nodeleted')); $this->display(); } @@ -87,8 +87,8 @@ class task extends control { $this->view->task = $this->task->getByID($taskID); $this->view->project = $this->project->getById($this->view->task->project); - $this->view->members = $this->project->getTeamMemberPairs($this->view->project->id); - $this->view->users = $this->loadModel('user')->getPairs('noletter'); + $this->view->members = $this->project->getTeamMemberPairs($this->view->project->id ,'nodeleted'); + $this->view->users = $this->loadModel('user')->getPairs('noletter, nodeleted'); $this->view->actions = $this->loadModel('action')->getList('task', $taskID); /* 设置菜单。*/ @@ -122,10 +122,15 @@ class task extends control die(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent')); } + $task = $this->task->getByID($taskID); + $project = $this->project->getById($task->project); + $members = $this->project->getTeamMemberPairs($project->id ,'nodeleted'); + /* 赋值。*/ $this->view->header->title = $this->lang->task->edit; $this->view->position[] = $this->lang->task->edit; $this->view->stories = $this->story->getProjectStoryPairs($this->view->project->id); + $this->view->members = $this->loadModel('user')->setDeleted($members, $task->owner); $this->display(); } diff --git a/module/user/lang/zh-cn.php b/module/user/lang/zh-cn.php index 86dd106abc..48a3724cb3 100644 --- a/module/user/lang/zh-cn.php +++ b/module/user/lang/zh-cn.php @@ -42,6 +42,7 @@ $lang->user->relogin = "重新登录"; $lang->user->asGuest = "游客访问"; $lang->user->goback = "返回前一页"; $lang->user->allUsers = '全部用户'; +$lang->user->deleted = '(已删除)'; $lang->user->profile = '用户档案'; $lang->user->project = '用户项目'; diff --git a/module/user/model.php b/module/user/model.php index 8e97e2fd97..c2a78b33b3 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -44,10 +44,14 @@ class userModel extends model return $this->dao->select('*')->from(TABLE_USER)->where('deleted')->eq(0)->orderBy('account')->fetchAll(); } - /* 获得account=>realname的列表。params: noletter|noempty|noclosed。*/ + /* 获得account=>realname的列表。params: noletter|noempty|noclosed|nodeleted。*/ public function getPairs($params = '') { - $users = $this->dao->select('account, realname')->from(TABLE_USER)->orderBy('account')->fetchPairs(); + $users = $this->dao->select('account, realname')->from(TABLE_USER) + ->beginIF(strpos($params, 'nodeleted') !== false) + ->where('deleted')->eq(0) + ->fi() + ->orderBy('account')->fetchPairs(); foreach($users as $account => $realName) { $firstLetter = ucfirst(substr($account, 0, 1)) . ':'; @@ -58,6 +62,17 @@ class userModel extends model if(strpos($params, 'noclosed') === false) $users = $users + array('closed' => 'Closed'); return $users; } + + /* 追加已经删除的用户。*/ + public function setDeleted($users, $deleteds = '') + { + $deleteds = explode(',', $deleteds); + foreach($deleteds as $deleted) + { + if(!isset($users[$deleted])) $users[$deleted] = $deleted . $this->lang->user->deleted; + } + return $users; + } /* 获得用户的真实姓名和email地址列表。*/ public function getRealNameAndEmails($users)