diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 40212056..4f5b9bc0 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -756,7 +756,8 @@ status VARCHAR(6), user_group VARCHAR(20), comments VARCHAR(20), sub_status VARCHAR(6), -index (lead_id) +index (lead_id), +index (user) ); CREATE TABLE vicidial_scripts ( diff --git a/extras/upgrade_2.0.5.sql b/extras/upgrade_2.0.5.sql index 59189c1c..d97b1b5a 100644 --- a/extras/upgrade_2.0.5.sql +++ b/extras/upgrade_2.0.5.sql @@ -255,3 +255,7 @@ index (record_id) ); UPDATE system_settings SET db_schema_version='1091'; + +CREATE INDEX user ON vicidial_agent_log (user); + +UPDATE system_settings SET db_schema_version='1092'; diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt index f2ab6679..31794b3f 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.5.txt @@ -190,6 +190,8 @@ Delete Timeclock Log Record -<\/B> This option allows the user to delete records Add Timeclock Log Record|| Modify Timeclock Log Record|| Delete Timeclock Log Record|| +USER GROUP TIMECLOCK STATUS REPORT|| +Click here to see the Timeclock Status for this user group|| ############################################################ CLIENT diff --git a/www/agc/timeclock.php b/www/agc/timeclock.php index a78240ce..29a9f8e3 100644 --- a/www/agc/timeclock.php +++ b/www/agc/timeclock.php @@ -7,10 +7,11 @@ # 80523-0134 - First Build # 80524-0225 - Changed event_date to DATETIME, added timestamp field and tcid_link field # 80525-2351 - Added an audit log that is not to be editable +# 80602-0641 - Fixed status update bug # -$version = '2.0.5-3'; -$build = '80525-2351'; +$version = '2.0.5-4'; +$build = '80602-0641'; $StarTtimE = date("U"); $NOW_TIME = date("Y-m-d H:i:s"); @@ -274,7 +275,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) print "\n"; ### Update the user's timeclock status record - $stmt="UPDATE vicidial_timeclock_status set status='LOGIN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';"; + $stmt="UPDATE vicidial_timeclock_status set status='LOGIN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $affected_rows = mysql_affected_rows($link); @@ -309,7 +310,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) print "\n"; ### Update the user's timeclock status record - $stmt="UPDATE vicidial_timeclock_status set status='LOGOUT', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';"; + $stmt="UPDATE vicidial_timeclock_status set status='LOGOUT', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $affected_rows = mysql_affected_rows($link); diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index b5debb0a..74192d96 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -12834,6 +12834,7 @@ if ($ADD==311111) echo "

Click here to see all CallBack Holds in this user group

\n"; + echo "

Click here to see the Timeclock Status for this user group

\n"; if ($LOGdelete_user_groups > 0) { @@ -15148,7 +15149,8 @@ if ($ADD==999999)
  • AGENT PERFORMANCE DETAIL
  • FRONTER - CLOSER REPORT
  • AGENT SPREADSHEET PERFORMANCE -
  • USER TIMECLOCK REPORT +
  • USER TIMECLOCK REPORT     + USER GROUP TIMECLOCK STATUS REPORT
  • SERVER PERFORMANCE 0) diff --git a/www/vicidial/timeclock_report.php b/www/vicidial/timeclock_report.php index 9213d09e..512090dd 100644 --- a/www/vicidial/timeclock_report.php +++ b/www/vicidial/timeclock_report.php @@ -38,7 +38,7 @@ if (strlen($order)<2) {$order='sales_down';} ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,webroot_writable FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -46,7 +46,8 @@ $i=0; while ($i < $qm_conf_ct) { $row=mysql_fetch_row($rslt); - $non_latin = $row[0]; + $non_latin = $row[0]; + $webroot_writable = $row[1]; $i++; } ##### END SETTINGS LOOKUP ##### diff --git a/www/vicidial/user_status.php b/www/vicidial/user_status.php index a077de0a..f341c083 100644 --- a/www/vicidial/user_status.php +++ b/www/vicidial/user_status.php @@ -30,6 +30,23 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];} if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,webroot_writable FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $webroot_writable = $row[1]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -40,6 +57,7 @@ if (!isset($begin_date)) {$begin_date = $TODAY;} if (!isset($end_date)) {$end_date = $TODAY;} $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; + if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; @@ -66,13 +84,19 @@ $browser = getenv("HTTP_USER_AGENT"); $row=mysql_fetch_row($rslt); $LOGfullname=$row[0]; $change_agent_campaign=$row[1]; - fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); - fclose($fp); + if ($webroot_writable > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } } else { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); - fclose($fp); + if ($webroot_writable > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fclose($fp); + } } $stmt="SELECT full_name,user_group from vicidial_users where user='" . mysql_real_escape_string($user) . "';"; @@ -99,6 +123,19 @@ $browser = getenv("HTTP_USER_AGENT"); $i++; } + $stmt="SELECT event_date,status,ip_address from vicidial_timeclock_status where user='" . mysql_real_escape_string($user) . "';"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $tc_logs_to_print = mysql_num_rows($rslt); + if ($tc_logs_to_print > 0) + { + $row=mysql_fetch_row($rslt); + $Tevent_date = $row[0]; + $Tstatus = $row[1]; + $Tip_address = $row[2]; + $i++; + } + } $stmt="select * from vicidial_campaigns;"; @@ -194,10 +231,26 @@ if ($agents_to_print > 0) else { - echo "Agent is not logged in\n
    "; + echo "Agent is not logged in to VICIDIAL\n
    "; } +echo "\n
    "; + +if ( ($Tstatus == "LOGIN") or ($Tstatus == "START") ) +{ + echo "User $user - is logged in to the timeclock.
    Login time: $Tevent_date from $Tip_address
    \n"; + + exit; +} +else +{ + echo "User $user - is NOT logged in to the timeclock.
    Last logout time: $Tevent_date from $Tip_address
    \n"; + + exit; +} + + echo "           $user - $full_name \n"; echo "       GROUP: $user_group

    \n";