diff --git a/app/call_center/call_center_queue_edit.php b/app/call_center/call_center_queue_edit.php
index 497bb9fa19..f183a65fef 100644
--- a/app/call_center/call_center_queue_edit.php
+++ b/app/call_center/call_center_queue_edit.php
@@ -793,7 +793,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-max_wait_time_with_no_agent']."\n";
echo "\n";
echo "
\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-max_wait_time_with_no_agent']."\n";
echo " | \n";
@@ -804,7 +804,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-max_wait_time_with_no_agent_time_reached']."\n";
echo "\n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-max_wait_time_with_no_agent_time_reached']."\n";
echo " | \n";
@@ -851,7 +851,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-tier_rule_wait_second']."\n";
echo "\n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-tier_rule_wait_second']."\n";
echo " | \n";
@@ -910,7 +910,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-discard_abandoned_after']."\n";
echo "\n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-discard_abandoned_after']."\n";
echo " | \n";
diff --git a/app/call_center/resources/classes/call_center.php b/app/call_center/resources/classes/call_center.php
index aad25b7b92..9e40c3cb76 100644
--- a/app/call_center/resources/classes/call_center.php
+++ b/app/call_center/resources/classes/call_center.php
@@ -66,35 +66,21 @@
*/
public function dialplan() {
- //check to see if the dialplan exists
+ //delete previous dialplan
if (strlen($this->dialplan_uuid) > 0) {
- $sql = "select dialplan_uuid, dialplan_name, dialplan_description from v_dialplans ";
+ //delete the previous dialplan
+ $sql = "delete from v_dialplans ";
$sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
$sql .= "and domain_uuid = '".$this->domain_uuid."' ";
- $prep_statement = $this->db->prepare($sql);
- if ($prep_statement) {
- $prep_statement->execute();
- $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
- if (is_array($row)) {
- //results found
- $dialplan_name = $row['dialplan_name'];
- $dialplan_description = $row['dialplan_description'];
- }
- else {
- //no results
- unset($this->dialplan_uuid);
- $sql = "update v_call_center_queues ";
- $sql .= "set dialplan_uuid = null ";
- $sql .= "where call_center_queue_uuid = '".$this->call_center_queue_uuid."' ";
- $sql .= "and domain_uuid = '".$this->domain_uuid."' ";
- //echo $sql."
\n";
- //exit;
- $this->db->exec($sql);
- unset($sql);
- }
- unset($prep_statement);
- }
+ $this->db->exec($sql);
+
+ $sql = "delete from v_dialplan_details ";
+ $sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
+ $sql .= "and domain_uuid = '".$this->domain_uuid."' ";
+ $this->db->exec($sql);
+ unset($sql);
}
+ unset($prep_statement);
//build the dialplan array
$dialplan["app_uuid"] = "95788e50-9500-079e-2807-fd530b0ea370";
@@ -181,20 +167,6 @@
$dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2";
$dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10;
- //delete the previous dialplan
- if(strlen($this->dialplan_uuid) > 0) {
- $sql = "delete from v_dialplans ";
- $sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
- $sql .= "and domain_uuid = '".$this->domain_uuid."' ";
- $this->db->exec($sql);
-
- $sql = "delete from v_dialplan_details ";
- $sql .= "where dialplan_uuid = '".$this->dialplan_uuid."' ";
- $sql .= "and domain_uuid = '".$this->domain_uuid."' ";
- $this->db->exec($sql);
- unset($sql);
- }
-
//add the dialplan permission
$p = new permissions;
$p->add("dialplan_add", 'temp');
@@ -205,22 +177,17 @@
//save the dialplan
$orm = new orm;
$orm->name('dialplans');
- if (strlen($this->dialplan_uuid) > 0) {
- $orm->uuid($this->dialplan_uuid);
- }
$orm->save($dialplan);
$dialplan_response = $orm->message;
+ $this->dialplan_uuid = $dialplan_response['uuid'];
//if new dialplan uuid then update the call center queue
- if (strlen($this->dialplan_uuid) == 0) {
- $this->dialplan_uuid = $dialplan_response['uuid'];
- $sql = "update v_call_center_queues ";
- $sql .= "set dialplan_uuid = '".$this->dialplan_uuid."' ";
- $sql .= "where call_center_queue_uuid = '".$this->call_center_queue_uuid."' ";
- $sql .= "and domain_uuid = '".$this->domain_uuid."' ";
- $this->db->exec($sql);
- unset($sql);
- }
+ $sql = "update v_call_center_queues ";
+ $sql .= "set dialplan_uuid = '".$this->dialplan_uuid."' ";
+ $sql .= "where call_center_queue_uuid = '".$this->call_center_queue_uuid."' ";
+ $sql .= "and domain_uuid = '".$this->domain_uuid."' ";
+ $this->db->exec($sql);
+ unset($sql);
//remove the temporary permission
$p->delete("dialplan_add", 'temp');
diff --git a/app/extensions/app_config.php b/app/extensions/app_config.php
index d99d130bdb..c989786d7d 100644
--- a/app/extensions/app_config.php
+++ b/app/extensions/app_config.php
@@ -83,6 +83,9 @@
//$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
+ $apps[$x]['permissions'][$y]['name'] = "extension_user_context";
+ $apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+ $y++;
//schema details
$y = 0; //table array index
diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php
index 485d721859..b10ef24a6a 100644
--- a/app/extensions/extension_edit.php
+++ b/app/extensions/extension_edit.php
@@ -85,7 +85,7 @@ else {
if (if_group("superadmin")) {
$accountcode = $_POST["accountcode"];
}
- else if (if_group("admin") && $billing_app_exists) {
+ elseif (if_group("admin") && $billing_app_exists) {
$sql_accountcode = "SELECT COUNT(*) as count FROM v_billings WHERE domain_uuid = '".$_SESSION['domain_uuid']."' AND type_value='".$_POST["accountcode"]."'";
$prep_statement_accountcode = $db->prepare(check_sql($sql_accountcode));
$prep_statement_accountcode->execute();
@@ -328,7 +328,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
//set the default user context
- if (if_group("superadmin")) {
+ if (permission_exists("extension_user_context")) {
//allow a user assigned to super admin to change the user_context
}
else {
@@ -634,7 +634,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "directory_exten_visible = '$directory_exten_visible', ";
$sql .= "limit_max = '$limit_max', ";
$sql .= "limit_destination = '$limit_destination', ";
- $sql .= "user_context = '$user_context', ";
+ if (permission_exists("extension_user_context")) {
+ $sql .= "user_context = '$user_context', ";
+ }
if (permission_exists('extension_missed_call')) {
$sql .= "missed_call_app = '$missed_call_app', ";
$sql .= "missed_call_data = '$missed_call_data', ";
@@ -881,7 +883,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update") {
$document['title'] = $text['title-extension-edit'];
}
- else if ($action == "add") {
+ elseif ($action == "add") {
$document['title'] = $text['title-extension-add'];
}
diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua b/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua
index c4eeeb0f63..077ebf77e0 100644
--- a/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua
+++ b/resources/install/scripts/app/xml_handler/resources/scripts/dialplan/dialplan.lua
@@ -1,6 +1,6 @@
-- xml_handler.lua
-- Part of FusionPBX
--- Copyright (C) 2013 Mark J Crane
+-- Copyright (C) 2013-2015 Mark J Crane
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
@@ -61,17 +61,6 @@
end
end
-
- --get the domain name
- function get_domain_name(domains, domain_uuid)
- for key,value in ipairs(domains) do
- if (value.domain_uuid == domain_uuid) then
- return value.domain_name;
- end
- end
- return nil;
- end
-
--set the xml array and then concatenate the array to a string
local xml = {}
table.insert(xml, [[]]);
@@ -252,12 +241,11 @@
condition = ""; --prevents duplicate time conditions
end
end
-
- if (call_context == "public") then
+
+ if (call_context == "public" or string.sub(call_context, 0, 7) == "public@" or string.sub(call_context, -7) == ".public") then
if (dialplan_detail_tag == "action") then
if (first_action) then
if (domain_uuid ~= nil and domain_uuid ~= '') then
- --domain_name = get_domain_name(domains, domain_uuid);
domain_name = domains[domain_uuid];
table.insert(xml, [[ ]]);
table.insert(xml, [[ ]]);
diff --git a/resources/switch.php b/resources/switch.php
index fcae5f6117..5b6e428a37 100644
--- a/resources/switch.php
+++ b/resources/switch.php
@@ -2226,7 +2226,7 @@ if (!function_exists('save_call_center_xml')) {
}
//get the contents of the template
- $file_contents = file_get_contents($path."/autoload_configs/callcenter.conf.xml");
+ $file_contents = file_get_contents($path."/autoload_configs/callcenter.conf.xml.noload");
//add the Call Center Queues, Agents and Tiers to the XML config
$file_contents = str_replace("{v_queues}", $v_queues, $file_contents);