Commit 64465660 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

No commit message

No commit message
parent 6ed7cc2d
......@@ -485,6 +485,7 @@ class tx_nG6_eid {
$from_email = trim(t3lib_div::_GP('from_email'));
$pid = trim(t3lib_div::_GP('pid'));
$project_url = trim(t3lib_div::_GP('project_url'));
$send_an_email = filter_var(trim(t3lib_div::_GP('send_an_email')), FILTER_VALIDATE_BOOLEAN);
// if group not exists, create group
$group_id = tx_nG6_db::get_group_id($group_name);
......@@ -512,6 +513,7 @@ class tx_nG6_eid {
// authorize new access
tx_nG6_db::add_access_to_project($new_id, $project_id, $right_id);
if ($send_an_email) {
// send an email to the new user
$message = str_replace("###USER_FIRST_NAME###", $first_name, $create_user_email);
$message = str_replace("###USER_LAST_NAME###", $last_name, $message);
......@@ -520,6 +522,7 @@ class tx_nG6_eid {
$msg_table = explode('\n', $message);
$message = implode("\n", $msg_table);
mail($email, $create_user_title, $message, "From: <".$from_email.">");
}
print '2';
// user exists in DB
......@@ -531,12 +534,11 @@ class tx_nG6_eid {
tx_nG6_db::add_access_to_project($c_user_id, $project_id, $right_id);
// send an email to the user
if ($email != "") {
if ($email != "" && $send_an_email) {
$add_user_email = trim(t3lib_div::_GP('add_user_email'));
$add_user_title = trim(t3lib_div::_GP('add_user_title'));
$project = tx_nG6_db::select_project($project_id);
$message = str_replace("###USER_FIRST_NAME###", $first_name, $add_user_email);
$message = str_replace("###USER_LAST_NAME###", $last_name, $message);
$message = str_replace("###PROJECT_NAME###", $project["name"], $message);
......@@ -545,6 +547,7 @@ class tx_nG6_eid {
$msg_table = explode('\n', $message);
$message = implode("\n", $msg_table);
mail($email, $add_user_title, $message, "From: <".$from_email.">");
}
print '0';
......
......@@ -108,7 +108,7 @@
<label index="error_dialog_new_member_ok">###USERNAME### was added to the project</label>
<label index="empty_form_btn_label">Clear form</label>
<label index="create_new_user_dialog_msg">To add a user to the project, seek the user using the autocompletion fields or fill the form to create a brand new user. When a new user is created an automatic email is sent within all login information.</label>
<label index="create_new_user_dialog_msg">To add a user to the project, seek the user using the autocompletion fields or fill the form to create a brand new user.</label>
<label index="multi_user_delete">Some users can't access anymore to any project. Delete them from database ?</label>
<label index="single_user_delete">This user has no longer access to any project. Should this user be deleted from the database ?</label>
<label index="confirmation_dialog_title">Confirmation</label>
......@@ -530,7 +530,7 @@
<label index="error_dialog_new_member_ok">###USERNAME### a été ajouté au projet</label>
<label index="empty_form_btn_label">Vider le formulaire</label>
<label index="create_new_user_dialog_msg">Afin d'ajouter un utilisateur au projet, rechercher l'utilisateur à l'aide de l'autocompletion ou remplisser l'ensemble des champs du formulaire afin de créer un nouvel utilisateur. Une fois l'utilisateur créé un mail automatique lui sera envoyer contenant l'ensemble des informations de connexion.</label>
<label index="create_new_user_dialog_msg">Afin d'ajouter un utilisateur au projet, rechercher l'utilisateur à l'aide de l'autocompletion ou remplisser l'ensemble des champs du formulaire afin de créer un nouvel utilisateur.</label>
<label index="multi_user_delete">Les utilisateurs supprimés du projet n'ont plus accès à aucun projet. Les supprimer de la base de données ?</label>
<label index="single_user_delete">L'utilisateur supprimé du projet n'a plus accès à aucun projet. Doit-il être supprimé de la base de données ?</label>
<label index="confirmation_dialog_title">Confirmation</label>
......
......@@ -758,7 +758,7 @@ $(function () {
add_user_html += '<option value="0" selected="selected">'+ $("#right_level_member").val() +'</option>';
add_user_html += '</select></td>';
add_user_html += '</tr><tr>';
add_user_html += '<td colspan="2"><input type="checkbox" checked="checked" name="send_an_email" id="send_an_email"/>' + $("#send_an_email").val() + '</td>';
add_user_html += '<td colspan="2"><input type="checkbox" checked="checked" name="send_email_chk" id="send_email_chk"/>' + $("#send_an_email").val() + '</td>';
add_user_html += '</tr></table></div>';
// dialog code
......@@ -1117,7 +1117,7 @@ $(function () {
val_url += "&create_user_title=" + $("#create_user_title").val();
val_url += "&from_email=" + $("#from_email").val();
val_url += "&project_url=" + escape(location.href);
val_url += "&send_an_email=" + $("#send_an_email").val();
val_url += "&send_an_email=" + ($("#send_email_chk").attr("checked") == "checked");
$.ajax({
url: val_url,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment