From baa7d46a9e064a8c2c931c52ba56407d8273d1ac Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 19 Feb 2007 18:33:46 +0000 Subject: [PATCH] changed campaign dial statuses to use dunamic number of statuses, replacing the static dial_status_x fields. Changes to database, admin.php, AST_VDhopper and timeonVDADall scripts git-svn-id: svn://192.168.202.10@532 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 3 +- bin/AST_VDadapt.pl | 45 +- bin/AST_VDhopper.pl | 38 +- extras/MySQL_AST_CREATE_tables.sql | 3 +- extras/upgrade_2.0.3.sql | 4 + .../TO_BE_TRANSLATED_2.0.3.txt | 11 + www/vicidial/AST_timeonVDADall.php | 9 +- www/vicidial/AST_timeonVDADallSUMMARY.php | 7 +- www/vicidial/admin.php | 963 ++++++++++-------- 9 files changed, 616 insertions(+), 467 deletions(-) diff --git a/UPGRADE b/UPGRADE index e4997caa..5910692d 100644 --- a/UPGRADE +++ b/UPGRADE @@ -73,7 +73,8 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom "--postal-code-gmt" flag to your adjust GMT script in the crontab to more accurately assign timezones to your leads. - +18. Changed dial statuses to use dynamic number of dial statuses instead of + static dial_status_x fields. diff --git a/bin/AST_VDadapt.pl b/bin/AST_VDadapt.pl index dd7e9ac8..1afacbf5 100644 --- a/bin/AST_VDadapt.pl +++ b/bin/AST_VDadapt.pl @@ -5,7 +5,7 @@ # DESCRIPTION: # adjusts the auto_dial_level for vicidial adaptive-predictive campaigns. # -# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 # # CHANGELOG # 60823-1302 - First build from AST_VDhopper.pl @@ -19,6 +19,7 @@ # 70111-1600 - Added ability to use BLEND/INBND/*_C/*_B/*_I as closer campaigns # 70205-1429 - Added code for campaign_changedate and campaign_stats_refresh updates # 70213-1221 - Added code for QueueMetrics queue_log QUEUESTART record +# 70219-1249 - Removed unused references to dial_status_x fields # # constants @@ -316,11 +317,6 @@ while ($master_loop<$CLIloops) # if ($DB) {print "TIME DEBUG: $master_loop $LOCAL_GMT_OFF_STD|$LOCAL_GMT_OFF|$isdst| GMT: $hour:$min\n";} @campaign_id=@MT; -@dial_status_a=@MT; -@dial_status_b=@MT; -@dial_status_c=@MT; -@dial_status_d=@MT; -@dial_status_e=@MT; @lead_order=@MT; @hopper_level=@MT; @auto_dial_level=@MT; @@ -343,7 +339,7 @@ if ($CLIcampaign) } else { - $stmtA = "SELECT campaign_id,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,UNIX_TIMESTAMP(campaign_changedate),campaign_stats_refresh from vicidial_campaigns where ( (active='Y') or (campaign_stats_refresh='Y') )"; + $stmtA = "SELECT campaign_id,lead_order,hopper_level,auto_dial_level,local_call_time,lead_filter_id,use_internal_dnc,dial_method,available_only_ratio_tally,adaptive_dropped_percentage,adaptive_maximum_level,adaptive_latest_server_time,adaptive_intensity,adaptive_dl_diff_target,UNIX_TIMESTAMP(campaign_changedate),campaign_stats_refresh from vicidial_campaigns where ( (active='Y') or (campaign_stats_refresh='Y') )"; } $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -353,29 +349,24 @@ while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; $campaign_id[$rec_count] = $aryA[0]; - $dial_status_a[$rec_count] = $aryA[1]; - $dial_status_b[$rec_count] = $aryA[2]; - $dial_status_c[$rec_count] = $aryA[3]; - $dial_status_d[$rec_count] = $aryA[4]; - $dial_status_e[$rec_count] = $aryA[5]; - $lead_order[$rec_count] = $aryA[6]; + $lead_order[$rec_count] = $aryA[1]; if (!$CLIlevel) - {$hopper_level[$rec_count] = $aryA[7];} + {$hopper_level[$rec_count] = $aryA[2];} else {$hopper_level[$rec_count] = $CLIlevel;} - $auto_dial_level[$rec_count] = $aryA[8]; - $local_call_time[$rec_count] = $aryA[9]; - $lead_filter_id[$rec_count] = $aryA[10]; - $use_internal_dnc[$rec_count] = $aryA[11]; - $dial_method[$rec_count] = $aryA[12]; - $available_only_ratio_tally[$i][$rec_count] = $aryA[13]; - $adaptive_dropped_percentage[$rec_count] = $aryA[14]; - $adaptive_maximum_level[$rec_count] = $aryA[15]; - $adaptive_latest_server_time[$rec_count] = $aryA[16]; - $adaptive_intensity[$rec_count] = $aryA[17]; - $adaptive_dl_diff_target[$rec_count] = $aryA[18]; - $campaign_changedate[$rec_count] = $aryA[19]; - $campaign_stats_refresh[$rec_count] = $aryA[20]; + $auto_dial_level[$rec_count] = $aryA[3]; + $local_call_time[$rec_count] = $aryA[4]; + $lead_filter_id[$rec_count] = $aryA[5]; + $use_internal_dnc[$rec_count] = $aryA[6]; + $dial_method[$rec_count] = $aryA[7]; + $available_only_ratio_tally[$i][$rec_count] = $aryA[8]; + $adaptive_dropped_percentage[$rec_count] = $aryA[9]; + $adaptive_maximum_level[$rec_count] = $aryA[10]; + $adaptive_latest_server_time[$rec_count] = $aryA[11]; + $adaptive_intensity[$rec_count] = $aryA[12]; + $adaptive_dl_diff_target[$rec_count] = $aryA[13]; + $campaign_changedate[$rec_count] = $aryA[14]; + $campaign_stats_refresh[$rec_count] = $aryA[15]; $rec_count++; } diff --git a/bin/AST_VDhopper.pl b/bin/AST_VDhopper.pl index 2813a46b..c43b4f57 100644 --- a/bin/AST_VDhopper.pl +++ b/bin/AST_VDhopper.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# AST_VDhopper.pl version 2.0.2 *DBI-version* +# AST_VDhopper.pl version 2.0.3 *DBI-version* # # DESCRIPTION: # uses DBD::MySQL to update the VICIDIAL leads hopper for the streamlined @@ -23,8 +23,9 @@ # a minute, you may want to play with the variables below to streamline for # your usage # -# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 # +# CHANGELOG # 50810-1613 - Added database server variable definitions lookup # 60215-1106 - Added Scheduled Callback release functionality # 60228-1623 - Change Callback activation to set the called_since_last_reset=N @@ -36,12 +37,13 @@ # 60511-1150 - Added inserts into vicidial_campaign_stats table # 60609-1451 - Added ability to filter by DNC list vicidial_dnc # 60614-1159 - Added campaign lead recycling ability -# 60715-2251 - changed to use /etc/astguiclient.conf for configs +# 60715-2251 - Changed to use /etc/astguiclient.conf for configs # 60801-1634 - Fixed Callback activation bug 000008 -# 60814-1720 - added option for no logging to file -# 60822-1527 - added campaign_stats and logging options for adaptive dialing -# 60925-1330 - fixed recycling leads issues -# 61110-1513 - changed Xth NEW to fill to hopper_level with standard if not enough NEW +# 60814-1720 - Added option for no logging to file +# 60822-1527 - Added campaign_stats and logging options for adaptive dialing +# 60925-1330 - Fixed recycling leads issues +# 61110-1513 - Changed Xth NEW to fill to hopper_level with standard if not enough NEW +# 70219-1247 - Changed to use dial_statuses field instead of dial_status_x fields # # constants @@ -384,11 +386,6 @@ while ($sthArows > $rec_count) { @aryA = $sthA->fetchrow_array; $campaign_id[$rec_count] = "$aryA[0]"; - $dial_status_a[$rec_count] = "$aryA[3]"; - $dial_status_b[$rec_count] = "$aryA[4]"; - $dial_status_c[$rec_count] = "$aryA[5]"; - $dial_status_d[$rec_count] = "$aryA[6]"; - $dial_status_e[$rec_count] = "$aryA[7]"; $lead_order[$rec_count] = "$aryA[8]"; if (!$CLIlevel) {$hopper_level[$rec_count] = "$aryA[13]";} @@ -402,6 +399,7 @@ while ($sthArows > $rec_count) $available_only_ratio_tally[$rec_count] = $aryA[47]; $adaptive_dropped_percentage[$rec_count] = $aryA[48]; $adaptive_maximum_level[$rec_count] = $aryA[49]; + $dial_statuses[$rec_count] = $aryA[61]; $rec_count++; } @@ -417,6 +415,18 @@ foreach(@campaign_id) $vicidial_log = 'vicidial_log'; $VCSdialable_leads[$i]=0; + $dial_statuses[$i] =~ s/ -$//gi; + @Dstatuses = split(/ /,$dial_statuses[$i]); + $Ds_to_print = (($#Dstatuses) + 0); + $STATUSsql[$i]=''; + $o=0; + while ($Ds_to_print > $o) + { + $o++; + $STATUSsql[$i] .= "'$Dstatuses[$o]',"; + } + chop($STATUSsql[$i]); + $stmtA = "SELECT dialable_leads from vicidial_campaign_stats where campaign_id='$campaign_id[$i]';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -955,7 +965,7 @@ foreach(@campaign_id) if ($DBX) {print " |$lead_filter_id[$i]|\n";} } - $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a[$i]','$dial_status_b[$i]','$dial_status_c[$i]','$dial_status_d[$i]','$dial_status_e[$i]') and list_id IN($camp_lists[$i]) and ($all_gmtSQL[$i]) $lead_filter_sql[$i];"; + $stmtA = "SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($STATUSsql[$i]) and list_id IN($camp_lists[$i]) and ($all_gmtSQL[$i]) $lead_filter_sql[$i];"; if ($DBX) {print " |$stmtA|\n";} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; @@ -1137,7 +1147,7 @@ foreach(@campaign_id) if ($campaign_leads_to_call[$i] > 0) { if ($DB) {print " lead call order: $order_stmt\n";} - $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a[$i]','$dial_status_b[$i]','$dial_status_c[$i]','$dial_status_d[$i]','$dial_status_e[$i]') and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $OTHER_level;"; + $stmtA = "SELECT lead_id,list_id,gmt_offset_now,phone_number,state FROM vicidial_list where called_since_last_reset='N' and status IN($STATUSsql[$i]) and list_id IN($camp_lists[$i]) and lead_id NOT IN($lead_id_lists) and ($all_gmtSQL[$i]) $lead_filter_sql[$i] $order_stmt limit $OTHER_level;"; if ($DBX) {print " |$stmtA|\n";} $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; diff --git a/extras/MySQL_AST_CREATE_tables.sql b/extras/MySQL_AST_CREATE_tables.sql index 67ef2ac3..61932b25 100644 --- a/extras/MySQL_AST_CREATE_tables.sql +++ b/extras/MySQL_AST_CREATE_tables.sql @@ -519,7 +519,8 @@ agent_pause_codes_active ENUM('Y','N') default 'N', campaign_description VARCHAR(255), campaign_changedate DATETIME, campaign_stats_refresh ENUM('Y','N') default 'N', -campaign_logindate DATETIME +campaign_logindate DATETIME, +auto_alt_dial_statuses VARCHAR(255) default ' NEW -' ); CREATE TABLE vicidial_lists ( diff --git a/extras/upgrade_2.0.3.sql b/extras/upgrade_2.0.3.sql index bf1163e2..40767fb3 100644 --- a/extras/upgrade_2.0.3.sql +++ b/extras/upgrade_2.0.3.sql @@ -99,3 +99,7 @@ queuemetrics_log_id VARCHAR(10) default 'VIC' ); INSERT INTO system_settings (version,install_date) values('2.0.X', CURDATE()); + +ALTER TABLE vicidial_campaigns ADD dial_statuses VARCHAR(255) default ' NEW -'; + +update vicidial_campaigns SET dial_statuses=concat_ws(""," ",`dial_status_a`," ",`dial_status_b`," ",`dial_status_c`," ",`dial_status_d`," ",`dial_status_e`," -"); diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.3.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.3.txt index 15eca044..b098c66d 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.3.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.0.3.txt @@ -135,6 +135,17 @@ QueueMetrics Database Password -<\/B> This is the password used to log in to you QueueMetrics URL -<\/B> This is the URL or web site address used to get to your QueueMetrics installation|| QueueMetrics Log ID -<\/B> This is the server ID that all VICIDIAL logs going into the QueueMetrics database will use as an identifier for each record|| QueueMetrics Log ID: || +Campaign Dial Status Added|| +Campaign Dial Status Removed|| +To add another status to dial, select it from the drop-down list and click ADD. To remove one of the dial statuses, click on the REMOVE link next to the status you want to remove|| +CAMPAIGN DIAL STATUS NOT ADDED|| +CAMPAIGN DIAL STATUS ADDED|| +this dial status is not selected for this campaign|| +CAMPAIGN DIAL STATUS NOT REMOVED|| +CAMPAIGN DIAL STATUS REMOVED|| +>REMOVE<|| +Dial Status || +no dial statuses selected for this campaign|| ############################################################ CLIENT diff --git a/www/vicidial/AST_timeonVDADall.php b/www/vicidial/AST_timeonVDADall.php index 26390480..40fe90a8 100644 --- a/www/vicidial/AST_timeonVDADall.php +++ b/www/vicidial/AST_timeonVDADall.php @@ -265,10 +265,10 @@ echo "\n\n"; if (!$group) {echo "

