From ff5360862e3f5650cc16c499ca1d674d6f2bdc4c Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 16 May 2008 09:25:09 +0000 Subject: [PATCH] added new closer/inbound service level report started work on timeclock feature, added auto-generate UserIDs and shifts to admin.php git-svn-id: svn://192.168.202.10@864 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 5 + bin/ADMIN_backup.pl | 1 - bin/AST_conf_update.pl | 135 ++- docs/BASE_INSTALL.txt | 8 +- docs/REQUIRED_APPS_INSTALL.txt | 10 +- docs/SCRATCH_INSTALL.txt | 8 +- docs/TIMECLOCK_PROCESS.txt | 79 ++ extras/MySQL_AST_CREATE_tables.sql | 20 +- extras/upgrade_2.0.5.sql | 16 + .../TO_BE_TRANSLATED_2.0.5.txt | 42 + www/agc/manager_send.php | 175 ++++ www/vicidial/AST_CLOSER_service_level.php | 894 ++++++++++++++++++ www/vicidial/AST_CLOSERstats.php | 32 +- www/vicidial/AST_VDADstats.php | 26 +- www/vicidial/admin.php | 663 ++++++++++++- www/vicidial/new_listloader_superL.php | 19 +- 16 files changed, 2041 insertions(+), 92 deletions(-) create mode 100644 docs/TIMECLOCK_PROCESS.txt create mode 100644 www/vicidial/AST_CLOSER_service_level.php diff --git a/UPGRADE b/UPGRADE index d2f33285..ba874347 100644 --- a/UPGRADE +++ b/UPGRADE @@ -108,6 +108,11 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom 21. Added collection of hangup reasons for inbound and outbound calls in the vicidial_log and vicidial_closer_log tables +22. The start of a new timeclock feature (not finished), including the addition + of shifts to VICIDIAL user groups and the ability to auto-generate + user IDs as you are adding users to the system. + +23. Added a new inbound/closer report for showing service levels diff --git a/bin/ADMIN_backup.pl b/bin/ADMIN_backup.pl index a5bc9b8c..dff736cd 100644 --- a/bin/ADMIN_backup.pl +++ b/bin/ADMIN_backup.pl @@ -42,7 +42,6 @@ if (length($ARGV[0])>1) if ($args =~ /--help/i) { print "allowed run time options:\n"; - print " [--all] = *DEFAULT* show GMT offset of records as they are inserted into hopper\n"; print " [--db-only] = only backup the database\n"; print " [--conf-only] = only backup the asterisk conf files\n"; print " [--without-db] = do not backup the database\n"; diff --git a/bin/AST_conf_update.pl b/bin/AST_conf_update.pl index 6558ed25..9a1b7a0d 100644 --- a/bin/AST_conf_update.pl +++ b/bin/AST_conf_update.pl @@ -2,27 +2,7 @@ # # AST_conf_update.pl version 2.0.5 *DBI-version* # -# DESCRIPTION: -# uses the Asterisk Manager interface and Net::MySQL to update whether a conference -# is still in use or not. If not in use 3 times in a row the extension in the -# conferences DB record is erased freeing that conference to be used again -# -# SUMMARY: -# This program was designed for people using the Asterisk PBX with conferences -# -# This program should be in the cron running every minute (like AST_vm_update.pl) -# -# For this program to work you need to have the "asterisk" MySQL database -# created with the conferences table in it, also make sure -# that the account running this program has read/write/update/delete access -# to that database -# -# It is recommended that you run this program on the local Asterisk machine -# -# If this script is run ever minute there is a theoretical limit of -# 600 conferences that it can check due to the wait interval. If you have -# more than this either change the cron when this script is run or change the -# wait interval below +# This script checks if there are channels in reserved conferences # # Copyright (C) 2008 Matt Florell LICENSE: AGPLv2 # @@ -30,6 +10,7 @@ # 50823-1456 - Added commandline arguments for debug at runtime # 60717-1135 - changed to DBI by Marin Blu # 60717-1536 - changed to use /etc/astguiclient.conf for configs +# 80506-1055 - Added check for vicidial_conferences in 3WAY # # constants @@ -157,7 +138,116 @@ if ($sthArows > 0) $sthA->finish(); +###################################################################### +##### CHECK vicidial_conferences TABLE ##### +###################################################################### +@PTextensions=@MT; @PT_conf_extens=@MT; @PTmessages=@MT; @PTold_messages=@MT; @NEW_messages=@MT; @OLD_messages=@MT; +$stmtA = "SELECT extension,conf_exten from vicidial_conferences where server_ip='$server_ip' and extension LIKE \"3WAY%\";"; +if ($DB) {print "|$stmtA|\n";} +$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; +$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; +$sthArows=$sthA->rows; +$rec_count=0; +while ($sthArows > $rec_count) + { + @aryA = $sthA->fetchrow_array; + $PTextensions[$rec_count] = "$aryA[0]"; + $PT_conf_extens[$rec_count] = "$aryA[1]"; + if ($DB) {print "|$PT_conf_extens[$rec_count]|$PTextensions[$rec_count]|\n";} + $rec_count++; + } + $sthA->finish(); +if (!$telnet_port) {$telnet_port = '5038';} + +### connect to asterisk manager through telnet +$t = new Net::Telnet (Port => $telnet_port, + Prompt => '/.*[\$%#>] $/', + Output_record_separator => '',); +#$fh = $t->dump_log("$telnetlog"); # uncomment for telnet log + if (length($ASTmgrUSERNAMEsend) > 3) {$telnet_login = $ASTmgrUSERNAMEsend;} + else {$telnet_login = $ASTmgrUSERNAME;} + +$t->open("$telnet_host"); +$t->waitfor('/[01]\n$/'); # print login +$t->print("Action: Login\nUsername: $telnet_login\nSecret: $ASTmgrSECRET\n\n"); +$t->waitfor('/Authentication accepted/'); # waitfor auth accepted + + +$i=0; +foreach(@PTextensions) + { + @list_channels=@MT; + $t->buffer_empty; + $COMMAND = "Action: Command\nCommand: Meetme list $PT_conf_extens[$i]\n\nAction: Ping\n\n"; + if ($DB) {print "|$PT_conf_extens[$i]|$COMMAND|\n";} + @list_channels = $t->cmd(String => "$COMMAND", Prompt => '/Response: Pong.*/'); + + + $j=0; + $conf_empty[$i]=0; + $conf_users[$i]=''; + foreach(@list_channels) + { + if($DB){print "|$list_channels[$j]|\n";} + if ($list_channels[$j] =~ /No active conferences|No such conference/i) + {$conf_empty[$i]++;} +# if ($list_channels[$j] =~ /^User /i) +# { +# $userx = ''; +# $userx = $list_channels[$j]; +# $userx =~ s/User \#: //gi; +# $conf_users[$i] .= "$userx|"; +# } + $j++; + } + + if($DB){print "Meetme list $PT_conf_extens[$i]- Exten:|$PTextensions[$i]| Empty:|$conf_empty[$i]| ";} + if (!$conf_empty[$i]) + { + if($DB){print "CONFERENCE STILL HAS PARTICIPANTS, DOING NOTHING FOR THIS CONFERENCE\n";} + if ($PTextensions[$i] =~ /Xtimeout\d$/i) + { + $PTextensions[$i] =~ s/Xtimeout\d$//gi; + $stmtA = "UPDATE vicidial_conferences set extension='$PTextensions[$i]' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + } + } + else + { + $NEWexten[$i] = $PTextensions[$i]; + if ($PTextensions[$i] =~ /Xtimeout3$/i) {$NEWexten[$i] =~ s/Xtimeout3$/Xtimeout2/gi;} + if ($PTextensions[$i] =~ /Xtimeout2$/i) {$NEWexten[$i] =~ s/Xtimeout2$/Xtimeout1/gi;} + if ($PTextensions[$i] =~ /Xtimeout1$/i) {$NEWexten[$i] = '';} + if ( ($PTextensions[$i] !~ /Xtimeout\d$/i) and (length($PTextensions[$i])> 0) ) {$NEWexten[$i] .= 'Xtimeout3';} + + + $stmtA = "UPDATE vicidial_conferences set extension='$NEWexten[$i]' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n"; + } + + $i++; + ### sleep for 10 hundredths of a second + usleep(1*100*1000); + } + +$t->buffer_empty; +@hangup = $t->cmd(String => "Action: Logoff\n\n", Prompt => "/.*/"); +$t->buffer_empty; +$ok = $t->close; + + +sleep(5); + + + + + +###################################################################### +##### CHECK conferences TABLE ##### +###################################################################### @PTextensions=@MT; @PT_conf_extens=@MT; @PTmessages=@MT; @PTold_messages=@MT; @NEW_messages=@MT; @OLD_messages=@MT; $stmtA = "SELECT extension,conf_exten from conferences where server_ip='$server_ip' and extension is NOT NULL and extension != '';"; if ($DB) {print "|$stmtA|\n";} @@ -262,6 +352,3 @@ if($DB){print "DONE... Exiting... Goodbye... See you later... \n";} exit; - - - diff --git a/docs/BASE_INSTALL.txt b/docs/BASE_INSTALL.txt index 4288acdb..c2e6c635 100644 --- a/docs/BASE_INSTALL.txt +++ b/docs/BASE_INSTALL.txt @@ -32,15 +32,15 @@ PHASE 1: INSTALLING ASTERISK mkdir /usr/src/asterisk cd /usr/src/asterisk wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.27.tar.gz -wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.24.tar.gz +wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.25.tar.gz wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.7.tar.gz gunzip asterisk-1.2.27.tar.gz tar xvf asterisk-1.2.27.tar -gunzip zaptel-1.2.24.tar.gz -tar xvf zaptel-1.2.24.tar +gunzip zaptel-1.2.25.tar.gz +tar xvf zaptel-1.2.25.tar gunzip libpri-1.2.7.tar.gz tar xvf libpri-1.2.7.tar -cd ./zaptel-1.2.24 +cd ./zaptel-1.2.25 wget http://www.freedomphones.net/files/newt-0.51.6.tar.gz gunzip newt-0.51.6.tar.gz tar xvf newt-0.51.6.tar diff --git a/docs/REQUIRED_APPS_INSTALL.txt b/docs/REQUIRED_APPS_INSTALL.txt index bb5c1d61..2bacaf97 100644 --- a/docs/REQUIRED_APPS_INSTALL.txt +++ b/docs/REQUIRED_APPS_INSTALL.txt @@ -505,16 +505,16 @@ rm -f /usr/lib/asterisk/modules/res_speech.so mkdir /usr/src/asterisk-1.4 cd /usr/src/asterisk-1.4 -wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.18.tar.gz -wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.8.tar.gz +wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.19.tar.gz +wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.9.tar.gz wget http://ftp.digium.com/pub/libpri/releases/libpri-1.4.3.tar.gz gunzip asterisk-1.4.18.tar.gz tar xvf asterisk-1.4.18.tar -gunzip zaptel-1.4.8.tar.gz -tar xvf zaptel-1.4.8.tar +gunzip zaptel-1.4.9.tar.gz +tar xvf zaptel-1.4.9.tar gunzip libpri-1.4.3.tar.gz tar xvf libpri-1.4.3.tar -cd ./zaptel-1.4.8 +cd ./zaptel-1.4.9 ./configure make make install diff --git a/docs/SCRATCH_INSTALL.txt b/docs/SCRATCH_INSTALL.txt index 43e0a986..1fe9bde9 100644 --- a/docs/SCRATCH_INSTALL.txt +++ b/docs/SCRATCH_INSTALL.txt @@ -893,12 +893,12 @@ with the following patch: - cd /usr/src/asterisk A. if you want 1.2 release (reliable with new features): - wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.2.27.tar.gz - - wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.24.tar.gz + - wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.2.25.tar.gz - wget http://ftp.digium.com/pub/libpri/releases/libpri-1.2.5.tar.gz - gunzip asterisk-1.2.27.tar.gz - tar xvf asterisk-1.2.27.tar - - gunzip zaptel-1.2.24.tar.gz - - tar xvf zaptel-1.2.24.tar + - gunzip zaptel-1.2.25.tar.gz + - tar xvf zaptel-1.2.25.tar - gunzip libpri-1.2.5.tar.gz - tar xvf libpri-1.2.5.tar B. if you want latest SVN_1.2 version (release tree with new patches) @@ -923,7 +923,7 @@ with the following patch: edit this line at the top and just add a hash # in front of it as shown: #PBX_LIBS+=$(shell $(CROSS_COMPILE_BIN)gtk-config --cflags >/dev/null 2>/dev/null && echo "pbx_gtkconsole.so") - - cd ./zaptel-1.2.24 + - cd ./zaptel-1.2.25 - make clean - make - make install diff --git a/docs/TIMECLOCK_PROCESS.txt b/docs/TIMECLOCK_PROCESS.txt new file mode 100644 index 00000000..dccf2bf4 --- /dev/null +++ b/docs/TIMECLOCK_PROCESS.txt @@ -0,0 +1,79 @@ +Timeclock process flow 2008-05-12 + +** THIS TIMECLOCK FUNCTIONALITY PROSESS IS PLANNED FOR THE 2.0.5 RELEASE ** + +This will outline the process I have thought through for adding a timeclock component to the VICIDIAL system. The objective is to add the following features to make VICIDIAL a more well-rounded product: +- Allow vicidial users to clock-in to the system +- Add a SHIFT section to administration +- Allow restrictions of agent-login by shift +- Allow ability to not allow agents to log-in to any VICIDIAL page(admin or agent) without clocking in. +- Have reports showing all timeclock totals for various parameters(user-group/campaign/time-period/in-groups/etc...) +- ability to allow managers to alter timeclock records with audit trail +- reports showing user log activity outside of shift timeframes + + +Description: + +The first new feature to be added to help with the overall adoption of this feature is the ability to have the system optionally generate unique userIDs as users are entered into the system. For this purpose a new auto-generate option has been added to the add-a-new-user and copy-user functions. This auto-generate feature will take the auto_user_add_value field in the system_settings table and check to see if an agent with that ID exists in the system. If they do, then 7 will be added to the number and checked again until a non-used number is found. + +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. + + +More to come... + + + + + + +The Database Changes: + +# add field for auto-increment of users +ALTER TABLE system_settings ADD auto_user_add_value INT(9) UNSIGNED default '101'; +UPDATE system_settings SET auto_user_add_value='2110'; + +# This table contains system shift information + CREATE TABLE vicidial_shifts ( +shift_id VARCHAR(20) NOT NULL, +shift_name VARCHAR(50), +shift_start_time VARCHAR(4) default '0900', +shift_length VARCHAR(5) default '16:00', +shift_weekdays VARCHAR(7) default '0123456', +index (shift_id) +); + +# add field for allowable shifts for user groups +ALTER TABLE vicidial_user_groups ADD group_shifts TEXT; + + + + + +# This table contains the log of timeclock activity + 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 VARCHAR(50) NOT NULL, +user VARCHAR(20) NOT NULL, +user_group VARCHAR(20) NOT NULL, +ip_address VARCHAR(15), +shift_id VARCHAR(20), +notes VARCHAR(255), +manager_user VARCHAR(20), +manager_ip VARCHAR(15), +index (user) +); + +# This table contains the current timeclock status of a user + CREATE TABLE vicidial_timeclock_status ( +user VARCHAR(20) UNIQUE NOT NULL, +user_group VARCHAR(20) NOT NULL, +event_epoch INT(10) UNSIGNED, +event_date TIMESTAMP, +status VARCHAR(50), +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 3af9fbe0..fc6badc1 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -472,7 +472,8 @@ user_group VARCHAR(20) NOT NULL, group_name VARCHAR(40) NOT NULL, allowed_campaigns TEXT, qc_allowed_campaigns TEXT, -qc_allowed_inbound_groups TEXT +qc_allowed_inbound_groups TEXT, +group_shifts TEXT ); CREATE TABLE vicidial_campaigns ( @@ -943,7 +944,8 @@ vicidial_agent_disable ENUM('NOT_ACTIVE','LIVE_AGENT','EXTERNAL','ALL') default allow_sipsak_messages ENUM('0','1') default '0', admin_home_url VARCHAR(255) default '../vicidial/welcome.php', enable_agc_xfer_log ENUM('0','1') default '0', -db_schema_version INT(8) UNSIGNED default '0' +db_schema_version INT(8) UNSIGNED default '0', +auto_user_add_value INT(9) UNSIGNED default '101', ); CREATE TABLE vicidial_campaigns_list_mix ( @@ -1069,6 +1071,14 @@ alias_name VARCHAR(50), logins_list VARCHAR(255) ); + CREATE TABLE vicidial_shifts ( +shift_id VARCHAR(20) NOT NULL, +shift_name VARCHAR(50), +shift_start_time VARCHAR(4) default '0900', +shift_length VARCHAR(5) default '16:00', +shift_weekdays VARCHAR(7) default '0123456', +index (shift_id) +); ALTER TABLE vicidial_campaign_server_stats ENGINE=HEAP; @@ -1083,6 +1093,9 @@ ALTER TABLE server_updater ENGINE=HEAP; ALTER TABLE web_client_sessions ENGINE=HEAP; +UPDATE system_settings SET auto_user_add_value='1101'; + + INSERT INTO vicidial_lists SET list_id='999',list_name='Default inbound list',campaign_id='TESTCAMP',active='N'; INSERT INTO system_settings (version,install_date) values('2.0.X', CURDATE()); @@ -1116,4 +1129,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='1083'; +UPDATE system_settings SET db_schema_version='1084'; + diff --git a/extras/upgrade_2.0.5.sql b/extras/upgrade_2.0.5.sql index b0d5c0ac..8e339a0f 100644 --- a/extras/upgrade_2.0.5.sql +++ b/extras/upgrade_2.0.5.sql @@ -134,3 +134,19 @@ logins_list VARCHAR(255) ); UPDATE system_settings SET db_schema_version='1083'; + +ALTER TABLE system_settings ADD auto_user_add_value INT(9) UNSIGNED default '101'; +UPDATE system_settings SET auto_user_add_value='1101'; + + CREATE TABLE vicidial_shifts ( +shift_id VARCHAR(20) NOT NULL, +shift_name VARCHAR(50), +shift_start_time VARCHAR(4) default '0900', +shift_length VARCHAR(5) default '16:00', +shift_weekdays VARCHAR(7) default '0123456', +index (shift_id) +); + +ALTER TABLE vicidial_user_groups ADD group_shifts TEXT; + +UPDATE system_settings SET db_schema_version='1084'; 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 61cc3e3e..be52fd97 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 @@ -111,6 +111,48 @@ Alias ID -<\/B> The ID of the alias used to allow for phone load balanced logins Alias Name -<\/B> The name used to describe a phones alias, Must be between 2 and 50 characters in length|| Phones Logins List -<\/B> The comma separated list of phone logins used when an agent logs in using phone load balanced logins. The Agent application will find the active server with the fewest agents logged into it and place a call from that server to the agent upon login|| PHONES WITHIN THIS PHONES ALIAS|| +Add New Shift|| +New Shift Addition|| +Modify Shift|| +Delete Shift|| +Shifts|| +Shift ID -<\/B> This is the short name of a Vicidial Shift Definition. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 20 characters, minimum of 2 characters|| +Shift Name -<\/B> This is a more descriptive name of the Shift Definition. This is a short summary of the Shift definition. max 50 characters, minimum of 2 characters|| +Shift Start Time -<\/B> This is the time that the campaign shift begins. Must only be numbers, 9:30 AM would be 0930 and 5:00 PM would be 1700|| +Shift Length -<\/B> This is the time in Hours and Minutes that the campaign shift lasts. 8 hours would be 08:00 and 7 hours and 30 minutes would be 07:30|| +Shift Weekdays -<\/B> In this section you should choose the days of the week that this shift is active|| +Show Shifts|| +Add A New Shift|| +Shift ID: || +Shift Name: || +Shift Start Time: || +Shift End Time: || +SHIFT DEFINITION NOT ADDED|| +there is already a shift entry with this ID|| +Shift ID and name must be at least 2 characters in length|| +Shift Start Time must be 4 digits in length and be a valid time|| +Shift Length must be 5 characters in length and be 24 hours or less|| +SHIFT ADDED: || +MODIFY A SHIFT|| +USER GROUPS USING THIS SHIFT:|| +DELETE THIS SHIFT DEFINITION|| +MODIFY A SHIFT|| +SHIFT NOT DELETED|| +SHIFT DELETION CONFIRMATION: || +Click here to delete shift|| +SHIFT DELETION COMPLETED:|| +SHIFT MODIFIED|| +SHIFT LISTINGS:|| +Shift Weekdays: || +Sunday|| +Monday|| +Tuesday|| +Wednesday|| +Thursday|| +Friday|| +Saturday|| +Group Shifts: || +Group Shifts -<\/B> This is a selectable list of shifts that can restrict the agents login time on the system|| ############################################################ CLIENT diff --git a/www/agc/manager_send.php b/www/agc/manager_send.php index 7e70659e..507519ba 100644 --- a/www/agc/manager_send.php +++ b/www/agc/manager_send.php @@ -753,6 +753,181 @@ if ($ACTION=="RedirectXtraCX") } } + + + + + + + + + +if ($ACTION=="RedirectXtraNeW") +{ + if ($channel=="$extrachannel") + {$ACTION="Redirect";} + else + { + $row=''; $rowx=''; + $channel_liveX=1; + $channel_liveY=1; + if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($extrachannel)<3) or (strlen($session_id)<3) ) + { + $channel_liveX=0; + $channel_liveY=0; + echo "One of these variables is not valid:\n"; + echo "Channel $channel must be greater than 2 characters\n"; + echo "ExtraChannel $extrachannel must be greater than 2 characters\n"; + echo "queryCID $queryCID must be greater than 14 characters\n"; + echo "exten $exten must be set\n"; + echo "ext_context $ext_context must be set\n"; + echo "ext_priority $ext_priority must be set\n"; + echo "session_id $session_id must be set\n"; + echo "\nRedirect Action not sent\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|$session_id|\n"); + fclose($fp); + } + } + } + else + { + if ($exten == "NEXTAVAILABLE") + { + $stmt="SELECT conf_exten FROM vicidial_conferences where server_ip='$server_ip' and ((extension='') or (extension is null)) limit 1;"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if (strlen($row[0]) > 3) + { + $stmt="UPDATE vicidial_conferences set extension='$user' where server_ip='$server_ip' and conf_exten='$row[0]';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + + $stmt="UPDATE vicidial_conferences set extension='3WAY_$user' where server_ip='$server_ip' and conf_exten='$session_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $exten = $row[0]; + } + else + { + $channel_liveX=0; + echo "Cannot find empty conference on $server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "Cannot find empty conference on $server_ip";} + } + } + + if (strlen($call_server_ip)<7) {$call_server_ip = $server_ip;} + + $stmt="SELECT count(*) FROM live_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$call_server_ip' and channel='$channel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveX=0; + echo "Channel $channel is not live on $call_server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $call_server_ip";} + } + } + $stmt="SELECT count(*) FROM live_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ( ($row[0]==0) && (!ereg("SECOND",$filename)) ) + { + $stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel='$extrachannel';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + if ($rowx[0]==0) + { + $channel_liveY=0; + echo "Channel $channel is not live on $server_ip, Redirect command not inserted\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel is not live on $server_ip";} + } + } + if ( ($channel_liveX==1) && ($channel_liveY==1) ) + { + if ( ($server_ip=="$call_server_ip") or (strlen($call_server_ip)<7) ) + { + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $channel','ExtraChannel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel and $extrachannel to $exten on $server_ip";} + } + else + { + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $dest_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$exten"; + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$call_server_ip','','Redirect','$queryCID','Channel: $channel','Context: $ext_context','Exten: $dest_dialstring','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + $stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Redirect','$queryCID','Channel: $extrachannel','Context: $ext_context','Exten: $exten','Priority: $ext_priority','CallerID: $queryCID','','','','','');"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + + echo "RedirectXtra command sent for Channel $channel on $call_server_ip and \nExtraChannel $extrachannel\n to $exten on $server_ip\n"; + if (ereg("SECOND|FIRST|DEBUG",$filename)) {$DBout .= "$channel/$call_server_ip and $extrachannel/$server_ip to $exten";} + } + } + else + { + if ($channel_liveX==1) + {$ACTION="Redirect"; $server_ip = $call_server_ip;} + if ($channel_liveY==1) + {$ACTION="Redirect"; $channel=$extrachannel;} + + } + + if (ereg("SECOND|FIRST|DEBUG",$filename)) + { + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./vicidial_debug.txt", "a"); + fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$DBout|\n"); + fclose($fp); + } + } + + } + } +} + + + + + + + + + + + if ($ACTION=="RedirectXtra") { if ($channel=="$extrachannel") diff --git a/www/vicidial/AST_CLOSER_service_level.php b/www/vicidial/AST_CLOSER_service_level.php new file mode 100644 index 00000000..819556da --- /dev/null +++ b/www/vicidial/AST_CLOSER_service_level.php @@ -0,0 +1,894 @@ + LICENSE: AGPLv2 +# +# CHANGES +# +# 80509-0943 - First build +# 80510-1500 - Added fixed scale hold time graph +# + +require("dbconnect.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); +$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); + +if (strlen($shift)<2) {$shift='ALL';} + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin 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]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + +$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 ($DB) {echo "|$stmt|\n";} +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + + + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; + } + +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date)) {$query_date = $NOW_DATE;} +if (!isset($end_date)) {$end_date = $NOW_DATE;} + +$stmt="select group_id from vicidial_inbound_groups;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$groups_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $groups_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + $i++; + } +?> + + + + + +\n"; +echo "VICIDIAL: VDAD Closer Service Level Stats\n"; +echo "
\n"; +echo "\n"; +echo " to \n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "           MODIFY | REPORTS \n"; +echo "
\n\n"; + +echo "
\n\n";
+
+
+if (!$group)
+{
+echo "\n\n";
+echo "PLEASE SELECT AN IN-GROUP AND DATE RANGE ABOVE AND CLICK SUBMIT\n";
+}
+
+else
+{
+if ($shift == 'AM') 
+	{
+	$time_BEGIN=$AM_shift_BEGIN;
+	$time_END=$AM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "03:45:00";}   
+	if (strlen($time_END) < 6) {$time_END = "15:15:00";}
+	}
+if ($shift == 'PM') 
+	{
+	$time_BEGIN=$PM_shift_BEGIN;
+	$time_END=$PM_shift_END;
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "15:15:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:15:00";}
+	}
+if ($shift == 'ALL') 
+	{
+	if (strlen($time_BEGIN) < 6) {$time_BEGIN = "00:00:00";}
+	if (strlen($time_END) < 6) {$time_END = "23:59:59";}
+	}
+$query_date_BEGIN = "$query_date $time_BEGIN";   
+$query_date_END = "$end_date $time_END";
+
+
+
+echo "VICIDIAL: Closer Service-Level Stats                      $NOW_TIME\n";
+
+echo "\n";
+echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
+echo "---------- TOTALS\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$TOTALcalls =	sprintf("%10s", $row[0]);
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_call_seconds = '         0';}
+else
+	{
+	$average_call_seconds = ($row[1] / $row[0]);
+	$average_call_seconds = round($average_call_seconds, 0);
+	$average_call_seconds =	sprintf("%10s", $average_call_seconds);
+	}
+
+echo "Total calls taken into this In-Group:  $TOTALcalls\n";
+echo "Average Call Length for all Calls:     $average_call_seconds seconds\n";
+
+$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP' and (length_in_sec <= 999 or length_in_sec is null);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$DROPcalls =	sprintf("%10s", $row[0]);
+if ( ($DROPcalls < 1) or ($TOTALcalls < 1) )
+	{$DROPpercent = '0';}
+else
+	{
+	$DROPpercent = (($DROPcalls / $TOTALcalls) * 100);
+	$DROPpercent = round($DROPpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{
+	$average_hold_seconds = '         0';
+	}
+else
+	{
+	$average_hold_seconds = ($row[1] / $row[0]);
+	$average_hold_seconds = round($average_hold_seconds, 0);
+	$average_hold_seconds =	sprintf("%10s", $average_hold_seconds);
+	}
+
+echo "Total DROP Calls:                      $DROPcalls  $DROPpercent%\n";
+echo "Average hold time for DROP Calls:      $average_hold_seconds seconds\n";
+
+
+
+
+##############################
+#########  CALL QUEUE STATS
+
+$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and (queue_seconds > 0);";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$row=mysql_fetch_row($rslt);
+
+$QUEUEcalls =	sprintf("%10s", $row[0]);
+if ( ($QUEUEcalls < 1) or ($TOTALcalls < 1) )
+	{$QUEUEpercent = '0';}
+else
+	{
+	$QUEUEpercent = (($QUEUEcalls / $TOTALcalls) * 100);
+	$QUEUEpercent = round($QUEUEpercent, 0);
+	}
+
+if ( ($row[0] < 1) or ($row[1] < 1) )
+	{$average_queue_seconds = '         0';}
+else
+	{
+	$average_queue_seconds = ($row[1] / $row[0]);
+	$average_queue_seconds = round($average_queue_seconds, 2);
+	$average_queue_seconds = sprintf("%10.2f", $average_queue_seconds);
+	}
+
+if ( ($TOTALcalls < 1) or ($row[1] < 1) )
+	{$average_total_queue_seconds = '         0';}
+else
+	{
+	$average_total_queue_seconds = ($row[1] / $TOTALcalls);
+	$average_total_queue_seconds = round($average_total_queue_seconds, 2);
+	$average_total_queue_seconds = sprintf("%10.2f", $average_total_queue_seconds);
+	}
+
+echo "Total Calls That entered Queue:        $QUEUEcalls  $QUEUEpercent%\n";
+echo "Average QUEUE Length for queue calls:  $average_queue_seconds seconds\n";
+echo "Average QUEUE Length across all calls: $average_total_queue_seconds seconds\n";
+
+
+
+##############################
+#########  HOLD TIME, CALL AND DROP STATS
+
+echo "\n";
+echo "---------- HOLD TIME, CALL AND DROP STATS\n";
+
+echo "";
+
+$hi_hour_count=0;
+$hi_hold_count=0;
+$last_full_record=0;
+$i=0;
+$h=0;
+while ($i <= 96)
+	{
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$stmt="select avg(queue_seconds) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$avg_hold[$i] = $row[0];
+	if ($avg_hold[$i] > $hi_hold_count) {$hi_hold_count = $avg_hold[$i];}
+	$avg_hold[$i] = round($avg_hold[$i], 0);
+	if (strlen($avg_hold[$i])<1) {$avg_hold[$i]=0; $max_hold[$i]=0;}
+	$stmt="select max(queue_seconds) from vicidial_closer_log where call_date >= '$query_date $h:00:00' and call_date <= '$query_date $h:14:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$max_hold[$i] = $row[0];
+	$max_hold[$i] = round($max_hold[$i], 0);
+	if (strlen($max_hold[$i])<1) {$max_hold[$i]=0;}
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='$group';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$stmt="select avg(queue_seconds) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$avg_hold[$i] = $row[0];
+	if ($avg_hold[$i] > $hi_hold_count) {$hi_hold_count = $avg_hold[$i];}
+	$avg_hold[$i] = round($avg_hold[$i], 0);
+	if (strlen($avg_hold[$i])<1) {$avg_hold[$i]=0; $max_hold[$i]=0;}
+	$stmt="select max(queue_seconds) from vicidial_closer_log where call_date >= '$query_date $h:15:00' and call_date <= '$query_date $h:29:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$max_hold[$i] = $row[0];
+	$max_hold[$i] = round($max_hold[$i], 0);
+	if (strlen($max_hold[$i])<1) {$max_hold[$i]=0;}
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$stmt="select avg(queue_seconds) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$avg_hold[$i] = $row[0];
+	if ($avg_hold[$i] > $hi_hold_count) {$hi_hold_count = $avg_hold[$i];}
+	$avg_hold[$i] = round($avg_hold[$i], 0);
+	if (strlen($avg_hold[$i])<1) {$avg_hold[$i]=0; $max_hold[$i]=0;}
+	$stmt="select max(queue_seconds) from vicidial_closer_log where call_date >= '$query_date $h:30:00' and call_date <= '$query_date $h:44:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$max_hold[$i] = $row[0];
+	$max_hold[$i] = round($max_hold[$i], 0);
+	if (strlen($max_hold[$i])<1) {$max_hold[$i]=0;}
+	$i++;
+
+
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$hour_count[$i] = $row[0];
+	if ($hour_count[$i] > $hi_hour_count) {$hi_hour_count = $hour_count[$i];}
+	if ($hour_count[$i] > 0) {$last_full_record = $i;}
+	$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "' and status='DROP';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$drop_count[$i] = $row[0];
+	$stmt="select avg(queue_seconds) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$avg_hold[$i] = $row[0];
+	if ($avg_hold[$i] > $hi_hold_count) {$hi_hold_count = $avg_hold[$i];}
+	$avg_hold[$i] = round($avg_hold[$i], 0);
+	if (strlen($avg_hold[$i])<1) {$avg_hold[$i]=0; $max_hold[$i]=0;}
+	$stmt="select max(queue_seconds) from vicidial_closer_log where call_date >= '$query_date $h:45:00' and call_date <= '$query_date $h:59:59' and campaign_id='" . mysql_real_escape_string($group) . "';";
+	$rslt=mysql_query($stmt, $link);
+	if ($DB) {echo "$stmt\n";}
+	$row=mysql_fetch_row($rslt);
+	$max_hold[$i] = $row[0];
+	$max_hold[$i] = round($max_hold[$i], 0);
+	if (strlen($max_hold[$i])<1) {$max_hold[$i]=0;}
+	$i++;
+	$h++;
+	}
+
+if ($hi_hour_count < 1)
+	{$hour_multiplier = 0;}
+else
+	{
+	$hour_multiplier = (20 / $hi_hour_count);
+	#$hour_multiplier = round($hour_multiplier, 0);
+	}
+if ($hi_hold_count < 1)
+	{$hold_multiplier = 0;}
+else
+	{
+	$hold_multiplier = (20 / $hi_hold_count);
+	#$hold_multiplier = round($hold_multiplier, 0);
+	}
+
+echo "";
+echo "\n";
+echo "GRAPH IN 15 MINUTE INCREMENTS OF AVERAGE HOLD TIME FOR CALLS TAKEN INTO THIS IN-GROUP\n";
+
+$k=1;
+$Mk=0;
+$call_scale = '0';
+while ($k <= 22) 
+	{
+	if ( ($k < 1) or ($hour_multiplier <= 0) )
+		{$scale_num = 20;}
+	else
+		{
+		$TMPscale_num=(23 / $hour_multiplier);
+		$TMPscale_num = round($TMPscale_num, 0);
+		$scale_num=($k / $hour_multiplier);
+		$scale_num = round($scale_num, 0);
+		}
+	$tmpscl = "$call_scale$TMPscale_num";
+
+	if ( ($Mk >= 4) or (strlen($tmpscl)==23) )
+		{
+		$Mk=0;
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$call_scale .= "$scale_num";
+		}
+	else
+		{
+		$call_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+$k=1;
+$Mk=0;
+$hold_scale = '0';
+while ($k <= 22) 
+	{
+	if ( ($k < 1) or ($hold_multiplier <= 0) )
+		{$scale_num = 20;}
+	else
+		{
+		$TMPscale_num=(23 / $hold_multiplier);
+		$TMPscale_num = round($TMPscale_num, 0);
+		$scale_num=($k / $hold_multiplier);
+		$scale_num = round($scale_num, 0);
+		}
+	$tmpscl = "$hold_scale$TMPscale_num";
+
+	if ( ($Mk >= 4) or (strlen($tmpscl)==23) )
+		{
+		$Mk=0;
+		$LENscale_num = (strlen($scale_num));
+		$k = ($k + $LENscale_num);
+		$hold_scale .= "$scale_num";
+		}
+	else
+		{
+		$hold_scale .= " ";
+		$k++;   $Mk++;
+		}
+	}
+
+
+echo "+-------------+-----------------------+-------+-------+  +-----------------------+-------+-------+\n";
+echo "|    TIME     |  AVG HOLD TIME (sec)  | (in seconds)  |  |    CALLS HANDLED      |       |       |\n";
+echo "| 15 MIN INT  |$hold_scale| AVG   | MAX   |  |$call_scale| DROPS | TOTAL |\n";
+echo "+-------------+-----------------------+-------+-------+  +-----------------------+-------+-------+\n";
+
+$YY = '00';
+$ZZ = '15';
+$i=0;
+$h=4;
+$hour= -1;
+$no_lines_yet=1;
+$TOT_AVG=0;
+  $TOT_lines=0;
+$TOT_MAX=0;
+$TOT_DROPS=0;
+$TOT_CALLS=0;
+
+while ($i <= 96)
+	{
+
+	$TOT_AVG = ($TOT_AVG + $avg_hold[$i]);
+	if ($TOT_MAX < $max_hold[$i]) {$TOT_MAX = $max_hold[$i];}
+	$TOT_DROPS = ($TOT_DROPS + $drop_count[$i]);
+	$TOT_CALLS = ($TOT_CALLS + $hour_count[$i]);
+
+	$char_counter=0;
+	$time = '      ';
+	if ($h >= 4) 
+		{
+		$hour++;
+		$h=0;
+		if ($hour < 10) {$hour = "0$hour";}
+		$Stime="$hour:$YY";
+		$Etime="$hour:$ZZ";
+		$Sdate="$query_date";
+		$Edate="$query_date";
+		$time = "+$Stime-$Etime+";
+		}
+	if ($h == 1) 
+		{
+		$Stime="$hour:15";
+		$Etime="$hour:30";
+		$Sdate="$query_date";
+		$Edate="$query_date";
+		$time = " $Stime-$Etime ";
+		}
+	if ($h == 2)
+		{
+		$Stime="$hour:30";
+		$Etime="$hour:45";
+		$Sdate="$query_date";
+		$Edate="$query_date";
+		$time = " $Stime-$Etime ";
+		}
+	if ($h == 3) 
+		{
+		$Zhour=$hour;
+		$Zhour++;
+		if ($Zhour < 10) {$Zhour = "0$Zhour";}
+		if ($Zhour > 23) {$Zhour = "00";}
+		$Stime="$hour:45";
+		$Etime="$Zhour:00";
+		$Sdate="$query_date";
+		$Edate="$query_date";
+		$time = " $Stime-$Etime ";
+		}
+
+	### BEGIN HOLD TIME TOTALS GRAPH ###
+		$Ghour_count = $hour_count[$i];
+	if ($Ghour_count > 0) {$no_lines_yet=0;}
+
+	$Gavg_hold = $avg_hold[$i];
+	if ($Gavg_hold < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$SAtime[$TOT_lines] = "$Stime";
+			$EAtime[$TOT_lines] = "$Etime";
+			$SAdate[$TOT_lines] = "$Sdate $Stime:00";
+			$EAdate[$TOT_lines] = "$Edate $Etime:00";
+			$Aavg_hold[$TOT_lines] = $avg_hold[$i];
+			$TOT_lines++;
+			$avg_hold[$i] =	sprintf("%5s", $avg_hold[$i]);
+			$max_hold[$i] =	sprintf("%5s", $max_hold[$i]);
+			echo "|$time|";
+			$k=0;   while ($k <= 22) {echo " ";   $k++;}
+			echo "| $avg_hold[$i] | $max_hold[$i] |";
+			}
+		}
+	else
+		{
+		$SAtime[$TOT_lines] = "$Stime";
+		$EAtime[$TOT_lines] = "$Etime";
+		$SAdate[$TOT_lines] = "$Sdate $Stime:00";
+		$EAdate[$TOT_lines] = "$Edate $Etime:00";
+		$Aavg_hold[$TOT_lines] = $avg_hold[$i];
+		$TOT_lines++;
+		$no_lines_yet=0;
+		$Xavg_hold = ($Gavg_hold * $hold_multiplier);
+		$Yavg_hold = (19 - $Xavg_hold);
+
+		$avg_hold[$i] =	sprintf("%5s", $avg_hold[$i]);
+		$max_hold[$i] =	sprintf("%5s", $max_hold[$i]);
+
+		echo "|$time|";
+		$k=0;   while ($k <= $Xavg_hold) {echo "*";   $k++;   $char_counter++;}
+		if ($char_counter >= 22) {echo "H";   $char_counter++;}
+		else {echo "*H";   $char_counter++;   $char_counter++;}
+		$k=0;   while ($k <= $Yavg_hold) {echo " ";   $k++;   $char_counter++;}
+			while ($char_counter <= 22) {echo " ";   $char_counter++;}
+		echo "| $avg_hold[$i] | $max_hold[$i] |";
+		}
+	### END HOLD TIME TOTALS GRAPH ###
+
+	$char_counter=0;
+ 	### BEGIN CALLS TOTALS GRAPH ###
+	$Ghour_count = $hour_count[$i];
+	if ($Ghour_count < 1) 
+		{
+		if ( ($no_lines_yet) or ($i > $last_full_record) )
+			{
+			$do_nothing=1;
+			}
+		else
+			{
+			$hour_count[$i] =	sprintf("%5s", $hour_count[$i]);
+			echo "  |";
+			$k=0;   while ($k <= 22) {echo " ";   $k++;}
+			echo "| $hour_count[$i] |       |\n";
+			}
+		}
+	else
+		{
+		$no_lines_yet=0;
+		$Xhour_count = ($Ghour_count * $hour_multiplier);
+		$Yhour_count = (19 - $Xhour_count);
+
+		$Gdrop_count = $drop_count[$i];
+		if ($Gdrop_count < 1) 
+			{
+			$hour_count[$i] =	sprintf("%5s", $hour_count[$i]);
+
+			echo "  |";
+			$k=0;   while ($k <= $Xhour_count) {echo "*";   $k++;   $char_counter++;}
+			if ($char_counter > 21) {echo "C";   $char_counter++;}
+			else {echo "*C";   $char_counter++;   $char_counter++;}
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 22) {echo " ";   $char_counter++;}
+			echo "|     0 | $hour_count[$i] |\n";
+			}
+		else
+			{
+			$Xdrop_count = ($Gdrop_count * $hour_multiplier);
+
+		#	if ($Xdrop_count >= $Xhour_count) {$Xdrop_count = ($Xdrop_count - 1);}
+
+			$XXhour_count = ( ($Xhour_count - $Xdrop_count) - 1 );
+
+			$hour_count[$i] =	sprintf("%5s", $hour_count[$i]);
+			$drop_count[$i] =	sprintf("%5s", $drop_count[$i]);
+
+			echo "  |";
+			$k=0;   while ($k <= $Xdrop_count) {echo ">";   $k++;   $char_counter++;}
+			echo "D";   $char_counter++;
+			$k=0;   while ($k <= $XXhour_count) {echo "*";   $k++;   $char_counter++;}
+			echo "C";   $char_counter++;
+			$k=0;   while ($k <= $Yhour_count) {echo " ";   $k++;   $char_counter++;}
+				while ($char_counter <= 22) {echo " ";   $char_counter++;}
+			echo "| $drop_count[$i] | $hour_count[$i] |\n";
+			}
+		}
+	### END CALLS TOTALS GRAPH ###
+	
+	$i++;
+	$h++;
+	}
+
+	$TOT_AVGraw = ($TOT_AVG / $TOT_lines);
+
+	$TOT_AVG =	sprintf("%5s", $TOT_AVGraw); 
+		while (strlen($TOT_AVG)>5) {$TOT_AVG = ereg_replace(".$",'',$TOT_AVG);}
+	$TOT_MAX =	sprintf("%5s", $TOT_MAX);
+	$TOT_DROPS =	sprintf("%5s", $TOT_DROPS);
+	$TOT_CALLS =	sprintf("%5s", $TOT_CALLS);
+
+
+echo "+-------------+-----------------------+-------+-------+  +-----------------------+-------+-------+\n";
+echo "| TOTAL                               | $TOT_AVG | $TOT_MAX |  |                       | $TOT_DROPS | $TOT_CALLS |\n";
+echo "+-------------------------------------+-------+-------+  +-----------------------+-------+-------+\n";
+
+
+
+
+##############################
+#########  CALL HOLD TIME BREAKDONW IN SECONDS
+
+
+echo "\n";
+echo "---------- CALL HOLD TIME BREAKDOWN IN SECONDS\n";
+/*
+$TOTALcalls = 0;
+echo "+-------------------------------------------------------------------------------------------+------------+\n";
+echo "|     0     5    10    15    20    25    30    35    40    45    50    55    60    90   +90 | TOTAL      |\n";
+echo "+-------------------------------------------------------------------------------------------+------------+\n";
+
+$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "' group by queue_seconds;";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$reasons_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $reasons_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+
+	$TOTALcalls = ($TOTALcalls + $row[0]);
+
+	if ($row[1] == 0) {$hd_0 = ($hd_0 + $row[0]);}
+	if ( ($row[1] > 0) and ($row[1] <= 5) ) {$hd_5 = ($hd_5 + $row[0]);}
+	if ( ($row[1] > 5) and ($row[1] <= 10) ) {$hd10 = ($hd10 + $row[0]);}
+	if ( ($row[1] > 10) and ($row[1] <= 15) ) {$hd15 = ($hd15 + $row[0]);}
+	if ( ($row[1] > 15) and ($row[1] <= 20) ) {$hd20 = ($hd20 + $row[0]);}
+	if ( ($row[1] > 20) and ($row[1] <= 25) ) {$hd25 = ($hd25 + $row[0]);}
+	if ( ($row[1] > 25) and ($row[1] <= 30) ) {$hd30 = ($hd30 + $row[0]);}
+	if ( ($row[1] > 30) and ($row[1] <= 35) ) {$hd35 = ($hd35 + $row[0]);}
+	if ( ($row[1] > 35) and ($row[1] <= 40) ) {$hd40 = ($hd40 + $row[0]);}
+	if ( ($row[1] > 40) and ($row[1] <= 45) ) {$hd45 = ($hd45 + $row[0]);}
+	if ( ($row[1] > 45) and ($row[1] <= 50) ) {$hd50 = ($hd50 + $row[0]);}
+	if ( ($row[1] > 50) and ($row[1] <= 55) ) {$hd55 = ($hd55 + $row[0]);}
+	if ( ($row[1] > 55) and ($row[1] <= 60) ) {$hd60 = ($hd60 + $row[0]);}
+	if ( ($row[1] > 60) and ($row[1] <= 90) ) {$hd90 = ($hd90 + $row[0]);}
+	if ($row[1] > 90) {$hd99 = ($hd99 + $row[0]);}
+	$i++;
+	}
+
+$hd_0 =	sprintf("%5s", $hd_0);
+$hd_5 =	sprintf("%5s", $hd_5);
+$hd10 =	sprintf("%5s", $hd10);
+$hd15 =	sprintf("%5s", $hd15);
+$hd20 =	sprintf("%5s", $hd20);
+$hd25 =	sprintf("%5s", $hd25);
+$hd30 =	sprintf("%5s", $hd30);
+$hd35 =	sprintf("%5s", $hd35);
+$hd40 =	sprintf("%5s", $hd40);
+$hd45 =	sprintf("%5s", $hd45);
+$hd50 =	sprintf("%5s", $hd50);
+$hd55 =	sprintf("%5s", $hd55);
+$hd60 =	sprintf("%5s", $hd60);
+$hd90 =	sprintf("%5s", $hd90);
+$hd99 =	sprintf("%5s", $hd99);
+
+$TOTALcalls =		sprintf("%10s", $TOTALcalls);
+
+echo "| $hd_0 $hd_5 $hd10 $hd15 $hd20 $hd25 $hd30 $hd35 $hd40 $hd45 $hd50 $hd55 $hd60 $hd90 $hd99 | $TOTALcalls |\n";
+echo "+-------------------------------------------------------------------------------------------+------------+\n";
+*/
+
+
+
+
+echo "+-------------+-------+-----------------------------------------+ +------+--------------------------------+\n";
+echo "|    TIME     |       |  % OF CALLS GROUPED BY HOLD TIME (SEC)  | |   AVERAGE TIME BEFORE ANSWER (SEC)    |\n";
+echo "| 15 MIN INT  | CALLS |    0   20   40   60   80  100  120 120+ | | AVG  |0   20   40   60   80  100  120 |\n";
+echo "+-------------+-------+-----------------------------------------+ +------+--------------------------------+\n";
+
+$stmt="select queue_seconds,UNIX_TIMESTAMP(call_date) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and  campaign_id='" . mysql_real_escape_string($group) . "';";
+$rslt=mysql_query($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$records_to_print = mysql_num_rows($rslt);
+$i=0;
+while ($i < $records_to_print)
+	{
+	$row=mysql_fetch_row($rslt);
+	$qs[$i] = $row[0];
+	$ut[$i] = $row[1];
+	$i++;
+	}
+
+$h=0;
+$APhd__0=0; $APhd_20=0; $APhd_40=0; $APhd_60=0; $APhd_80=0; $APhd100=0; $APhd120=0; $APhd121=0;
+$SAdate_count = count($SAdate);
+while ($h < $SAdate_count)
+	{
+	$avg_hold_scale='';	$calls=0; 
+	$hd__0=0; $hd_20=0; $hd_40=0; $hd_60=0; $hd_80=0; $hd100=0; $hd120=0; $hd121=0;
+	$Phd__0=0; $Phd_20=0; $Phd_40=0; $Phd_60=0; $Phd_80=0; $Phd100=0; $Phd120=0; $Phd121=0;
+	$SAdate_ARY = explode(' ',$SAdate[$h]);
+	$SAday_ARY = explode('-',$SAdate_ARY[0]);
+	$SAtime_ARY = explode(':',$SAdate_ARY[1]);
+	$EAdate_ARY = explode(' ',$EAdate[$h]);
+	$EAday_ARY = explode('-',$EAdate_ARY[0]);
+	$EAtime_ARY = explode(':',$EAdate_ARY[1]);
+
+	$SAepoch = mktime($SAtime_ARY[0], $SAtime_ARY[1], $SAtime_ARY[2], $SAday_ARY[1], $SAday_ARY[2], $SAday_ARY[0]);
+	$EAepoch = mktime($EAtime_ARY[0], $EAtime_ARY[1], $EAtime_ARY[2], $EAday_ARY[1], $EAday_ARY[2], $EAday_ARY[0]);
+
+	$i=0;
+	while ($i < $records_to_print)
+		{
+		if ( ($ut[$i] >= $SAepoch) and ($ut[$i] < $EAepoch) )
+			{
+			$calls++;
+			if ($qs[$i] == 0) {$hd__0++;}
+			if ( ($qs[$i] > 0) and ($qs[$i] <= 20) ) {$hd_20++;}
+			if ( ($qs[$i] > 20) and ($qs[$i] <= 40) ) {$hd_40++;}
+			if ( ($qs[$i] > 40) and ($qs[$i] <= 60) ) {$hd_60++;}
+			if ( ($qs[$i] > 60) and ($qs[$i] <= 80) ) {$hd_80++;}
+			if ( ($qs[$i] > 80) and ($qs[$i] <= 100) ) {$hd100++;}
+			if ( ($qs[$i] > 100) and ($qs[$i] <= 120) ) {$hd120++;}
+			if ($qs[$i] > 120) {$hd121++;}
+			}
+		$i++;
+		}
+	
+	if ($hd__0 > 0) {$Phd__0 = round( ( ($hd__0 / $calls) * 100) );}
+	if ($hd_20 > 0) {$Phd_20 = round( ( ($hd_20 / $calls) * 100) );}
+	if ($hd_40 > 0) {$Phd_40 = round( ( ($hd_40 / $calls) * 100) );}
+	if ($hd_60 > 0) {$Phd_60 = round( ( ($hd_60 / $calls) * 100) );}
+	if ($hd_80 > 0) {$Phd_80 = round( ( ($hd_80 / $calls) * 100) );}
+	if ($hd100 > 0) {$Phd100 = round( ( ($hd100 / $calls) * 100) );}
+	if ($hd120 > 0) {$Phd120 = round( ( ($hd120 / $calls) * 100) );}
+	if ($hd121 > 0) {$Phd121 = round( ( ($hd121 / $calls) * 100) );}
+	$Aavg_hold[$h] =	sprintf("%4s", $Aavg_hold[$h]);
+	$calls =	sprintf("%5s", $calls);
+	$hd__0 =	sprintf("%4s", $hd__0);
+	$hd_20 =	sprintf("%4s", $hd_20);
+	$hd_40 =	sprintf("%4s", $hd_40);
+	$hd_60 =	sprintf("%4s", $hd_60);
+	$hd_80 =	sprintf("%4s", $hd_80);
+	$hd100 =	sprintf("%4s", $hd100);
+	$hd120 =	sprintf("%4s", $hd120);
+	$hd121 =	sprintf("%4s", $hd121);
+	$Phd__0 =	sprintf("%4s", $Phd__0);
+	$Phd_20 =	sprintf("%4s", $Phd_20);
+	$Phd_40 =	sprintf("%4s", $Phd_40);
+	$Phd_60 =	sprintf("%4s", $Phd_60);
+	$Phd_80 =	sprintf("%4s", $Phd_80);
+	$Phd100 =	sprintf("%4s", $Phd100);
+	$Phd120 =	sprintf("%4s", $Phd120);
+	$Phd121 =	sprintf("%4s", $Phd121);
+
+	$ALLcalls = ($ALLcalls + $calls);
+	$ALLhd__0 = ($ALLhd__0 + $hd__0);
+	$ALLhd_20 = ($ALLhd_20 + $hd_20);
+	$ALLhd_40 = ($ALLhd_40 + $hd_40);
+	$ALLhd_60 = ($ALLhd_60 + $hd_60);
+	$ALLhd_80 = ($ALLhd_80 + $hd_80);
+	$ALLhd100 = ($ALLhd100 + $hd100);
+	$ALLhd120 = ($ALLhd120 + $hd120);
+	$ALLhd121 = ($ALLhd121 + $hd121);
+
+	if ( ($Aavg_hold[$h] < 1) or ($Aavg_hold[$h] > 119) )
+		{
+		if ($Aavg_hold[$h] < 1)		{$avg_hold_scale = '                                ';}
+		if ($Aavg_hold[$h] > 119)	{$avg_hold_scale = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';}
+		}
+	else
+		{
+		$avg_hold_val = ( (32 / 120) * $Aavg_hold[$h] );
+		$k=0;
+		$blank=0;
+		while ($k < 32)
+			{
+			if ($k <= $avg_hold_val) 
+				{
+				if ($k < 1) {$avg_hold_scale .= '';}
+				$avg_hold_scale .= 'x';
+				}
+			else 
+				{
+				if ( ($k > 0) and ($blank < 1) ) {$avg_hold_scale .= '';}
+				$avg_hold_scale .= ' ';
+				$blank++;
+				}
+			$k++;
+			if ( ($k > 31) and ($blank < 1) ) {$avg_hold_scale .= '';}
+			}
+		}
+
+	$time = " $SAtime[$h]-$EAtime[$h] ";
+	if (ereg(':00-',$time)) {$time = "+$SAtime[$h]-$EAtime[$h]+";}
+	echo "|$time| $calls | $Phd__0 $Phd_20 $Phd_40 $Phd_60 $Phd_80 $Phd100 $Phd120 $Phd121 | | $Aavg_hold[$h] |$avg_hold_scale|\n";
+	
+	$h++;
+	}
+
+if ($ALLhd__0 > 0) {$APhd__0 = round( ( ($ALLhd__0 / $ALLcalls) * 100) );}
+if ($ALLhd_20 > 0) {$APhd_20 = round( ( ($ALLhd_20 / $ALLcalls) * 100) );}
+if ($ALLhd_40 > 0) {$APhd_40 = round( ( ($ALLhd_40 / $ALLcalls) * 100) );}
+if ($ALLhd_60 > 0) {$APhd_60 = round( ( ($ALLhd_60 / $ALLcalls) * 100) );}
+if ($ALLhd_80 > 0) {$APhd_80 = round( ( ($ALLhd_80 / $ALLcalls) * 100) );}
+if ($ALLhd100 > 0) {$APhd100 = round( ( ($ALLhd100 / $ALLcalls) * 100) );}
+if ($ALLhd120 > 0) {$APhd120 = round( ( ($ALLhd120 / $ALLcalls) * 100) );}
+if ($ALLhd121 > 0) {$APhd121 = round( ( ($ALLhd121 / $ALLcalls) * 100) );}
+
+$ALLcalls =	sprintf("%5s", $ALLcalls);
+$APhd__0 =	sprintf("%4s", $APhd__0);
+$APhd_20 =	sprintf("%4s", $APhd_20);
+$APhd_40 =	sprintf("%4s", $APhd_40);
+$APhd_60 =	sprintf("%4s", $APhd_60);
+$APhd_80 =	sprintf("%4s", $APhd_80);
+$APhd100 =	sprintf("%4s", $APhd100);
+$APhd120 =	sprintf("%4s", $APhd120);
+$APhd121 =	sprintf("%4s", $APhd121);
+
+$TOT_AVG =	sprintf("%4s", $TOT_AVGraw); 
+	while (strlen($TOT_AVG)>4) {$TOT_AVG = ereg_replace(".$",'',$TOT_AVG);}
+
+echo "+-------------+-------+-----------------------------------------+ +------+--------------------------------+\n";
+echo "| TOTAL       | $ALLcalls | $APhd__0 $APhd_20 $APhd_40 $APhd_60 $APhd_80 $APhd100 $APhd120 $APhd121 | | $TOT_AVG |\n";
+echo "+-------------+-------+-----------------------------------------+ +------+\n";
+
+$ENDtime = date("U");
+$RUNtime = ($ENDtime - $STARTtime);
+echo "\nRun Time: $RUNtime seconds\n";
+}
+
+
+
+?>
+
+ + \ No newline at end of file diff --git a/www/vicidial/AST_CLOSERstats.php b/www/vicidial/AST_CLOSERstats.php index 47aefe58..b7e31351 100644 --- a/www/vicidial/AST_CLOSERstats.php +++ b/www/vicidial/AST_CLOSERstats.php @@ -37,11 +37,29 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); if (strlen($shift)<2) {$shift='ALL';} - $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin 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); - $auth=$row[0]; + $non_latin = $row[0]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + +$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 ($DB) {echo "|$stmt|\n";} +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { @@ -256,7 +274,6 @@ echo "| 0 5 10 15 20 25 30 35 40 45 50 55 echo "+-------------------------------------------------------------------------------------------+------------+\n"; $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' group by queue_seconds;"; -if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $reasons_to_print = mysql_num_rows($rslt); @@ -303,7 +320,6 @@ $hd99 = sprintf("%5s", $hd99); $TOTALcalls = sprintf("%10s", $TOTALcalls); -echo "+-------------------------------------------------------------------------------------------+------------+\n"; echo "| $hd_0 $hd_5 $hd10 $hd15 $hd20 $hd25 $hd30 $hd35 $hd40 $hd45 $hd50 $hd55 $hd60 $hd90 $hd99 | $TOTALcalls |\n"; echo "+-------------------------------------------------------------------------------------------+------------+\n"; @@ -321,7 +337,6 @@ echo "| HANGUP REASON | CALLS |\n"; echo "+----------------------+------------+\n"; $stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' group by term_reason;"; -if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $reasons_to_print = mysql_num_rows($rslt); @@ -387,7 +402,6 @@ while ($Cstatuses_to_print > $o) } $stmt="select count(*),status from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;"; -if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $statuses_to_print = mysql_num_rows($rslt); @@ -599,7 +613,7 @@ else } echo "\n"; -echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS PLACED FROM THIS CAMPAIGN\n"; +echo "GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS TAKEN INTO THIS IN-GROUP\n"; $k=1; $Mk=0; diff --git a/www/vicidial/AST_VDADstats.php b/www/vicidial/AST_VDADstats.php index 34ba976b..daad257d 100644 --- a/www/vicidial/AST_VDADstats.php +++ b/www/vicidial/AST_VDADstats.php @@ -37,11 +37,29 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); if (strlen($shift)<2) {$shift='ALL';} - $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin 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); - $auth=$row[0]; + $non_latin = $row[0]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + +$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 ($DB) {echo "|$stmt|\n";} +if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; + if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 2802d518..61d58e22 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -715,6 +715,18 @@ if (isset($_GET["alias_name"])) {$alias_name=$_GET["alias_name"];} elseif (isset($_POST["alias_name"])) {$alias_name=$_POST["alias_name"];} if (isset($_GET["logins_list"])) {$logins_list=$_GET["logins_list"];} elseif (isset($_POST["logins_list"])) {$logins_list=$_POST["logins_list"];} +if (isset($_GET["shift_id"])) {$shift_id=$_GET["shift_id"];} + elseif (isset($_POST["shift_id"])) {$shift_id=$_POST["shift_id"];} +if (isset($_GET["shift_name"])) {$shift_name=$_GET["shift_name"];} + elseif (isset($_POST["shift_name"])) {$shift_name=$_POST["shift_name"];} +if (isset($_GET["shift_start_time"])) {$shift_start_time=$_GET["shift_start_time"];} + elseif (isset($_POST["shift_start_time"])) {$shift_start_time=$_POST["shift_start_time"];} +if (isset($_GET["shift_length"])) {$shift_length=$_GET["shift_length"];} + elseif (isset($_POST["shift_length"])) {$shift_length=$_POST["shift_length"];} +if (isset($_GET["shift_weekdays"])) {$shift_weekdays=$_GET["shift_weekdays"];} + elseif (isset($_POST["shift_weekdays"])) {$shift_weekdays=$_POST["shift_weekdays"];} +if (isset($_GET["group_shifts"])) {$group_shifts=$_GET["group_shifts"];} + elseif (isset($_POST["group_shifts"])) {$group_shifts=$_POST["group_shifts"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} @@ -872,6 +884,10 @@ $qc_finish = ereg_replace("[^0-9]","",$qc_finish); $qc_commit = ereg_replace("[^0-9]","",$qc_commit); $campaign_shift_start_time = ereg_replace("[^0-9]","",$campaign_shift_start_time); $campaign_day_start_time = ereg_replace("[^0-9]","",$campaign_day_start_time); +$shift_start_time = ereg_replace("[^0-9]","",$shift_start_time); + +### DIGITS and COLONS +$shift_length = ereg_replace("[^\:0-9]","",$shift_length); ### DIGITS and DASHES $group_rank = ereg_replace("[^-0-9]","",$group_rank); @@ -1016,6 +1032,7 @@ $drop_inbound_group = ereg_replace("[^-\_0-9a-zA-Z]","",$drop_inbound_group); $afterhours_xfer_group = ereg_replace("[^-\_0-9a-zA-Z]","",$afterhours_xfer_group); $after_hours_action = ereg_replace("[^-\_0-9a-zA-Z]","",$after_hours_action); $alias_id = ereg_replace("[^-\_0-9a-zA-Z]","",$alias_id); +$shift_id = ereg_replace("[^-\_0-9a-zA-Z]","",$shift_id); ### ALPHA-NUMERIC and underscore and dash and comma $logins_list = ereg_replace("[^-\,\_0-9a-zA-Z]","",$logins_list); @@ -1059,7 +1076,7 @@ $vsc_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_name); $vsc_description = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$vsc_description); $code_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$code_name); $alias_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$alias_name); - +$shift_name = ereg_replace("[^ \.\,-\_0-9a-zA-Z]","",$shift_name); ### ALPHA-NUMERIC and underscore and dash and slash and at and dot $call_out_number_group = ereg_replace("[^-\.\:\/\@\_0-9a-zA-Z]","",$call_out_number_group); @@ -1236,11 +1253,13 @@ $list_mix_container = ereg_replace(";","",$list_mix_container); # 80414-1505 - More work on QC, added vicidial_qc_codes # 80424-0442 - Added non_latin system_settings lookup at top to override dbconnect setting # 80505-0333 - Added phones_alias sections to allow for load-balanced-phone-logins +# 80512-1529 - Added auto-generate of User ID feature +# 80515-1345 - Added Shifts sub-section to Admin section # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.0.5-128'; -$build = '80505-0333'; +$admin_version = '2.0.5-130'; +$build = '80515-1345'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -1388,6 +1407,7 @@ if ($ADD==111111) {$hh='usergroups'; echo "Add New Users Group";} if ($ADD==1111111) {$hh='scripts'; echo "Add New Script";} if ($ADD==11111111) {$hh='filters'; echo "Add New Filter";} if ($ADD==111111111) {$hh='admin'; $sh='times'; echo "Add New Call Time";} +if ($ADD==131111111) {$hh='admin'; $sh='times'; echo "Add New Shift";} if ($ADD==1111111111) {$hh='admin'; $sh='times'; echo "Add New State Call Time";} if ($ADD==11111111111) {$hh='admin'; $sh='phones'; echo "ADD NEW PHONE";} if ($ADD==12111111111) {$hh='admin'; $sh='phones'; echo "ADD NEW PHONE ALIAS";} @@ -1413,6 +1433,7 @@ if ($ADD==211111) {$hh='usergroups'; echo "New Users Group Addition";} if ($ADD==2111111) {$hh='scripts'; echo "New Script Addition";} if ($ADD==21111111) {$hh='filters'; echo "New Filter Addition";} if ($ADD==211111111) {$hh='admin'; $sh='times'; echo "New Call Time Addition";} +if ($ADD==231111111) {$hh='admin'; $sh='times'; echo "New Shift Addition";} if ($ADD==2111111111) {$hh='admin'; $sh='times'; echo "New State Call Time Addition";} if ($ADD==21111111111) {$hh='admin'; $sh='phones'; echo "ADDING NEW PHONE";} if ($ADD==22111111111) {$hh='admin'; $sh='phones'; echo "ADDING NEW PHONE ALIAS";} @@ -1462,6 +1483,7 @@ if ($ADD==3111111) {$hh='scripts'; echo "Modify Script";} if ($ADD==31111111) {$hh='filters'; echo "Modify Filter";} if ($ADD==311111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";} if ($ADD==321111111) {$hh='admin'; $sh='times'; echo "Modify Call Time State Definitions List";} +if ($ADD==331111111) {$hh='admin'; $sh='times'; echo "Modify Shift";} if ($ADD==3111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";} if ($ADD==31111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE";} if ($ADD==32111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE ALIAS";} @@ -1490,6 +1512,7 @@ if ($ADD==411111) {$hh='usergroups'; echo "Modify Users Groups";} if ($ADD==4111111) {$hh='scripts'; echo "Modify Script";} if ($ADD==41111111) {$hh='filters'; echo "Modify Filter";} if ($ADD==411111111) {$hh='admin'; $sh='times'; echo "Modify Call Time";} +if ($ADD==431111111) {$hh='admin'; $sh='times'; echo "Modify Shift";} if ($ADD==4111111111) {$hh='admin'; $sh='times'; echo "Modify State Call Time";} if ($ADD==41111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE";} if ($ADD==42111111111) {$hh='admin'; $sh='phones'; echo "MODIFY PHONE ALIAS";} @@ -1512,6 +1535,7 @@ if ($ADD==511111) {$hh='usergroups'; echo "Delete Users Group";} if ($ADD==5111111) {$hh='scripts'; echo "Delete Script";} if ($ADD==51111111) {$hh='filters'; echo "Delete Filter";} if ($ADD==511111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} +if ($ADD==531111111) {$hh='admin'; $sh='times'; echo "Delete Shift";} if ($ADD==5111111111) {$hh='admin'; $sh='times'; echo "Delete State Call Time";} if ($ADD==51111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} if ($ADD==52111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE ALIAS";} @@ -1534,6 +1558,7 @@ if ($ADD==611111) {$hh='usergroups'; echo "Delete Users Group";} if ($ADD==6111111) {$hh='scripts'; echo "Delete Script";} if ($ADD==61111111) {$hh='filters'; echo "Delete Filter";} if ($ADD==611111111) {$hh='admin'; $sh='times'; echo "Delete Call Time";} +if ($ADD==631111111) {$hh='admin'; $sh='times'; echo "Delete Shift";} if ($ADD==6111111111) {$hh='admin'; $sh='times'; echo "Delete State Call Time";} if ($ADD==61111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE";} if ($ADD==62111111111) {$hh='admin'; $sh='phones'; echo "DELETE PHONE ALIAS";} @@ -1556,6 +1581,7 @@ if ($ADD==100000) {$hh='usergroups'; echo "User Groups";} if ($ADD==1000000) {$hh='scripts'; echo "Scripts";} if ($ADD==10000000) {$hh='filters'; echo "Filters";} if ($ADD==100000000) {$hh='admin'; $sh='times'; echo "Call Times";} +if ($ADD==130000000) {$hh='admin'; $sh='times'; echo "Shifts";} if ($ADD==1000000000) {$hh='admin'; $sh='times'; echo "State Call Times";} if ($ADD==10000000000) {$hh='admin'; $sh='phones'; echo "PHONE LIST";} if ($ADD==12000000000) {$hh='admin'; $sh='phones'; echo "PHONE ALIAS LIST";} @@ -3006,6 +3032,11 @@ echo "
Group Name - This is the description of the vicidial user group max of 40 characters. +
+ +
+Group Shifts - This is a selectable list of shifts that can restrict the agents login time on the system. +

@@ -3115,6 +3146,32 @@ echo "> + > 1) { ?> @@ -4363,10 +4513,11 @@ if ($ADD=="1") echo "



+ +VICIDIAL_SHIFTS TABLE

+ +
+Shift ID - This is the short name of a Vicidial Shift Definition. This needs to be a unique identifier. Do not use any spaces or punctuation for this field. max 20 characters, minimum of 2 characters. + +
+
+Shift Name - This is a more descriptive name of the Shift Definition. This is a short summary of the Shift definition. max 50 characters, minimum of 2 characters. + +
+
+Shift Start Time - This is the time that the campaign shift begins. Must only be numbers, 9:30 AM would be 0930 and 5:00 PM would be 1700. + +
+
+Shift Length - This is the time in Hours and Minutes that the campaign shift lasts. 8 hours would be 08:00 and 7 hours and 30 minutes would be 07:30. + +
+
+Shift Weekdays - In this section you should choose the days of the week that this shift is active. + + + +



VICIDIAL LIST LOADER FUNCTIONALITY

@@ -4169,10 +4226,103 @@ function scriptInsertField() { } } - - - +function user_auto() + { + var user_toggle = document.getElementById("user_toggle"); + var user_field = document.getElementById("user"); + if (user_toggle.value < 1) + { + user_field.value = 'AUTOGENERATEZZZZZZZZ'; + user_field.disabled = true; + user_toggle.value = 1; + } + else + { + user_field.value = ''; + user_field.disabled = false; + user_toggle.value = 0; + } + } + +function user_submit() + { + var user_field = document.getElementById("user"); + user_field.disabled = false; + document.userform.submit(); + } + + +function shift_time() + { + var start_time = document.getElementById("shift_start_time"); + var end_time = document.getElementById("shift_end_time"); + var length = document.getElementById("shift_length"); + + var start_time_hour=start_time.value.substring(0,2); + var start_time_min=start_time.value.substring(2,4); + var end_time_hour=end_time.value.substring(0,2); + var end_time_min=end_time.value.substring(2,4); + start_time_hour=(start_time_hour * 1); + start_time_min=(start_time_min * 1); + end_time_hour=(end_time_hour * 1); + end_time_min=(end_time_min * 1); + + if (start_time.value == end_time.value) + { + var shift_length = '24:00'; + } + else + { + if ( (start_time_hour > end_time_hour) || ( (start_time_hour == end_time_hour) && (start_time_min > end_time_min) ) ) + { + var shift_hour = ( (24 - start_time_hour) + end_time_hour); + var shift_minute = ( (60 - start_time_min) + end_time_min); + if (shift_minute >= 60) + { + shift_minute = (shift_minute - 60); + } + else + { + shift_hour = (shift_hour - 1); + } + } + else + { + var shift_hour = (end_time_hour - start_time_hour); + var shift_minute = (end_time_min - start_time_min); + } + if (shift_minute < 0) + { + shift_minute = (shift_minute + 60); + shift_hour = (shift_hour - 1); + } + + if (shift_hour < 10) {shift_hour = '0' + shift_hour} + if (shift_minute < 10) {shift_minute = '0' + shift_minute} + var shift_length = shift_hour + ':' + shift_minute; + } +// alert(start_time_hour + '|' + start_time_min + '|' + end_time_hour + '|' + end_time_min + '|--|' + shift_hour + ':' + shift_minute + '|' + shift_length + '|'); + + length.value = shift_length; + } + +\n"; +echo "\n"; +echo "\n"; echo "\n"; $stmt="SELECT admin_home_url from system_settings;"; @@ -4298,7 +4448,7 @@ if (strlen($admin_hh) > 1) { 1) { ?> -
>   > Show Call Times     |     > Add A New Call Time     |     > Show State Call Times     |     > Add A New State Call Time  
>> Show Call Times  | > Add A New Call Time  | > Show State Call Times  | > Add A New State Call Time  | > Show Shifts  | > Add A New Shift
\n"; echo ""; - echo "
ADD A NEW USER
\n"; + echo "
ADD A NEW USER\n"; echo "\n"; + echo "\n"; echo "
\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "$NWB#vicidial_users-user_group$NWE\n"; - echo "\n"; + echo "\n"; echo "
User Number: $NWB#vicidial_users-user$NWE
User Number: $NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
User Level:
Phone Login: $NWB#vicidial_users-phone_login$NWE
Phone Pass: $NWB#vicidial_users-phone_pass$NWE
\n"; } else @@ -4407,7 +4558,7 @@ if ($ADD=="1") ###################### -# ADD=1 display the COPY USER FORM SCREEN +# ADD=1A display the COPY USER FORM SCREEN ###################### if ($ADD=="1A") @@ -4417,10 +4568,11 @@ if ($ADD=="1A") echo "
\n"; echo ""; - echo "
COPY USER\n"; + echo "
COPY USER\n"; echo "\n"; + echo "\n"; echo "
\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; @@ -4442,7 +4594,7 @@ if ($ADD=="1A") } echo "$Uusers_list"; echo "$NWB#vicidial_users-user$NWE\n"; - echo "\n"; + echo "\n"; echo "
User Number: $NWB#vicidial_users-user$NWE
User Number: $NWB#vicidial_users-user$NWE
Password: $NWB#vicidial_users-pass$NWE
Full Name: $NWB#vicidial_users-full_name$NWE
\n"; } else @@ -4939,6 +5091,46 @@ if ($ADD==1111111111) } +###################### +# ADD=131111111 display the ADD NEW SHIFT SCREEN +###################### + +if ($ADD==131111111) +{ + if ($LOGmodify_call_times==1) + { + echo "
\n"; + echo ""; + + echo "
ADD NEW SHIFT\n"; + echo "\n"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
Shift ID: (no spaces or punctuation)$NWB#vicidial_shifts-shift_id$NWE
Shift Name: (short description of the shift)$NWB#vicidial_shifts-shift_name$NWE
Shift Start Time: \n"; + echo "   Shift End Time: \n"; + echo " $NWB#vicidial_shifts-shift_start_time$NWE
Shift Length: $NWB#vicidial_shifts-shift_length$NWE
Shift Weekdays:
$NWB#vicidial_shifts-shift_weekdays$NWE
\n"; + echo "Sunday
\n"; + echo "Monday
\n"; + echo "Tuesday
\n"; + echo "Wednesday
\n"; + echo "Thursday
\n"; + echo "Friday
\n"; + echo "Saturday
\n"; + echo "
\n"; + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +} + + ###################### # ADD=11111111111 display the ADD NEW PHONE SCREEN ###################### @@ -5132,14 +5324,51 @@ if ($ADD=="2") {echo "
USER NOT ADDED - there is already a user in the system with this user number\n";} else { - if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 10) ) { echo "
USER NOT ADDED - Please go back and look at the data you entered\n"; - echo "
user id must be between 2 and 8 characters long\n"; + echo "
user id must be between 2 and 10 characters long\n"; echo "
full name and password must be at least 2 characters long\n"; } else { + if (ereg('AUTOGENERA',$user)) + { + $new_user=0; + $auto_user_add_value=0; + while ($new_user < 2) + { + if ($new_user < 1) + { + $stmt = "SELECT auto_user_add_value FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + $ss_auav_ct = mysql_num_rows($rslt); + if ($ss_auav_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_user_add_value = $row[0]; + } + $new_user++; + } + $stmt = "SELECT count(*) FROM vicidial_users where user='$auto_user_add_value';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + { + $new_user++; + } + else + { + echo "\n"; + $auto_user_add_value = ($auto_user_add_value + 7); + } + } + $user = $auto_user_add_value; + echo "
user_id has been auto-generated: $user
\n"; + + $stmt="UPDATE system_settings SET auto_user_add_value='$user';"; + $rslt=mysql_query($stmt, $link); + } echo "
USER ADDED: $user\n"; $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass) values('$user','$pass','$full_name','$user_level','$user_group','$phone_login','$phone_pass');"; @@ -5172,14 +5401,53 @@ if ($ADD=="2A") {echo "
USER NOT ADDED - there is already a user in the system with this user number\n";} else { - if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 8) ) + if ( (strlen($user) < 2) or (strlen($pass) < 2) or (strlen($full_name) < 2) or (strlen($user) > 10) ) { echo "
USER NOT ADDED - Please go back and look at the data you entered\n"; - echo "
user id must be between 2 and 8 characters long\n"; + echo "
user id must be between 2 and 10 characters long\n"; echo "
full name and password must be at least 2 characters long\n"; + echo "\n"; } else { + if (ereg('AUTOGENERA',$user)) + { + $new_user=0; + $auto_user_add_value=0; + while ($new_user < 2) + { + if ($new_user < 1) + { + $stmt = "SELECT auto_user_add_value FROM system_settings;"; + $rslt=mysql_query($stmt, $link); + $ss_auav_ct = mysql_num_rows($rslt); + if ($ss_auav_ct > 0) + { + $row=mysql_fetch_row($rslt); + $auto_user_add_value = $row[0]; + } + $new_user++; + } + $stmt = "SELECT count(*) FROM vicidial_users where user='$auto_user_add_value';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + { + $new_user++; + } + else + { + echo "\n"; + $auto_user_add_value = ($auto_user_add_value + 7); + } + } + $user = $auto_user_add_value; + echo "
user_id has been auto-generated: $user
\n"; + + $stmt="UPDATE system_settings SET auto_user_add_value='$user';"; + $rslt=mysql_query($stmt, $link); + } + $stmt="INSERT INTO vicidial_users (user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit) SELECT \"$user\",\"$pass\",\"$full_name\",user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit from vicidial_users where user=\"$source_user_id\";"; $rslt=mysql_query($stmt, $link); @@ -5951,6 +6219,55 @@ $ADD=3111111111; } +###################### +# ADD=231111111 adds new shift definition to the system +###################### + +if ($ADD==231111111) +{ + echo ""; + $stmt="SELECT count(*) from vicidial_shifts where shift_id='$shift_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
SHIFT DEFINITION NOT ADDED - there is already a shift entry with this ID\n";} + else + { + $shift_length_test = eregi_replace(':','',$shift_length); + if ( (strlen($shift_id) < 2) or (strlen($shift_name) < 2) or (strlen($shift_start_time) < 4) or (strlen($shift_start_time) > 4) or (strlen($shift_length) < 5) or (strlen($shift_length) > 5) or ($shift_start_time > 2359) or ($shift_length_test > 2400) ) + { + echo "
SHIFT DEFINITION NOT ADDED - Please go back and look at the data you entered\n"; + echo "
Shift ID and name must be at least 2 characters in length\n"; + echo "
Shift Start Time must be 4 digits in length and be a valid time\n"; + echo "
Shift Length must be 5 characters in length and be 24 hours or less\n"; + } + else + { + $p=0; + $shift_weekdays_ct = count($shift_weekdays); + while ($p <= $shift_weekdays_ct) + { + $SHIFT_weekdays .= "$shift_weekdays[$p]"; + $p++; + } + $stmt="INSERT INTO vicidial_shifts SET shift_id='$shift_id',shift_name='$shift_name',shift_start_time='$shift_start_time',shift_length='$shift_length',shift_weekdays='$SHIFT_weekdays';"; + $rslt=mysql_query($stmt, $link); + + echo "
SHIFT ADDED: $shift_id\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD A NEW SHIFT ENTRY |$stmt|\n"); + fclose($fp); + } + } + } +$ADD=331111111; +} + + ###################### # ADD=21111111111 adds new phone to the system ###################### @@ -7312,7 +7629,15 @@ if ($ADD==411111) } else { - $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' where user_group='$OLDuser_group';"; + $p=0; + $GROUP_shifts=' '; + $group_shifts_ct = count($group_shifts); + while ($p <= $group_shifts_ct) + { + $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';"; $rslt=mysql_query($stmt, $link); echo "
USER GROUP MODIFIED\n"; @@ -7528,6 +7853,57 @@ $ADD=3111111111; # go to state call time modification form below } +###################### +# ADD=431111111 modify shift in the system +###################### + +if ($ADD==431111111) +{ + if ($LOGmodify_call_times==1) + { + echo ""; + + $shift_length_test = eregi_replace(':','',$shift_length); + if ( (strlen($shift_id) < 2) or (strlen($shift_name) < 2) or (strlen($shift_start_time) < 4) or (strlen($shift_start_time) > 4) or (strlen($shift_length) < 5) or (strlen($shift_length) > 5) or ($shift_start_time > 2359) or ($shift_length_test > 2400) ) + { + echo "
SHIFT DEFINITION NOT MODIFIED - Please go back and look at the data you entered\n"; + echo "
Shift ID and name must be at least 2 characters in length\n"; + echo "
Shift Start Time must be 4 digits in length and be a valid time\n"; + echo "
Shift Length must be 5 characters in length and be 24 hours or less\n"; + } + else + { + $p=0; + $shift_weekdays_ct = count($shift_weekdays); + while ($p <= $shift_weekdays_ct) + { + $SHIFT_weekdays .= "$shift_weekdays[$p]"; + $p++; + } + $shift_start_time = preg_replace('/\D/', '', $shift_start_time); + $stmt="UPDATE vicidial_shifts set shift_name='$shift_name', shift_start_time='$shift_start_time', shift_length='$shift_length', shift_weekdays='$SHIFT_weekdays' where shift_id='$shift_id';"; + $rslt=mysql_query($stmt, $link); + + echo "
SHIFT MODIFIED\n"; + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|MODIFY SHIFT ENTRY |$stmt|\n"); + fclose($fp); + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=331111111; # go to shift modification form below +} + + ###################### # ADD=41111111111 modify phone record in the system ###################### @@ -8318,6 +8694,27 @@ if ($ADD==5111111111) $ADD='3111111111'; # go to state call time modification below } +###################### +# ADD=531111111 confirmation before deletion of shift record +###################### + +if ($ADD==531111111) +{ + echo ""; + + if ( (strlen($shift_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
SHIFT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Shift ID must be at least 2 characters in length\n"; + } + else + { + echo "
SHIFT DELETION CONFIRMATION: $shift_id\n"; + echo "

