diff --git a/app/dialplan/dialplan_delete.php b/app/dialplan/dialplan_delete.php index a22d81d9c0..e44e365a6f 100644 --- a/app/dialplan/dialplan_delete.php +++ b/app/dialplan/dialplan_delete.php @@ -52,8 +52,8 @@ else { if (strlen($dialplan_uuid) > 0) { //get the dialplan data $sql = "select * from v_dialplans "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and dialplan_uuid = '$dialplan_uuid' "; + //$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "where dialplan_uuid = '$dialplan_uuid' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); @@ -69,15 +69,15 @@ if (strlen($dialplan_uuid) > 0) { //delete child data $sql = "delete from v_dialplan_details "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and dialplan_uuid = '$dialplan_uuid' "; + //$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "where dialplan_uuid = '$dialplan_uuid'; "; $db->query($sql); unset($sql); //delete parent data $sql = "delete from v_dialplans "; - $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "and dialplan_uuid = '$dialplan_uuid' "; + //$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "where dialplan_uuid = '$dialplan_uuid'; "; $db->query($sql); unset($sql); diff --git a/app/dialplan/dialplan_edit.php b/app/dialplan/dialplan_edit.php index 44759c439b..ef47495600 100644 --- a/app/dialplan/dialplan_edit.php +++ b/app/dialplan/dialplan_edit.php @@ -115,7 +115,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $_POST["dialplan_name"] = $dialplan_name; } } - //array cleanup + //array preparation $x = 0; foreach ($_POST["dialplan_details"] as $row) { //unset the empty row @@ -126,6 +126,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (strlen($row["dialplan_detail_uuid"]) == 0) { unset($_POST["dialplan_details"][$x]["dialplan_detail_uuid"]); } + //set the domain_uuid + if (strlen($row["domain_uuid"]) == 0) { + $_POST["dialplan_details"][$x]["domain_uuid"] = $_SESSION['domain_uuid']; + } //increment the row $x++; } @@ -162,12 +166,11 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //pre-populate the form if (count($_GET)>0 && $_POST["persistformvar"] != "true") { $dialplan_uuid = $_GET["id"]; - $sql = "select * from v_dialplans "; -// $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; - $sql .= "where dialplan_uuid = '$dialplan_uuid' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + $orm = new orm; + $orm->name('dialplans'); + $orm->uuid($dialplan_uuid); + $result = $orm->find()->get(); + //$message = $orm->message; foreach ($result as &$row) { $app_uuid = $row["app_uuid"]; $dialplan_name = $row["dialplan_name"]; @@ -736,13 +739,13 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "