Domain name edit only perform the actions if the features are installed.

This commit is contained in:
markjcrane 2015-07-24 14:05:02 -06:00
parent 8c5b7c318d
commit 6392bff01a
1 changed files with 295 additions and 272 deletions

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2012
Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -139,14 +139,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($original_domain_name != $domain_name) {
// update dialplans
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/dialplan/app_config.php")){
$sql = "update v_dialplans set ";
$sql .= "dialplan_context = '".$domain_name."' ";
$sql .= "where dialplan_context = '".$original_domain_name."' ";
$sql .= "and domain_uuid = '".$domain_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
}
// update extensions (accountcode, user_context, dial_domain)
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/extensions/app_config.php")){
$sql = "update v_extensions set ";
$sql .= "accountcode = '".$domain_name."' ";
$sql .= "where accountcode = '".$original_domain_name."' ";
@ -167,8 +170,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "and domain_uuid = '".$domain_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
}
// update cdr records (domain_name, context)
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/xml_cdr/app_config.php")){
$sql = "update v_xml_cdr set ";
$sql .= "domain_name = '".$domain_name."' ";
$sql .= "where domain_name = '".$original_domain_name."' ";
@ -182,6 +187,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "and domain_uuid = '".$domain_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
}
// update billing, if installed
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php")){
@ -242,6 +248,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
// update conference session recording paths
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/conference_centers/app_config.php")){
$sql = "select conference_session_uuid, recording from v_conference_sessions ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and recording like '%".$original_domain_name."%' ";
@ -263,8 +270,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
}
unset($sql, $prep_statement, $result);
}
// update conference center greetings
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/conference_centers/app_config.php")){
$sql = "select conference_center_uuid, conference_center_greeting from v_conference_centers ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and conference_center_greeting like '%".$original_domain_name."%' ";
@ -286,8 +295,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
}
unset($sql, $prep_statement, $result);
}
// update ivr menu greetings
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/ivr_menu/app_config.php")){
$sql = "select ivr_menu_uuid, ivr_menu_greet_long, ivr_menu_greet_short from v_ivr_menus ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ( ";
@ -315,8 +326,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
}
unset($sql, $prep_statement, $result);
}
// update ivr menu option parameters
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/ivr_menu/app_config.php")){
$sql = "select ivr_menu_option_uuid, ivr_menu_option_param from v_ivr_menu_options ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ivr_menu_option_param like '%".$original_domain_name."%' ";
@ -338,8 +351,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
}
unset($sql, $prep_statement, $result);
}
// update call center queue record templates
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/call_center/app_config.php")){
$sql = "select call_center_queue_uuid, queue_record_template from v_call_center_queues ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and queue_record_template like '%".$original_domain_name."%' ";
@ -361,8 +376,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
}
unset($sql, $prep_statement, $result);
}
// update call center agent contacts
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/call_center/app_config.php")){
$sql = "select call_center_agent_uuid, agent_contact from v_call_center_agents ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and agent_contact like '%".$original_domain_name."%' ";
@ -384,8 +401,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
}
unset($sql, $prep_statement, $result);
}
// update call flows data, anti-data and contexts
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/call_flows/app_config.php")){
$sql = "select call_flow_uuid, call_flow_data, call_flow_anti_data, call_flow_context from v_call_flows ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ( ";
@ -417,8 +436,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
}
unset($sql, $prep_statement, $result);
}
// update ring group context, forward destination, timeout data
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/ring_groups/app_config.php")){
$sql = "select ring_group_uuid, ring_group_context, ring_group_forward_destination, ring_group_timeout_data from v_ring_groups ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ( ";
@ -450,8 +471,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
}
unset($sql, $prep_statement, $result);
}
// update device lines server address, outbound proxy
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/devices/app_config.php")){
$sql = "select device_line_uuid, server_address, outbound_proxy from v_device_lines ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and ( ";
@ -479,6 +502,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
}
unset($sql, $prep_statement, $result);
}
// update dialplan, dialplan/public xml files
$dialplan_xml = file_get_contents($_SESSION['switch']['dialplan']['dir']."/".$domain_name.".xml");
@ -492,6 +516,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($dialplan_public_xml);
// update dialplan details
if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/dialplan/app_config.php")){
$sql = "select dialplan_detail_uuid, dialplan_detail_data from v_dialplan_details ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and dialplan_detail_data like '%".$original_domain_name."%' ";
@ -513,6 +538,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
}
unset($sql, $prep_statement, $result);
}
// update session domain name
$_SESSION['domains'][$domain_uuid]['domain_name'] = $domain_name;
@ -535,9 +561,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$db->exec(check_sql($sql));
unset($sql);
}
}
}
//upgrade the domains
@ -710,7 +734,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
require "domain_settings.php";
}
//include the footer
require_once "resources/footer.php";
?>