If updating the voicemail password from hot desking update password in the voicemail table. Update a few of the comments.

This commit is contained in:
Mark Crane 2013-09-28 20:06:11 +00:00
parent 20a20c104e
commit 0ab4dfe1c1
2 changed files with 30 additions and 27 deletions

View File

@ -44,7 +44,7 @@ if (count($_GET)>0) {
$id = check_str($_GET["id"]);
}
//delete the extension
//delete the hot desking information
if (strlen($id)>0) {
$sql = "update v_extensions set ";
$sql .= "unique_id = null, ";
@ -59,7 +59,7 @@ if (count($_GET)>0) {
}
//get the extension
$sql = "select * from v_extensions ";
$sql = "select extension from v_extensions ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));

View File

@ -106,31 +106,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//update the extension
if ($action == "add" && permission_exists('extension_edit')) {
$sql = "update v_extensions set ";
$sql .= "unique_id = '$unique_id' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$extension_uuid'";
$db->exec(check_sql($sql));
unset($sql);
}
//update the extension
if ($action == "update" && permission_exists('extension_edit')) {
$sql = "update v_extensions set ";
$sql .= "unique_id = '$unique_id', ";
if (strlen($vm_password) > 0) {
$sql .= "vm_password = '$vm_password' ";
}
else {
$sql .= "vm_password = 'user-choose' ";
}
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$extension_uuid'";
$db->exec(check_sql($sql));
unset($sql);
}
//get the extension
$sql = "select * from v_extensions ";
@ -141,9 +116,37 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$extension = $row["extension"];
$number_alias = $row["number_alias"];
}
unset ($prep_statement);
//update the extension and voicemail
if ($action == "update" && permission_exists('extension_edit')) {
//update the extension
$sql = "update v_extensions set ";
$sql .= "unique_id = '$unique_id', ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$extension_uuid'";
$db->exec(check_sql($sql));
unset($sql);
//update the voicemail
if (strlen($vm_password) > 0) {
$sql = "update v_voicemails set ";
$sql .= "unique_id = '$unique_id', ";
$sql .= "voicemail_password = '$vm_password' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (is_numeric($extension)) {
$sql .= "and voicemail_id = '$extension'";
}
else {
$sql .= "and voicemail_id = '$number_alias'";
}
$db->exec(check_sql($sql));
unset($sql);
}
}
//delete extension from memcache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {