X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=user_add.php;h=28baa2cf5065783684f9acafee80fc2a2bd3077a;hb=d0c39073f009db09baa980ef6e1c2f1e71500a58;hp=e948aa712629cd11946ef6774ead648255b292a3;hpb=1bebedf4f6025a06d5c738a82ef057d2d0200eac;p=timetracker.git diff --git a/user_add.php b/user_add.php index e948aa71..28baa2cf 100644 --- a/user_add.php +++ b/user_add.php @@ -43,7 +43,7 @@ if (!ttAccessAllowed('manage_users')) { // End of access checks. // Use the "limit" plugin if we have one. Ignore include errors. -// The "limit" plugin is not required for normal operation of the Time Tracker. +// The "limit" plugin is not required for normal operation of Time Tracker. @include('plugins/limit/user_add.php'); if ($user->isPluginEnabled('cl')) @@ -91,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 { @@ -157,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