Click here to delete shift $shift_id


\n"; + } + +$ADD='331111111'; # go to call time modification below +} ###################### # ADD=51111111111 confirmation before deletion of phone record @@ -9052,7 +9449,7 @@ if ($ADD==611111111) if ($WeBRooTWritablE > 0) { $fp = fopen ("./admin_changes_log.txt", "a"); - fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|call_time_id='$call_time_id'|\n"); + fwrite ($fp, "$date|!DELETING CALL TIME!|$PHP_AUTH_USER|$ip|$stmt|\n"); fclose($fp); } echo "
CALL TIME DELETION COMPLETED: $call_time_id\n"; @@ -9119,6 +9516,39 @@ $ADD='1000000000'; # go to call times list } +###################### +# ADD=631111111 delete shift record +###################### + +if ($ADD==631111111) +{ + echo ""; + + if ( (strlen($shift_id) < 2) or ($LOGdelete_call_times < 1) ) + { + echo "
SHIFT NOT DELETED - Please go back and look at the data you entered\n"; + echo "
Shift ID must be at least 2 characters in length\n"; + } + else + { + $stmt="DELETE from vicidial_shifts where shift_id='$shift_id' limit 1;"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|!DELETING SHIFT!!!!!|$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + echo "
SHIFT DELETION COMPLETED: $shift_id\n"; + echo "

