Update call_center_agent_delete.php

This commit is contained in:
FusionPBX 2016-10-27 13:17:09 -06:00 committed by GitHub
parent 91ca9bae66
commit 2ff221703c
1 changed files with 31 additions and 27 deletions

View File

@ -23,24 +23,29 @@
Contributor(s): Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
*/ */
require_once "root.php";
require_once "resources/require.php"; //includes
require_once "resources/check_auth.php"; require_once "root.php";
if (permission_exists('call_center_agent_delete')) { require_once "resources/require.php";
//access granted require_once "resources/check_auth.php";
}
else { //check the permissions
echo "access denied"; if (permission_exists('call_center_agent_delete')) {
exit; //access granted
} }
else {
echo "access denied";
exit;
}
//add multi-lingual support //add multi-lingual support
$language = new text; $language = new text;
$text = $language->get(); $text = $language->get();
if (count($_GET)>0) { //get the primary key
$id = check_str($_GET["id"]); if (count($_GET)>0) {
} $id = check_str($_GET["id"]);
}
//get the agent details //get the agent details
$sql = "select * from v_call_center_agents "; $sql = "select * from v_call_center_agents ";
@ -64,24 +69,23 @@ if (count($_GET)>0) {
$response = event_socket_request($fp, $cmd); $response = event_socket_request($fp, $cmd);
} }
//delete the agent from db //delete the agent from db
if (strlen($id)>0) { if (strlen($id)>0) {
//tiers table //tiers table
$sql = "delete from v_call_center_tiers "; $sql = "delete from v_call_center_tiers ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and agent_name = '$agent_name' "; $sql .= "and agent_name = '$agent_name' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
unset($sql); unset($sql);
//agents table //agents table
$sql = "delete from v_call_center_agents "; $sql = "delete from v_call_center_agents ";
$sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_center_agent_uuid = '$id' "; $sql .= "and call_center_agent_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
unset($sql); unset($sql);
} }
//synchronize configuration //synchronize configuration