diff --git a/app/contacts/app_languages.php b/app/contacts/app_languages.php index ebced4445b..ca7a35d77c 100644 --- a/app/contacts/app_languages.php +++ b/app/contacts/app_languages.php @@ -183,15 +183,35 @@ $text['description-contact_note']['pt-pt'] = "Introduza uma nota."; $text['description-contact_note']['fr-fr'] = ""; + $text['label-shared']['en-us'] = "Shared"; + $text['label-shared']['es-cl'] = "Compartido"; + $text['label-shared']['pt-pt'] = "Partilhada"; + $text['label-shared']['fr-fr'] = "Commun"; + + $text['description-shared']['en-us'] = "Share this contact with other users on the domain."; + $text['description-shared']['es-cl'] = "Comparte este contacto con otros usuarios en el dominio."; + $text['description-shared']['pt-pt'] = "Compartilhe esse contato com outros usuários do domínio."; + $text['description-shared']['fr-fr'] = "Partager ce contact avec d'autres utilisateurs sur le domaine."; + + $text['option-true']['en-us'] = "True"; + $text['option-true']['es-cl'] = "Verdadero"; + $text['option-true']['pt-pt'] = "Sim"; + $text['option-true']['fr-fr'] = "Oui"; + + $text['option-false']['en-us'] = "False"; + $text['option-false']['es-cl'] = "Falso"; + $text['option-false']['pt-pt'] = "Não"; + $text['option-false']['fr-fr'] = "Non"; + $text['label-groups']['en-us'] = "Groups"; $text['label-groups']['es-cl'] = "Grupos"; $text['label-groups']['pt-pt'] = "Grupos"; $text['label-groups']['fr-fr'] = "Groupes"; - $text['description-groups']['en-us'] = "Contacts assigned to a Group will be visible to all Users in the Group."; - $text['description-groups']['es-cl'] = "Contactos asignados a un grupo serán visibles por todos los usuarios del grupo."; - $text['description-groups']['pt-pt'] = "Contatos atribuídos a um grupo será visível por todos os usuários do grupo."; - $text['description-groups']['fr-fr'] = "Contacts affectés à un groupe seront visibles par tous les utilisateurs du groupe."; + $text['description-groups']['en-us'] = "Contacts assigned to a group are only visible to users in the group. Contacts not assigned to a group will be visible to all users in the domain."; + $text['description-groups']['es-cl'] = "Contactos asignados a un grupo sólo son visibles para los usuarios del grupo. Los contactos no asignados a un grupo serán visibles para todos los usuarios del dominio."; + $text['description-groups']['pt-pt'] = "Contatos atribuídos a um grupo só são visíveis para os usuários do grupo. Contatos não atribuídos a um grupo será visível para todos os usuários no domínio."; + $text['description-groups']['fr-fr'] = "Contacts affectés à un groupe ne sont accessibles qu'aux utilisateurs du groupe. Contacts ne sont pas affectés à un groupe seront visibles à tous les utilisateurs dans le domaine."; $text['button-qr_code']['en-us'] = "QR Code"; $text['button-qr_code']['es-cl'] = "Código QR"; diff --git a/app/contacts/contact_edit.php b/app/contacts/contact_edit.php index 9b88415d35..70db4cb2ca 100644 --- a/app/contacts/contact_edit.php +++ b/app/contacts/contact_edit.php @@ -158,9 +158,30 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $location = "contacts.php"; } //if ($action == "add") - //handle insertion of contact group - if ($_POST['group_uuid'] != '') { - $group_uuid = $_POST["group_uuid"]; + //if contact is shared, remove contact group record containing user's uuid + if ($_POST['contact_shared'] == 'true') { + $sql = "delete from v_contact_groups "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $sql .= "and group_uuid = '".$_SESSION['groups'][0]['user_uuid']."' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($prep_statement, $sql); + $group_uuid = $_POST['group_uuid']; + } + //if private contact, delete any groups currently assigned, set group uuid to user's uuid + else { + $sql = "delete from v_contact_groups "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and contact_uuid = '".$contact_uuid."' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($prep_statement, $sql); + $group_uuid = $_SESSION['groups'][0]['user_uuid']; + } + + //handle insertion of contact group (or private contact, if not shared) + if ($group_uuid != '') { $sql = "insert into v_contact_groups "; $sql .= "( "; $sql .= "contact_group_uuid, "; @@ -586,11 +607,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; - //echo "
| ".$text['label-groups'].": | "; + echo ""; $sql = "select "; $sql .= "g.*, "; $sql .= "cg.contact_group_uuid "; @@ -618,6 +666,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "and g.domain_uuid = '".$domain_uuid."' "; $sql .= "and cg.domain_uuid = '".$domain_uuid."' "; $sql .= "and cg.contact_uuid = '".$contact_uuid."' "; + $sql .= "and cg.group_uuid <> '".$_SESSION['groups'][0]['user_uuid']."' "; $sql .= "order by g.group_name asc "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); @@ -631,7 +680,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo " | ".$field['group_name']." | \n"; echo "\n"; if (permission_exists('contact_group_delete') || if_group("superadmin")) { - echo " $v_link_label_delete\n"; + echo " $v_link_label_delete\n"; } echo " | \n"; echo "
| \n"; + echo " | \n"; echo " ".$text['label-contact_note'].":\n"; echo " | \n"; - echo "\n"; + echo " | \n";
echo " \n";
echo " \n"; echo $text['description-contact_note']."\n"; diff --git a/app/contacts/contacts.php b/app/contacts/contacts.php index bb97c075e1..6e702773b8 100644 --- a/app/contacts/contacts.php +++ b/app/contacts/contacts.php @@ -54,21 +54,15 @@ require_once "resources/paging.php"; $order = check_str($_GET["order"]); //show the content - echo " ";
- echo " ";
- echo "
"; //include the footer require_once "resources/footer.php"; diff --git a/core/users/signup.php b/core/users/signup.php index 8f2fa7c6bf..054538ecfa 100644 --- a/core/users/signup.php +++ b/core/users/signup.php @@ -44,12 +44,17 @@ else { $username = check_str($_POST["username"]); $password = check_str($_POST["password"]); $confirmpassword = check_str($_POST["confirmpassword"]); -$group_name = check_str($_POST["group_name"]); +$group_uuid_name = check_str($_POST["group_uuid_name"]); $user_email = check_str($_POST["user_email"]); $contact_organization = check_str($_POST["contact_organization"]); $contact_name_given = check_str($_POST["contact_name_given"]); $contact_name_family = check_str($_POST["contact_name_family"]); +if ($group_uuid_name != '') { + $group_data = explode('|', $group_uuid_name); + $group_uuid = $group_data[0]; + $group_name = $group_data[1]; +} if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") { @@ -140,13 +145,14 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") { unset($sql); //add the user to the group - if (strlen($group_name) > 0) { + if (strlen($group_uuid) > 0) { if ( ($group_name == "superadmin" && if_group("superadmin")) || $group_name != "superadmin") { $sql = "insert into v_group_users "; $sql .= "( "; $sql .= "group_user_uuid, "; $sql .= "domain_uuid, "; $sql .= "group_name, "; + $sql .= "group_uuid, "; $sql .= "user_uuid "; $sql .= ") "; $sql .= "values "; @@ -154,6 +160,7 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") { $sql .= "'".$group_user_uuid."', "; $sql .= "'".$domain_uuid."', "; $sql .= "'".$group_name."', "; + $sql .= "'".$group_uuid."', "; $sql .= "'".$user_uuid."' "; $sql .= ")"; $db->exec(check_sql($sql)); @@ -275,14 +282,13 @@ if (count($_POST)>0 && check_str($_POST["persistform"]) != "1") { $sql .= "order by group_name asc "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); - echo " |