Inbound Routes - Add: Integrate new Enabled toggle.

This commit is contained in:
fusionate
2023-06-15 23:44:40 +00:00
parent 09ef6074a7
commit e8cca7bcc6

View File

@@ -61,15 +61,15 @@
$destination = new destinations;
//get the http post values and set them as php variables
if (count($_POST) > 0) {
if (!empty($_POST) && count($_POST) > 0) {
$dialplan_name = $_POST["dialplan_name"];
$caller_id_outbound_prefix = $_POST["caller_id_outbound_prefix"];
$limit = $_POST["limit"];
$public_order = $_POST["public_order"];
$condition_field_1 = $_POST["condition_field_1"];
$condition_expression_1 = $_POST["condition_expression_1"];
$condition_field_2 = $_POST["condition_field_2"];
$condition_expression_2 = $_POST["condition_expression_2"];
$condition_field_1 = $_POST["condition_field_1"] ?? null;
$condition_expression_1 = $_POST["condition_expression_1"] ?? null;
$condition_field_2 = $_POST["condition_field_2"] ?? null;
$condition_expression_2 = $_POST["condition_expression_2"] ?? null;
$destination_uuid = $_POST["destination_uuid"];
$action_1 = $_POST["action_1"];
@@ -78,7 +78,7 @@
$action_application_1 = array_shift($action_1_array);
$action_data_1 = join(':', $action_1_array);
$action_2 = $_POST["action_2"];
$action_2 = $_POST["action_2"] ?? '';
//$action_2 = "transfer:1001 XML default";
$action_2_array = explode(":", $action_2);
$action_application_2 = array_shift($action_2_array);
@@ -105,7 +105,7 @@
$destination_number = $row["destination_number"];
$condition_expression_1 = $row["destination_number"];
$fax_uuid = $row["fax_uuid"];
$destination_carrier = $row["destination_carrier"];
$destination_carrier = $row["destination_carrier"] ?? null;
$destination_accountcode = $row["destination_accountcode"];
}
unset($sql, $parameters, $row);
@@ -122,7 +122,7 @@
$condition_expression_1 = '^('.$condition_expression_1.')$';
}
}
$dialplan_enabled = $_POST["dialplan_enabled"];
$dialplan_enabled = $_POST["dialplan_enabled"] ?? 'false';
$dialplan_description = $_POST["dialplan_description"];
if (empty($dialplan_enabled)) { $dialplan_enabled = "true"; } //set default to enabled
}
@@ -139,6 +139,7 @@
}
//check for all required data
$msg = '';
if (empty($domain_uuid)) { $msg .= "".$text['label-required-domain_uuid']."<br>\n"; }
if (empty($dialplan_name)) { $msg .= "".$text['label-required-dialplan_name']."<br>\n"; }
if (empty($condition_field_1)) { $msg .= "".$text['label-required-condition_field_1']."<br>\n"; }
@@ -739,7 +740,6 @@
echo "<td colspan='4' class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='limit' maxlength='255' value=\"".escape($limit)."\">\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
@@ -751,7 +751,6 @@
echo " <input class='formfld' type='text' name='caller_id_outbound_prefix' maxlength='255' value=\"".escape($limit)."\">\n";
echo "<br />\n";
echo "".$text['description-caller-id-number-prefix']."<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
@@ -773,7 +772,6 @@
}
echo " </select>\n";
echo " <br />\n";
echo " \n";
echo "</td>\n";
echo "</tr>\n";
@@ -781,23 +779,20 @@
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " ".$text['label-enabled']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='dialplan_enabled'>\n";
if (!empty($dialplan_enabled) && $dialplan_enabled == "true") {
echo " <option value='true' SELECTED >".$text['label-true']."</option>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='dialplan_enabled' name='dialplan_enabled' value='true' ".(!empty($dialplan_enabled) && $dialplan_enabled == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
echo " <select class='formfld' id='dialplan_enabled' name='dialplan_enabled'>\n";
echo " <option value='true' ".($dialplan_enabled == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($dialplan_enabled == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
}
if (!empty($dialplan_enabled) && $dialplan_enabled == "false") {
echo " <option value='false' SELECTED >".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
@@ -808,7 +803,6 @@
echo "<td colspan='4' class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='dialplan_description' maxlength='255' value=\"".escape($dialplan_description)."\">\n";
echo "<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
@@ -825,4 +819,4 @@
//include the footer
require_once "resources/footer.php";
?>
?>