Update destination_edit.php

This commit is contained in:
FusionPBX 2018-02-16 21:28:38 -07:00 committed by GitHub
parent 1cc38d6ea9
commit 1e1e3c816f
1 changed files with 414 additions and 396 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2017
Portions created by the Initial Developer are Copyright (C) 2008-2018
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -82,6 +82,7 @@
//get http post variables and set them to php variables
if (count($_POST) > 0) {
//set the variables
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
$domain_uuid = check_str($_POST["domain_uuid"]);
@ -167,14 +168,8 @@
return;
}
//determine whether save the dialplan
foreach ($_POST["dialplan_details"] as $row) {
if (strlen($row["dialplan_detail_data"]) > 0) {
$add_dialplan = true;
break;
}
}
//save the inbound destination and add the dialplan for the inbound route
if ($destination_type == 'inbound') {
//get the array
$dialplan_details = $_POST["dialplan_details"];
@ -218,9 +213,7 @@
$dialplan_uuid = uuid();
}
//build the destination array
$destination = $_POST;
$destination["destination_uuid"] = $destination_uuid;
//set the dialplan_uuid
$destination["dialplan_uuid"] = $dialplan_uuid;
//build the dialplan array
@ -528,6 +521,10 @@
}
}
//build the destination array
$destination = $_POST;
$destination["destination_uuid"] = $destination_uuid;
//prepare the array
$array['destinations'][] = $destination;
$array['dialplans'][] = $dialplan;
@ -542,7 +539,7 @@
//save the dialplan
$database = new database;
$database->app_name = 'dialplans';
$database->app_name = 'destinations';
$database->app_uuid = '5ec89622-b19c-3559-64f0-afde802ab139';
if (isset($dialplan["dialplan_uuid"])) {
$database->uuid($dialplan["dialplan_uuid"]);
@ -570,6 +567,27 @@
$cache = new cache;
$cache->delete("dialplan:".$destination_context);
$cache->delete("dialplan:".$destination_context.":".$destination_number);
}
//save the outbound destination
if ($destination_type == 'outbound') {
//prepare the array
$array['destinations'][0]["destination_uuid"] = $destination_uuid;
$array['destinations'][0]["domain_uuid"] = $_POST["domain_uuid"];
$array['destinations'][0]["destination_type"] = $_POST["destination_type"];
$array['destinations'][0]["destination_number"] = $_POST["destination_number"];
$array['destinations'][0]["destination_context"] = $_POST["destination_context"];
$array['destinations'][0]["destination_enabled"] = $_POST["destination_enabled"];
$array['destinations'][0]["destination_description"] = $_POST["destination_description"];
//save the destination
$database = new database;
$database->app_name = 'destinations';
$database->app_uuid = '5ec89622-b19c-3559-64f0-afde802ab139';
$database->save($array);
$dialplan_response = $database->message;
}
//redirect the user
if ($action == "add") {
@ -907,7 +925,7 @@
echo "</td>\n";
echo "</tr>\n";
if (permission_exists('destination_record')) {
if ($destination_type == 'inbound' && permission_exists('destination_record')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>".$text['label-destination_record']."</td>\n";
echo "<td class='vtable' align='left'>\n";