From 8de5f93c2be12c403388db114ab4d5d3b32db319 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Tue, 8 Dec 2020 09:21:32 +0800 Subject: [PATCH] * fix bug #3693. --- module/block/view/todoblock.html.php | 2 +- module/bug/control.php | 10 +- module/company/control.php | 27 +++-- module/company/view/browse.html.php | 8 +- module/company/view/dynamic.html.php | 4 +- module/dept/model.php | 7 +- module/my/control.php | 14 ++- module/my/view/todo.html.php | 8 +- module/product/control.php | 21 +++- module/product/view/dynamic.html.php | 16 +-- module/project/control.php | 64 ++++++----- module/project/model.php | 15 +-- module/project/view/dynamic.html.php | 16 +-- module/project/view/team.html.php | 4 +- module/story/control.php | 10 +- module/task/control.php | 9 +- module/todo/control.php | 33 ++++-- module/todo/js/common.js | 2 +- module/todo/view/footer.html.php | 2 +- module/todo/view/view.html.php | 2 +- module/user/control.php | 159 ++++++++++++++------------- module/user/js/todo.js | 2 +- module/user/model.php | 36 ++---- module/user/view/bug.html.php | 8 +- module/user/view/dynamic.html.php | 6 +- module/user/view/edit.html.php | 2 +- module/user/view/featurebar.html.php | 16 +-- module/user/view/story.html.php | 8 +- module/user/view/task.html.php | 10 +- module/user/view/testcase.html.php | 8 +- module/user/view/testtask.html.php | 8 +- module/user/view/todo.html.php | 6 +- 32 files changed, 290 insertions(+), 253 deletions(-) diff --git a/module/block/view/todoblock.html.php b/module/block/view/todoblock.html.php index 44b71b7384..ef86a5e7cc 100644 --- a/module/block/view/todoblock.html.php +++ b/module/block/view/todoblock.html.php @@ -38,7 +38,7 @@ if(!$selfCall) die(include('./todolist.html.php'));
-
'> + '>

todo->create;?>

