diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 796e44af7c5..21d9fc2226b 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -156,59 +156,59 @@ if ($conf->ldap->enabled && $_GET["action"] == 'reactivate' && $candisableuser) // Action ajout user if ($_POST["action"] == 'add' && $canadduser) { - $message=""; - if (! $_POST["nom"]) { - $message='
'.$langs->trans("NameNotDefined").'
'; - $action="create"; // Go back to create page - } - if (! $_POST["login"]) { - $message='
'.$langs->trans("LoginNotDefined").'
'; - $action="create"; // Go back to create page - } + $message=""; + if (! $_POST["nom"]) { + $message='
'.$langs->trans("NameNotDefined").'
'; + $action="create"; // Go back to create page + } + if (! $_POST["login"]) { + $message='
'.$langs->trans("LoginNotDefined").'
'; + $action="create"; // Go back to create page + } - if (! $message) - { - $edituser = new User($db); + if (! $message) + { + $edituser = new User($db); - $edituser->nom = trim($_POST["nom"]); - $edituser->prenom = trim($_POST["prenom"]); - $edituser->login = trim($_POST["login"]); - $edituser->admin = trim($_POST["admin"]); - $edituser->office_phone = trim($_POST["office_phone"]); - $edituser->office_fax = trim($_POST["office_fax"]); - $edituser->user_mobile = trim($_POST["user_mobile"]); - $edituser->email = trim($_POST["email"]); - $edituser->webcal_login = trim($_POST["webcal_login"]); - $edituser->note = trim($_POST["note"]); - $edituser->ldap_sid = trim($_POST["ldap_sid"]); + $edituser->nom = trim($_POST["nom"]); + $edituser->prenom = trim($_POST["prenom"]); + $edituser->login = trim($_POST["login"]); + $edituser->admin = trim($_POST["admin"]); + $edituser->office_phone = trim($_POST["office_phone"]); + $edituser->office_fax = trim($_POST["office_fax"]); + $edituser->user_mobile = trim($_POST["user_mobile"]); + $edituser->email = trim($_POST["email"]); + $edituser->webcal_login = trim($_POST["webcal_login"]); + $edituser->note = trim($_POST["note"]); + $edituser->ldap_sid = trim($_POST["ldap_sid"]); - $db->begin(); + $db->begin(); - $id = $edituser->create(); + $id = $edituser->create(); - if ($id > 0) - { - if (isset($_POST['password']) && trim($_POST['password'])) - { - $edituser->password($user,trim($_POST['password']),$conf->password_encrypted); - } + if ($id > 0) + { + if (isset($_POST['password']) && trim($_POST['password'])) + { + $edituser->password($user,trim($_POST['password']),$conf->password_encrypted); + } - $db->commit(); + $db->commit(); - Header("Location: fiche.php?id=$id"); - exit; - } - else - { - $db->rollback(); + Header("Location: fiche.php?id=$id"); + exit; + } + else + { + $db->rollback(); - //$message='
'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'
'; - $message='
'.$edituser->error.$id.'
'; + //$message='
'.$langs->trans("ErrorLoginAlreadyExists",$edituser->login).'
'; + $message='
'.$edituser->error.$id.'
'; - $action="create"; // Go back to create page - } + $action="create"; // Go back to create page + } - } + } } // Action ajout groupe utilisateur