Add domain_uuid to the dialplan_detail array.

This commit is contained in:
Mark Crane 2014-02-06 10:13:57 +00:00
parent 6db8a2c8f1
commit b7dc9d39ac
2 changed files with 18 additions and 15 deletions

View File

@ -52,8 +52,8 @@ else {
if (strlen($dialplan_uuid) > 0) { if (strlen($dialplan_uuid) > 0) {
//get the dialplan data //get the dialplan data
$sql = "select * from v_dialplans "; $sql = "select * from v_dialplans ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; //$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' "; $sql .= "where dialplan_uuid = '$dialplan_uuid' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
@ -69,15 +69,15 @@ if (strlen($dialplan_uuid) > 0) {
//delete child data //delete child data
$sql = "delete from v_dialplan_details "; $sql = "delete from v_dialplan_details ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; //$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' "; $sql .= "where dialplan_uuid = '$dialplan_uuid'; ";
$db->query($sql); $db->query($sql);
unset($sql); unset($sql);
//delete parent data //delete parent data
$sql = "delete from v_dialplans "; $sql = "delete from v_dialplans ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; //$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' "; $sql .= "where dialplan_uuid = '$dialplan_uuid'; ";
$db->query($sql); $db->query($sql);
unset($sql); unset($sql);

View File

@ -115,7 +115,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$_POST["dialplan_name"] = $dialplan_name; $_POST["dialplan_name"] = $dialplan_name;
} }
} }
//array cleanup //array preparation
$x = 0; $x = 0;
foreach ($_POST["dialplan_details"] as $row) { foreach ($_POST["dialplan_details"] as $row) {
//unset the empty row //unset the empty row
@ -126,6 +126,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (strlen($row["dialplan_detail_uuid"]) == 0) { if (strlen($row["dialplan_detail_uuid"]) == 0) {
unset($_POST["dialplan_details"][$x]["dialplan_detail_uuid"]); 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 //increment the row
$x++; $x++;
} }
@ -162,12 +166,11 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") { if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
$dialplan_uuid = $_GET["id"]; $dialplan_uuid = $_GET["id"];
$sql = "select * from v_dialplans "; $orm = new orm;
// $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $orm->name('dialplans');
$sql .= "where dialplan_uuid = '$dialplan_uuid' "; $orm->uuid($dialplan_uuid);
$prep_statement = $db->prepare(check_sql($sql)); $result = $orm->find()->get();
$prep_statement->execute(); //$message = $orm->message;
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) { foreach ($result as &$row) {
$app_uuid = $row["app_uuid"]; $app_uuid = $row["app_uuid"];
$dialplan_name = $row["dialplan_name"]; $dialplan_name = $row["dialplan_name"];
@ -736,13 +739,13 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <select class='formfld' name='dialplan_enabled'>\n"; echo " <select class='formfld' name='dialplan_enabled'>\n";
echo " <option value=''></option>\n"; echo " <option value=''></option>\n";
if ($dialplan_enabled == "true") { if ($dialplan_enabled == "true") {
echo " <option value='true' SELECTED >".$text['option-true']."</option>\n"; echo " <option value='true' selected='selected'>".$text['option-true']."</option>\n";
} }
else { else {
echo " <option value='true'>".$text['option-true']."</option>\n"; echo " <option value='true'>".$text['option-true']."</option>\n";
} }
if ($dialplan_enabled == "false") { if ($dialplan_enabled == "false") {
echo " <option value='false' SELECTED >".$text['option-false']."</option>\n"; echo " <option value='false' selected='selected'>".$text['option-false']."</option>\n";
} }
else { else {
echo " <option value='false'>".$text['option-false']."</option>\n"; echo " <option value='false'>".$text['option-false']."</option>\n";