\n"; + } + +$ADD='130000000'; # go to shifts list +} + + ###################### # ADD=61111111111 delete phone record ###################### @@ -12084,6 +12514,7 @@ if ($ADD==311111) $row=mysql_fetch_row($rslt); $user_group = $row[0]; $group_name = $row[1]; + $GROUP_shifts = $row[5]; echo ""; echo "
MODIFY A USERS GROUP ENTRY\n"; @@ -12092,16 +12523,42 @@ if ($ADD==311111) echo "
\n"; echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; - echo "\n"; + + echo "\n"; - echo "\n"; + echo "\n"; + echo "
 \n"; echo "\n"; echo "
Group: (no spaces or punctuation)$NWB#vicidial_user_groups-user_group$NWE
Description: (description of group)$NWB#vicidial_user_groups-group_name$NWE
Allowed Campaigns: \n"; - echo "$campaigns_list"; - echo "$NWB#vicidial_user_groups-allowed_campaigns$NWE
Allowed Campaigns:
$NWB#vicidial_user_groups-allowed_campaigns$NWE
\n"; + echo "$campaigns_list
 "; + echo "
QC Allowed Campaigns: \n"; + + echo "
Group Shifts:
$NWB#vicidial_user_groups-group_shifts$NWE
\n"; + $stmt="SELECT shift_id,shift_name from vicidial_shifts order by shift_id"; + $rslt=mysql_query($stmt, $link); + $shifts_to_print = mysql_num_rows($rslt); + $o=0; + while ($shifts_to_print > $o) + { + $rowx=mysql_fetch_row($rslt); + $shift_id_value = $rowx[0]; + $shift_name_value = $rowx[1]; + echo " $shift_id_value - $shift_name_value
\n"; + $o++; + } + echo "
 
