Fix a bug with follow me where disabling it didn't clear the dial string.

This commit is contained in:
Mark Crane
2013-01-17 06:14:31 +00:00
parent 54614de30f
commit ce1c49d909
4 changed files with 14 additions and 56 deletions

View File

@@ -35,7 +35,6 @@ include "root.php";
public $forward_all_destination;
public $forward_all_enabled;
private $dial_string;
private $dial_string_update = false;
public function set() {
//set the global variable
@@ -59,22 +58,14 @@ include "root.php";
if (count($result) > 0) {
foreach ($result as &$row) {
$this->extension = $row["extension"];
if ($this->forward_all_enabled == "false" && $row["forward_all_enabled"] == "true") {
$this->dial_string_update = true;
}
}
}
unset ($prep_statement);
if ($this->forward_all_enabled == "true") {
$this->dial_string_update = true;
}
//update the extension
$sql = "update v_extensions set ";
$sql .= "forward_all_destination = '$this->forward_all_destination', ";
if ($this->dial_string_update) {
$sql .= "dial_string = '".$this->dial_string."', ";
}
$sql .= "dial_string = '".$this->dial_string."', ";
$sql .= "forward_all_enabled = '$this->forward_all_enabled' ";
$sql .= "where domain_uuid = '$this->domain_uuid' ";
$sql .= "and extension_uuid = '$this->extension_uuid' ";
@@ -91,10 +82,6 @@ include "root.php";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
//syncrhonize configuration
if ($this->dial_string_update) {
save_extension_xml();
}
} //function
} //class