please select a campaign from the pulldown above\n"; exit;} else { -$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; if ($group=='XXXX-ALL-ACTIVE-XXXX') { - $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout) from vicidial_campaigns;"; + $stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses) from vicidial_campaigns;"; } if ($non_latin > 0) { @@ -294,6 +294,9 @@ $ADAavailonly = $row[14]; $TAPERtime = $row[15]; $CALLtime = $row[16]; $DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); $stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; if ($group=='XXXX-ALL-ACTIVE-XXXX') @@ -383,7 +386,7 @@ echo ""; echo "HOPPER LEVEL:  $HOPlev     "; echo "DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   "; echo "DL DIFF:  $diffONEMIN     "; -echo "STATUSES:  $DIALstatusA, $DIALstatusB, $DIALstatusC, $DIALstatusD, $DIALstatusE     "; +echo "STATUSES:  $DIALstatuses     "; echo ""; echo ""; diff --git a/www/vicidial/AST_timeonVDADallSUMMARY.php b/www/vicidial/AST_timeonVDADallSUMMARY.php index f53f999e..f2934b55 100644 --- a/www/vicidial/AST_timeonVDADallSUMMARY.php +++ b/www/vicidial/AST_timeonVDADallSUMMARY.php @@ -130,7 +130,7 @@ $group = $groups[$k]; echo "$group   -   "; echo "Modify\n"; -$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $DIALlev = $row[0]; @@ -151,6 +151,9 @@ $ADAavailonly = $row[14]; $TAPERtime = $row[15]; $CALLtime = $row[16]; $DIALtimeout = $row[17]; +$DIALstatuses = $row[18]; + $DIALstatuses = (preg_replace("/ -$|^ /","",$DIALstatuses)); + $DIALstatuses = (ereg_replace(' ',', ',$DIALstatuses)); $stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; $rslt=mysql_query($stmt, $link); @@ -216,7 +219,7 @@ echo ""; echo "HOPPER LEVEL:  $HOPlev     "; echo "DROPPED / ANSWERED:  $dropsTODAY / $answersTODAY   "; echo "DL DIFF:  $diffONEMIN     "; -echo "STATUSES:  $DIALstatusA, $DIALstatusB, $DIALstatusC, $DIALstatusD, $DIALstatusE     "; +echo "STATUSES:  $DIALstatuses     "; echo ""; echo ""; diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index da2cef87..f093e8f5 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -2,7 +2,7 @@ # admin.php - VICIDIAL administration page # # -# Copyright (C) 2006 Matt Florell LICENSE: GPLv2 +# Copyright (C) 2007 Matt Florell LICENSE: GPLv2 # @@ -564,11 +564,18 @@ if (isset($_GET["queuemetrics_url"])) {$queuemetrics_url=$_GET["queuemetrics_u elseif (isset($_POST["queuemetrics_url"])) {$queuemetrics_url=$_POST["queuemetrics_url"];} if (isset($_GET["queuemetrics_log_id"])) {$queuemetrics_log_id=$_GET["queuemetrics_log_id"];} elseif (isset($_POST["queuemetrics_log_id"])) {$queuemetrics_log_id=$_POST["queuemetrics_log_id"];} - +if (isset($_GET["dial_status"])) {$dial_status=$_GET["dial_status"];} + elseif (isset($_POST["dial_status"])) {$dial_status=$_POST["dial_status"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} if (isset($lead_filter_id)) {$lead_filter_id = strtoupper($lead_filter_id);} +if (strlen($dial_status) > 0) + { + $ADD='28'; + $status = $dial_status; + } + ##### BEGIN VARIABLE FILTERING FOR SECURITY ##### if ($non_latin < 1) @@ -792,6 +799,7 @@ $user = ereg_replace("[^-\_0-9a-zA-Z]","",$user); $user_group = ereg_replace("[^-\_0-9a-zA-Z]","",$user_group); $VICIDIAL_park_on_filename = ereg_replace("[^-\_0-9a-zA-Z]","",$VICIDIAL_park_on_filename); $auto_alt_dial = ereg_replace("[^-\_0-9a-zA-Z]","",$auto_alt_dial); +$dial_status = ereg_replace("[^-\_0-9a-zA-Z]","",$dial_status); ### ALPHA-NUMERIC and spaces $lead_order = ereg_replace("[^ 0-9a-zA-Z]","",$lead_order); @@ -951,12 +959,13 @@ $lead_filter_sql = ereg_replace(";","",$lead_filter_sql); # 70206-1323 - Added user setting for vicidial_recording_override # 70212-1412 - Added system settings section # 70214-1226 - Added QueueMetrics Log ID field to system settings section +# 70219-1102 - Changed campaign dial statuses to be one string allowing for high limit # # 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.87'; -$build = '70214-1226'; +$admin_version = '2.0.88'; +$build = '70219-1102'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -1083,6 +1092,7 @@ if ($ADD==23) {$hh='campaigns'; echo "New Campaign HotKey Addition";} if ($ADD==25) {$hh='campaigns'; echo "New Campaign Lead Recycle Addition";} if ($ADD==26) {$hh='campaigns'; echo "New Auto Alt Dial Status";} if ($ADD==27) {$hh='campaigns'; echo "New Agent Pause Code";} +if ($ADD==28) {$hh='campaigns'; echo "Campaign Dial Status Added";} if ($ADD==211) {$hh='lists'; echo "New List Addition";} if ($ADD==2111) {$hh='ingroups'; echo "New In-Group Addition";} if ($ADD==21111) {$hh='remoteagent'; echo "New Remote Agents Addition";} @@ -1160,6 +1170,7 @@ if ($ADD==63) {$hh='campaigns'; echo "Emergency VDAC Jam Clear";} if ($ADD==65) {$hh='campaigns'; echo "Delete Lead Recycle";} if ($ADD==66) {$hh='campaigns'; echo "Delete Auto Alt Dial Status";} if ($ADD==67) {$hh='campaigns'; echo "Delete Agent Pause Code";} +if ($ADD==68) {$hh='campaigns'; echo "Campaign Dial Status Removed";} if ($ADD==611) {$hh='lists'; echo "Delete List";} if ($ADD==6111) {$hh='ingroups'; echo "Delete In-Group";} if ($ADD==61111) {$hh='remoteagent'; echo "Delete Remote Agents";} @@ -1676,7 +1687,7 @@ echo "\n"; echo "\n"; echo "\n"; - echo "\n"; + } + + echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE\n"; echo "\n"; @@ -7302,7 +7404,7 @@ if ($ADD==31) if ($display_dialable_count == 'Y') { ### call function to calculate and print dialable leads - dialable_leads($DB,$link,$local_call_time,$dial_status_a,$dial_status_b,$dial_status_c,$dial_status_d,$dial_status_e,$camp_lists,$fSQL); + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); echo " - HIDE

"; } else @@ -7608,6 +7710,7 @@ if ($ADD==34) $campaign_changedate = $row[58]; $campaign_stats_refresh = $row[59]; $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; echo "
MODIFY A CAMPAIGN'S RECORD: $row[0] - Basic View | "; echo "Detail View | "; @@ -7626,58 +7729,61 @@ if ($ADD==34) echo "\n"; echo "\n"; echo "\n"; - echo "\n"; + } + + echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; + echo "   \n"; + echo "     $NWB#vicidial_campaigns-dial_status$NWE\n"; echo "\n"; @@ -7761,7 +7867,7 @@ if ($ADD==34) if ($display_dialable_count == 'Y') { ### call function to calculate and print dialable leads - dialable_leads($DB,$link,$local_call_time,$dial_status_a,$dial_status_b,$dial_status_c,$dial_status_d,$dial_status_e,$camp_lists,$fSQL); + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); echo " - HIDE

"; } else @@ -10032,318 +10138,337 @@ exit; ##### CALCULATE DIALABLE LEADS ##### -function dialable_leads($DB,$link,$local_call_time,$dial_status_a,$dial_status_b,$dial_status_c,$dial_status_d,$dial_status_e,$camp_lists,$fSQL) +function dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL) { ##### BEGIN calculate what gmt_offset_now values are within the allowed local_call_time setting ### if (isset($camp_lists)) { if (strlen($camp_lists)>1) { - $g=0; - $p='13'; - $GMT_gmt[0] = ''; - $GMT_hour[0] = ''; - $GMT_day[0] = ''; - while ($p > -13) + if (strlen($dial_statuses)>2) { - $pzone=3600 * $p; - $pmin=(gmdate("i", time() + $pzone)); - $phour=( (gmdate("G", time() + $pzone)) * 100); - $pday=gmdate("w", time() + $pzone); - $tz = sprintf("%.2f", $p); - $GMT_gmt[$g] = "$tz"; - $GMT_day[$g] = "$pday"; - $GMT_hour[$g] = ($phour + $pmin); - $p = ($p - 0.25); - $g++; - } - - $stmt="SELECT * FROM vicidial_call_times where call_time_id='$local_call_time';"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $rowx=mysql_fetch_row($rslt); - $Gct_default_start = "$rowx[3]"; - $Gct_default_stop = "$rowx[4]"; - $Gct_sunday_start = "$rowx[5]"; - $Gct_sunday_stop = "$rowx[6]"; - $Gct_monday_start = "$rowx[7]"; - $Gct_monday_stop = "$rowx[8]"; - $Gct_tuesday_start = "$rowx[9]"; - $Gct_tuesday_stop = "$rowx[10]"; - $Gct_wednesday_start = "$rowx[11]"; - $Gct_wednesday_stop = "$rowx[12]"; - $Gct_thursday_start = "$rowx[13]"; - $Gct_thursday_stop = "$rowx[14]"; - $Gct_friday_start = "$rowx[15]"; - $Gct_friday_stop = "$rowx[16]"; - $Gct_saturday_start = "$rowx[17]"; - $Gct_saturday_stop = "$rowx[18]"; - $Gct_state_call_times = "$rowx[19]"; - - $ct_states = ''; - $ct_state_gmt_SQL = ''; - $ct_srs=0; - $b=0; - if (strlen($Gct_state_call_times)>2) - { - $state_rules = explode('|',$Gct_state_call_times); - $ct_srs = ((count($state_rules)) - 2); - } - while($ct_srs >= $b) - { - if (strlen($state_rules[$b])>1) + $g=0; + $p='13'; + $GMT_gmt[0] = ''; + $GMT_hour[0] = ''; + $GMT_day[0] = ''; + while ($p > -13) { - $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $Gstate_call_time_id = "$row[0]"; - $Gstate_call_time_state = "$row[1]"; - $Gsct_default_start = "$row[4]"; - $Gsct_default_stop = "$row[5]"; - $Gsct_sunday_start = "$row[6]"; - $Gsct_sunday_stop = "$row[7]"; - $Gsct_monday_start = "$row[8]"; - $Gsct_monday_stop = "$row[9]"; - $Gsct_tuesday_start = "$row[10]"; - $Gsct_tuesday_stop = "$row[11]"; - $Gsct_wednesday_start = "$row[12]"; - $Gsct_wednesday_stop = "$row[13]"; - $Gsct_thursday_start = "$row[14]"; - $Gsct_thursday_stop = "$row[15]"; - $Gsct_friday_start = "$row[16]"; - $Gsct_friday_stop = "$row[17]"; - $Gsct_saturday_start = "$row[18]"; - $Gsct_saturday_stop = "$row[19]"; - - $ct_states .="'$Gstate_call_time_state',"; - - $r=0; - $state_gmt=''; - while($r < $g) - { - if ($GMT_day[$r]==0) #### Sunday local time - { - if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==1) #### Monday local time - { - if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==2) #### Tuesday local time - { - if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==3) #### Wednesday local time - { - if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==4) #### Thursday local time - { - if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==5) #### Friday local time - { - if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==6) #### Saturday local time - { - if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) ) - {$state_gmt.="'$GMT_gmt[$r]',";} - } - } - $r++; - } - $state_gmt = "$state_gmt'99'"; - $ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) "; + $pzone=3600 * $p; + $pmin=(gmdate("i", time() + $pzone)); + $phour=( (gmdate("G", time() + $pzone)) * 100); + $pday=gmdate("w", time() + $pzone); + $tz = sprintf("%.2f", $p); + $GMT_gmt[$g] = "$tz"; + $GMT_day[$g] = "$pday"; + $GMT_hour[$g] = ($phour + $pmin); + $p = ($p - 0.25); + $g++; } - $b++; - } - if (strlen($ct_states)>2) - { - $ct_states = eregi_replace(",$",'',$ct_states); - $ct_statesSQL = "and state NOT IN($ct_states)"; + $stmt="SELECT * FROM vicidial_call_times where call_time_id='$local_call_time';"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rowx=mysql_fetch_row($rslt); + $Gct_default_start = "$rowx[3]"; + $Gct_default_stop = "$rowx[4]"; + $Gct_sunday_start = "$rowx[5]"; + $Gct_sunday_stop = "$rowx[6]"; + $Gct_monday_start = "$rowx[7]"; + $Gct_monday_stop = "$rowx[8]"; + $Gct_tuesday_start = "$rowx[9]"; + $Gct_tuesday_stop = "$rowx[10]"; + $Gct_wednesday_start = "$rowx[11]"; + $Gct_wednesday_stop = "$rowx[12]"; + $Gct_thursday_start = "$rowx[13]"; + $Gct_thursday_stop = "$rowx[14]"; + $Gct_friday_start = "$rowx[15]"; + $Gct_friday_stop = "$rowx[16]"; + $Gct_saturday_start = "$rowx[17]"; + $Gct_saturday_stop = "$rowx[18]"; + $Gct_state_call_times = "$rowx[19]"; + + $ct_states = ''; + $ct_state_gmt_SQL = ''; + $ct_srs=0; + $b=0; + if (strlen($Gct_state_call_times)>2) + { + $state_rules = explode('|',$Gct_state_call_times); + $ct_srs = ((count($state_rules)) - 2); + } + while($ct_srs >= $b) + { + if (strlen($state_rules[$b])>1) + { + $stmt="SELECT * from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $Gstate_call_time_id = "$row[0]"; + $Gstate_call_time_state = "$row[1]"; + $Gsct_default_start = "$row[4]"; + $Gsct_default_stop = "$row[5]"; + $Gsct_sunday_start = "$row[6]"; + $Gsct_sunday_stop = "$row[7]"; + $Gsct_monday_start = "$row[8]"; + $Gsct_monday_stop = "$row[9]"; + $Gsct_tuesday_start = "$row[10]"; + $Gsct_tuesday_stop = "$row[11]"; + $Gsct_wednesday_start = "$row[12]"; + $Gsct_wednesday_stop = "$row[13]"; + $Gsct_thursday_start = "$row[14]"; + $Gsct_thursday_stop = "$row[15]"; + $Gsct_friday_start = "$row[16]"; + $Gsct_friday_stop = "$row[17]"; + $Gsct_saturday_start = "$row[18]"; + $Gsct_saturday_stop = "$row[19]"; + + $ct_states .="'$Gstate_call_time_state',"; + + $r=0; + $state_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) ) + {$state_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + $state_gmt = "$state_gmt'99'"; + $ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) "; + } + + $b++; + } + if (strlen($ct_states)>2) + { + $ct_states = eregi_replace(",$",'',$ct_states); + $ct_statesSQL = "and state NOT IN($ct_states)"; + } + else + { + $ct_statesSQL = ""; + } + + $r=0; + $default_gmt=''; + while($r < $g) + { + if ($GMT_day[$r]==0) #### Sunday local time + { + if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_sunday_start) and ($GMT_hour[$r]<$Gct_sunday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==1) #### Monday local time + { + if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_monday_start) and ($GMT_hour[$r]<$Gct_monday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==2) #### Tuesday local time + { + if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_tuesday_start) and ($GMT_hour[$r]<$Gct_tuesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==3) #### Wednesday local time + { + if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_wednesday_start) and ($GMT_hour[$r]<$Gct_wednesday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==4) #### Thursday local time + { + if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_thursday_start) and ($GMT_hour[$r]<$Gct_thursday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==5) #### Friday local time + { + if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_friday_start) and ($GMT_hour[$r]<$Gct_friday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + if ($GMT_day[$r]==6) #### Saturday local time + { + if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) + { + if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + else + { + if ( ($GMT_hour[$r]>=$Gct_saturday_start) and ($GMT_hour[$r]<$Gct_saturday_stop) ) + {$default_gmt.="'$GMT_gmt[$r]',";} + } + } + $r++; + } + + $default_gmt = "$default_gmt'99'"; + $all_gmtSQL = "(gmt_offset_now IN($default_gmt) $ct_statesSQL) $ct_state_gmt_SQL"; + + $dial_statuses = preg_replace("/ -$/","",$dial_statuses); + $Dstatuses = explode(" ", $dial_statuses); + $Ds_to_print = (count($Dstatuses) -1); + $Dsql = ''; + $o=0; + while ($Ds_to_print > $o) + { + $Dsql .= "'$Dstatuses[$o]',"; + $o++; + } + $Dsql = preg_replace("/,$/","",$Dsql); + + $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $fSQL"; + #$DB=1; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $rslt_rows = mysql_num_rows($rslt); + if ($rslt_rows) + { + $rowx=mysql_fetch_row($rslt); + $active_leads = "$rowx[0]"; + } + else {$active_leads = '0';} + + echo "This campaign has $active_leads leads to be dialed in those lists\n"; } else { - $ct_statesSQL = ""; + echo "no dial statuses selected for this campaign\n"; } - - $r=0; - $default_gmt=''; - while($r < $g) - { - if ($GMT_day[$r]==0) #### Sunday local time - { - if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gct_sunday_start) and ($GMT_hour[$r]<$Gct_sunday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==1) #### Monday local time - { - if (($Gct_monday_start==0) and ($Gct_monday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gct_monday_start) and ($GMT_hour[$r]<$Gct_monday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==2) #### Tuesday local time - { - if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gct_tuesday_start) and ($GMT_hour[$r]<$Gct_tuesday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==3) #### Wednesday local time - { - if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gct_wednesday_start) and ($GMT_hour[$r]<$Gct_wednesday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==4) #### Thursday local time - { - if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gct_thursday_start) and ($GMT_hour[$r]<$Gct_thursday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==5) #### Friday local time - { - if (($Gct_friday_start==0) and ($Gct_friday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gct_friday_start) and ($GMT_hour[$r]<$Gct_friday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - } - if ($GMT_day[$r]==6) #### Saturday local time - { - if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0)) - { - if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - else - { - if ( ($GMT_hour[$r]>=$Gct_saturday_start) and ($GMT_hour[$r]<$Gct_saturday_stop) ) - {$default_gmt.="'$GMT_gmt[$r]',";} - } - } - $r++; - } - - $default_gmt = "$default_gmt'99'"; - $all_gmtSQL = "(gmt_offset_now IN($default_gmt) $ct_statesSQL) $ct_state_gmt_SQL"; - - $stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN('$dial_status_a','$dial_status_b','$dial_status_c','$dial_status_d','$dial_status_e') and list_id IN($camp_lists) and ($all_gmtSQL) $fSQL"; - #$DB=1; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $rslt_rows = mysql_num_rows($rslt); - if ($rslt_rows) - { - $rowx=mysql_fetch_row($rslt); - $active_leads = "$rowx[0]"; - } - else {$active_leads = '0';} - - echo "This campaign has $active_leads leads to be dialed in those lists\n"; } else {

-Dial Status - This is where you set the statuses that you are wanting to dial on within the lists that are active for the campaign below +Dial Status - This is where you set the statuses that you are wanting to dial on within the lists that are active for the campaign below. To add another status to dial, select it from the drop-down list and click ADD. To remove one of the dial statuses, click on the REMOVE link next to the status you want to remove.
@@ -2827,18 +2838,14 @@ if ($ADD==73) echo "\n"; echo ""; - $stmt="SELECT * from vicidial_campaigns where campaign_id='$campaign_id';"; + $stmt="SELECT dial_statuses,local_call_time,lead_filter_id from vicidial_campaigns where campaign_id='$campaign_id';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); - $dial_status_a = $row[3]; - $dial_status_b = $row[4]; - $dial_status_c = $row[5]; - $dial_status_d = $row[6]; - $dial_status_e = $row[7]; - $local_call_time = $row[16]; + $dial_statuses = $row[0]; + $local_call_time = $row[1]; if ($lead_filter_id=='') { - $lead_filter_id = $row[35]; + $lead_filter_id = $row[2]; if ($lead_filter_id=='') { $lead_filter_id='NONE'; @@ -2869,12 +2876,12 @@ if ($ADD==73) echo "Show Dialable Leads Count -

\n"; echo "CAMPAIGN: $campaign_id
\n"; echo "LISTS: $camp_lists
\n"; - echo "STATUSES: $dial_status_a,$dial_status_b,$dial_status_c,$dial_status_d,$dial_status_e
\n"; + echo "STATUSES: $dial_statuses
\n"; echo "FILTER: $lead_filter_id
\n"; echo "CALL TIME: $local_call_time

\n"; ### call function to calculate and print dialable leads - dialable_leads($DB,$link,$local_call_time,$dial_status_a,$dial_status_b,$dial_status_c,$dial_status_d,$dial_status_e,$camp_lists,$fSQL); + dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$fSQL); echo "

\n"; echo "\n"; @@ -4069,6 +4076,52 @@ $ADD=31; } +###################### +# ADD=28 adds new status to the campaign dial statuses +###################### + +if ($ADD==28) +{ + $status = eregi_replace("-----.*",'',$status); + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] > 0) + {echo "
CAMPAIGN DIAL STATUS NOT ADDED - there is already an entry for this campaign with this status\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN DIAL STATUS NOT ADDED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN DIAL STATUS ADDED: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + if (strlen($row[0])<2) {$row[0] = ' -';} + $dial_statuses = " $status$row[0]"; + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|ADD CAMPAIGN DIAL STATUS |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } +$ADD=31; +} + + ###################### # ADD=211 adds the new list to the system ###################### @@ -6302,6 +6355,57 @@ $ADD=31; # go to campaign modification form below } +###################### +# ADD=68 remove campaign dial status +###################### + +if ($ADD==68) +{ + if ($LOGmodify_campaigns==1) + { + echo ""; + $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and dial_statuses LIKE \"% $status %\";"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + if ($row[0] < 1) + {echo "
CAMPAIGN DIAL STATUS NOT REMOVED - this dial status is not selected for this campaign\n";} + else + { + if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) ) + { + echo "
CAMPAIGN DIAL STATUS NOT REMOVED - Please go back and look at the data you entered\n"; + echo "
status must be between 1 and 6 characters in length\n"; + } + else + { + echo "
CAMPAIGN DIAL STATUS REMOVED: $campaign_id - $status\n"; + + $stmt="SELECT dial_statuses from vicidial_campaigns where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + + $dial_statuses = eregi_replace(" $status "," ",$row[0]); + $stmt="UPDATE vicidial_campaigns set dial_statuses='$dial_statuses' where campaign_id='$campaign_id';"; + $rslt=mysql_query($stmt, $link); + + ### LOG CHANGES TO LOG FILE ### + if ($WeBRooTWritablE > 0) + { + $fp = fopen ("./admin_changes_log.txt", "a"); + fwrite ($fp, "$date|DIAL STATUS REMOVED |$PHP_AUTH_USER|$ip|$stmt|\n"); + fclose($fp); + } + } + } + } + else + { + echo "You do not have permission to view this page\n"; + exit; + } +$ADD=31; # go to campaign modification form below +} + ###################### # ADD=611 delete list record and all leads within it ###################### @@ -7034,6 +7138,7 @@ if ($ADD==31) $campaign_changedate = $row[58]; $campaign_stats_refresh = $row[59]; $campaign_logindate = $row[60]; + $dial_statuses = $row[61]; echo "
MODIFY A CAMPAIGNS RECORD: $row[0] -
Basic View"; echo " | Detail View | "; @@ -7051,64 +7156,61 @@ if ($ADD==31) echo "
Park Extension: - Filename: $NWB#vicidial_campaigns-park_ext$NWE
Web Form: $NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $NWB#vicidial_campaigns-allow_closers$NWE
Dial status 1:
Dial Status $o: \n"; + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Status: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 2: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 3: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 4: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 5: $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE
Park Extension: $row[9] - $row[10]$NWB#vicidial_campaigns-park_ext$NWE
Web Form: $row[11]$NWB#vicidial_campaigns-web_form_address$NWE
Allow Closers: $row[12] $NWB#vicidial_campaigns-allow_closers$NWE
Dial status 1:
Dial Status $o: \n"; + echo "$Dstatus - $statname_list[$Dstatus]         \n"; + echo "REMOVE
Add A Dial Status: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 2: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 3: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 4: $NWB#vicidial_campaigns-dial_status$NWE
Dial status 5: $NWB#vicidial_campaigns-dial_status$NWE
List Order: $NWB#vicidial_campaigns-lead_order$NWE