From d51d233d730ca13953ca02c23a616c8884ff4aaf Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 17 Nov 2008 00:20:11 +0000 Subject: [PATCH] Added another level of timeclock checking to vicidial.php updated docs git-svn-id: svn://192.168.202.10@1008 3d104415-ff17-0410-8863-d5cf3c621b8a --- docs/BASE_INSTALL.txt | 4 +-- docs/REQUIRED_APPS_INSTALL.txt | 2 +- docs/SCRATCH_INSTALL.txt | 8 +++--- www/agc/vdc_db_query.php | 3 ++- www/agc/vicidial.php | 47 ++++++++++++++++++++++++++++++++-- www/vicidial/AST_IVRfilter.php | 8 +++--- 6 files changed, 58 insertions(+), 14 deletions(-) diff --git a/docs/BASE_INSTALL.txt b/docs/BASE_INSTALL.txt index 4d92d39b..abc57edb 100644 --- a/docs/BASE_INSTALL.txt +++ b/docs/BASE_INSTALL.txt @@ -394,7 +394,7 @@ setterm -powersave off setterm -powerdown ### start time server -/usr/local/bin/ntpdate -u 18.145.0.30 +/usr/local/bin/ntpdate -u ntp.myfloridacity.us /usr/sbin/ntpd ### start up the MySQL server @@ -475,7 +475,7 @@ PHASE 6: ADDING CRONTAB ENTRIES FOR ASTGUICLIENT/VICIDIAL SCRIPTS 3 1 * * * /usr/share/astguiclient/AST_DB_optimize.pl ## adjust time on the server with ntp -30 * * * * /usr/local/bin/ntpdate -u 18.145.0.30 2>/dev/null 1>&2 +30 * * * * /usr/local/bin/ntpdate -u ntp.myfloridacity.us 2>/dev/null 1>&2 ### VICIDIAL agent time log weekly summary report generation 2 0 * * 0 /usr/share/astguiclient/AST_agent_week.pl diff --git a/docs/REQUIRED_APPS_INSTALL.txt b/docs/REQUIRED_APPS_INSTALL.txt index db8bc7bb..8f88a7f6 100644 --- a/docs/REQUIRED_APPS_INSTALL.txt +++ b/docs/REQUIRED_APPS_INSTALL.txt @@ -122,7 +122,7 @@ cd ntp-4.2.2p3 ./configure make make install -/usr/local/bin/ntpdate -u 18.145.0.30 +/usr/local/bin/ntpdate -u ntp.myfloridacity.us cd /usr/local diff --git a/docs/SCRATCH_INSTALL.txt b/docs/SCRATCH_INSTALL.txt index ab1fddff..825e9521 100644 --- a/docs/SCRATCH_INSTALL.txt +++ b/docs/SCRATCH_INSTALL.txt @@ -577,9 +577,9 @@ the time is the same on our client computers and our servers. - ./configure - make - make install - - vi /etc/ntp.conf (change to just 1 line: "server 18.145.0.30") + - vi /etc/ntp.conf (change to just 1 line: "server ntp.myfloridacity.us") - cp /etc/ntp.conf /etc/ntpd.conf # just to be sure - - /usr/local/bin/ntpdate -u 18.145.0.30 # initial sync + - /usr/local/bin/ntpdate -u ntp.myfloridacity.us # initial sync - /usr/sbin/ntpd # run it - you are done @@ -2869,7 +2869,7 @@ SUBPHASE 6.4: setting up asterisk and helper applications for startup /usr/bin/setterm -powerdown ### start time server -/usr/local/bin/ntpdate -u 18.145.0.30 +/usr/local/bin/ntpdate -u ntp.myfloridacity.us /usr/sbin/ntpd ### start up the MySQL server @@ -2951,7 +2951,7 @@ SUBPHASE 6.5: setting up astguiclient scripts for continuous running 3 1 * * * /usr/share/astguiclient/AST_DB_optimize.pl ## adjust time on the server with ntp -30 * * * * /usr/local/bin/ntpdate -u 18.145.0.30 2>/dev/null 1>&2 +30 * * * * /usr/local/bin/ntpdate -u ntp.myfloridacity.us 2>/dev/null 1>&2 ### VICIDIAL agent time log weekly and daily summary report generation 2 0 * * 0 /usr/share/astguiclient/AST_agent_week.pl diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php index 06ab3456..543a7698 100644 --- a/www/agc/vdc_db_query.php +++ b/www/agc/vdc_db_query.php @@ -180,7 +180,7 @@ $version = '2.0.5-93'; $build = '81114-0126'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=183; +$mysql_log_count=184; $one_mysql_log=0; require("dbconnect.php"); @@ -498,6 +498,7 @@ if ($ACTION == 'LogiNCamPaigns') $stmt="SELECT event from vicidial_timeclock_log where user='$user' and event_epoch >= '$EoD' order by timeclock_id desc limit 1;"; if ($DB>0) {echo "|$stmt|";} $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00184',$user,$server_ip,$session_name,$one_mysql_log);} $events_to_parse = mysql_num_rows($rslt); if ($events_to_parse > 0) { diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index ae516d90..88b23d45 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -212,7 +212,7 @@ $version = '2.0.5-186'; $build = '81110-1514'; $mel=1; # Mysql Error Log enabled = 1 -$mysql_log_count=51; +$mysql_log_count=53; $one_mysql_log=0; require("dbconnect.php"); @@ -285,7 +285,7 @@ $random = (rand(1000000, 9999999) + 10000000); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable FROM system_settings;"; +$stmt = "SELECT use_non_latin,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,webroot_writable,timeclock_end_of_day FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01001',$VD_login,$server_ip,$session_name,$one_mysql_log);} if ($DB) {echo "$stmt\n";} @@ -299,6 +299,7 @@ while ($i < $qm_conf_ct) $vdc_customer_date_format = $row[2]; $vdc_header_phone_format = $row[3]; $WeBRooTWritablE = $row[4]; + $timeclock_end_of_day = $row[5]; $i++; } @@ -712,6 +713,48 @@ $VDloginDISPLAY=0; $VU_vicidial_recording_override=$row[11]; $VU_alter_custphone_override=$row[12]; + + ### BEGIN - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR + $stmt="SELECT forced_timeclock_login from vicidial_user_groups where user_group='$VU_user_group';"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01052',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $row=mysql_fetch_row($rslt); + $forced_timeclock_login = $row[0]; + + if ( (ereg('Y',$forced_timeclock_login)) or ( (ereg('ADMIN_EXEMPT',$forced_timeclock_login)) and ($VU_user_level < 8) ) ) + { + $last_agent_event=''; + $HHMM = date("Hi"); + $HHteod = substr($timeclock_end_of_day,0,2); + $MMteod = substr($timeclock_end_of_day,2,2); + + if ($HHMM < $timeclock_end_of_day) + {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d")-1, date("Y"));} + else + {$EoD = mktime($HHteod, $MMteod, 10, date("m"), date("d"), date("Y"));} + + $EoDdate = date("Y-m-d H:i:s", $EoD); + + ##### grab timeclock logged-in time for each user ##### + $stmt="SELECT event from vicidial_timeclock_log where user='$VD_login' and event_epoch >= '$EoD' order by timeclock_id desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'01053',$VD_login,$server_ip,$session_name,$one_mysql_log);} + $events_to_parse = mysql_num_rows($rslt); + if ($events_to_parse > 0) + { + $rowx=mysql_fetch_row($rslt); + $last_agent_event = $rowx[0]; + } + if ($DB>0) {echo "|$stmt|$events_to_parse|$last_agent_event|";} + if ( (strlen($last_agent_event)<2) or (ereg('LOGOUT',$last_agent_event)) ) + { + $VDloginDISPLAY=1; + $VDdisplayMESSAGE = "YOU MUST LOG IN TO THE TIMECLOCK FIRST
"; + } + } + ### END - CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR + + if ($WeBRooTWritablE > 0) { fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); diff --git a/www/vicidial/AST_IVRfilter.php b/www/vicidial/AST_IVRfilter.php index 867ea1a0..2cab8e01 100644 --- a/www/vicidial/AST_IVRfilter.php +++ b/www/vicidial/AST_IVRfilter.php @@ -202,12 +202,12 @@ else {$UpsalePERCENT = (($rowD[1] / $Utotal) * 100); $UpsalePERCENT = round($UpsalePERCENT, 2);} $UpsalePERCENT = sprintf("%6s", $UpsalePERCENT); -$archv = sprintf("%7s", $rowD[0]); -$Uarchv = sprintf("%7s", $rowD[1]); -if ( ($Utotal < 1) or ($rowD[1] < 1) ) +$archv = sprintf("%7s", $rowE[0]); +$Uarchv = sprintf("%7s", $rowE[1]); +if ( ($Utotal < 1) or ($rowE[1] < 1) ) {$UarchvPERCENT = '0';} else - {$UarchvPERCENT = (($rowD[1] / $Utotal) * 100); $UarchvPERCENT = round($UarchvPERCENT, 2);} + {$UarchvPERCENT = (($rowE[1] / $Utotal) * 100); $UarchvPERCENT = round($UarchvPERCENT, 2);} $UarchvPERCENT = sprintf("%6s", $UarchvPERCENT); $total = sprintf("%7s", $total);