Fix dashboard widget for agent status management (#5993)
* Fix dashboard widget for agent status management This needed to be updated for the ext@domain call center naming change. * Add support for On-Break and remove user_status and agent_status syncing
This commit is contained in:
parent
00f121701f
commit
832549a32e
|
|
@ -54,35 +54,32 @@
|
||||||
if (count($_POST) > 0) {
|
if (count($_POST) > 0) {
|
||||||
foreach ($_POST['agents'] as $row) {
|
foreach ($_POST['agents'] as $row) {
|
||||||
if (strlen($row['agent_status']) > 0) {
|
if (strlen($row['agent_status']) > 0) {
|
||||||
|
|
||||||
//agent set status
|
//agent set status
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
//set the user_status
|
// update the database
|
||||||
$sql = "update v_users set ";
|
$array['call_center_agents'][0]['call_center_agent_uuid'] = $row['id'];
|
||||||
$sql .= "user_status = :user_status ";
|
$array['call_center_agents'][0]['domain_uuid'] = $_SESSION['user']['domain_uuid'];
|
||||||
$sql .= "where domain_uuid = :domain_uuid ";
|
$array['call_center_agents'][0]['agent_status'] = $row['agent_status'];
|
||||||
$sql .= "and username = :username ";
|
$database = new database;
|
||||||
$parameters['user_status'] = $row['agent_status'];
|
$database->app_name = 'call_centers_dashboard';
|
||||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
$database->app_uuid = '95788e50-9500-079e-2807-fd530b0ea370';
|
||||||
$parameters['username'] = $row['agent_name'];
|
$database->save($array);
|
||||||
|
|
||||||
|
//set the call center status
|
||||||
|
$cmd = "api callcenter_config agent set status ".$row['id']." '".$row['agent_status']."'";
|
||||||
|
$response = event_socket_request($fp, $cmd);
|
||||||
//set the agent status to available and assign the agent to the queue with the tier
|
//set the agent status to available and assign the agent to the queue with the tier
|
||||||
if ($row['agent_status'] == 'Available') {
|
if ($row['agent_status'] == 'Available') {
|
||||||
//set the call center status
|
|
||||||
//$cmd = "api callcenter_config agent set status ".$row['agent_name']."@".$_SESSION['domain_name']." '".$row['agent_status']."'";
|
|
||||||
//$response = event_socket_request($fp, $cmd);
|
|
||||||
|
|
||||||
//assign the agent to the queue
|
//assign the agent to the queue
|
||||||
$cmd = "api callcenter_config tier add ".$row['queue_name']."@".$_SESSION['domain_name']." ".$row['agent_name']."@".$_SESSION['domain_name']." 1 1";
|
$cmd = "api callcenter_config tier add ".$row['queue_extension']."@".$_SESSION['domain_name']." ".$row['id']." 1 1";
|
||||||
$response = event_socket_request($fp, $cmd);
|
$response = event_socket_request($fp, $cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
//un-assign the agent from the queue
|
//un-assign the agent from the queue
|
||||||
if ($row['agent_status'] == 'Logged Out') {
|
if ($row['agent_status'] == 'Logged Out') {
|
||||||
$cmd = "api callcenter_config tier del ".$row['queue_name']."@".$_SESSION['domain_name']." ".$row['agent_name']."@".$_SESSION['domain_name'];
|
$cmd = "api callcenter_config tier del ".$row['queue_extension']."@".$_SESSION['domain_name']." ".$row['id'];
|
||||||
$response = event_socket_request($fp, $cmd);
|
$response = event_socket_request($fp, $cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(200);
|
usleep(200);
|
||||||
unset($parameters);
|
unset($parameters);
|
||||||
}
|
}
|
||||||
|
|
@ -105,7 +102,7 @@
|
||||||
//get the call center queues from the database
|
//get the call center queues from the database
|
||||||
$sql = "select * from v_call_center_queues ";
|
$sql = "select * from v_call_center_queues ";
|
||||||
$sql .= "where domain_uuid = :domain_uuid ";
|
$sql .= "where domain_uuid = :domain_uuid ";
|
||||||
$sql .= "order by queue_name asc ";
|
$sql .= "order by queue_extension asc ";
|
||||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$call_center_queues = $database->select($sql, $parameters, 'all');
|
$call_center_queues = $database->select($sql, $parameters, 'all');
|
||||||
|
|
@ -115,11 +112,14 @@
|
||||||
//get the agents from the database
|
//get the agents from the database
|
||||||
$sql = "select * from v_call_center_agents ";
|
$sql = "select * from v_call_center_agents ";
|
||||||
$sql .= "where user_uuid = :user_uuid ";
|
$sql .= "where user_uuid = :user_uuid ";
|
||||||
$sql .= "and domain_uuid = :domain_uuid ";
|
$sql .= "and domain_uuid = :domain_uuid";
|
||||||
$parameters['user_uuid'] = $_SESSION['user_uuid'];
|
$parameters['user_uuid'] = $_SESSION['user_uuid'];
|
||||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||||
$database = new database;
|
$database = new database;
|
||||||
$agent = $database->select($sql, $parameters, 'all');
|
$agents = $database->select($sql, $parameters, 'all');
|
||||||
|
if (count($agents) > 0) {
|
||||||
|
$agent = $agents[0];
|
||||||
|
}
|
||||||
unset($sql, $parameters);
|
unset($sql, $parameters);
|
||||||
|
|
||||||
//update the queue status
|
//update the queue status
|
||||||
|
|
@ -127,11 +127,8 @@
|
||||||
foreach ($call_center_queues as $queue) {
|
foreach ($call_center_queues as $queue) {
|
||||||
$call_center_queues[$x]['queue_status'] = 'Logged Out';
|
$call_center_queues[$x]['queue_status'] = 'Logged Out';
|
||||||
foreach ($call_center_tiers as $tier) {
|
foreach ($call_center_tiers as $tier) {
|
||||||
if (
|
if ($queue['queue_extension'] .'@'. $_SESSION['user']['domain_name'] == $tier['queue'] && $agent['call_center_agent_uuid'] == $tier['agent']) {
|
||||||
$queue['queue_name'] .'@'. $_SESSION['domain_name'] == $tier['queue']
|
$call_center_queues[$x]['queue_status'] = $agent['agent_status'];
|
||||||
&& $agent['agent_name'] .'@'. $_SESSION['domain_name'] == $tier['agent']
|
|
||||||
) {
|
|
||||||
$call_center_queues[$x]['queue_status'] = 'Available';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$x++;
|
$x++;
|
||||||
|
|
@ -194,11 +191,12 @@
|
||||||
// }
|
// }
|
||||||
// echo " </td>\n";
|
// echo " </td>\n";
|
||||||
echo " <td class='no-wrap right'>\n";
|
echo " <td class='no-wrap right'>\n";
|
||||||
echo " <input type='hidden' name='agents[".$x."][queue_name]' value='".escape($row['queue_name'])."'>\n";
|
echo " <input type='hidden' name='agents[".$x."][queue_extension]' value='".escape($row['queue_extension'])."'>\n";
|
||||||
echo " <input type='hidden' name='agents[".$x."][agent_name]' value='".escape($agent['agent_name'])."'>\n";
|
echo " <input type='hidden' name='agents[".$x."][agent_name]' value='".escape($agent['agent_name'])."'>\n";
|
||||||
echo " <input type='hidden' name='agents[".$x."][id]' value='".escape($agent['call_center_agent_uuid'])."'>\n";
|
echo " <input type='hidden' name='agents[".$x."][id]' value='".escape($agent['call_center_agent_uuid'])."'>\n";
|
||||||
echo " <label style='margin: 0; cursor: pointer; margin-right: 10px;'><input type='radio' name='agents[".$x."][agent_status]' value='Available' ".($row['queue_status'] == 'Available' ? "checked='checked'" : null)."> ".$text['option-available']."</label>\n";
|
echo " <label style='margin: 0; cursor: pointer; margin-right: 10px;'><input type='radio' name='agents[".$x."][agent_status]' value='Available' ".($row['queue_status'] == 'Available' ? "checked='checked'" : null)."> ".$text['option-available']."</label>\n";
|
||||||
echo " <label style='margin: 0; cursor: pointer;'><input type='radio' name='agents[".$x."][agent_status]' value='Logged Out' ".($row['queue_status'] == 'Logged Out' ? "checked='checked'" : null)."> ".$text['option-logged_out']."</label>\n";
|
echo " <label style='margin: 0; cursor: pointer; margin-right: 10px;'><input type='radio' name='agents[".$x."][agent_status]' value='Logged Out' ".($row['queue_status'] == 'Logged Out' ? "checked='checked'" : null)."> ".$text['option-logged_out']."</label>\n";
|
||||||
|
echo " <label style='margin: 0; cursor: pointer;'><input type='radio' name='agents[".$x."][agent_status]' value='On Break' ".($row['queue_status'] == 'On Break' ? "checked='checked'" : null)."> ".$text['option-on_break']."</label>\n";
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
$x++;
|
$x++;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue