diff --git a/app/destinations/destination_edit.php b/app/destinations/destination_edit.php index 2a2bf30703..6c700c55b3 100644 --- a/app/destinations/destination_edit.php +++ b/app/destinations/destination_edit.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2008-2016 + Portions created by the Initial Developer are Copyright (C) 2008-2017 the Initial Developer. All Rights Reserved. Contributor(s): @@ -114,6 +114,9 @@ $_POST["destination_uuid"] = $destination_uuid; } + //set the default context + if ($destination_type =="outbound" && strlen($destination_context) == 0) { $destination_context = $_SESSION['domain_name']; } + //check for all required data $msg = ''; if (strlen($destination_type) == 0) { $msg .= $text['message-required']." ".$text['label-destination_type']."
\n"; } @@ -274,7 +277,7 @@ //delete previous fax detection settings $sql = "delete from v_dialplan_details "; - $sql .= "where domain_uuid = '".$domain_uuid."' "; + $sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) "; $sql .= "and dialplan_uuid = '".$dialplan_uuid."' "; $sql .= "and ("; $sql .= " dialplan_detail_data like '%tone_detect%' "; @@ -351,7 +354,7 @@ $sql = "delete from v_dialplan_details "; $sql .= "where dialplan_uuid = '".$dialplan_uuid."' "; if (!permission_exists('destination_domain')) { - $sql .= "and domain_uuid = '".$domain_uuid."' "; + $sql .= "where (domain_uuid = '".$domain_uuid."' or domain_uuid is null) "; } //echo $sql."

"; $db->exec(check_sql($sql)); @@ -502,6 +505,8 @@ //set the defaults if (strlen($destination_type) == 0) { $destination_type = 'inbound'; } if (strlen($destination_context) == 0) { $destination_context = 'public'; } + if ($destination_type =="outbound" && $destination_context == "public") { $destination_context = $_SESSION['domain_name']; } + if ($destination_type =="outbound" && strlen($destination_context) == 0) { $destination_context = $_SESSION['domain_name']; } //show the header require_once "resources/header.php"; @@ -525,7 +530,6 @@ echo " if (document.getElementById('tr_buy')) { document.getElementById('tr_buy').style.display = 'none'; }\n"; echo " if (document.getElementById('tr_carrier')) { document.getElementById('tr_carrier').style.display = 'none'; }\n"; echo " document.getElementById('tr_account_code').style.display = 'none';\n"; - echo " document.getElementById('destination_context').value = '".$_SESSION['domain_name']."'"; echo " }\n"; echo " else if (dir == 'inbound') {\n"; echo " if (document.getElementById('tr_caller_id_name')) { document.getElementById('tr_caller_id_name').style.display = ''; }\n";