From a3aeeb3b63272562014766a7c85c73aba0497eb0 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Thu, 7 Aug 2014 16:11:10 +0000 Subject: [PATCH] Fix duplication of some of the dialplan details. --- app/destinations/destination_edit.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index eb4c9521a3..8e91b51d79 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -324,9 +324,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $actions = explode(":", $row["dialplan_detail_data"]); $dialplan_detail_type = array_shift($actions); $dialplan_detail_data = join(':', $actions); - if (isset($row["dialplan_detail_uuid"])) { - $dialplan["dialplan_details"][$y]["dialplan_detail_uuid"] = $row["dialplan_detail_uuid"]; - } + $dialplan["dialplan_details"][$y]["domain_uuid"] = $_SESSION['domain_uuid']; $dialplan["dialplan_details"][$y]["dialplan_detail_tag"] = "action"; $dialplan["dialplan_details"][$y]["dialplan_detail_type"] = $dialplan_detail_type; @@ -336,7 +334,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $y++; } } - + + //delete the previous details + if(strlen($row["dialplan_detail_uuid"]) > 0){ + $sql = "delete from v_dialplan_details "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and dialplan_uuid = '".$row["dialplan_detail_uuid"]."' "; + $db->exec(check_sql($sql)); + unset($sql); + } + //save the dialplan $orm = new orm; $orm->name('dialplans');