QC Allowed Campaigns:
$NWB#vicidial_user_groups-qc_allowed_campaigns$NWE
\n"; echo "$qc_campaigns_list"; - echo "$NWB#vicidial_user_groups-qc_allowed_campaigns$NWE
QC Allowed Inbound Groups: \n"; + echo "
 
QC Allowed Inbound Groups:
$NWB#vicidial_user_groups-qc_allowed_inbound_groups$NWE
\n"; echo "$qc_groups_list"; - echo "$NWB#vicidial_user_groups-qc_allowed_inbound_groups$NWE
\n"; @@ -12589,6 +13046,116 @@ echo "You are not authorized to view this page. Please go back."; } + +###################### +# ADD=331111111 modify shift definition info in the system +###################### + +if ($ADD==331111111) +{ + +if ($LOGmodify_call_times==1) +{ +echo "
\n"; + echo ""; + + $stmt="SELECT * from vicidial_shifts where shift_id='$shift_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $shift_name = $row[1]; + $shift_start_time = $row[2]; + $shift_length = $row[3]; + $shift_weekdays = $row[4]; + + $shift_start_hour = substr($shift_start_time,0,2); + $shift_start_min = substr($shift_start_time,2,2); + $shift_length_hour = substr($shift_length,0,2); + $shift_length_min = substr($shift_length,3,2); + $shift_end_hour = ($shift_start_hour + $shift_length_hour); + $shift_end_min = ($shift_start_min + $shift_length_min); + if ($shift_end_min >=60) + { + $shift_end_min = ($shift_end_min - 60); + $shift_end_hour++; + } + if ($shift_end_hour >=24) + { + $shift_end_hour = ($shift_end_hour - 24); + } + $shift_end_hour = sprintf("%02s", $shift_end_hour); + $shift_end_min = sprintf("%02s", $shift_end_min); + $shift_end = "$shift_end_hour$shift_end_min"; + +echo ""; + +echo "
MODIFY A SHIFT\n"; +echo "\n"; +echo "\n"; +echo "
\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "\n"; +echo "
Shift ID: $shift_id
Shift Name: (short description of the shift)$NWB#vicidial_shifts-shift_name$NWE
Shift Start Time: \n"; +echo "   Shift End Time: \n"; +echo " $NWB#vicidial_shifts-shift_start_time$NWE
Shift Length: $NWB#vicidial_shifts-shift_length$NWE
Shift Weekdays:
$NWB#vicidial_shifts-shift_weekdays$NWE
\n"; +echo "Sunday
\n"; +echo "Monday
\n"; +echo "Tuesday
\n"; +echo "Wednesday
\n"; +echo "Thursday
\n"; +echo "Friday
\n"; +echo "Saturday
\n"; +echo "
\n"; + +echo "


