Update ivr_menu_edit.php

Fix a problem when adding a new IVR Menu.
This commit is contained in:
FusionPBX 2016-10-02 15:33:17 -06:00 committed by GitHub
parent 186c3e5db8
commit 9bdc6ee758
1 changed files with 15 additions and 6 deletions

View File

@ -52,10 +52,12 @@
if (strlen($_REQUEST["id"]) > 0) {
$action = "update";
$ivr_menu_uuid = check_str($_REQUEST["id"]);
if (strlen($_REQUEST["ivr_menu_uuid"]) > 0) {
$ivr_menu_uuid = $_REQUEST["ivr_menu_uuid"];
}
}
else {
$action = "add";
$ivr_menu_uuid = uuid();
}
//get total ivr menu count from the database, check limit, if defined
@ -123,11 +125,6 @@
//process the http data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get the id
if ($action == "update" && strlen($ivr_menu_uuid) == 0) {
$ivr_menu_uuid = check_str($_POST["ivr_menu_uuid"]);
}
//check for all required data
$msg = '';
if (strlen($ivr_menu_name) == 0) { $msg .= $text['message-required'].$text['label-name']."<br>\n"; }
@ -220,6 +217,18 @@
exit;
}
//add a uuid to ivr_menu_uuid if it is empty
if (strlen($ivr_menu_uuid) == 0) {
$ivr_menu_uuid = uuid();
$_POST["ivr_menu_uuid"] = $ivr_menu_uuid;
}
//add a uuid to dialplan_uuid if it is empty
if (strlen($dialplan_uuid) == 0) {
$dialplan_uuid = uuid();
$_POST["dialplan_uuid"] = $dialplan_uuid;
}
//build the xml dialplan
$dialplan_xml = "<extension name=\"".$ivr_menu_name."\" continue=\"\" uuid=\"".$dialplan_uuid."\">\n";
$dialplan_xml .= " <condition field=\"destination_number\" expression=\"^".$ivr_menu_extension."\">\n";