X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=user_add.php;h=9fa6112941210b5cd70fc2a40cade25ff41760c3;hb=35727570b2274aca4f0d816372dabfc93d00cf2d;hp=7fb6ea3c7507adaa09cd1efe0e0d4339b8396cb2;hpb=30bb88aea34039db35d696233149168a14af024c;p=timetracker.git diff --git a/user_add.php b/user_add.php index 7fb6ea3c..9fa61129 100644 --- a/user_add.php +++ b/user_add.php @@ -29,6 +29,7 @@ require_once('initialize.php'); import('form.Form'); import('ttTeamHelper'); +import('ttGroupHelper'); import('ttUserHelper'); import('form.Table'); import('form.TableColumn'); @@ -46,7 +47,7 @@ if (!ttAccessAllowed('manage_users')) { @include('plugins/limit/user_add.php'); if ($user->isPluginEnabled('cl')) - $clients = ttTeamHelper::getActiveClients($user->getGroup()); + $clients = ttGroupHelper::getActiveClients(); $assigned_projects = array(); if ($request->isPost()) { @@ -90,7 +91,7 @@ if ($user->isPluginEnabled('cl')) $form->addInput(array('type'=>'floatfield','maxlength'=>'10','name'=>'rate','format'=>'.2','value'=>$cl_rate)); -$projects = ttTeamHelper::getActiveProjects($user->getGroup()); +$projects = ttGroupHelper::getActiveProjects(); // Define classes for the projects table. class NameCellRenderer extends DefaultCellRenderer { @@ -156,7 +157,13 @@ if ($request->isPost()) { 'client_id' => $cl_client_id, 'projects' => $assigned_projects, 'email' => $cl_email); - if (ttUserHelper::insert($fields)) { + $user_id = ttUserHelper::insert($fields); + if ($user_id) { + if (!$user->exists()) { + // We added a user to an empty subgroup. Set new user as on behalf user. + // Needed for user-based things to work (such as notifications config). + $user->setOnBehalfUser($user_id); + } header('Location: users.php'); exit(); } else