When the Destination (DID) is deleted then remove the inbound route dialplan
This commit is contained in:
@@ -40,20 +40,50 @@ else {
|
|||||||
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
$text[$key] = $value[$_SESSION['domain']['language']['code']];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//get the ID
|
||||||
if (count($_GET) > 0) {
|
if (count($_GET) > 0) {
|
||||||
$id = check_str($_GET["id"]);
|
$id = check_str($_GET["id"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete the destination
|
//if no id then exit
|
||||||
if (strlen($id) > 0) {
|
if (isset($id)) {
|
||||||
$sql = "delete from v_destinations ";
|
echo "ID is required."
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
//get the dialplan_uuid
|
||||||
|
$orm = new orm;
|
||||||
|
$orm->name('destinations');
|
||||||
|
$orm->uuid($id);
|
||||||
|
$result = $orm->find()->get();
|
||||||
|
foreach ($result as &$row) {
|
||||||
|
$dialplan_uuid = $row["dialplan_uuid"];
|
||||||
|
}
|
||||||
|
unset ($prep_statement);
|
||||||
|
|
||||||
|
//delete the dialplan
|
||||||
|
if (isset($dialplan_uuid)) {
|
||||||
|
$sql = "delete from v_dialplan_details ";
|
||||||
$sql .= "where domain_uuid = '$domain_uuid' ";
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||||
$sql .= "and destination_uuid = '$id' ";
|
$sql .= "and dialplan_uuid = '$id' ";
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$db->exec(check_sql($sql));
|
||||||
$prep_statement->execute();
|
unset($sql);
|
||||||
|
|
||||||
|
$sql = "delete from v_dialplan ";
|
||||||
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||||
|
$sql .= "and dialplan_uuid = '$id' ";
|
||||||
|
$db->exec(check_sql($sql));
|
||||||
unset($sql);
|
unset($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//delete the destination
|
||||||
|
$sql = "delete from v_destinations ";
|
||||||
|
$sql .= "where domain_uuid = '$domain_uuid' ";
|
||||||
|
$sql .= "and destination_uuid = '$id' ";
|
||||||
|
$db->exec(check_sql($sql));
|
||||||
|
unset($sql);
|
||||||
|
|
||||||
|
//redirect the user
|
||||||
$_SESSION["message"] = $text['message-delete'];
|
$_SESSION["message"] = $text['message-delete'];
|
||||||
header("Location: destinations.php");
|
header("Location: destinations.php");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user