From 8f4b1979cdee8d42f8098f80e79e8ca0509841fb Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Fri, 16 Mar 2018 00:17:08 +0000 Subject: [PATCH] Fixed creating and editing teams by admin - broken during roles revamp. --- WEB-INF/lib/ttImportHelper.class.php | 2 +- WEB-INF/lib/ttTeamHelper.class.php | 3 ++- WEB-INF/templates/footer.tpl | 2 +- admin_team_add.php | 1 - register.php | 1 - 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/WEB-INF/lib/ttImportHelper.class.php b/WEB-INF/lib/ttImportHelper.class.php index 002dac22..9ce34ff7 100644 --- a/WEB-INF/lib/ttImportHelper.class.php +++ b/WEB-INF/lib/ttImportHelper.class.php @@ -139,7 +139,7 @@ class ttImportHelper { foreach ($this->users as $key=>$user_item) { $user_id = ttUserHelper::insert(array( 'team_id' => $this->team_id, - 'role' => $user_item['ROLE'], + 'role_id' => $user_item['ROLE_ID'], // Note: NOT mapped value. Not implemented currently, need to fix. 'client_id' => $user_item['CLIENT_ID'], // Note: NOT mapped value, replaced in CLIENT handler. 'name' => $user_item['NAME'], 'login' => $user_item['LOGIN'], diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index a90ee7f6..1cf0d270 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -698,7 +698,8 @@ class ttTeamHelper { $role_manager = ROLE_MANAGER; $sql = "select t.name as team_name, u.id as manager_id, u.name as manager_name, u.login as manager_login, u.email as manager_email from tt_teams t - inner join tt_users u on (u.team_id = t.id and u.role = $role_manager) + inner join tt_users u on (u.team_id = t.id) + inner join tt_roles r on (r.id = u.role_id and r.rank = 512) where t.id = $team_id"; $res = $mdb2->query($sql); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 918caff6..a1a57597 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.46.4083 | Copyright © Anuko | +  Anuko Time Tracker 1.17.47.4084 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/admin_team_add.php b/admin_team_add.php index 6626a8d8..08a19311 100644 --- a/admin_team_add.php +++ b/admin_team_add.php @@ -107,7 +107,6 @@ if ($request->isPost()) { // Team created, now create a team manager. $user_id = ttUserHelper::insert(array( 'team_id' => $team_id, - 'role' => ROLE_MANAGER, 'role_id' => $role_id, 'name' => $cl_manager_name, 'login' => $cl_manager_login, diff --git a/register.php b/register.php index 13cf5574..92e97be6 100644 --- a/register.php +++ b/register.php @@ -109,7 +109,6 @@ if ($request->isPost()) { // Team created, now create a team manager. $user_id = ttUserHelper::insert(array( 'team_id' => $team_id, - 'role' => ROLE_MANAGER, // TODO: this is now out of sync (324 vs 512 for new role id). Work in progress. 'role_id' => $role_id, 'name' => $cl_manager_name, 'login' => $cl_manager_login, -- 2.20.1