added user-group timeclock status report

fixed bug in timeclock.php script

git-svn-id: svn://192.168.202.10@886 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2008-06-02 10:48:58 +00:00
parent cb8dedfae2
commit 3d9d797af3
7 changed files with 77 additions and 13 deletions
+2 -1
View File
@@ -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 (
+4
View File
@@ -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';
@@ -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
+5 -4
View File
@@ -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 "<!-- NEW vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\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 "<!-- vicidial_timeclock_log record updated for $user: |$affected_rows| -->\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);
+3 -1
View File
@@ -12834,6 +12834,7 @@ if ($ADD==311111)
echo "<br><br><a href=\"$PHP_SELF?ADD=8111&user_group=$user_group\">Click here to see all CallBack Holds in this user group</a><BR><BR>\n";
echo "<br><br><a href=\"./timeclock_status.php?user_group=$user_group\">Click here to see the Timeclock Status for this user group</a><BR><BR>\n";
if ($LOGdelete_user_groups > 0)
{
@@ -15148,7 +15149,8 @@ if ($ADD==999999)
<LI><a href="AST_agent_performance_detail.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>AGENT PERFORMANCE DETAIL</a></FONT>
<LI><a href="fcstats.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>FRONTER - CLOSER REPORT</a></FONT>
<LI><a href="vicidial_sales_viewer.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>AGENT SPREADSHEET PERFORMANCE</a></FONT>
<LI><a href="timeclock_report.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>USER TIMECLOCK REPORT</a></FONT>
<LI><a href="timeclock_report.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>USER TIMECLOCK REPORT</a></FONT> &nbsp; &nbsp;
<a href="timeclock_status.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>USER GROUP TIMECLOCK STATUS REPORT</a></FONT>
<LI><a href="AST_server_performance.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=2>SERVER PERFORMANCE</a></FONT>
<?
if ($enable_queuemetrics_logging_LU > 0)
+3 -2
View File
@@ -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 #####
+58 -5
View File
@@ -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<BR>";
echo "Agent is not logged in to VICIDIAL\n<BR>";
}
echo "\n<BR>";
if ( ($Tstatus == "LOGIN") or ($Tstatus == "START") )
{
echo "User $user - is logged in to the timeclock. <BR>Login time: $Tevent_date from $Tip_address<BR>\n";
exit;
}
else
{
echo "User $user - is NOT logged in to the timeclock. <BR>Last logout time: $Tevent_date from $Tip_address<BR>\n";
exit;
}
echo " &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $user - $full_name \n";
echo " &nbsp; &nbsp; &nbsp; GROUP: $user_group <BR><BR>\n";