diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql
index 83c52232..0306a3e3 100644
--- a/extras/MySQL_AST_CREATE_tables.sql
+++ b/extras/MySQL_AST_CREATE_tables.sql
@@ -494,7 +494,8 @@ group_name VARCHAR(40) NOT NULL,
allowed_campaigns TEXT,
qc_allowed_campaigns TEXT,
qc_allowed_inbound_groups TEXT,
-group_shifts TEXT
+group_shifts TEXT,
+forced_timeclock_login ENUM('Y','N','ADMIN_EXEMPT') default 'N'
);
CREATE TABLE vicidial_campaigns (
@@ -1346,7 +1347,7 @@ CREATE INDEX phone_number on vicidial_xfer_log (phone_number);
CREATE INDEX phone_number on vicidial_closer_log (phone_number);
CREATE INDEX date_user on vicidial_closer_log (call_date,user);
-UPDATE system_settings SET db_schema_version='1116';
+UPDATE system_settings SET db_schema_version='1117';
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
diff --git a/extras/upgrade_2.0.5.sql b/extras/upgrade_2.0.5.sql
index 59987bd5..2b95359d 100644
--- a/extras/upgrade_2.0.5.sql
+++ b/extras/upgrade_2.0.5.sql
@@ -526,3 +526,7 @@ UPDATE system_settings SET db_schema_version='1115';
ALTER TABLE vicidial_campaigns ADD three_way_dial_prefix VARCHAR(20) default '';
UPDATE system_settings SET db_schema_version='1116';
+
+ALTER TABLE vicidial_user_groups ADD forced_timeclock_login ENUM('Y','N','ADMIN_EXEMPT') default 'N';
+
+UPDATE system_settings SET db_schema_version='1117';
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 d0515fae..5e98c24d 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
@@ -336,6 +336,8 @@ INBOUND_MAN allows the agent to place manual dial calls from a campaign list whi
FORCE will force the agents to choose a PAUSE code if they click on the PAUSE button||
3-Way Call Dial Prefix -<\/B> This defines what is used as the dial prefix for 3-way calls, default is empty so the campaign dial prefix is used, passthru so you can hear ringing is 88||
3-Way Call Dial Prefix||
+Force Timeclock Login -<\/B> This option allows you to not let an agent log in to the VICIDIAL agent interface if they have not logged into the timeclock. Default is N. There is an option to exempt admin users, levels 8 and 9||
+Force Timeclock Login||
############################################################ CLIENT
@@ -372,6 +374,7 @@ Active: ||
Alt Count: ||
Change this phone number to INACTIVE||
Change this phone number to ACTIVE||
+YOU MUST LOG IN TO THE TIMECLOCK FIRST||
############################################################ MANAGER Manual
diff --git a/www/agc/vdc_db_query.php b/www/agc/vdc_db_query.php
index b7553c8e..aaf19eac 100644
--- a/www/agc/vdc_db_query.php
+++ b/www/agc/vdc_db_query.php
@@ -169,10 +169,11 @@
# 81020-1459 - Fixed bugs in queue_log logging
# 81104-0134 - Added mysql error logging capability
# 81104-1617 - Added multi-retry for some vicidial_live_agents table MySQL queries
+# 81106-0410 - Added force_timeclock_login option to LoginCampaigns function
#
-$version = '2.0.5-87';
-$build = '81104-1617';
+$version = '2.0.5-88';
+$build = '81106-0410';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=180;
$one_mysql_log=0;
@@ -342,7 +343,7 @@ $agents='@agents';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
-$stmt = "SELECT use_non_latin FROM system_settings;";
+$stmt = "SELECT use_non_latin,timeclock_end_of_day FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -351,7 +352,8 @@ $i=0;
while ($i < $qm_conf_ct)
{
$row=mysql_fetch_row($rslt);
- $non_latin = $row[0];
+ $non_latin = $row[0];
+ $timeclock_end_of_day = $row[1];
$i++;
}
##### END SETTINGS LOOKUP #####
@@ -439,52 +441,93 @@ echo "
if ($ACTION == 'LogiNCamPaigns')
{
if ( (strlen($user)<1) )
- {
- echo "\n";
- echo "-- ERROR -- \n";
- echo " \n";
- exit;
- }
+ {
+ echo "\n";
+ echo "-- ERROR -- \n";
+ echo " \n";
+ exit;
+ }
else
- {
- echo "\n";
- echo "-- PLEASE SELECT A CAMPAIGN -- \n";
-
- $stmt="SELECT user_group from vicidial_users where user='$user' and pass='$pass'";
- if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00004',$user,$server_ip,$session_name,$one_mysql_log);}
- $row=mysql_fetch_row($rslt);
- $VU_user_group=$row[0];
-
- $LOGallowed_campaignsSQL='';
-
- $stmt="SELECT allowed_campaigns 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,'00005',$user,$server_ip,$session_name,$one_mysql_log);}
- $row=mysql_fetch_row($rslt);
- if ( (!eregi("ALL-CAMPAIGNS",$row[0])) )
{
- $LOGallowed_campaignsSQL = eregi_replace(' -','',$row[0]);
- $LOGallowed_campaignsSQL = eregi_replace(' ',"','",$LOGallowed_campaignsSQL);
- $LOGallowed_campaignsSQL = "and campaign_id IN('$LOGallowed_campaignsSQL')";
- }
+ $stmt="SELECT user_group,user_level from vicidial_users where user='$user' and pass='$pass'";
+ if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00004',$user,$server_ip,$session_name,$one_mysql_log);}
+ $row=mysql_fetch_row($rslt);
+ $VU_user_group=$row[0];
+ $VU_user_level=$row[1];
- $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id";
- $rslt=mysql_query($stmt, $link);
- if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00006',$user,$server_ip,$session_name,$one_mysql_log);}
- $camps_to_print = mysql_num_rows($rslt);
+ $LOGallowed_campaignsSQL='';
- $o=0;
- while ($camps_to_print > $o)
- {
- $rowx=mysql_fetch_row($rslt);
- echo "$rowx[0] - $rowx[1] \n";
- $o++;
+ $stmt="SELECT allowed_campaigns,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,'00005',$user,$server_ip,$session_name,$one_mysql_log);}
+ $row=mysql_fetch_row($rslt);
+ $forced_timeclock_login = $row[1];
+ if ( (!eregi("ALL-CAMPAIGNS",$row[0])) )
+ {
+ $LOGallowed_campaignsSQL = eregi_replace(' -','',$row[0]);
+ $LOGallowed_campaignsSQL = eregi_replace(' ',"','",$LOGallowed_campaignsSQL);
+ $LOGallowed_campaignsSQL = "and campaign_id IN('$LOGallowed_campaignsSQL')";
+ }
+
+ $show_campaign_list=1;
+ ### CHECK TO SEE IF AGENT IS LOGGED IN TO TIMECLOCK, IF NOT, OUTPUT ERROR
+ 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='$user' and event_epoch >= '$EoD' order by timeclock_id desc limit 1;";
+ if ($DB>0) {echo "|$stmt|";}
+ $rslt=mysql_query($stmt, $link);
+ $events_to_parse = mysql_num_rows($rslt);
+ if ($events_to_parse > 0)
+ {
+ $rowx=mysql_fetch_row($rslt);
+ $last_agent_event = $rowx[0];
+ }
+ if ( (strlen($last_agent_event)<2) or (ereg('LOGOUT',$last_agent_event)) )
+ {$show_campaign_list=0;}
+ }
+
+ if ($show_campaign_list > 0)
+ {
+ $stmt="SELECT campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id";
+ $rslt=mysql_query($stmt, $link);
+ if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00006',$user,$server_ip,$session_name,$one_mysql_log);}
+ $camps_to_print = mysql_num_rows($rslt);
+
+ echo "\n";
+ echo "-- PLEASE SELECT A CAMPAIGN -- \n";
+
+ $o=0;
+ while ($camps_to_print > $o)
+ {
+ $rowx=mysql_fetch_row($rslt);
+ echo "$rowx[0] - $rowx[1] \n";
+ $o++;
+ }
+ echo " \n";
+ }
+ else
+ {
+ echo "\n";
+ echo "-- YOU MUST LOG IN TO THE TIMECLOCK FIRST -- \n";
+ echo " \n";
+ }
+ exit;
}
- echo " \n";
- exit;
- }
}
diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php
index a0172fd2..8fadb03b 100644
--- a/www/agc/vicidial.php
+++ b/www/agc/vicidial.php
@@ -204,10 +204,11 @@
# 81103-1427 - Added 3way call dial prefix
# 81104-0140 - Added mysql error logging capability
# 81104-1618 - Changed MySQL queries logging
+# 81106-0411 - Changedthe campaign login list behaviour
#
-$version = '2.0.5-183';
-$build = '81104-1618';
+$version = '2.0.5-184';
+$build = '81106-0411';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=51;
$one_mysql_log=0;
@@ -439,10 +440,16 @@ while ($camps_to_print > $o)
if ( (eregi("$VD_campaign",$rowx[0])) and (strlen($VD_campaign) == strlen($rowx[0])) )
{$camp_form_code .= "$rowx[0]$campname \n";}
else
- {$camp_form_code .= "$rowx[0]$campname \n";}
+ {
+ if (!ereg('login_allowable_campaigns',$camp_form_code))
+ {$camp_form_code .= "$rowx[0]$campname \n";}
+ }
}
else
- {$camp_form_code .= "$rowx[0]$campname \n";}
+ {
+ if (!ereg('login_allowable_campaigns',$camp_form_code))
+ {$camp_form_code .= "$rowx[0]$campname \n";}
+ }
$o++;
}
$camp_form_code .= "\n";
@@ -535,8 +542,9 @@ echo "User Password: ";
echo " \n";
echo "Campaign: ";
-echo "$camp_form_code \n";
-echo " \n";
+echo "$camp_form_code \n";
+echo " \n";
+echo " \n";
echo " VERSION: $version BUILD: $build \n";
echo "\n";
echo "\n\n";
diff --git a/www/vicidial/AST_CLOSERstats.php b/www/vicidial/AST_CLOSERstats.php
index 1758ac65..b5dc38c7 100644
--- a/www/vicidial/AST_CLOSERstats.php
+++ b/www/vicidial/AST_CLOSERstats.php
@@ -16,6 +16,7 @@
# 80722-2149 - Added Status Category stats
# 81015-0705 - Added IVR calls count
# 81024-0037 - Added multi-select inbound-groups
+# 81105-2118 - Added Answered calls 15-minute breakdown
#
require("dbconnect.php");
@@ -577,7 +578,8 @@ $ad99 = sprintf("%5s", $ad99);
$BDansweredCALLS = sprintf("%10s", $BDansweredCALLS);
-echo "| $ad_0 $ad_5 $ad10 $ad15 $ad20 $ad25 $ad30 $ad35 $ad40 $ad45 $ad50 $ad55 $ad60 $ad90 $ad99 | $BDansweredCALLS |\n";
+$answeredTOTALs = "$ad_0 $ad_5 $ad10 $ad15 $ad20 $ad25 $ad30 $ad35 $ad40 $ad45 $ad50 $ad55 $ad60 $ad90 $ad99 | $BDansweredCALLS |";
+echo "| $answeredTOTALs\n";
echo "+-------------------------------------------------------------------------------------------+------------+\n";
@@ -1165,6 +1167,114 @@ echo "+------+------------------------------------------------------------------
+
+##############################
+######### CALL ANSWERED TIME BREAKDOWN IN SECONDS
+
+$BDansweredCALLS = 0;
+
+echo "\n";
+echo "---------- CALL ANSWERED TIME BREAKDOWN IN SECONDS\n";
+echo "+------+-------------------------------------------------------------------------------------------+------------+\n";
+echo "| HOUR | 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n";
+echo "+------+-------------------------------------------------------------------------------------------+------------+\n";
+
+
+
+
+$ZZ = '00';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+
+while ($i <= 96)
+ {
+ $char_counter=0;
+ $time = ' ';
+ if ($h >= 4)
+ {
+ $hour++;
+ $h=0;
+ if ($hour < 10) {$hour = "0$hour";}
+ $time = "+$hour$ZZ+";
+ $SQLtime = "$hour:$ZZ:00";
+ $SQLtimeEND = "$hour:15:00";
+ }
+ if ($h == 1) {$time = " 15 "; $SQLtime = "$hour:15:00"; $SQLtimeEND = "$hour:30:00";}
+ if ($h == 2) {$time = " 30 "; $SQLtime = "$hour:30:00"; $SQLtimeEND = "$hour:45:00";}
+ if ($h == 3)
+ {
+ $time = " 45 ";
+ $SQLtime = "$hour:45:00";
+ $hourEND = ($hour + 1);
+ if ($hourEND < 10) {$hourEND = "0$hourEND";}
+ if ($hourEND > 23) {$SQLtimeEND = "23:59:59";}
+ else {$SQLtimeEND = "$hourEND:00:00";}
+ }
+
+ $ad_0=0; $ad_5=0; $ad10=0; $ad15=0; $ad20=0; $ad25=0; $ad30=0; $ad35=0;
+ $ad40=0; $ad45=0; $ad50=0; $ad55=0; $ad60=0; $ad90=0; $ad99=0; $BDansweredCALLS=0;
+
+ $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date $SQLtime' and call_date < '$query_date $SQLtimeEND' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE') group by queue_seconds;";
+ $rslt=mysql_query($stmt, $link);
+ if ($DB) {echo "$stmt\n";}
+ $reasons_to_print = mysql_num_rows($rslt);
+ $j=0;
+ while ($j < $reasons_to_print)
+ {
+ $row=mysql_fetch_row($rslt);
+
+ $BDansweredCALLS = ($BDansweredCALLS + $row[0]);
+
+ if ($row[1] == 0) {$ad_0 = ($ad_0 + $row[0]);}
+ if ( ($row[1] > 0) and ($row{1} <= 5) ) {$ad_5 = ($ad_5 + $row[0]);}
+ if ( ($row[1] > 5) and ($row{1} <= 10) ) {$ad10 = ($ad10 + $row[0]);}
+ if ( ($row[1] > 10) and ($row{1} <= 15) ) {$ad15 = ($ad15 + $row[0]);}
+ if ( ($row[1] > 15) and ($row{1} <= 20) ) {$ad20 = ($ad20 + $row[0]);}
+ if ( ($row[1] > 20) and ($row{1} <= 25) ) {$ad25 = ($ad25 + $row[0]);}
+ if ( ($row[1] > 25) and ($row{1} <= 30) ) {$ad30 = ($ad30 + $row[0]);}
+ if ( ($row[1] > 30) and ($row{1} <= 35) ) {$ad35 = ($ad35 + $row[0]);}
+ if ( ($row[1] > 35) and ($row{1} <= 40) ) {$ad40 = ($ad40 + $row[0]);}
+ if ( ($row[1] > 40) and ($row{1} <= 45) ) {$ad45 = ($ad45 + $row[0]);}
+ if ( ($row[1] > 45) and ($row{1} <= 50) ) {$ad50 = ($ad50 + $row[0]);}
+ if ( ($row[1] > 50) and ($row{1} <= 55) ) {$ad55 = ($ad55 + $row[0]);}
+ if ( ($row[1] > 55) and ($row{1} <= 60) ) {$ad60 = ($ad60 + $row[0]);}
+ if ( ($row[1] > 60) and ($row{1} <= 90) ) {$ad90 = ($ad90 + $row[0]);}
+ if ($row[1] > 90) {$ad99 = ($ad99 + $row[0]);}
+ $j++;
+ }
+
+ $ad_0 = sprintf("%5s", $ad_0);
+ $ad_5 = sprintf("%5s", $ad_5);
+ $ad10 = sprintf("%5s", $ad10);
+ $ad15 = sprintf("%5s", $ad15);
+ $ad20 = sprintf("%5s", $ad20);
+ $ad25 = sprintf("%5s", $ad25);
+ $ad30 = sprintf("%5s", $ad30);
+ $ad35 = sprintf("%5s", $ad35);
+ $ad40 = sprintf("%5s", $ad40);
+ $ad45 = sprintf("%5s", $ad45);
+ $ad50 = sprintf("%5s", $ad50);
+ $ad55 = sprintf("%5s", $ad55);
+ $ad60 = sprintf("%5s", $ad60);
+ $ad90 = sprintf("%5s", $ad90);
+ $ad99 = sprintf("%5s", $ad99);
+
+ $BDansweredCALLS = sprintf("%10s", $BDansweredCALLS);
+
+ echo "|$time| $ad_0 $ad_5 $ad10 $ad15 $ad20 $ad25 $ad30 $ad35 $ad40 $ad45 $ad50 $ad55 $ad60 $ad90 $ad99 | $BDansweredCALLS |\n";
+
+
+ $i++;
+ $h++;
+ }
+
+echo "+------+-------------------------------------------------------------------------------------------+------------+\n";
+echo "|TOTALS| $answeredTOTALs\n";
+echo "+------+-------------------------------------------------------------------------------------------+------------+\n";
+
+
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\nRun Time: $RUNtime seconds\n";
diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php
index 9b15bd7d..7975db3f 100644
--- a/www/vicidial/admin.php
+++ b/www/vicidial/admin.php
@@ -847,6 +847,8 @@ if (isset($_GET["three_way_call_cid"])) {$three_way_call_cid=$_GET["three_way
elseif (isset($_POST["three_way_call_cid"])) {$three_way_call_cid=$_POST["three_way_call_cid"];}
if (isset($_GET["three_way_dial_prefix"])) {$three_way_dial_prefix=$_GET["three_way_dial_prefix"];}
elseif (isset($_POST["three_way_dial_prefix"])) {$three_way_dial_prefix=$_POST["three_way_dial_prefix"];}
+if (isset($_GET["forced_timeclock_login"])) {$forced_timeclock_login=$_GET["forced_timeclock_login"];}
+ elseif (isset($_POST["forced_timeclock_login"])) {$forced_timeclock_login=$_POST["forced_timeclock_login"];}
if (isset($script_id)) {$script_id= strtoupper($script_id);}
@@ -1211,6 +1213,7 @@ $three_way_call_cid = ereg_replace("[^-\_0-9a-zA-Z]","",$three_way_call_cid);
### ALPHA-NUMERIC and underscore and dash and comma
$logins_list = ereg_replace("[^-\,\_0-9a-zA-Z]","",$logins_list);
+$forced_timeclock_login = ereg_replace("[^-\,\_0-9a-zA-Z]","",$forced_timeclock_login);
### ALPHA-NUMERIC and spaces
$lead_order = ereg_replace("[^ 0-9a-zA-Z]","",$lead_order);
@@ -3565,6 +3568,11 @@ echo "
Group Name - This is the description of the vicidial user group max of 40 characters.
+
+
+
+Force Timeclock Login - This option allows you to not let an agent log in to the VICIDIAL agent interface if they have not logged into the timeclock. Default is N. There is an option to exempt admin users, levels 8 and 9.
+
@@ -8546,7 +8554,7 @@ if ($ADD==411111)
$GROUP_shifts .= "$group_shifts[$p] ";
$p++;
}
- $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name',allowed_campaigns='$campaigns_value',qc_allowed_campaigns='$qc_campaigns_value',qc_allowed_inbound_groups='$qc_groups_value',group_shifts='$GROUP_shifts' where user_group='$OLDuser_group';";
+ $stmt="UPDATE vicidial_user_groups set user_group='$user_group', group_name='$group_name',allowed_campaigns='$campaigns_value',qc_allowed_campaigns='$qc_campaigns_value',qc_allowed_inbound_groups='$qc_groups_value',group_shifts='$GROUP_shifts',forced_timeclock_login='$forced_timeclock_login' where user_group='$OLDuser_group';";
$rslt=mysql_query($stmt, $link);
echo "USER GROUP MODIFIED \n";
@@ -13984,9 +13992,10 @@ if ($ADD==311111)
$stmt="SELECT * from vicidial_user_groups where user_group='$user_group';";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
- $user_group = $row[0];
- $group_name = $row[1];
- $GROUP_shifts = $row[5];
+ $user_group = $row[0];
+ $group_name = $row[1];
+ $GROUP_shifts = $row[5];
+ $forced_timeclock_login = $row[6];
echo "";
echo " MODIFY A USERS GROUP ENTRY