Prevent duplicate call center dialplans.
This commit is contained in:
parent
639b28381d
commit
1bc779aed2
|
|
@ -272,6 +272,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
//update the call center queue
|
||||
$sql = "update v_call_center_queues set ";
|
||||
$sql .= "queue_name = '$queue_name', ";
|
||||
$sql .= "dialplan_uuid = '$dialplan_uuid', ";
|
||||
$sql .= "queue_extension = '$queue_extension', ";
|
||||
$sql .= "queue_strategy = '$queue_strategy', ";
|
||||
$sql .= "queue_moh_sound = '$queue_moh_sound', ";
|
||||
|
|
@ -314,8 +315,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
$c = new call_center;
|
||||
$c->db = $db;
|
||||
$c->domain_uuid = $_SESSION['domain_uuid'];
|
||||
$c->call_center_queue_uuid = $call_center_queue_uuid;
|
||||
$c->dialplan_uuid = $dialplan_uuid;
|
||||
$c->queue_name = $queue_name;
|
||||
$c->queue_name = $queue_name;
|
||||
$c->queue_cid_prefix = $queue_cid_prefix;
|
||||
$c->queue_timeout_action = $queue_timeout_action;
|
||||
$c->queue_description = $queue_description;
|
||||
|
|
@ -329,7 +332,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
$cache = new cache;
|
||||
$cache->delete("memcache delete dialplan:".$_SESSION["context"]);
|
||||
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
//set the update message
|
||||
$_SESSION["message"] = $text['message-update'];
|
||||
} //if ($action == "update")
|
||||
|
||||
//add agent/tier to queue
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2010-2014
|
||||
Copyright (C) 2015
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
|
|
@ -36,6 +36,7 @@
|
|||
* define the variables
|
||||
*/
|
||||
public $domain_uuid;
|
||||
public $call_center_queue_uuid;
|
||||
public $dialplan_uuid;
|
||||
public $queue_name;
|
||||
public $queue_description;
|
||||
|
|
@ -74,11 +75,23 @@
|
|||
if ($prep_statement) {
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_ASSOC);
|
||||
if (strlen($row['dialplan_uuid']) > 0) {
|
||||
$this->dialplan_uuid = $row['dialplan_uuid'];
|
||||
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."<br />\n";
|
||||
//exit;
|
||||
$this->db->exec($sql);
|
||||
unset($sql);
|
||||
}
|
||||
unset($prep_statement);
|
||||
}
|
||||
}
|
||||
|
|
@ -192,10 +205,23 @@
|
|||
//save the dialplan
|
||||
$orm = new orm;
|
||||
$orm->name('dialplans');
|
||||
$orm->uuid($this->dialplan_uuid);
|
||||
if (strlen($this->dialplan_uuid) > 0) {
|
||||
$orm->uuid($this->dialplan_uuid);
|
||||
}
|
||||
$orm->save($dialplan);
|
||||
$dialplan_response = $orm->message;
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
//remove the temporary permission
|
||||
$p->delete("dialplan_add", 'temp');
|
||||
$p->delete("dialplan_detail_add", 'temp');
|
||||
|
|
|
|||
Loading…
Reference in New Issue