Merge pull request #3743 from hregis/develop_origin
Fix: Parse error: syntax error, unexpected '}'
This commit is contained in:
commit
5db82b8869
@ -107,186 +107,184 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
if (empty($reshook)) {
|
if (empty($reshook)) {
|
||||||
|
|
||||||
if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) {
|
if ($action == 'confirm_disable' && $confirm == "yes" && $candisableuser) {
|
||||||
if ($id <> $user->id) {
|
if ($id <> $user->id) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->setstatus(0);
|
$object->setstatus(0);
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) {
|
if ($action == 'confirm_enable' && $confirm == "yes" && $candisableuser) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if ($id <> $user->id) {
|
if ($id <> $user->id) {
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|
||||||
if (!empty($conf->file->main_limit_users)) {
|
if (!empty($conf->file->main_limit_users)) {
|
||||||
$nb = $object->getNbOfUsers("active");
|
$nb = $object->getNbOfUsers("active");
|
||||||
if ($nb >= $conf->file->main_limit_users) {
|
if ($nb >= $conf->file->main_limit_users) {
|
||||||
$error ++;
|
$error ++;
|
||||||
setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors');
|
setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$object->setstatus(1);
|
$object->setstatus(1);
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) {
|
if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) {
|
||||||
if ($id <> $user->id) {
|
if ($id <> $user->id) {
|
||||||
$object = new User($db);
|
$object = new User($db);
|
||||||
$object->id = $id;
|
$object->id = $id;
|
||||||
$result = $object->delete();
|
$result = $object->delete();
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans("ErrorUserCannotBeDelete"), 'errors');
|
setEventMessage($langs->trans("ErrorUserCannotBeDelete"), 'errors');
|
||||||
} else {
|
} else {
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action Add user
|
// Action Add user
|
||||||
if ($action == 'add' && $canadduser) {
|
if ($action == 'add' && $canadduser) {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
if (!$_POST["lastname"]) {
|
if (!$_POST["lastname"]) {
|
||||||
$error ++;
|
$error ++;
|
||||||
setEventMessage($langs->trans("NameNotDefined"), 'errors');
|
setEventMessage($langs->trans("NameNotDefined"), 'errors');
|
||||||
$action = "create"; // Go back to create page
|
$action = "create"; // Go back to create page
|
||||||
}
|
}
|
||||||
if (!$_POST["login"]) {
|
if (!$_POST["login"]) {
|
||||||
$error ++;
|
$error ++;
|
||||||
setEventMessage($langs->trans("LoginNotDefined"), 'errors');
|
setEventMessage($langs->trans("LoginNotDefined"), 'errors');
|
||||||
$action = "create"; // Go back to create page
|
$action = "create"; // Go back to create page
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($conf->file->main_limit_users)) // If option to limit users is set
|
if (!empty($conf->file->main_limit_users)) { // If option to limit users is set
|
||||||
{
|
$nb = $object->getNbOfUsers("active");
|
||||||
$nb = $object->getNbOfUsers("active");
|
if ($nb >= $conf->file->main_limit_users) {
|
||||||
if ($nb >= $conf->file->main_limit_users) {
|
$error ++;
|
||||||
$error ++;
|
setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors');
|
||||||
setEventMessage($langs->trans("YourQuotaOfUsersIsReached"), 'errors');
|
$action = "create"; // Go back to create page
|
||||||
$action = "create"; // Go back to create page
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
$object->lastname = GETPOST("lastname", 'alpha');
|
$object->lastname = GETPOST("lastname", 'alpha');
|
||||||
$object->firstname = GETPOST("firstname", 'alpha');
|
$object->firstname = GETPOST("firstname", 'alpha');
|
||||||
$object->login = GETPOST("login", 'alpha');
|
$object->login = GETPOST("login", 'alpha');
|
||||||
$object->api_key = GETPOST("api_key", 'alpha');
|
$object->api_key = GETPOST("api_key", 'alpha');
|
||||||
$object->gender = GETPOST("gender", 'alpha');
|
$object->gender = GETPOST("gender", 'alpha');
|
||||||
$object->admin = GETPOST("admin", 'alpha');
|
$object->admin = GETPOST("admin", 'alpha');
|
||||||
$object->office_phone = GETPOST("office_phone", 'alpha');
|
$object->office_phone = GETPOST("office_phone", 'alpha');
|
||||||
$object->office_fax = GETPOST("office_fax", 'alpha');
|
$object->office_fax = GETPOST("office_fax", 'alpha');
|
||||||
$object->user_mobile = GETPOST("user_mobile");
|
$object->user_mobile = GETPOST("user_mobile");
|
||||||
$object->skype = GETPOST("skype");
|
$object->skype = GETPOST("skype");
|
||||||
$object->email = GETPOST("email", 'alpha');
|
$object->email = GETPOST("email", 'alpha');
|
||||||
$object->job = GETPOST("job", 'alpha');
|
$object->job = GETPOST("job", 'alpha');
|
||||||
$object->signature = GETPOST("signature");
|
$object->signature = GETPOST("signature");
|
||||||
$object->accountancy_code = GETPOST("accountancy_code");
|
$object->accountancy_code = GETPOST("accountancy_code");
|
||||||
$object->note = GETPOST("note");
|
$object->note = GETPOST("note");
|
||||||
$object->ldap_sid = GETPOST("ldap_sid");
|
$object->ldap_sid = GETPOST("ldap_sid");
|
||||||
$object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0;
|
$object->fk_user = GETPOST("fk_user") > 0 ? GETPOST("fk_user") : 0;
|
||||||
|
|
||||||
$object->thm = GETPOST("thm") != '' ? GETPOST("thm") : '';
|
$object->thm = GETPOST("thm") != '' ? GETPOST("thm") : '';
|
||||||
$object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : '';
|
$object->tjm = GETPOST("tjm") != '' ? GETPOST("tjm") : '';
|
||||||
$object->salary = GETPOST("salary") != '' ? GETPOST("salary") : '';
|
$object->salary = GETPOST("salary") != '' ? GETPOST("salary") : '';
|
||||||
$object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : '';
|
$object->salaryextra = GETPOST("salaryextra") != '' ? GETPOST("salaryextra") : '';
|
||||||
$object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : '';
|
$object->weeklyhours = GETPOST("weeklyhours") != '' ? GETPOST("weeklyhours") : '';
|
||||||
|
|
||||||
$object->color = GETPOST("color") != '' ? GETPOST("color") : '';
|
$object->color = GETPOST("color") != '' ? GETPOST("color") : '';
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||||
if ($ret < 0) {
|
if ($ret < 0) {
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set entity property
|
// Set entity property
|
||||||
$entity = GETPOST('entity', 'int');
|
$entity = GETPOST('entity', 'int');
|
||||||
if (!empty($conf->multicompany->enabled)) {
|
if (!empty($conf->multicompany->enabled)) {
|
||||||
if (!empty($_POST["superadmin"])) {
|
if (!empty($_POST["superadmin"])) {
|
||||||
$object->entity = 0;
|
$object->entity = 0;
|
||||||
} else {
|
} else {
|
||||||
if ($conf->multicompany->transverse_mode) {
|
if ($conf->multicompany->transverse_mode) {
|
||||||
$object->entity = 1; // all users are forced into master entity
|
$object->entity = 1; // all users are forced into master entity
|
||||||
} else {
|
} else {
|
||||||
$object->entity = ($entity == '' ? 1 : $entity);
|
$object->entity = ($entity == '' ? 1 : $entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$object->entity = ($entity == '' ? 1 : $entity);
|
$object->entity = ($entity == '' ? 1 : $entity);
|
||||||
/*if ($user->admin && $user->entity == 0 && GETPOST("admin",'alpha'))
|
/*if ($user->admin && $user->entity == 0 && GETPOST("admin",'alpha'))
|
||||||
{
|
{
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
if ($id > 0) {
|
if ($id > 0) {
|
||||||
if (isset($_POST['password']) && trim($_POST['password'])) {
|
if (isset($_POST['password']) && trim($_POST['password'])) {
|
||||||
$object->setPassword($user, trim($_POST['password']));
|
$object->setPassword($user, trim($_POST['password']));
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||||
exit;
|
exit;
|
||||||
} else {
|
} else {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
if (is_array($object->errors) && count($object->errors)) {
|
if (is_array($object->errors) && count($object->errors)) {
|
||||||
setEventMessage($object->errors, 'errors');
|
setEventMessage($object->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
$action = "create"; // Go back to create page
|
$action = "create"; // Go back to create page
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
// Action add usergroup
|
||||||
}
|
if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield)
|
||||||
|
{
|
||||||
|
if ($group)
|
||||||
|
{
|
||||||
|
$editgroup = new UserGroup($db);
|
||||||
|
$editgroup->fetch($group);
|
||||||
|
$editgroup->oldcopy=clone $editgroup;
|
||||||
|
|
||||||
// Action add usergroup
|
$object->fetch($id);
|
||||||
if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield)
|
if ($action == 'addgroup') {
|
||||||
{
|
$object->SetInGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity));
|
||||||
if ($group)
|
}
|
||||||
{
|
if ($action == 'removegroup') {
|
||||||
$editgroup = new UserGroup($db);
|
$object->RemoveFromGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity));
|
||||||
$editgroup->fetch($group);
|
}
|
||||||
$editgroup->oldcopy=clone $editgroup;
|
|
||||||
|
|
||||||
$object->fetch($id);
|
if ($result > 0) {
|
||||||
if ($action == 'addgroup') {
|
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
||||||
$object->SetInGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity));
|
exit;
|
||||||
}
|
} else {
|
||||||
if ($action == 'removegroup') {
|
setEventMessage($object->error, 'errors');
|
||||||
$object->RemoveFromGroup($group, ($conf->multicompany->transverse_mode ? GETPOST("entity") : $editgroup->entity));
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($action == 'update' && !$_POST["cancel"]) {
|
||||||
header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id);
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
exit;
|
|
||||||
} else {
|
|
||||||
setEventMessage($object->error, 'errors');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'update' && !$_POST["cancel"]) {
|
if ($caneditfield) // Case we can edit all field
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
{
|
||||||
|
$error = 0;
|
||||||
if ($caneditfield) // Case we can edit all field
|
|
||||||
{
|
|
||||||
$error = 0;
|
|
||||||
|
|
||||||
if (!$_POST["lastname"]) {
|
if (!$_POST["lastname"]) {
|
||||||
setEventMessage($langs->trans("NameNotDefined"), 'errors');
|
setEventMessage($langs->trans("NameNotDefined"), 'errors');
|
||||||
@ -493,9 +491,8 @@ if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield)
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Change password with a new generated one
|
// Change password with a new generated one
|
||||||
if ((($action == 'confirm_password' && $confirm == 'yes')
|
if ((($action == 'confirm_password' && $confirm == 'yes')
|
||||||
|| ($action == 'confirm_passwordsend' && $confirm == 'yes')) && $caneditpassword
|
|| ($action == 'confirm_passwordsend' && $confirm == 'yes')) && $caneditpassword
|
||||||
) {
|
) {
|
||||||
@ -519,7 +516,7 @@ if (($action == 'addgroup' || $action == 'removegroup') && $caneditfield)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Action initialisation donnees depuis record LDAP
|
// Action initialisation donnees depuis record LDAP
|
||||||
if ($action == 'adduserldap') {
|
if ($action == 'adduserldap') {
|
||||||
$selecteduser = $_POST['users'];
|
$selecteduser = $_POST['users'];
|
||||||
|
|
||||||
@ -1154,14 +1151,14 @@ else
|
|||||||
dol_fiche_head($head, 'user', $title, 0, 'user');
|
dol_fiche_head($head, 'user', $title, 0, 'user');
|
||||||
|
|
||||||
dol_banner_tab($object,'id','',$user->rights->user->user->lire || $user->admin);
|
dol_banner_tab($object,'id','',$user->rights->user->user->lire || $user->admin);
|
||||||
|
|
||||||
|
|
||||||
print '<div class="fichecenter">';
|
print '<div class="fichecenter">';
|
||||||
print '<div class="fichehalfleft">';
|
print '<div class="fichehalfleft">';
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
// Login
|
// Login
|
||||||
print '<tr><td>'.$langs->trans("Login").'</td>';
|
print '<tr><td>'.$langs->trans("Login").'</td>';
|
||||||
if (! empty($object->ldap_sid) && $object->statut==0)
|
if (! empty($object->ldap_sid) && $object->statut==0)
|
||||||
@ -1345,13 +1342,13 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
print '<div class="underbanner clearboth"></div>';
|
print '<div class="underbanner clearboth"></div>';
|
||||||
print '<table class="border tableforfield" width="100%">';
|
print '<table class="border tableforfield" width="100%">';
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("LastConnexion").'</td>';
|
print '<tr><td>'.$langs->trans("LastConnexion").'</td>';
|
||||||
print '<td>'.dol_print_date($object->datelastlogin,"dayhour").'</td>';
|
print '<td>'.dol_print_date($object->datelastlogin,"dayhour").'</td>';
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@ -1445,10 +1442,10 @@ else
|
|||||||
|
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
print '</div></div>';
|
print '</div></div>';
|
||||||
print '<div style="clear:both"></div>';
|
print '<div style="clear:both"></div>';
|
||||||
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
|
|
||||||
@ -1694,7 +1691,7 @@ else
|
|||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lastname
|
// Lastname
|
||||||
print "<tr>";
|
print "<tr>";
|
||||||
print '<td class="fieldrequired">'.$langs->trans("Lastname").'</td>';
|
print '<td class="fieldrequired">'.$langs->trans("Lastname").'</td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user