From f0d90fd1e0e4c211fd8176ed45fc27865d28bef0 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 9 Jul 2015 10:48:01 -0300 Subject: [PATCH] Fix the call center dialplan so that it does not create duplicates using the new call center class. --- .../resources/classes/call_center.php | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/app/call_center/resources/classes/call_center.php b/app/call_center/resources/classes/call_center.php index 094593186b..251ccfa2e2 100644 --- a/app/call_center/resources/classes/call_center.php +++ b/app/call_center/resources/classes/call_center.php @@ -85,12 +85,6 @@ //build the dialplan array $dialplan["app_uuid"] = "95788e50-9500-079e-2807-fd530b0ea370"; - if (strlen($this->dialplan_uuid) > 0) { - $dialplan["dialplan_uuid"] = $this->dialplan_uuid; - } - else { - $this->dialplan_uuid = uuid(); - } $dialplan["domain_uuid"] = $this->domain_uuid; $dialplan["dialplan_name"] = ($this->queue_name != '') ? $this->queue_name : format_phone($this->destination_number); $dialplan["dialplan_number"] = $this->destination_number; @@ -174,13 +168,17 @@ $dialplan["dialplan_details"][$y]["dialplan_detail_group"] = "2"; $dialplan["dialplan_details"][$y]["dialplan_detail_order"] = $y * 10; - //delete the previous details + //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."' "; - //echo $sql."

"; - $this->db->exec(check_sql($sql)); + $this->db->exec($sql); unset($sql); } @@ -194,9 +192,7 @@ //save the dialplan $orm = new orm; $orm->name('dialplans'); - if (isset($dialplan["dialplan_uuid"])) { - $orm->uuid($dialplan["dialplan_uuid"]); - } + $orm->uuid($this->dialplan_uuid); $orm->save($dialplan); $dialplan_response = $orm->message;