From a90b7231cdd175eb13e673301592e954b7f6f82c Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sun, 1 Apr 2018 01:11:17 -0600 Subject: [PATCH] Update call_center_agent_status.php --- app/call_centers/call_center_agent_status.php | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/app/call_centers/call_center_agent_status.php b/app/call_centers/call_center_agent_status.php index 5e076d8dc2..350b0abe1a 100644 --- a/app/call_centers/call_center_agent_status.php +++ b/app/call_centers/call_center_agent_status.php @@ -67,6 +67,11 @@ //get the http post values and set them as php variables if (count($_POST) > 0) { + //debug info + //echo "
\n";
+		//print_r($_POST);
+		//echo "
\n"; + foreach($_POST['agents'] as $row) { if (strlen($row['agent_status']) > 0) { //agent set status @@ -76,7 +81,7 @@ $sql = "update v_users set "; $sql .= "user_status = '".$row['agent_status']."' "; $sql .= "where domain_uuid = '".$domain_uuid."' "; - $sql .= "and username = '".$row['agent_name']."' "; + $sql .= "and user_uuid = '".$row['user_uuid']."' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); } @@ -97,20 +102,20 @@ //echo $cmd."\n"; //set the agent status to available and assign the agent to the queue with the tier - if (isset($row['queue_name']) && $row['agent_status'] == 'Available') { + if (isset($row['queue_uuid']) && $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 - $cmd = "api callcenter_config tier add ".$row['queue_name']." ".$row['agent_uuid']." 1 1"; + $cmd = "api callcenter_config tier add ".$row['queue_uuid']." ".$row['agent_uuid']." 1 1"; //echo $cmd."
\n"; $response = event_socket_request($fp, $cmd); } //un-assign the agent from the queue - if (isset($row['queue_name']) && $row['agent_status'] == 'Logged Out') { - $cmd = "api callcenter_config tier del ".$row['queue_name']." ".$row['agent_uuid']; + if (isset($row['queue_uuid']) && $row['agent_status'] == 'Logged Out') { + $cmd = "api callcenter_config tier del ".$row['queue_uuid']." ".$row['agent_uuid']; //echo $cmd."
\n"; $response = event_socket_request($fp, $cmd); } @@ -186,13 +191,12 @@ } //increment x $x++; - } //debug info - //echo "
\n";
-	//print_r($agents);
-	//echo "
\n"; + echo "
\n";
+	print_r($agents);
+	echo "
\n"; //set the row style $c = 0; @@ -268,6 +272,7 @@ $html .= " "; $html .= " \n"; $html .= " \n"; + $html .= " \n"; $html .= " \n"; $html .= " \n"; //$html .= "   \n";