diff --git a/module/bug/control.php b/module/bug/control.php index ba3704f287..77147f8061 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1388,15 +1388,17 @@ class bug extends control /** * AJAX: get bugs of a user in html select. * - * @param string $account + * @param int $userID * @param string $id the id of the select control. * @access public * @return string */ - public function ajaxGetUserBugs($account = '', $id = '') + public function ajaxGetUserBugs($userID = '', $id = '') { - if($account == '') $account = $this->app->user->account; - $bugs = $this->bug->getUserBugPairs($account); + if($userID == '') $userID = $this->app->user->id; + $user = $this->loadModel('user')->getById($userID, 'id'); + $account = $user->account; + $bugs = $this->bug->getUserBugPairs($account); if($id) die(html::select("bugs[$id]", $bugs, '', 'class="form-control"')); die(html::select('bug', $bugs, '', 'class=form-control')); diff --git a/module/company/control.php b/module/company/control.php index 4c1c107308..f71cea1b2e 100644 --- a/module/company/control.php +++ b/module/company/control.php @@ -140,10 +140,10 @@ class company extends control * Company dynamic. * * @param string $browseType - * @param string $orderBy + * @param string $param * @param int $recTotal - * @param int $recPerPage - * @param int $pageID + * @param string $date + * @param string $direction next|pre * @access public * @return void */ @@ -176,7 +176,13 @@ class company extends control $sort = $this->loadModel('common')->appendOrder($orderBy); /* Set the user and type. */ - $account = $browseType == 'account' ? $param : 'all'; + $account = 'all'; + $user = ''; + if($browseType == 'account') + { + $user = $this->loadModel('user')->getById((int)$param, 'id'); + if($user) $account = $user->account; + } $product = $browseType == 'product' ? $param : 'all'; $project = $browseType == 'project' ? $param : 'all'; $period = ($browseType == 'account' or $browseType == 'product' or $browseType == 'project') ? 'all' : $browseType; @@ -194,9 +200,12 @@ class company extends control $this->view->projects = $projects; /* Get users.*/ - $users = $this->loadModel('user')->getPairs('noclosed|nodeleted|noletter'); - $users[''] = $this->lang->company->user; - $this->view->users = $users; + $userIdPairs = $this->loadModel('user')->getPairs('noclosed|nodeleted|noletter|useid'); + $userIdPairs[''] = $this->lang->company->user; + $this->view->userIdPairs = $userIdPairs; + + $accountPairs = $this->user->getPairs('noclosed|nodeleted|noletter'); + $accountPairs[''] = ''; /* The header and position. */ $this->view->title = $this->lang->company->common . $this->lang->colon . $this->lang->company->dynamic; @@ -215,7 +224,6 @@ class company extends control /* Build search form. */ $projects[0] = ''; $products[0] = ''; - $users[''] = ''; ksort($projects); ksort($products); $projects['all'] = $this->lang->project->allProject; @@ -231,7 +239,7 @@ class company extends control $this->config->company->dynamic->search['params']['action']['values'] = $this->lang->action->search->label; $this->config->company->dynamic->search['params']['project']['values'] = $projects; $this->config->company->dynamic->search['params']['product']['values'] = $products; - $this->config->company->dynamic->search['params']['actor']['values'] = $users; + $this->config->company->dynamic->search['params']['actor']['values'] = $accountPairs; $this->loadModel('search')->setSearchParams($this->config->company->dynamic->search); /* Assign. */ @@ -242,6 +250,7 @@ class company extends control $this->view->queryID = $queryID; $this->view->orderBy = $orderBy; $this->view->pager = $pager; + $this->view->user = $user; $this->view->param = $param; $this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $browseType); $this->view->direction = $direction; diff --git a/module/company/view/browse.html.php b/module/company/view/browse.html.php index 1bd5cadff4..000075db08 100644 --- a/module/company/view/browse.html.php +++ b/module/company/view/browse.html.php @@ -84,12 +84,12 @@ js::set('confirmDelete', $lang->user->confirmDelete); - account => '')) . html::a(helper::createLink('user', 'view', "account=$user->account"), sprintf('%03d', $user->id));?> + account => '')) . html::a(helper::createLink('user', 'view', "userID=$user->id"), sprintf('%03d', $user->id));?> id);?> - account", $user->realname, '', "title='$user->realname'")) echo $user->realname;?> + id", $user->realname, '', "title='$user->realname'")) echo $user->realname;?> account;?> '>user->roleList, $user->role, '');?> email);?> @@ -100,8 +100,8 @@ js::set('confirmDelete', $lang->user->confirmDelete); visits;?> sso->turnon)) common::printIcon('user', 'unbind', "userID=$user->account", $user, 'list', 'unlink', "hiddenwin"); - common::printIcon('user', 'unlock', "userID=$user->account", $user, 'list', 'unlock', "hiddenwin"); + if(!empty($config->sso->turnon)) common::printIcon('user', 'unbind', "userID=$user->id", $user, 'list', 'unlink', "hiddenwin"); + common::printIcon('user', 'unlock', "userID=$user->id", $user, 'list', 'unlock', "hiddenwin"); common::printIcon('user', 'edit', "userID=$user->id&from=company", '', 'list'); $deleteClass = (strpos($this->app->company->admins, ",{$user->account},") === false and common::hasPriv('user', 'delete')) ? 'btn iframe' : 'btn disabled'; diff --git a/module/company/view/dynamic.html.php b/module/company/view/dynamic.html.php index a2465c1753..3ca1aad52d 100644 --- a/module/company/view/dynamic.html.php +++ b/module/company/view/dynamic.html.php @@ -25,7 +25,7 @@ echo html::a(inlink('dynamic', "browseType=$period"), $label, '', "class='btn btn-link $active' id='{$period}'") ?> -
+
id : '', 'onchange=changeUser(this.value) class="form-control chosen"');?>
global->flow != 'onlyTest'):?>
@@ -56,7 +56,7 @@
time?> - actor);?> + actor);?> actionLabel;?> action != 'login' and $action->action != 'logout'):?> objectLabel;?> diff --git a/module/dept/model.php b/module/dept/model.php index badce32d02..2fbee55e05 100644 --- a/module/dept/model.php +++ b/module/dept/model.php @@ -354,13 +354,16 @@ class deptModel extends model * Get user pairs of a department. * * @param int $deptID + * @param string $params * @access public * @return array */ - public function getDeptUserPairs($deptID = 0) + public function getDeptUserPairs($deptID = 0, $params = '') { $childDepts = $this->getAllChildID($deptID); - return $this->dao->select('account, realname')->from(TABLE_USER) + $keyField = strpos($params, 'useid') !== false ? 'id' : 'account'; + + return $this->dao->select("$keyField, realname")->from(TABLE_USER) ->where('deleted')->eq(0) ->beginIF($deptID)->andWhere('dept')->in($childDepts)->fi() ->orderBy('account') diff --git a/module/my/control.php b/module/my/control.php index 516ef202fc..e2d25de6e3 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -71,7 +71,7 @@ class my extends control * My todos. * * @param string $type - * @param string $account + * @param int $userID * @param string $status * @param int $recTotal * @param int $recPerPage @@ -79,7 +79,7 @@ class my extends control * @access public * @return void */ - public function todo($type = 'all', $account = '', $status = 'all', $orderBy = "date_desc,status,begin", $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function todo($type = 'all', $userID = '', $status = 'all', $orderBy = "date_desc,status,begin", $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Save session. */ $uri = $this->app->getURI(true); @@ -95,6 +95,10 @@ class my extends control if($this->app->getViewType() == 'mhtml') $recPerPage = 10; $pager = pager::init($recTotal, $recPerPage, $pageID); + if(empty($userID)) $userID = $this->app->user->id; + $user = $this->loadModel('user')->getById($userID, 'id'); + $account = $user->account; + /* The title and position. */ $this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->todo; $this->view->position[] = $this->lang->my->todo; @@ -110,6 +114,7 @@ class my extends control $this->view->recPerPage = $recPerPage; $this->view->pageID = $pageID; $this->view->status = $status; + $this->view->user = $user; $this->view->account = $this->app->user->account; $this->view->orderBy = $orderBy == 'date_desc,status,begin,id_desc' ? '' : $orderBy; $this->view->pager = $pager; @@ -544,10 +549,9 @@ class my extends control * My dynamic. * * @param string $type - * @param string $orderBy * @param int $recTotal - * @param int $recPerPage - * @param int $pageID + * @param string $date + * @param string $direction next|pre * @access public * @return void */ diff --git a/module/my/view/todo.html.php b/module/my/view/todo.html.php index e111b1c577..3c73e4bb2a 100644 --- a/module/my/view/todo.html.php +++ b/module/my/view/todo.html.php @@ -18,7 +18,7 @@ todo->periods as $period => $label):?> user->account}&status=undone"; + if($period == 'before') $vars .= "&userID={$app->user->id}&status=undone"; $label = "$label"; $active = ''; if($period == $type) @@ -35,7 +35,7 @@
- " . $lang->todo->export, '', "class='btn btn-link export'");?> + id}&orderBy=$orderBy", 'html', true), " " . $lang->todo->export, '', "class='btn btn-link export'");?> " . $lang->todo->batchCreate, '', "id='batchCreate' class='btn btn-secondary iframe' data-width='80%'", '', 'true');?> " . $lang->todo->create, '', "id='create' class='btn btn-primary iframe' data-width='80%'", '', 'true');?>
@@ -60,7 +60,7 @@ $canbatchAction = ($type != 'cycle' and ($canBatchEdit or $canBatchFinish or $canBatchClose or (common::hasPriv('todo', 'import2Today') and $importFuture))); ?> - + id}&status=$status&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID"; ?>
@@ -142,7 +142,7 @@ createLink('todo', 'batchEdit', "from=myTodo&type=$type&account=$account&status=$status"); + $actionLink = $this->createLink('todo', 'batchEdit', "from=myTodo&type=$type&userID={$user->id}&status=$status"); echo html::commonButton($lang->edit, "onclick=\"setFormAction('$actionLink')\""); } if($canBatchFinish) diff --git a/module/product/control.php b/module/product/control.php index fce5845b9d..0858cc5da9 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -535,11 +535,12 @@ class product extends control /** * Product dynamic. * + * @param int $productID * @param string $type - * @param string $orderBy + * @param string $param * @param int $recTotal - * @param int $recPerPage - * @param int $pageID + * @param string $date + * @param string $direction next|pre * @access public * @return void */ @@ -569,7 +570,12 @@ class product extends control $pager = new pager($recTotal, $recPerPage = 50, $pageID = 1); /* Set the user and type. */ - $account = $type == 'account' ? $param : 'all'; + $account = 'all'; + if($type == 'account') + { + $user = $this->loadModel('user')->getById((int)$param, 'id'); + if($user) $account = $user->account; + } $period = $type == 'account' ? 'all' : $type; $date = empty($date) ? '' : date('Y-m-d', $date); $actions = $this->loadModel('action')->getDynamic($account, $period, $sort, $pager, $productID, 'all', $date, $direction); @@ -579,12 +585,15 @@ class product extends control $this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $this->products[$productID]); $this->view->position[] = $this->lang->product->dynamic; + $this->view->userIdPairs = $this->loadModel('user')->getPairs('noletter|nodeleted|noclosed|useid'); + $this->view->accountPairs = $this->user->getPairs('noletter|nodeleted|noclosed'); + /* Assign. */ $this->view->productID = $productID; $this->view->type = $type; - $this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted|noclosed'); - $this->view->account = $account; $this->view->orderBy = $orderBy; + $this->view->account = $account; + $this->view->user = isset($user) ? $user : ''; $this->view->param = $param; $this->view->pager = $pager; $this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $type); diff --git a/module/product/view/dynamic.html.php b/module/product/view/dynamic.html.php index 0d995517e9..ef5f703625 100755 --- a/module/product/view/dynamic.html.php +++ b/module/product/view/dynamic.html.php @@ -27,9 +27,9 @@
8; + $withSearch = count($accountPairs) > 8; $active = $param ? 'btn-active-text' : ''; - $current = $param ? zget($users, $param, $param) : $lang->product->viewByUser; + $current = $param ? zget($accountPairs, $account) : $lang->product->viewByUser; $current = "" . $current . '' . ' '; ?> @@ -43,12 +43,12 @@
$name) + $usersPinYin = common::convert2Pinyin($userIdPairs); + foreach($userIdPairs as $userID => $name) { - if(!$account) continue; - $searchKey = $withSearch ? ('data-key="' . zget($usersPinYin, $account, '') . '"') : ''; - echo html::a($this->createLink('product', 'dynamic', "productID=$productID&type=account¶m=$account"), $name, '', $searchKey); + if(!$userID) continue; + $searchKey = $withSearch ? ('data-key="' . zget($usersPinYin, $userID, '') . '"') : ''; + echo html::a($this->createLink('product', 'dynamic', "productID=$productID&type=account¶m=$userID"), $name, '', $searchKey); } ?>
@@ -82,7 +82,7 @@
time?> - actor);?> + actor);?> actionLabel;?> objectLabel;?> objectID;?> diff --git a/module/project/control.php b/module/project/control.php index 66885dd5f0..793deb8762 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -2023,38 +2023,36 @@ class project extends control * Unlink a memeber. * * @param int $projectID - * @param string $account + * @param int $userID * @param string $confirm yes|no * @access public * @return void */ - public function unlinkMember($projectID, $account, $confirm = 'no') + public function unlinkMember($projectID, $userID, $confirm = 'no') { - if($confirm == 'no') - { - die(js::confirm($this->lang->project->confirmUnlinkMember, $this->inlink('unlinkMember', "projectID=$projectID&account=$account&confirm=yes"))); - } - else - { - $this->project->unlinkMember($projectID, $account); + if($confirm == 'no') die(js::confirm($this->lang->project->confirmUnlinkMember, $this->inlink('unlinkMember', "projectID=$projectID&userID=$userID&confirm=yes"))); - /* if ajax request, send result. */ - if($this->server->ajax) + $user = $this->loadModel('user')->getById($userID, 'id'); + $account = $user->account; + + $this->project->unlinkMember($projectID, $account); + + /* if ajax request, send result. */ + if($this->server->ajax) + { + if(dao::isError()) { - if(dao::isError()) - { - $response['result'] = 'fail'; - $response['message'] = dao::getError(); - } - else - { - $response['result'] = 'success'; - $response['message'] = ''; - } - $this->send($response); + $response['result'] = 'fail'; + $response['message'] = dao::getError(); } - die(js::locate($this->inlink('team', "projectID=$projectID"), 'parent')); + else + { + $response['result'] = 'success'; + $response['message'] = ''; + } + $this->send($response); } + die(js::locate($this->inlink('team', "projectID=$projectID"), 'parent')); } /** @@ -2226,11 +2224,12 @@ class project extends control /** * Project dynamic. * + * @param int $projectID * @param string $type - * @param string $orderBy + * @param string $param * @param int $recTotal - * @param int $recPerPage - * @param int $pageID + * @param string $date + * @param string $direction next|pre * @access public * @return void */ @@ -2271,7 +2270,12 @@ class project extends control $pager = new pager($recTotal, $recPerPage = 50, $pageID = 1); /* Set the user and type. */ - $account = $type == 'account' ? $param : 'all'; + $account = 'all'; + if($type == 'account') + { + $user = $this->loadModel('user')->getById((int)$param, 'id'); + if($user) $account = $user->account; + } $period = $type == 'account' ? 'all' : $type; $date = empty($date) ? '' : date('Y-m-d', $date); $actions = $this->loadModel('action')->getDynamic($account, $period, $sort, $pager, 'all', $projectID, $date, $direction); @@ -2282,13 +2286,15 @@ class project extends control $this->view->position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); $this->view->position[] = $this->lang->project->dynamic; + $this->view->userIdPairs = $this->loadModel('user')->getPairs('noletter|nodeleted|useid'); + $this->view->accountPairs = $this->user->getPairs('noletter|nodeleted'); + /* Assign. */ $this->view->projectID = $projectID; $this->view->type = $type; - $this->view->users = $this->loadModel('user')->getPairs('noletter|nodeleted'); - $this->view->account = $account; $this->view->orderBy = $orderBy; $this->view->pager = $pager; + $this->view->account = $account; $this->view->param = $param; $this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $type); $this->view->direction = $direction; diff --git a/module/project/model.php b/module/project/model.php index 757cd2e74f..b1e1985e96 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1765,7 +1765,7 @@ class projectModel extends model public function getTeamMembers($projectID) { if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getTeamMembers(); - return $this->dao->select("t1.*, t1.hours * t1.days AS totalHours, if(t2.deleted='0', t2.realname, t1.account) as realname")->from(TABLE_TEAM)->alias('t1') + return $this->dao->select("t1.*, t1.hours * t1.days AS totalHours, t2.id as userID, if(t2.deleted='0', t2.realname, t1.account) as realname")->from(TABLE_TEAM)->alias('t1') ->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account') ->where('t1.root')->eq((int)$projectID) ->andWhere('t1.type')->eq('project') @@ -1786,24 +1786,25 @@ class projectModel extends model { if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getTeamMembersPairs(); $this->app->loadConfig('user'); - $users = $this->dao->select('t1.account, t2.realname')->from(TABLE_TEAM)->alias('t1') + $keyField = strpos($params, 'useid') !== false ? 'id' : 'account'; + $users = $this->dao->select("t2.id, t2.account, t2.realname")->from(TABLE_TEAM)->alias('t1') ->leftJoin(TABLE_USER)->alias('t2')->on('t1.account = t2.account') ->where('t1.root')->eq((int)$projectID) ->andWhere('t1.type')->eq('project') ->beginIF($params == 'nodeleted' or empty($this->config->user->showDeleted)) ->andWhere('t2.deleted')->eq(0) ->fi() - ->fetchPairs(); + ->fetchAll($keyField); - if($usersToAppended) $users += $this->dao->select('account, realname')->from(TABLE_USER)->where('account')->in($usersToAppended)->fetchPairs(); + if($usersToAppended) $users += $this->dao->select("id, account, realname")->from(TABLE_USER)->where('account')->in($usersToAppended)->fetchPairs($keyField); if(!$users) return array('' => ''); - foreach($users as $account => $realName) + foreach($users as $account => $user) { - $firstLetter = ucfirst(substr($account, 0, 1)) . ':'; + $firstLetter = ucfirst(substr($user->account, 0, 1)) . ':'; if(!empty($this->config->isINT)) $firstLetter = ''; - $users[$account] = $firstLetter . ($realName ? $realName : $account); + $users[$account] = $firstLetter . ($user->realname ? $user->realname : $user->account); } return array('' => '') + $users; } diff --git a/module/project/view/dynamic.html.php b/module/project/view/dynamic.html.php index 2b7770dbdd..1d1af4a2fd 100755 --- a/module/project/view/dynamic.html.php +++ b/module/project/view/dynamic.html.php @@ -27,9 +27,9 @@
8; + $withSearch = count($accountPairs) > 8; $active = $param ? 'btn-active-text' : ''; - $current = $param ? zget($users, $param, $param) : $lang->project->viewByUser; + $current = $param ? zget($accountPairs, $account, $account) : $lang->project->viewByUser; $current = "" . $current . '' . ' '; ?> @@ -43,12 +43,12 @@
$name) + $usersPinYin = common::convert2Pinyin($userIdPairs); + foreach($userIdPairs as $userID => $name) { - if(!$account) continue; - $searchKey = $withSearch ? ('data-key="' . zget($usersPinYin, $account, '') . '"') : ''; - echo html::a($this->createLink('project', 'dynamic', "productID=$projectID&type=account¶m=$account"), $name); + if(!$userID) continue; + $searchKey = $withSearch ? ('data-key="' . zget($usersPinYin, $userID, '') . '"') : ''; + echo html::a($this->createLink('project', 'dynamic', "productID=$projectID&type=account¶m=$userID"), $name); } ?>
@@ -83,7 +83,7 @@
time?> - actor);?> + actor);?> actionLabel;?> objectLabel;?> objectID;?> diff --git a/module/project/view/team.html.php b/module/project/view/team.html.php index cffb070a32..af2df8add4 100644 --- a/module/project/view/team.html.php +++ b/module/project/view/team.html.php @@ -66,7 +66,7 @@
account", $member->realname)) print $member->realname; + if(!common::printLink('user', 'view', "userID={$member->userID}", $member->realname)) print $member->realname; $memberHours = $member->days * $member->hours; $totalHours += $memberHours; ?> @@ -82,7 +82,7 @@ createLink('project', 'unlinkMember', "projectID=$project->id&account=$member->account&confirm=yes"); + $unlinkURL = $this->createLink('project', 'unlinkMember', "projectID=$project->id&userID=$member->userID&confirm=yes"); echo html::a("javascript:ajaxDelete(\"$unlinkURL\", \"mainContent\", confirmUnlinkMember)", '', '', "class='btn' title='{$lang->project->unlinkMember}'"); } ?> diff --git a/module/story/control.php b/module/story/control.php index e749aaa095..6dc8e46e53 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1822,15 +1822,17 @@ class story extends control /** * AJAX: get storys of a user in html select. * - * @param string $account + * @param int $userID * @param string $id the id of the select control. * @access public * @return string */ - public function ajaxGetUserStorys($account = '', $id = '') + public function ajaxGetUserStorys($userID = '', $id = '') { - if($account == '') $account = $this->app->user->account; - $storys = $this->story->getUserStoryPairs($account); + if($userID == '') $userID = $this->app->user->id; + $user = $this->loadModel('user')->getById($userID, 'id'); + $account = $user->account; + $storys = $this->story->getUserStoryPairs($account); if($id) die(html::select("storys[$id]", $storys, '', 'class="form-control"')); die(html::select('story', $storys, '', 'class=form-control')); diff --git a/module/task/control.php b/module/task/control.php index c6318e31c6..22309e2fc5 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1247,15 +1247,18 @@ class task extends control /** * AJAX: return tasks of a user in html select. * - * @param string $account + * @param int $userID * @param string $id * @param string $status * @access public * @return string */ - public function ajaxGetUserTasks($account = '', $id = '', $status = 'wait,doing') + public function ajaxGetUserTasks($userID = '', $id = '', $status = 'wait,doing') { - if($account == '') $account = $this->app->user->account; + if($userID == '') $userID = $this->app->user->id; + $user = $this->loadModel('user')->getById($userID, 'id'); + $account = $user->account; + $tasks = $this->task->getUserTaskPairs($account, $status); if($id) die(html::select("tasks[$id]", $tasks, '', 'class="form-control"')); diff --git a/module/todo/control.php b/module/todo/control.php index 13c4c2ba91..c0d867bf34 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -30,14 +30,18 @@ class todo extends control * Create a todo. * * @param string|date $date - * @param string $account + * @param int $userID * @access public * @return void */ - public function create($date = 'today', $account = '', $from = 'todo') + public function create($date = 'today', $userID = '', $from = 'todo') { if($date == 'today') $date = date::today(); - if($account == '') $account = $this->app->user->account; + if($userID == '') $userID = $this->app->user->id; + + $user = $this->loadModel('user')->getById($userID, 'id'); + $account = $user->account; + if(!empty($_POST)) { $todoID = $this->todo->create($date, $account); @@ -65,7 +69,7 @@ class todo extends control if($this->app->getViewType() == 'xhtml') die(js::locate($this->createLink('todo', 'view', "todoID=$todoID"), 'parent')); if(isonlybody()) die(js::locate($this->createLink('my', 'todo', "type=$date"), 'parent.parent')); - die(js::locate($this->createLink('my', 'todo', "type=all&account=&status=all&orderBy=id_desc"), 'parent')); + die(js::locate($this->createLink('my', 'todo', "type=all&userID=&status=all&orderBy=id_desc"), 'parent')); } unset($this->lang->todo->typeList['cycle']); @@ -82,11 +86,10 @@ class todo extends control * Batch create todo * * @param string $date - * @param string $account * @access public * @return void */ - public function batchCreate($date = 'today', $account = '') + public function batchCreate($date = 'today') { if($date == 'today') $date = date(DT_DATE1, time()); if(!empty($_POST)) @@ -164,12 +167,12 @@ class todo extends control * * @param string $from example:myTodo, todoBatchEdit. * @param string $type - * @param string $account + * @param int $userID * @param string $status * @access public * @return void */ - public function batchEdit($from = '', $type = 'today', $account = '', $status = 'all') + public function batchEdit($from = '', $type = 'today', $userID = '', $status = 'all') { /* Get form data for my-todo. */ if($from == 'myTodo') @@ -179,7 +182,10 @@ class todo extends control $todoIDList = array(); $columns = 7; - if($account == '') $account = $this->app->user->account; + if($userID == '') $userID = $this->app->user->id; + $user = $this->loadModel('user')->getById($userID, 'id'); + $account = $user->account; + $bugs = $this->bug->getUserBugPairs($account); $tasks = $this->task->getUserTaskPairs($account, $status); $storys = $this->loadModel('story')->getUserStoryPairs($account); @@ -356,7 +362,6 @@ class todo extends control { $this->lang->todo->menu = $this->lang->user->menu; $this->lang->todo->menuOrder = $this->lang->user->menuOrder; - $this->user->setMenu($this->user->getPairs(), $todo->account); $this->lang->company->menu->browseUser['subModule'] = 'todo'; $this->lang->set('menugroup.todo', $from); } @@ -374,6 +379,7 @@ class todo extends control $this->view->todo = $todo; $this->view->times = date::buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); $this->view->users = $this->user->getPairs('noletter'); + $this->view->user = $this->user->getById($todo->account); $this->view->actions = $this->loadModel('action')->getList('todo', $todoID); $this->view->from = $from; $this->view->projects = $this->loadModel('project')->getPairs(); @@ -502,15 +508,18 @@ class todo extends control /** * Get data to export * - * @param string $productID + * @param int $userID * @param string $orderBy * @access public * @return void */ - public function export($account, $orderBy) + public function export($userID, $orderBy) { if($_POST) { + $user = $this->loadModel('user')->getById($userID, 'id'); + $account = $user->account; + $todoLang = $this->lang->todo; $todoConfig = $this->config->todo; diff --git a/module/todo/js/common.js b/module/todo/js/common.js index a579536014..d846ab20b7 100644 --- a/module/todo/js/common.js +++ b/module/todo/js/common.js @@ -23,7 +23,7 @@ function loadList(type, id) divID = '#nameBox'; } - var param = 'account=' + account; + var param = 'userID=' + userID; if(id) param += '&id=' + id; if(type == 'bug') { diff --git a/module/todo/view/footer.html.php b/module/todo/view/footer.html.php index f82d350974..a2eca96d2b 100644 --- a/module/todo/view/footer.html.php +++ b/module/todo/view/footer.html.php @@ -1,2 +1,2 @@ -user->account)?> +user->id)?> diff --git a/module/todo/view/view.html.php b/module/todo/view/view.html.php index 72c7aadf41..a68fc76fc5 100644 --- a/module/todo/view/view.html.php +++ b/module/todo/view/view.html.php @@ -52,7 +52,7 @@ } else { - $browseLink = $this->createLink('user', 'todo', "account=$todo->account"); + $browseLink = $this->createLink('user', 'todo', "userID=$user->id"); } if($this->app->user->admin or ($this->app->user->account == $todo->account) or ($this->app->user->account == $todo->assignedTo)) diff --git a/module/user/control.php b/module/user/control.php index fb944967c1..3fdde4b52c 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -31,22 +31,22 @@ class user extends control /** * View a user. * - * @param string $account + * @param string $userID * @access public * @return void */ - public function view($account) + public function view($userID) { - if($this->config->global->flow == 'onlyStory') $this->locate($this->createLink('user', 'dynamic', "period=today&account=$account")); - if($this->config->global->flow == 'onlyTask') $this->locate($this->createLink('user', 'task', "account=$account")); - if($this->config->global->flow == 'onlyTest') $this->locate($this->createLink('user', 'bug', "account=$account")); - $this->locate($this->createLink('user', 'todo', "account=$account")); + if($this->config->global->flow == 'onlyStory') $this->locate($this->createLink('user', 'dynamic', "period=today&userID=$userID")); + if($this->config->global->flow == 'onlyTask') $this->locate($this->createLink('user', 'task', "userID=$userID")); + if($this->config->global->flow == 'onlyTest') $this->locate($this->createLink('user', 'bug', "userID=$userID")); + $this->locate($this->createLink('user', 'todo', "userID=$userID")); } /** * Todos of a user. * - * @param string $account + * @param string $userID * @param string $type the todo type, today|lastweek|thisweek|all|undone, or a date. * @param string $status * @param string $orderBy @@ -56,7 +56,7 @@ class user extends control * @access public * @return void */ - public function todo($account, $type = 'today', $status = 'all', $orderBy='date,status,begin', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function todo($userID, $type = 'today', $status = 'all', $orderBy='date,status,begin', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Set thie url to session. */ $uri = $this->app->getURI(true); @@ -72,14 +72,14 @@ class user extends control $sort = $this->loadModel('common')->appendOrder($orderBy); /* Get user, totos. */ - $user = $this->user->getById($account); + $user = $this->user->getById($userID, 'id'); $account = $user->account; $todos = $this->todo->getList($type, $account, $status, 0, $pager, $sort); $date = (int)$type == 0 ? helper::today() : $type; /* set menus. */ $this->lang->set('menugroup.user', 'company'); - $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted'), $account); + $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted|useid'), $userID); $this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->todo; $this->view->position[] = $this->lang->user->todo; @@ -87,7 +87,6 @@ class user extends control $this->view->date = $date; $this->view->todos = $todos; $this->view->user = $user; - $this->view->account = $account; $this->view->type = $type; $this->view->status = $status; $this->view->orderBy = $orderBy; @@ -99,7 +98,7 @@ class user extends control /** * Story of a user. * - * @param string $account + * @param int $userID * @param string $type * @param int $recTotal * @param int $recPerPage @@ -107,7 +106,7 @@ class user extends control * @access public * @return void */ - public function story($account, $type = 'assignedTo', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function story($userID, $type = 'assignedTo', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Save session. */ $this->session->set('storyList', $this->app->getURI(true)); @@ -116,9 +115,11 @@ class user extends control $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); + $user = $this->user->getById($userID, 'id'); + $account = $user->account; + /* Set menu. */ $this->lang->set('menugroup.user', 'company'); - $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted'), $account); /* Assign. */ $this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->story; @@ -126,9 +127,9 @@ class user extends control $this->view->stories = $this->loadModel('story')->getUserStories($account, $type, 'id_desc', $pager); $this->view->users = $this->user->getPairs('noletter'); $this->view->type = $type; - $this->view->account = $account; - $this->view->user = $this->user->getById($account); + $this->view->user = $user; $this->view->pager = $pager; + $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted|useid'), $userID); $this->display(); } @@ -136,7 +137,7 @@ class user extends control /** * Tasks of a user. * - * @param string $account + * @param int $userID * @param string $type * @param int $recTotal * @param int $recPerPage @@ -144,7 +145,7 @@ class user extends control * @access public * @return void */ - public function task($account, $type = 'assignedTo', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function task($userID, $type = 'assignedTo', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Save the session. */ $this->session->set('taskList', $this->app->getURI(true)); @@ -153,9 +154,12 @@ class user extends control $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); + $user = $this->user->getById($userID, 'id'); + $account = $user->account; + /* Set the menu. */ $this->lang->set('menugroup.user', 'company'); - $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted'), $account); + $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted|useid'), $userID); /* Assign. */ $this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->task; @@ -163,8 +167,7 @@ class user extends control $this->view->tabID = 'task'; $this->view->tasks = $this->loadModel('task')->getUserTasks($account, $type, 0, $pager); $this->view->type = $type; - $this->view->account = $account; - $this->view->user = $this->user->getById($account); + $this->view->user = $user; $this->view->pager = $pager; $this->display(); @@ -173,7 +176,7 @@ class user extends control /** * User bugs. * - * @param string $account + * @param int $userID * @param string $type * @param string $orderBy * @param int $recTotal @@ -182,7 +185,7 @@ class user extends control * @access public * @return void */ - public function bug($account, $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function bug($userID, $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Save the session. */ $this->session->set('bugList', $this->app->getURI(true)); @@ -191,9 +194,12 @@ class user extends control $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); + $user = $this->user->getById($userID, 'id'); + $account = $user->account; + /* Set menu. */ $this->lang->set('menugroup.user', 'company'); - $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted'), $account); + $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted|useid'), $userID); /* Load the lang of bug module. */ $this->app->loadLang('bug'); @@ -202,9 +208,8 @@ class user extends control $this->view->position[] = $this->lang->user->bug; $this->view->tabID = 'bug'; $this->view->bugs = $this->loadModel('bug')->getUserBugs($account, $type, $orderBy, 0, $pager); - $this->view->account = $account; $this->view->type = $type; - $this->view->user = $this->user->getById($account); + $this->view->user = $user; $this->view->users = $this->user->getPairs('noletter'); $this->view->pager = $pager; @@ -214,7 +219,7 @@ class user extends control /** * User's testtask * - * @param string $account + * @param int $userID * @param string $orderBy * @param int $recTotal * @param int $recPerPage @@ -222,15 +227,18 @@ class user extends control * @access public * @return void */ - public function testtask($account, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function testtask($userID, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Load pager. */ $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); + $user = $this->user->getById($userID, 'id'); + $account = $user->account; + /* Set menu. */ $this->lang->set('menugroup.user', 'company'); - $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted'), $account); + $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted|useid'), $userID); /* Save session. */ $this->session->set('testtaskList', $this->app->getURI(true)); @@ -244,8 +252,7 @@ class user extends control $this->view->position[] = $this->lang->user->testTask; $this->view->tasks = $this->loadModel('testtask')->getByUser($account, $pager, $sort); $this->view->users = $this->user->getPairs('noletter'); - $this->view->account = $account; - $this->view->user = $this->user->getById($account); + $this->view->user = $user; $this->view->recTotal = $recTotal; $this->view->recPerPage = $recPerPage; $this->view->pageID = $pageID; @@ -257,6 +264,7 @@ class user extends control /** * User's test case. * + * @param int $userID * @param string $type * @param string $orderBy * @param int $recTotal @@ -265,7 +273,7 @@ class user extends control * @access public * @return void */ - public function testcase($account, $type = 'case2Him', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function testcase($userID, $type = 'case2Him', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Save session, load lang. */ $this->session->set('caseList', $this->app->getURI(true)); @@ -275,12 +283,14 @@ class user extends control $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); + $user = $this->user->getById($userID, 'id'); + $account = $user->account; + /* Append id for secend sort. */ $sort = $this->loadModel('common')->appendOrder($orderBy); /* Set menu. */ $this->lang->set('menugroup.user', 'company'); - $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted'), $account); $cases = array(); if($type == 'case2Him') @@ -296,8 +306,7 @@ class user extends control /* Assign. */ $this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->testCase; $this->view->position[] = $this->lang->user->testCase; - $this->view->account = $account; - $this->view->user = $this->user->getById($account); + $this->view->user = $user; $this->view->cases = $cases; $this->view->users = $this->user->getPairs('noletter'); $this->view->tabID = 'test'; @@ -307,6 +316,7 @@ class user extends control $this->view->pageID = $pageID; $this->view->orderBy = $orderBy; $this->view->pager = $pager; + $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted|useid'), $userID); $this->display(); } @@ -314,23 +324,25 @@ class user extends control /** * User projects. * - * @param string $account + * @param int $userID * @access public * @return void */ - public function project($account) + public function project($userID) { + $user = $this->user->getById($userID, 'id'); + $account = $user->account; + /* Set the menus. */ $this->loadModel('project'); $this->lang->set('menugroup.user', 'company'); - $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclose|nodeleted'), $account); + $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclose|nodeleted|useid'), $userID); $this->view->title = $this->lang->user->common . $this->lang->colon . $this->lang->user->project; $this->view->position[] = $this->lang->user->project; $this->view->tabID = 'project'; $this->view->projects = $this->user->getProjects($account); - $this->view->account = $account; - $this->view->user = $this->user->getById($account); + $this->view->user = $user; $this->display(); } @@ -338,27 +350,25 @@ class user extends control /** * The profile of a user. * - * @param string $account + * @param int $userID * @access public * @return void */ - public function profile($account = '') + public function profile($userID = '') { - if(empty($account)) $account = $this->app->user->account; + if(empty($userID)) $userID = $this->app->user->id; - /* Set menu. */ - $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclose|nodeleted'), $account); - - $user = $this->user->getById($account); + $user = $this->user->getById($userID, 'id'); + $account = $user->account; $this->view->title = "USER #$user->id $user->account/" . $this->lang->user->profile; $this->view->position[] = $this->lang->user->common; $this->view->position[] = $this->lang->user->profile; - $this->view->account = $account; $this->view->user = $user; $this->view->groups = $this->loadModel('group')->getByAccount($account); $this->view->deptPath = $this->dept->getParents($user->dept); $this->view->personalData = $this->user->getPersonalData($user->account); + $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclose|nodeleted|useid'), $userID); $this->display(); } @@ -612,43 +622,35 @@ class user extends control /** * Unlock a user. * - * @param int $account + * @param int $userID * @param string $confirm * @access public * @return void */ - public function unlock($account, $confirm = 'no') + public function unlock($userID, $confirm = 'no') { - if($confirm == 'no') - { - die(js::confirm($this->lang->user->confirmUnlock, $this->createLink('user', 'unlock', "account=$account&confirm=yes"))); - } - else - { - $this->user->cleanLocked($account); - die(js::locate($this->session->userList ? $this->session->userList : $this->createLink('company', 'browse'), 'parent')); - } + if($confirm == 'no') die(js::confirm($this->lang->user->confirmUnlock, $this->createLink('user', 'unlock', "userID=$userID&confirm=yes"))); + + $user = $this->user->getById($userID, 'id'); + $this->user->cleanLocked($user->account); + die(js::locate($this->session->userList ? $this->session->userList : $this->createLink('company', 'browse'), 'parent')); } /** * Unbind Ranzhi * - * @param string $account + * @param string $userID * @param string $confirm * @access public * @return void */ - public function unbind($account, $confirm = 'no') + public function unbind($userID, $confirm = 'no') { - if($confirm == 'no') - { - die(js::confirm($this->lang->user->confirmUnbind, $this->createLink('user', 'unbind', "account=$account&confirm=yes"))); - } - else - { - $this->user->unbind($account); - die(js::locate($this->session->userList ? $this->session->userList : $this->createLink('company', 'browse'), 'parent')); - } + if($confirm == 'no') die(js::confirm($this->lang->user->confirmUnbind, $this->createLink('user', 'unbind', "userID=$userID&confirm=yes"))); + + $user = $this->user->getById($userID, 'id'); + $this->user->unbind($user->account); + die(js::locate($this->session->userList ? $this->session->userList : $this->createLink('company', 'browse'), 'parent')); } @@ -936,19 +938,21 @@ class user extends control * User dynamic. * * @param string $period - * @param string $account - * @param string $orderBy + * @param int $userID * @param int $recTotal - * @param int $recPerPage - * @param int $pageID + * @param string $date + * @param string $direction next|pre * @access public * @return void */ - public function dynamic($period = 'today', $account = '', $recTotal = 0, $date = '', $direction = 'next') + public function dynamic($period = 'today', $userID = '', $recTotal = 0, $date = '', $direction = 'next') { + $user = $this->user->getById($userID, 'id'); + $account = $user->account; + /* set menus. */ $this->lang->set('menugroup.user', 'company'); - $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted'), $account); + $this->view->userList = $this->user->setUserList($this->user->getPairs('noempty|noclosed|nodeleted|useid'), $userID); /* Save session. */ $uri = $this->app->getURI(true); @@ -980,9 +984,8 @@ class user extends control /* Assign. */ $this->view->type = $period; $this->view->users = $this->loadModel('user')->getPairs('noletter'); - $this->view->account = $account; $this->view->pager = $pager; - $this->view->user = $this->user->getById($account); + $this->view->user = $user; $this->view->dateGroups = $this->action->buildDateGroup($actions, $direction, $period); $this->view->direction = $direction; $this->display(); diff --git a/module/user/js/todo.js b/module/user/js/todo.js index 72b0c829f4..6fb71fec92 100644 --- a/module/user/js/todo.js +++ b/module/user/js/todo.js @@ -1,6 +1,6 @@ function changeDate(date) { - location.href = createLink('user', 'todo', 'account=' + account + '&type=' + date.replace(/\-/g, '')); + location.href = createLink('user', 'todo', 'userID=' + userID + '&type=' + date.replace(/\-/g, '')); } $(function() diff --git a/module/user/model.php b/module/user/model.php index 60d371ef62..b63eace6c0 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -13,25 +13,6 @@ app->getMethodName(); - $selectHtml = html::select('account', $users, $account, "onchange=\"switchAccount(this.value, '$methodName')\""); - foreach($this->lang->user->menu as $key => $value) - { - $replace = ($key == 'account') ? $selectHtml : $account; - common::setMenuVars($this->lang->user->menu, $key, $replace); - } - } - /** * Set users list. * @@ -78,7 +59,7 @@ class userModel extends model * If there's xxfirst in the params, use INSTR function to get the position of role fields in a order string, * thus to make sure users of this role at first. */ - $fields = 'account, realname, deleted'; + $fields = 'id, account, realname, deleted'; if(strpos($params, 'pofirst') !== false) $fields .= ", INSTR(',pd,po,', role) AS roleOrder"; if(strpos($params, 'pdfirst') !== false) $fields .= ", INSTR(',po,pd,', role) AS roleOrder"; if(strpos($params, 'qafirst') !== false) $fields .= ", INSTR(',qd,qa,', role) AS roleOrder"; @@ -87,6 +68,8 @@ class userModel extends model if(strpos($params, 'devfirst')!== false) $fields .= ", INSTR(',td,pm,qd,qa,dev,', role) AS roleOrder"; $orderBy = strpos($params, 'first') !== false ? 'roleOrder DESC, account' : 'account'; + $keyField = (strpos($params, 'useid')!== false) ? 'id' : "account"; + /* Get raw records. */ $this->app->loadConfig('user'); unset($this->config->user->moreLink); @@ -96,7 +79,7 @@ class userModel extends model ->beginIF(strpos($params, 'nodeleted') !== false or empty($this->config->user->showDeleted))->andWhere('deleted')->eq('0')->fi() ->orderBy($orderBy) ->beginIF($maxCount)->limit($maxCount)->fi() - ->fetchAll('account'); + ->fetchAll($keyField); if($maxCount and $maxCount == count($users)) { @@ -106,14 +89,14 @@ class userModel extends model $this->config->user->moreLink = helper::createLink('user', 'ajaxGetMore') . $connectString . "params=" . base64_encode($moreLinkParams); } - if($usersToAppended) $users += $this->dao->select($fields)->from(TABLE_USER)->where('account')->in($usersToAppended)->fetchAll('account'); + if($usersToAppended) $users += $this->dao->select($fields)->from(TABLE_USER)->where('account')->in($usersToAppended)->fetchAll($keyField); /* Cycle the user records to append the first letter of his account. */ foreach($users as $account => $user) { - $firstLetter = ucfirst(substr($account, 0, 1)) . ':'; + $firstLetter = ucfirst(substr($user->account, 0, 1)) . ':'; if(strpos($params, 'noletter') !== false or !empty($this->config->isINT)) $firstLetter = ''; - $users[$account] = $firstLetter . (($user->deleted and strpos($params, 'realname') === false) ? $account : ($user->realname ? $user->realname : $account)); + $users[$account] = $firstLetter . (($user->deleted and strpos($params, 'realname') === false) ? $user->account : ($user->realname ? $user->realname : $user->account)); } /* Append empty, closed, and guest users. */ @@ -189,6 +172,9 @@ class userModel extends model */ public function getById($userID, $field = 'account') { + if($field == 'id') $userID = (int)$userID; + if($field == 'account') $userID = str_replace(' ', '', $userID); + $user = $this->dao->select('*')->from(TABLE_USER)->where("`$field`")->eq($userID)->fetch(); if(!$user) return false; $user->last = date(DT_DATETIME1, $user->last); @@ -1505,7 +1491,7 @@ class userModel extends model $linkedProjectProducts = array(); if($objectType == 'product') { - $stmt = $this->dao->select('project,product')->from(TABLE_PROJECTPRODUCT)->alias('t1') + $stmt = $this->dao->select('t1.project,t1.product')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id') ->where('t1.product')->in($objectIdList) ->andWhere('t2.deleted')->eq(0) diff --git a/module/user/view/bug.html.php b/module/user/view/bug.html.php index ad547f9ab3..6dbf3375f4 100644 --- a/module/user/view/bug.html.php +++ b/module/user/view/bug.html.php @@ -19,16 +19,16 @@ user->thirdPerson, $user->gender); $active = $type == 'assignedTo' ? 'active' : ''; - echo "
  • " . html::a(inlink('bug', "account=$account&type=assignedTo"), sprintf($lang->user->assignedTo, $that)) . "
  • "; + echo "
  • " . html::a(inlink('bug', "userID={$user->id}&type=assignedTo"), sprintf($lang->user->assignedTo, $that)) . "
  • "; $active = $type == 'openedBy' ? 'active' : ''; - echo "
  • " . html::a(inlink('bug', "account=$account&type=openedBy"), sprintf($lang->user->openedBy, $that)) . "
  • "; + echo "
  • " . html::a(inlink('bug', "userID={$user->id}&type=openedBy"), sprintf($lang->user->openedBy, $that)) . "
  • "; $active = $type == 'resolvedBy' ? 'active' : ''; - echo "
  • " . html::a(inlink('bug', "account=$account&type=resolvedBy"), sprintf($lang->user->resolvedBy, $that)) . "
  • "; + echo "
  • " . html::a(inlink('bug', "userID={$user->id}&type=resolvedBy"), sprintf($lang->user->resolvedBy, $that)) . "
  • "; $active = $type == 'closedBy' ? 'active' : ''; - echo "
  • " . html::a(inlink('bug', "account=$account&type=closedBy"), sprintf($lang->user->closedBy, $that)) . "
  • "; + echo "
  • " . html::a(inlink('bug', "userID={$user->id}&type=closedBy"), sprintf($lang->user->closedBy, $that)) . "
  • "; ?> diff --git a/module/user/view/dynamic.html.php b/module/user/view/dynamic.html.php index 83bf799b0f..22fa97a7f2 100644 --- a/module/user/view/dynamic.html.php +++ b/module/user/view/dynamic.html.php @@ -25,7 +25,7 @@ $active = 'btn-active-text'; $label .= " {$pager->recTotal}"; } - echo html::a(inlink('dynamic', "type=$period&account=$account"), $label, '', "class='btn btn-link $active' id='{$period}'") + echo html::a(inlink('dynamic', "type=$period&userID={$user->id}"), $label, '', "class='btn btn-link $active' id='{$period}'") ?> @@ -76,8 +76,8 @@ $firstDate = date('Y-m-d', strtotime($firstAction->originalDate) + 24 * 3600); $lastDate = substr($action->originalDate, 0, 10); $hasPre = $this->action->hasPreOrNext($firstDate, 'pre'); $hasNext = $this->action->hasPreOrNext($lastDate, 'next'); -$preLink = $hasPre ? inlink('dynamic', "type=$type&account=$account&recTotal={$pager->recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; -$nextLink = $hasNext ? inlink('dynamic', "type=$type&account=$account&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; +$preLink = $hasPre ? inlink('dynamic', "type=$type&userID={$user->id}&recTotal={$pager->recTotal}&date=" . strtotime($firstDate) . '&direction=pre') : 'javascript:;'; +$nextLink = $hasNext ? inlink('dynamic', "type=$type&userID={$user->id}&recTotal={$pager->recTotal}&date=" . strtotime($lastDate) . '&direction=next') : 'javascript:;'; ?>
    diff --git a/module/user/view/edit.html.php b/module/user/view/edit.html.php index c48aa7c16a..2aa36f4ce4 100644 --- a/module/user/view/edit.html.php +++ b/module/user/view/edit.html.php @@ -18,7 +18,7 @@

    id;?> - account", $user->realname)) echo $user->realname;?> (account;?>) + id", $user->realname)) echo $user->realname;?> (account;?>) arrow . $lang->user->edit;?>

    diff --git a/module/user/view/featurebar.html.php b/module/user/view/featurebar.html.php index 201aaa0115..cb9c352567 100755 --- a/module/user/view/featurebar.html.php +++ b/module/user/view/featurebar.html.php @@ -12,48 +12,48 @@ { $label = "{$lang->user->schedule}"; $active = $methodName == 'todo' ? ' btn-active-text' : ''; - common::printLink('user', 'todo', "account=$account", $label, '', "class='btn btn-link $active'"); + common::printLink('user', 'todo', "userID={$user->id}", $label, '', "class='btn btn-link $active'"); } if($config->global->flow != 'onlyTask' and $config->global->flow != 'onlyTest') { $label = "{$lang->user->story}"; $active = $methodName == 'story' ? ' btn-active-text' : ''; - common::printLink('user', 'story', "account=$account", $label, '', "class='btn btn-link $active'"); + common::printLink('user', 'story', "userID={$user->id}", $label, '', "class='btn btn-link $active'"); } if($config->global->flow == 'full' or $config->global->flow == 'onlyTask') { $label = "{$lang->user->task}"; $active = $methodName == 'task' ? ' btn-active-text' : ''; - common::printLink('user', 'task', "account=$account", $label, '', "class='btn btn-link $active'"); + common::printLink('user', 'task', "userID={$user->id}", $label, '', "class='btn btn-link $active'"); } if($config->global->flow == 'full' or $config->global->flow == 'onlyTest') { $label = "{$lang->user->bug}"; $active = $methodName == 'bug' ? ' btn-active-text' : ''; - common::printLink('user', 'bug', "account=$account", $label, '', "class='btn btn-link $active'"); + common::printLink('user', 'bug', "userID={$user->id}", $label, '', "class='btn btn-link $active'"); $label = "{$lang->user->test}"; $active = ($methodName == 'testtask' or $methodName == 'testcase')? ' btn-active-text' : ''; - common::printLink('user', 'testtask', "account=$account", $label, '', "class='btn btn-link $active'"); + common::printLink('user', 'testtask', "userID={$user->id}", $label, '', "class='btn btn-link $active'"); } $label = "{$lang->user->dynamic}"; $active = $methodName == 'dynamic' ? ' btn-active-text' : ''; - common::printLink('user', 'dynamic', "type=today&account=$account", $label, '', "class='btn btn-link $active'"); + common::printLink('user', 'dynamic', "type=today&userID={$user->id}", $label, '', "class='btn btn-link $active'"); if($config->global->flow == 'full' or $config->global->flow == 'onlyTask') { $label = "{$lang->user->project}"; $active = $methodName == 'project' ? ' btn-active-text' : ''; - common::printLink('user', 'project', "account=$account", $label, '', "class='btn btn-link $active'"); + common::printLink('user', 'project', "userID={$user->id}", $label, '', "class='btn btn-link $active'"); } $label = "{$lang->user->profile}"; $active = $methodName == 'profile' ? ' btn-active-text' : ''; - common::printLink('user', 'profile', "account=$account", $label, '', "class='btn btn-link $active'"); + common::printLink('user', 'profile', "userID={$user->id}", $label, '', "class='btn btn-link $active'"); ?>
    diff --git a/module/user/view/story.html.php b/module/user/view/story.html.php index 213a0f2737..756fe4a522 100644 --- a/module/user/view/story.html.php +++ b/module/user/view/story.html.php @@ -19,16 +19,16 @@ user->thirdPerson, $user->gender); $active = $type == 'assignedTo' ? 'active' : ''; - echo "
  • " . html::a(inlink('story', "account=$account&type=assignedTo"), sprintf($lang->user->assignedTo, $that)) . "
  • "; + echo "
  • " . html::a(inlink('story', "userID={$user->id}&type=assignedTo"), sprintf($lang->user->assignedTo, $that)) . "
  • "; $active = $type == 'openedBy' ? 'active' : ''; - echo "
  • " . html::a(inlink('story', "account=$account&type=openedBy"), sprintf($lang->user->openedBy, $that)) . "
  • "; + echo "
  • " . html::a(inlink('story', "userID={$user->id}&type=openedBy"), sprintf($lang->user->openedBy, $that)) . "
  • "; $active = $type == 'reviewedBy' ? 'active' : ''; - echo "
  • " . html::a(inlink('story', "account=$account&type=reviewedBy"), sprintf($lang->user->reviewedBy ,$that)) . "
  • "; + echo "
  • " . html::a(inlink('story', "userID={$user->id}&type=reviewedBy"), sprintf($lang->user->reviewedBy ,$that)) . "
  • "; $active = $type == 'closedBy' ? 'active' : ''; - echo "
  • " . html::a(inlink('story', "account=$account&type=closedBy"), sprintf($lang->user->closedBy ,$that)) . "
  • "; + echo "
  • " . html::a(inlink('story', "userID={$user->id}&type=closedBy"), sprintf($lang->user->closedBy ,$that)) . "
  • "; ?> diff --git a/module/user/view/task.html.php b/module/user/view/task.html.php index b4fa0b3e95..20579d9cd3 100644 --- a/module/user/view/task.html.php +++ b/module/user/view/task.html.php @@ -19,19 +19,19 @@ user->thirdPerson, $user->gender); $active = $type == 'assignedTo' ? 'active' : ''; - echo "
  • " . html::a(inlink('task', "account=$account&type=assignedTo"), sprintf($lang->user->assignedTo, $that)) . "
  • "; + echo "
  • " . html::a(inlink('task', "userID={$user->id}&type=assignedTo"), sprintf($lang->user->assignedTo, $that)) . "
  • "; $active = $type == 'openedBy' ? 'active' : ''; - echo "
  • " . html::a(inlink('task', "account=$account&type=openedBy"), sprintf($lang->user->openedBy, $that)) . "
  • "; + echo "
  • " . html::a(inlink('task', "userID={$user->id}&type=openedBy"), sprintf($lang->user->openedBy, $that)) . "
  • "; $active = $type == 'finishedBy' ? 'active' : ''; - echo "
  • " . html::a(inlink('task', "account=$account&type=finishedBy"), sprintf($lang->user->finishedBy, $that)) . "
  • "; + echo "
  • " . html::a(inlink('task', "userID={$user->id}&type=finishedBy"), sprintf($lang->user->finishedBy, $that)) . "
  • "; $active = $type == 'closedBy' ? 'active' : ''; - echo "
  • " . html::a(inlink('task', "account=$account&type=closedBy"), sprintf($lang->user->closedBy, $that)) . "
  • "; + echo "
  • " . html::a(inlink('task', "userID={$user->id}&type=closedBy"), sprintf($lang->user->closedBy, $that)) . "
  • "; $active = $type == 'canceledBy' ? 'active' : ''; - echo "
  • " . html::a(inlink('task', "account=$account&type=canceledBy"), sprintf($lang->user->canceledBy, $that)) . "
  • "; + echo "
  • " . html::a(inlink('task', "userID={$user->id}&type=canceledBy"), sprintf($lang->user->canceledBy, $that)) . "
  • "; ?> diff --git a/module/user/view/testcase.html.php b/module/user/view/testcase.html.php index 7648ef036b..8dc2d55049 100755 --- a/module/user/view/testcase.html.php +++ b/module/user/view/testcase.html.php @@ -17,12 +17,12 @@ @@ -30,7 +30,7 @@
    id}&type=$type&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID"; $this->app->loadLang('testtask'); ?> diff --git a/module/user/view/testtask.html.php b/module/user/view/testtask.html.php index 18226f521e..fe5bc14ef6 100755 --- a/module/user/view/testtask.html.php +++ b/module/user/view/testtask.html.php @@ -17,16 +17,16 @@
    - + id}&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID"; ?> diff --git a/module/user/view/todo.html.php b/module/user/view/todo.html.php index 6cdb23fc57..15f4e80da6 100644 --- a/module/user/view/todo.html.php +++ b/module/user/view/todo.html.php @@ -13,7 +13,7 @@ - +id);?>
    idAB);?>
    - recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"; ?> + id}&type=$type&status=$status&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"; ?>
    idAB);?>