From 1fa714764aa894b98226b07ac76dae3f2e5ff9cf Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 5 Mar 2014 14:09:37 +0000 Subject: [PATCH] Fix for issue #744, user status emergency logout git-svn-id: svn://192.168.202.10@2082 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/www/vicidial/user_status.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/agc_2-X/trunk/www/vicidial/user_status.php b/agc_2-X/trunk/www/vicidial/user_status.php index c4b4ea9e..baf41aeb 100644 --- a/agc_2-X/trunk/www/vicidial/user_status.php +++ b/agc_2-X/trunk/www/vicidial/user_status.php @@ -27,6 +27,7 @@ # 131016-2101 - Added checking for level 8 add-copy restriction # 131208-2156 - Added user log TIMEOUTLOGOUT event status # 140108-0707 - Added webserver and hostname to report logging +# 140305-0905 - Bug fix for issue #744, emergency logout # $startMS = microtime(); @@ -346,7 +347,7 @@ if ($stage == "log_agent_out") { $now_date_epoch = date('U'); $inactive_epoch = ($now_date_epoch - 60); - $stmt = "SELECT user,campaign_id,UNIX_TIMESTAMP(last_update_time) from vicidial_live_agents where user='" . mysqli_real_escape_string($link, $user) . "';"; + $stmt = "SELECT user,campaign_id,UNIX_TIMESTAMP(last_update_time),status from vicidial_live_agents where user='" . mysqli_real_escape_string($link, $user) . "';"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {echo "
$stmt\n";} $vla_ct = mysqli_num_rows($rslt); @@ -356,6 +357,7 @@ if ($stage == "log_agent_out") $VLA_user = $row[0]; $VLA_campaign_id = $row[1]; $VLA_update_time = $row[2]; + $VLA_status = $row[3]; if ($VLA_update_time > $inactive_epoch) { @@ -390,7 +392,7 @@ if ($stage == "log_agent_out") if ($DB) {echo "\n
VAL VALUES: $VAL_agent_log_id|$VAL_status|$VAL_lead_id\n";} - if ( ($VAL_wait_epoch < 1) or ( ($VAL_status == 'PAUSE') and ($VAL_dispo_epoch < 1) ) ) + if ( ($VAL_wait_epoch < 1) or ( (preg_match('/PAUSE/', $VLA_status)) and ($VAL_dispo_epoch < 1) ) ) { $VAL_pause_sec = ( ($now_date_epoch - $VAL_pause_epoch) + $VAL_pause_sec); $stmt = "UPDATE vicidial_agent_log SET wait_epoch='$now_date_epoch', pause_sec='$VAL_pause_sec' where agent_log_id='$VAL_agent_log_id';";