From e8cca7bcc66de6a622a8749f2499d4e152cffe87 Mon Sep 17 00:00:00 2001 From: fusionate Date: Thu, 15 Jun 2023 23:44:40 +0000 Subject: [PATCH] Inbound Routes - Add: Integrate new Enabled toggle. --- app/dialplan_inbound/dialplan_inbound_add.php | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/app/dialplan_inbound/dialplan_inbound_add.php b/app/dialplan_inbound/dialplan_inbound_add.php index d9e2d2f20b..60ae2b55e0 100644 --- a/app/dialplan_inbound/dialplan_inbound_add.php +++ b/app/dialplan_inbound/dialplan_inbound_add.php @@ -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']."
\n"; } if (empty($dialplan_name)) { $msg .= "".$text['label-required-dialplan_name']."
\n"; } if (empty($condition_field_1)) { $msg .= "".$text['label-required-condition_field_1']."
\n"; } @@ -739,7 +740,6 @@ echo "\n"; echo " \n"; echo "
\n"; - echo "\n"; echo "\n"; echo "\n"; @@ -751,7 +751,6 @@ echo " \n"; echo "
\n"; echo "".$text['description-caller-id-number-prefix']."
\n"; - echo "\n"; echo "\n"; echo "\n"; @@ -773,7 +772,6 @@ } echo " \n"; echo "
\n"; - echo " \n"; echo "\n"; echo "\n"; @@ -781,23 +779,20 @@ echo "\n"; echo " ".$text['label-enabled']."\n"; echo "\n"; - echo "\n"; - echo " \n"; + echo " \n"; + echo " \n"; } else { - echo " \n"; + echo " \n"; } - if (!empty($dialplan_enabled) && $dialplan_enabled == "false") { - echo " \n"; - } - else { - echo " \n"; - } - echo " \n"; echo "
\n"; - echo "\n"; echo "\n"; echo "\n"; @@ -808,7 +803,6 @@ echo "\n"; echo " \n"; echo "
\n"; - echo "\n"; echo "\n"; echo "\n"; @@ -825,4 +819,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file