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):
Mark J Crane <markjcrane@fusionpbx.com>
*/
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