diff --git a/docs/TIMECLOCK_PROCESS.txt b/docs/TIMECLOCK_PROCESS.txt index d35df405..2ecfbf76 100644 --- a/docs/TIMECLOCK_PROCESS.txt +++ b/docs/TIMECLOCK_PROCESS.txt @@ -19,6 +19,12 @@ The first new feature to be added to help with the overall adoption of this feat To facilitate more workforce management, as is desired with the addition of a timeclock function to VICIDIAL, I have decided to add a SHIFT structure to the system as well. This should allow for scheduling of user_groups of agents and will have the ability to not allow them to login if they try to login outside of their scheduled hours. A shift will have a start time and a length(to make running over midnight easier) as well as a list of the days of the week that the shift applies. Each user-group can have multiple shifts activated for it, for instance you may want a Monday-Friday shift of 9AM-5PM and a Saturday shift of 10AM to 4PM. In this case the user-group would have two shifts selected. Some reports will also be viewable by shift as well. + +Newly Created Scripts: +timeclock.php - linked to from vicidial.php/admin.php/welcome.php to give easy access for users to use the timeclock and then go back to what they were doing. + + + More to come... @@ -49,7 +55,7 @@ ALTER TABLE vicidial_user_groups ADD group_shifts TEXT; CREATE TABLE vicidial_timeclock_log ( timeclock_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, event_epoch INT(10) UNSIGNED NOT NULL, -event_date TIMESTAMP NOT NULL, +event_date DATETIME NOT NULL, login_sec INT(10) UNSIGNED, event VARCHAR(50) NOT NULL, user VARCHAR(20) NOT NULL, @@ -59,6 +65,8 @@ shift_id VARCHAR(20), notes VARCHAR(255), manager_user VARCHAR(20), manager_ip VARCHAR(15), +event_datestamp TIMESTAMP NOT NULL, +tcid_link INT(9) UNSIGNED, index (user) ); @@ -73,4 +81,3 @@ ip_address VARCHAR(15), shift_id VARCHAR(20), index (user) ); - diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 75a7bbba..5b36deb3 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -1084,7 +1084,7 @@ index (shift_id) CREATE TABLE vicidial_timeclock_log ( timeclock_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, event_epoch INT(10) UNSIGNED NOT NULL, -event_date TIMESTAMP NOT NULL, +event_date DATETIME NOT NULL, login_sec INT(10) UNSIGNED, event VARCHAR(50) NOT NULL, user VARCHAR(20) NOT NULL, @@ -1094,6 +1094,8 @@ shift_id VARCHAR(20), notes VARCHAR(255), manager_user VARCHAR(20), manager_ip VARCHAR(15), +event_datestamp TIMESTAMP NOT NULL, +tcid_link INT(9) UNSIGNED, index (user) ); @@ -1157,5 +1159,5 @@ INSERT INTO vicidial_state_call_times SET state_call_time_id='utah',state_call_t INSERT INTO vicidial_state_call_times SET state_call_time_id='washington',state_call_time_state='WA',state_call_time_name='Washington 8am',sct_default_start='800',sct_default_stop='2100'; INSERT INTO vicidial_state_call_times SET state_call_time_id='wyoming',state_call_time_state='WY',state_call_time_name='Wyoming 8am-8pm',sct_default_start='800',sct_default_stop='2000'; -UPDATE system_settings SET db_schema_version='1086'; +UPDATE system_settings SET db_schema_version='1087'; diff --git a/extras/upgrade_2.0.5.sql b/extras/upgrade_2.0.5.sql index 612eb8de..f7bca5ec 100644 --- a/extras/upgrade_2.0.5.sql +++ b/extras/upgrade_2.0.5.sql @@ -183,3 +183,9 @@ index (user) ); UPDATE system_settings SET db_schema_version='1086'; + +ALTER TABLE vicidial_timeclock_log MODIFY event_date DATETIME; +ALTER TABLE vicidial_timeclock_log ADD event_datestamp TIMESTAMP NOT NULL; +ALTER TABLE vicidial_timeclock_log ADD tcid_link INT(9) UNSIGNED; + +UPDATE system_settings SET db_schema_version='1087'; diff --git a/www/agc/timeclock.php b/www/agc/timeclock.php index 6da8b6f6..6a5ebfbc 100644 --- a/www/agc/timeclock.php +++ b/www/agc/timeclock.php @@ -5,10 +5,11 @@ # # CHANGELOG # 80523-0134 - First Build +# 80524-0225 - Changed event_date to DATETIME, added timestamp field and tcid_link field # -$version = '2.0.5-1'; -$build = '80523-0134'; +$version = '2.0.5-2'; +$build = '80524-0225'; $StarTtimE = date("U"); $NOW_TIME = date("Y-m-d H:i:s"); @@ -264,7 +265,7 @@ if ( ($stage == 'login') or ($stage == 'logout') ) $LOGtimeMESSAGE = "You logged in at $NOW_TIME"; ### Add a record to the timeclock log - $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';"; + $stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $affected_rows = mysql_affected_rows($link); @@ -284,14 +285,15 @@ if ( ($stage == 'login') or ($stage == 'logout') ) $LOGtimeMESSAGE = "You logged out at $NOW_TIME
Amount of time you were logged-in: $totTIME_HMS"; ### Add a record to the timeclock log - $stmt="INSERT INTO vicidial_timeclock_log set event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec';"; + $stmt="INSERT INTO vicidial_timeclock_log set event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $affected_rows = mysql_affected_rows($link); - print "\n"; + $timeclock_id = mysql_insert_id($link); + print "\n"; ### Update last login record in the timeclock log - $stmt="UPDATE vicidial_timeclock_log set login_sec='$last_action_sec' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;"; + $stmt="UPDATE vicidial_timeclock_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); $affected_rows = mysql_affected_rows($link);