From 2ff221703c0ee1e9ff87f3fbdc1b1ba8aaf5fbe3 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 27 Oct 2016 13:17:09 -0600 Subject: [PATCH] Update call_center_agent_delete.php --- app/call_centers/call_center_agent_delete.php | 58 ++++++++++--------- 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/app/call_centers/call_center_agent_delete.php b/app/call_centers/call_center_agent_delete.php index d7703ec81f..f131e2202a 100644 --- a/app/call_centers/call_center_agent_delete.php +++ b/app/call_centers/call_center_agent_delete.php @@ -23,24 +23,29 @@ Contributor(s): Mark J Crane */ -require_once "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('call_center_agent_delete')) { - //access granted -} -else { - echo "access denied"; - exit; -} + +//includes + require_once "root.php"; + require_once "resources/require.php"; + require_once "resources/check_auth.php"; + +//check the permissions + if (permission_exists('call_center_agent_delete')) { + //access granted + } + else { + echo "access denied"; + exit; + } //add multi-lingual support $language = new text; $text = $language->get(); -if (count($_GET)>0) { - $id = check_str($_GET["id"]); -} +//get the primary key + if (count($_GET)>0) { + $id = check_str($_GET["id"]); + } //get the agent details $sql = "select * from v_call_center_agents "; @@ -64,24 +69,23 @@ if (count($_GET)>0) { $response = event_socket_request($fp, $cmd); } - - //delete the agent from db if (strlen($id)>0) { //tiers table - $sql = "delete from v_call_center_tiers "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and agent_name = '$agent_name' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset($sql); + $sql = "delete from v_call_center_tiers "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "and agent_name = '$agent_name' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($sql); + //agents table - $sql = "delete from v_call_center_agents "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "and call_center_agent_uuid = '$id' "; - $prep_statement = $db->prepare(check_sql($sql)); - $prep_statement->execute(); - unset($sql); + $sql = "delete from v_call_center_agents "; + $sql .= "where domain_uuid = '$domain_uuid' "; + $sql .= "and call_center_agent_uuid = '$id' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + unset($sql); } //synchronize configuration