\n"; +echo "USER GROUPS USING THIS SHIFT:
\n"; +echo "\n"; + + + $stmt="SELECT user_group,group_name from vicidial_user_groups where group_shifts LIKE\"% $shift_id %\";"; + $rslt=mysql_query($stmt, $link); + $camps_to_print = mysql_num_rows($rslt); + $o=0; + while ($camps_to_print > $o) { + $row=mysql_fetch_row($rslt); + echo "\n"; + $o++; + } + + +echo "
$row[0] $row[1]
\n"; +echo "

\n"; + +if ($LOGdelete_call_times > 0) + { + echo "

DELETE THIS SHIFT DEFINITION\n"; + } +} +else +{ +echo "You are not authorized to view this page. Please go back."; +} + +} + + ###################### # ADD=31111111111 modify phone record in the system ###################### @@ -13076,7 +13643,7 @@ if ($ADD==311111111111111) echo "
\n"; echo ""; - $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version from system_settings;"; + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value from system_settings;"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $version = $row[0]; @@ -13096,12 +13663,14 @@ if ($ADD==311111111111111) $admin_home_url = $row[14]; $enable_agc_xfer_log = $row[15]; $db_schema_version = $row[16]; + $auto_user_add_value = $row[17]; echo "
MODIFY VICIDIAL SYSTEM SETTINGS\n"; echo "\n"; echo "
\n"; echo "\n"; echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -14073,6 +14642,41 @@ echo "
Version: $version
DB Schema Version: $db_schema_version
Auto User-add Value: $auto_user_add_value
Install Date: $install_date
Use Non-Latin: $NWB#settings-use_non_latin$NWE
Webroot Writable: $NWB#settings-webroot_writable$NWE
\n"; echo "
\n"; } +###################### +# ADD=130000000 display all shifts +###################### +if ($ADD==130000000) +{ +echo "
\n"; + + echo ""; + + $stmt="SELECT * from vicidial_shifts order by shift_id"; + $rslt=mysql_query($stmt, $link); + $filters_to_print = mysql_num_rows($rslt); + +echo "
SHIFT LISTINGS:\n"; +echo "
\n"; + + $o=0; + while ($filters_to_print > $o) { + $row=mysql_fetch_row($rslt); + if (eregi("1$|3$|5$|7$|9$", $o)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + $o++; + } + +echo "
$row[0] $row[1] $row[2] $row[3] $row[4] MODIFY
\n"; +} + ###################### # ADD=10000000000 display all phones ###################### @@ -14303,7 +14907,8 @@ if ($ADD==999999)
  • TIME ON VDAD (per campaign)   (all campaigns SUMMARY)     SIP Listen - Barge     IAX Listen - Barge
  • VDAD REPORT -
  • CLOSER REPORT +
  • INBOUND/CLOSER REPORT +
  • INBOUND/CLOSER SERVICE_LEVEL REPORT
  • AGENT PERFORMANCE DETAIL
  • FRONTER - CLOSER REPORT
  • AGENT SPREADSHEET PERFORMANCE diff --git a/www/vicidial/new_listloader_superL.php b/www/vicidial/new_listloader_superL.php index c8b32631..1a592300 100644 --- a/www/vicidial/new_listloader_superL.php +++ b/www/vicidial/new_listloader_superL.php @@ -20,11 +20,12 @@ # 70417-1059 - Fixed default phone_code bug # 70510-1518 - Added campaign and system duplicate check and phonecode override # 80428-0417 - UTF8 changes +# 80514-1030 - removed filesize limit and raised number of errors to be displayed # # make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. -$version = '2.0.4'; -$build = '70510-1518'; +$version = '2.0.5-25'; +$build = '80514-1030'; require("dbconnect.php"); @@ -551,7 +552,7 @@ function ParseFileName() { $good++; } else { - if ($bad < 10000) {print "
    record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list\n";} + if ($bad < 1000000) {print "
    record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list\n";} $bad++; } $total++; @@ -766,7 +767,7 @@ function ParseFileName() { $good++; } else { - if ($bad < 10000) {print "
    record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + if ($bad < 1000000) {print "
    record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} $bad++; } $total++; @@ -787,7 +788,7 @@ function ParseFileName() { print ""; } -if ($leadfile && filesize($LF_path)<=8388608) { +if ($leadfile) { $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; if ($file_layout=="standard") { @@ -990,7 +991,7 @@ if ($leadfile && filesize($LF_path)<=8388608) { $good++; } else { - if ($bad < 10000) {print "
    record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + if ($bad < 1000000) {print "
    record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} $bad++; } $total++; @@ -1216,7 +1217,7 @@ if ($leadfile && filesize($LF_path)<=8388608) { $good++; } else { - if ($bad < 10000) {print "
    record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} + if ($bad < 1000000) {print "
    record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead\n";} $bad++; } $total++; @@ -1454,8 +1455,8 @@ if ($leadfile && filesize($LF_path)<=8388608) { # } print ""; } -} else if (filesize($leadfile)>8388608) { - print "
    ERROR: File exceeds the 8MB limit.
    "; +#} else if (filesize($leadfile)>8388608) { +# print "
    ERROR: File exceeds the 8MB limit.
    "; } ?>