diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index 55060bf939..1fa0d04b57 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -104,26 +104,16 @@ $destination_type_fax = $_POST["destination_type_fax"]; $destination_type_text = $_POST["destination_type_text"]; $destination_carrier = trim($_POST["destination_carrier"]); - //convert the number to a regular expression - $destination_number_regex = string_to_regex($destination_number, $destination_prefix); - $_POST["destination_number_regex"] = $destination_number_regex; + //get the destination app and data $destination_array = explode(":", $_POST["destination_action"], 2); $destination_app = $destination_array[0]; $destination_data = $destination_array[1]; - unset($_POST["destination_action"]); + //get the alternate destination app and data $destination_alternate_array = explode(":", $_POST["destination_alternate_action"], 2); $destination_alternate_app = $destination_alternate_array[0]; $destination_alternate_data = $destination_alternate_array[1]; - unset($_POST["destination_alternate_action"]); - //set the application and data - $_POST["destination_app"] = $destination_app; - $_POST["destination_data"] = $destination_data; - $_POST["destination_alternate_app"] = $destination_alternate_app; - $_POST["destination_alternate_data"] = $destination_alternate_data; - //unset the db_destination_number - unset($_POST["db_destination_number"]); } //process the http post @@ -229,6 +219,7 @@ if (is_array($row) && @sizeof($row) != 0) { if (!permission_exists('destination_number')) { $destination_number = $row["destination_number"]; + $destination_prefix = $row["destination_prefix"]; } if (!permission_exists('destination_context')) { $destination_context = $row["destination_context"]; @@ -237,6 +228,9 @@ unset($sql, $parameters, $row); } + //convert the number to a regular expression + $destination_number_regex = string_to_regex($destination_number, $destination_prefix); + //if empty then get new uuid if (!is_uuid($dialplan_uuid)) { $dialplan_uuid = uuid(); @@ -412,7 +406,7 @@ } //add fax detection - if (strlen($fax_uuid) > 0) { + if (is_uuid($fax_uuid)) { //add set tone detect_hits=1 $dialplan["dialplan_details"][$y]["domain_uuid"] = $domain_uuid; @@ -589,9 +583,6 @@ $database->execute($sql, $parameters); unset($sql, $parameters); } - - //remove empty dialplan details from the POST array - unset($_POST["dialplan_details"]); } //build the destination array @@ -600,9 +591,11 @@ $destination["dialplan_uuid"] = $dialplan_uuid; $destination["fax_uuid"] = $fax_uuid; $destination["destination_type"] = $destination_type; - $destination["destination_number"] = $destination_number; - $destination["destination_number_regex"] = $destination_number_regex; - $destination["destination_prefix"] = $destination_prefix; + if (permission_exists('destination_number')) { + $destination["destination_number"] = $destination_number; + $destination["destination_number_regex"] = $destination_number_regex; + $destination["destination_prefix"] = $destination_prefix; + } $destination["destination_caller_id_name"] = $destination_caller_id_name; $destination["destination_caller_id_number"] = $destination_caller_id_number; $destination["destination_cid_name_prefix"] = $destination_cid_name_prefix; @@ -904,16 +897,18 @@ echo "\n"; echo "\n"; - echo "\n"; - echo "\n"; - echo " ".$text['label-destination_prefix']."\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "
\n"; - echo $text['description-destination_prefix']."\n"; - echo "\n"; - echo "\n"; + if (permission_exists('destination_number')) { + echo "\n"; + echo "\n"; + echo " ".$text['label-destination_prefix']."\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['description-destination_prefix']."\n"; + echo "\n"; + echo "\n"; + } echo "\n"; echo "\n";