diff --git a/app/contacts/contact_edit.php b/app/contacts/contact_edit.php index 5aa21cad3d..8f8155f990 100644 --- a/app/contacts/contact_edit.php +++ b/app/contacts/contact_edit.php @@ -63,7 +63,7 @@ else { } //get http post variables and set them to php variables - if (count($_POST)>0) { + if (count($_POST) > 0) { $contact_type = check_str($_POST["contact_type"]); $contact_organization = check_str($_POST["contact_organization"]); $contact_name_prefix = check_str($_POST["contact_name_prefix"]); @@ -272,9 +272,29 @@ else { $contact_time_zone = $row["contact_time_zone"]; $contact_note = $row["contact_note"]; } - unset ($prep_statement); + unset ($prep_statement, $sql); } +//get the users array + $sql = "SELECT * FROM v_users "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "order by username asc "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $users = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset($prep_statement, $sql); + +//get the users assigned to this contact + $sql = "SELECT * FROM v_contact_users as u, v_contact_users as c "; + $sql .= "where u.user_uuid = c.user_uuid "; + $sql .= "and m.domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and m.contact_uuid = '".$contact_uuid."' "; + $sql .= "order by u.username asc "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $contact_users = $prep_statement->fetchAll(PDO::FETCH_NAMED); + unset($prep_statement, $sql); + //show the header require_once "resources/header.php"; if ($action == "update") { @@ -284,7 +304,7 @@ else { $document['title'] = $text['title-contact-add']; } -// qr code generation +//qr code generation $_GET['type'] = "text"; $qr_vcard = true; include "contacts_vcard.php"; @@ -620,6 +640,39 @@ else { echo "\n"; echo ""; + if (if_group("superadmin") || if_group("admin")) { + echo " "; + echo " ".$text['label-users'].""; + echo " "; + if ($action == "update") { + echo " \n"; + foreach($contact_users as $field) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + } + echo "
".$field['username']."\n"; + echo " $v_link_label_delete\n"; + echo "
\n"; + } + echo "
\n"; + echo " "; + if ($action == "update") { + echo " \n"; + } + unset($users); + echo "
\n"; + echo " ".$text['description-users']."\n"; + echo " "; + echo " "; + } + if (permission_exists('contact_group_view')) { echo "
\n"; echo "\n";