FIX_user_team
This commit is contained in:
parent
8393a7c797
commit
95285dd602
@ -202,52 +202,53 @@ class UserController extends AdminController
|
||||
// ];
|
||||
// $this->bookStack->createEditUser($bookStackData);
|
||||
|
||||
// if ($insert) {
|
||||
// $teamData['user_id'] = $insert;
|
||||
// foreach ($teams as $value) {
|
||||
// $teamData['team_id'] = $value;
|
||||
// $teamData['created_by'] = get_session_userid();
|
||||
// $this->userTeamsModel->insert($teamData);
|
||||
// }
|
||||
if ($insert) {
|
||||
|
||||
// $db = \Config\Database::connect();
|
||||
// $tableName = 'hdz_staff';
|
||||
$teamData['user_id'] = $insert;
|
||||
foreach ($teams as $value) {
|
||||
$teamData['team_id'] = $value;
|
||||
$teamData['created_by'] = get_session_userid();
|
||||
$this->userTeamsModel->insert($teamData);
|
||||
}
|
||||
|
||||
// $db = \Config\Database::connect();
|
||||
// $tableName = 'hdz_staff';
|
||||
|
||||
// // Set default values
|
||||
// $admin = 0;
|
||||
// $acm = 0;
|
||||
// $acm_id = null;
|
||||
// // Set default values
|
||||
// $admin = 0;
|
||||
// $acm = 0;
|
||||
// $acm_id = null;
|
||||
|
||||
// if ($userData['role'] == 3) {
|
||||
// $admin = 0;
|
||||
// $acm = 1;
|
||||
// $acm_id = $insert;
|
||||
// } else if (in_array($userData['role'], [1, 5])) {
|
||||
// $admin = 1;
|
||||
// $acm = 0;
|
||||
// $acm_id = null;
|
||||
// }
|
||||
// if ($userData['role'] == 3) {
|
||||
// $admin = 0;
|
||||
// $acm = 1;
|
||||
// $acm_id = $insert;
|
||||
// } else if (in_array($userData['role'], [1, 5])) {
|
||||
// $admin = 1;
|
||||
// $acm = 0;
|
||||
// $acm_id = null;
|
||||
// }
|
||||
|
||||
// $password = '12345678'; // Default password
|
||||
// $hashedPassword = password_hash($password, PASSWORD_DEFAULT);
|
||||
// $password = '12345678'; // Default password
|
||||
// $hashedPassword = password_hash($password, PASSWORD_DEFAULT);
|
||||
|
||||
// $hdz_staff = [
|
||||
// 'emp_code' => $userData['emp_code'],
|
||||
// 'fullname' => $userData['first_name'],
|
||||
// 'username' => strtolower($userData['first_name']),
|
||||
// 'email' => $userData['email'],
|
||||
// 'admin' => $admin,
|
||||
// 'acm' => $acm,
|
||||
// 'acm_id' => $acm_id,
|
||||
// 'registration' => time(),
|
||||
// 'password' => $hashedPassword,
|
||||
// 'active' => 1,
|
||||
// 'department' => 'a:7:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"5";i:3;s:1:"3";i:4;s:1:"9";i:5;s:1:"4";i:6;s:2:"10";}',
|
||||
// ];
|
||||
// $hdz_staff = [
|
||||
// 'emp_code' => $userData['emp_code'],
|
||||
// 'fullname' => $userData['first_name'],
|
||||
// 'username' => strtolower($userData['first_name']),
|
||||
// 'email' => $userData['email'],
|
||||
// 'admin' => $admin,
|
||||
// 'acm' => $acm,
|
||||
// 'acm_id' => $acm_id,
|
||||
// 'registration' => time(),
|
||||
// 'password' => $hashedPassword,
|
||||
// 'active' => 1,
|
||||
// 'department' => 'a:7:{i:0;s:1:"1";i:1;s:1:"2";i:2;s:1:"5";i:3;s:1:"3";i:4;s:1:"9";i:5;s:1:"4";i:6;s:2:"10";}',
|
||||
// ];
|
||||
|
||||
// $db->table($tableName)->insert($hdz_staff);
|
||||
// $db->table($tableName)->insert($hdz_staff);
|
||||
|
||||
// }
|
||||
}
|
||||
}
|
||||
$this->myLogger->logme('error', 'User create Successfully created by id {data}', ['data' => get_session_userid()]);
|
||||
return redirect()->to(base_url('/user/list'));
|
||||
@ -400,17 +401,17 @@ class UserController extends AdminController
|
||||
// $this->bookStack->createEditUser($bookStackData,$existingData);
|
||||
|
||||
|
||||
// if ($update) {
|
||||
if ($update) {
|
||||
|
||||
// if ($teams) {
|
||||
// $this->userTeamsModel->where('user_id', $id)->delete();
|
||||
// $teamData['user_id'] = $id;
|
||||
// foreach ($teams as $value) {
|
||||
// $teamData['team_id'] = $value;
|
||||
// $teamData['created_by'] = get_session_userid();
|
||||
// $this->userTeamsModel->insert($teamData);
|
||||
// }
|
||||
// }
|
||||
if ($teams) {
|
||||
$this->userTeamsModel->where('user_id', $id)->delete();
|
||||
$teamData['user_id'] = $id;
|
||||
foreach ($teams as $value) {
|
||||
$teamData['team_id'] = $value;
|
||||
$teamData['created_by'] = get_session_userid();
|
||||
$this->userTeamsModel->insert($teamData);
|
||||
}
|
||||
}
|
||||
|
||||
// $db = \Config\Database::connect();
|
||||
// $tableName = 'hdz_staff';
|
||||
@ -461,7 +462,7 @@ class UserController extends AdminController
|
||||
// $db->table($tableName)->insert($hdz_staff);
|
||||
// }
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
return redirect()->to(base_url('/user/list'));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user