Calls: Added ability to unset the caller id on Follow Me and Call Forwarding.

This commit is contained in:
Nate Jones 2015-03-18 14:36:12 +00:00
parent 60bca06375
commit 4e5c96c9d1
2 changed files with 16 additions and 10 deletions

View File

@ -371,7 +371,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "forward_busy_enabled = '".$forward_busy_enabled."', "; $sql .= "forward_busy_enabled = '".$forward_busy_enabled."', ";
$sql .= "forward_no_answer_destination = '".$forward_no_answer_destination."', "; $sql .= "forward_no_answer_destination = '".$forward_no_answer_destination."', ";
$sql .= "forward_no_answer_enabled = '".$forward_no_answer_enabled."', "; $sql .= "forward_no_answer_enabled = '".$forward_no_answer_enabled."', ";
$sql .= "forward_caller_id_uuid = '".$forward_caller_id_uuid."' "; $sql .= "forward_caller_id_uuid = ".(($forward_caller_id_uuid != '') ? "'".$forward_caller_id_uuid."' " : "null ");
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and extension_uuid = '".$extension_uuid."'"; $sql .= "and extension_uuid = '".$extension_uuid."'";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
@ -534,8 +534,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$result_forward = $prep_statement_forward->fetchAll(PDO::FETCH_ASSOC); $result_forward = $prep_statement_forward->fetchAll(PDO::FETCH_ASSOC);
if (count($result_forward) > 0) { if (count($result_forward) > 0) {
echo "<select name='forward_caller_id_uuid' id='forward_caller_id_uuid' class='formfld' >\n"; echo "<select name='forward_caller_id_uuid' id='forward_caller_id_uuid' class='formfld' >\n";
echo " <option>".$text['label-select-cid-number']."</option>\n"; echo " <option value=''>".$text['label-select-cid-number']."</option>\n";
echo " <option disabled='disabled'></option>\n"; echo " <option value='' disabled='disabled'></option>\n";
foreach ($result_forward as &$row_forward) { foreach ($result_forward as &$row_forward) {
$selected = $row_forward["destination_uuid"] == $forward_caller_id_uuid ? "selected='selected' " : ''; $selected = $row_forward["destination_uuid"] == $forward_caller_id_uuid ? "selected='selected' " : '';
echo "<option value='".$row_forward["destination_uuid"]."' ".$selected.">".format_phone($row_forward["destination_number"])." : ".$row_forward["destination_description"]."</option>\n"; echo "<option value='".$row_forward["destination_uuid"]."' ".$selected.">".format_phone($row_forward["destination_number"])." : ".$row_forward["destination_description"]."</option>\n";
@ -601,8 +601,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$result_follow_me = $prep_statement_follow_me->fetchAll(PDO::FETCH_ASSOC); $result_follow_me = $prep_statement_follow_me->fetchAll(PDO::FETCH_ASSOC);
if (count($result_follow_me) > 0) { if (count($result_follow_me) > 0) {
echo "<select name='follow_me_caller_id_uuid' id='follow_me_caller_id_uuid' class='formfld' >\n"; echo "<select name='follow_me_caller_id_uuid' id='follow_me_caller_id_uuid' class='formfld' >\n";
echo " <option>".$text['label-select-cid-number']."</option>\n"; echo " <option value=''>".$text['label-select-cid-number']."</option>\n";
echo " <option disabled='disabled'></option>\n"; echo " <option value='' disabled='disabled'></option>\n";
foreach ($result_follow_me as &$row_follow_me) { foreach ($result_follow_me as &$row_follow_me) {
$selected = $row_follow_me["destination_uuid"] == $follow_me_caller_id_uuid ? "selected='selected'" : ''; $selected = $row_follow_me["destination_uuid"] == $follow_me_caller_id_uuid ? "selected='selected'" : '';
echo "<option value='".$row_follow_me["destination_uuid"]."' ".$selected.">".format_phone($row_follow_me["destination_number"])." : ".$row_follow_me["destination_description"]."</option>\n"; echo "<option value='".$row_follow_me["destination_uuid"]."' ".$selected.">".format_phone($row_follow_me["destination_number"])." : ".$row_follow_me["destination_description"]."</option>\n";

View File

@ -86,9 +86,7 @@ include "root.php";
if (strlen($this->cid_number_prefix) > 0) { if (strlen($this->cid_number_prefix) > 0) {
$sql .= "cid_number_prefix, "; $sql .= "cid_number_prefix, ";
} }
if (strlen($this->follow_me_caller_id_uuid) > 0) { $sql .= "follow_me_caller_id_uuid, ";
$sql .= "follow_me_caller_id_uuid, ";
}
$sql .= "follow_me_enabled "; $sql .= "follow_me_enabled ";
$sql .= ")"; $sql .= ")";
$sql .= "values "; $sql .= "values ";
@ -102,6 +100,9 @@ include "root.php";
if (strlen($this->follow_me_caller_id_uuid) > 0) { if (strlen($this->follow_me_caller_id_uuid) > 0) {
$sql .= "'$this->follow_me_caller_id_uuid', "; $sql .= "'$this->follow_me_caller_id_uuid', ";
} }
else {
$sql .= 'null, ';
}
$sql .= "'$this->follow_me_enabled' "; $sql .= "'$this->follow_me_enabled' ";
$sql .= ")"; $sql .= ")";
if ($v_debug) { if ($v_debug) {
@ -119,7 +120,12 @@ include "root.php";
$sql = "update v_follow_me set "; $sql = "update v_follow_me set ";
$sql .= "follow_me_enabled = '$this->follow_me_enabled', "; $sql .= "follow_me_enabled = '$this->follow_me_enabled', ";
$sql .= "cid_name_prefix = '$this->cid_name_prefix', "; $sql .= "cid_name_prefix = '$this->cid_name_prefix', ";
$sql .= "follow_me_caller_id_uuid = '$this->follow_me_caller_id_uuid', "; if (strlen($this->follow_me_caller_id_uuid) > 0) {
$sql .= "follow_me_caller_id_uuid = '$this->follow_me_caller_id_uuid', ";
}
else {
$sql .= "follow_me_caller_id_uuid = null, ";
}
$sql .= "cid_number_prefix = '$this->cid_number_prefix' "; $sql .= "cid_number_prefix = '$this->cid_number_prefix' ";
$sql .= "where domain_uuid = '$this->domain_uuid' "; $sql .= "where domain_uuid = '$this->domain_uuid' ";
$sql .= "and follow_me_uuid = '$this->follow_me_uuid' "; $sql .= "and follow_me_uuid = '$this->follow_me_uuid' ";
@ -336,7 +342,7 @@ include "root.php";
$dial_string_caller_id_number = "\${caller_id_number}"; $dial_string_caller_id_number = "\${caller_id_number}";
if (strlen($this->follow_me_caller_id_uuid) > 0){ if (strlen($this->follow_me_caller_id_uuid) > 0){
$sql_caller = "select destination_number, destination_description from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->follow_me_caller_id_uuid'"; $sql_caller = "select destination_number, destination_description from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->follow_me_caller_id_uuid'";
$prep_statement_caller = $db->prepare($sql_caller); $prep_statement_caller = $db->prepare($sql_caller);
if ($prep_statement_caller) { if ($prep_statement_caller) {
$prep_statement_caller->execute(); $prep_statement_caller->execute();