Added hopper_drop_run_trigger_all option

Moved dialable_leads function to functions.php
Added 'dialable_count' option to list_info Non-Agent API function

git-svn-id: svn://192.168.202.10@3420 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2021-04-06 22:27:23 +00:00
parent db0104be14
commit 33596f9638
16 changed files with 8039 additions and 9255 deletions
+39 -8
View File
@@ -22,7 +22,7 @@
# - S = Standard hopper load # - S = Standard hopper load
# - D = Campaign Drop-Run # - D = Campaign Drop-Run
# #
# Copyright (C) 2020 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# CHANGELOG # CHANGELOG
# 50810-1613 - Added database server variable definitions lookup # 50810-1613 - Added database server variable definitions lookup
@@ -100,10 +100,11 @@
# 201111-1359 - Added support for hopper_drop_run_trigger # 201111-1359 - Added support for hopper_drop_run_trigger
# 201122-1039 - Added support for daily call count limits # 201122-1039 - Added support for daily call count limits
# 201220-1032 - Changes for shared agent campaigns # 201220-1032 - Changes for shared agent campaigns
# 210405-1008 - Added hopper_drop_run_trigger=A option
# #
# constants # constants
$build = '201220-1032'; $build = '210405-1008';
$DB=0; # Debug flag, set to 0 for no debug messages. Can be overriden with CLI --debug flag $DB=0; # Debug flag, set to 0 for no debug messages. Can be overriden with CLI --debug flag
$US='__'; $US='__';
$MT[0]=''; $MT[0]='';
@@ -2658,10 +2659,40 @@ foreach(@campaign_id)
$hopperPRIORITY='0'; $hopperPRIORITY='0';
##### Load overrides if Hopper Drop-Run is triggered ##### ##### Load overrides if Hopper Drop-Run is triggered #####
if ($hopper_drop_run_trigger[$i] =~ /Y/) if ($hopper_drop_run_trigger[$i] =~ /Y|A/)
{ {
if ($hopper_drop_run_trigger[$i] =~ /A/)
{
$ALL_drop_statuses="'DROP','PDROP','XDROP'";
$stmtA = "SELECT status FROM vicidial_statuses where status LIKE \"%DROP%\" or status_name LIKE \"%DROP%\";";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsA=$sthA->rows;
$rec_count=0;
while ($sthArowsA > $rec_count)
{
@aryA = $sthA->fetchrow_array;
$ALL_drop_statuses .= ",'$aryA[0]'";
$rec_count++;
}
$sthA->finish();
$stmtA = "SELECT status FROM vicidial_campaign_statuses where status LIKE \"%DROP%\" or status_name LIKE \"%DROP%\";";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArowsA=$sthA->rows;
$rec_count=0;
while ($sthArowsA > $rec_count)
{
@aryA = $sthA->fetchrow_array;
$ALL_drop_statuses .= ",'$aryA[0]'";
$rec_count++;
}
$sthA->finish();
}
else
{$ALL_drop_statuses="'DROP'";}
$cslrSQL=''; $cslrSQL='';
$STATUSsql[$i]="'DROP'"; $STATUSsql[$i] = $ALL_drop_statuses;
$list_order_mix[$i]='DISABLED'; $list_order_mix[$i]='DISABLED';
$lead_order[$i]='DOWN LAST CALL TIME'; $lead_order[$i]='DOWN LAST CALL TIME';
$hopper_level[$i]='20000'; $hopper_level[$i]='20000';
@@ -2672,8 +2703,8 @@ foreach(@campaign_id)
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
if ($DBX) {print "CAMPAIGN Hopper Drop-Run RESET: $affected_rows|$stmtA|\n";} if ($DBX) {print "CAMPAIGN Hopper Drop-Run RESET: $affected_rows|$stmtA|\n";}
if ($DB) {print "Campaign Drop-Run triggered for $campaign_id[$i] |$STATUSsql[$i]|$list_order_mix[$i]|$affected_rows|\n";} if ($DB) {print "Campaign Drop-Run triggered for $campaign_id[$i]($hopper_drop_run_trigger[$i]) |$STATUSsql[$i]|$list_order_mix[$i]|$affected_rows|\n";}
$hopper_begin_output .= "Campaign Drop-Run triggered for $campaign_id[$i] |$STATUSsql[$i]|$list_order_mix[$i]|$affected_rows| \n"; $hopper_begin_output .= "Campaign Drop-Run triggered for $campaign_id[$i]($hopper_drop_run_trigger[$i]) |$STATUSsql[$i]|$list_order_mix[$i]|$affected_rows| \n";
} }
##### Get count of leads that are dialable ##### ##### Get count of leads that are dialable #####
@@ -3371,13 +3402,13 @@ foreach(@campaign_id)
$insert_end_output .= " DNC lead skipped: $DNCskip \n"; $insert_end_output .= " DNC lead skipped: $DNCskip \n";
$insert_end_output .= " Daily call count limit lead skipped: $DCCLskip \n"; $insert_end_output .= " Daily call count limit lead skipped: $DCCLskip \n";
if ($DB) {print "$insert_end_output";} if ($DB) {print "$insert_end_output";}
$insert_end_outputSQL = ",adapt_output='$insert_end_output'"; $insert_end_outputSQL = ",adapt_output=\"$insert_end_output\"";
} }
} }
} }
} }
# update debug output # update debug output
$stmtA = "UPDATE vicidial_campaign_stats_debug SET entry_time='$now_date',debug_output='$hopper_begin_output'$insert_end_outputSQL where campaign_id='$campaign_id[$i]' and server_ip='HOPPER';"; $stmtA = "UPDATE vicidial_campaign_stats_debug SET entry_time='$now_date',debug_output=\"$hopper_begin_output\"$insert_end_outputSQL where campaign_id='$campaign_id[$i]' and server_ip='HOPPER';";
$affected_rows = $dbhA->do($stmtA); $affected_rows = $dbhA->do($stmtA);
$i++; $i++;
+3 -1
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2021-04-02 NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2021-04-06
This document describes the functions of an API(Application Programming This document describes the functions of an API(Application Programming
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen. Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
@@ -185,6 +185,7 @@ Changes:
210330-1633 - Added ability to use custom_fields_copy on update_list on a deleted list_id 210330-1633 - Added ability to use custom_fields_copy on update_list on a deleted list_id
210401-1058 - Added 'custom_fields_update' option for update_list function 210401-1058 - Added 'custom_fields_update' option for update_list function
210402-1102 - Added 'custom_fields_delete' option for update_list function 210402-1102 - Added 'custom_fields_delete' option for update_list function
210406-1047 - Added 'dialable_count' option to list_info function
API Functions use the 'function' variable API Functions use the 'function' variable
@@ -1843,6 +1844,7 @@ source - description of what originated the API call (maximum 20 characters)
SETTINGS FIELDS- (optional) SETTINGS FIELDS- (optional)
leads_counts - Y or N, will include the counts of all leads and NEW status leads in the response, default is 'N' leads_counts - Y or N, will include the counts of all leads and NEW status leads in the response, default is 'N'
dialable_count - Y or N, will use the list's campaign settings to provide a count of how many are dialable right now, default is 'N'
stage - the format of the exported data: csv, tab, pipe(default) stage - the format of the exported data: csv, tab, pipe(default)
header - include a header(YES) or not(NO). This is optional, default is not to include a header header - include a header(YES) or not(NO). This is optional, default is not to include a header
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
-957
View File
@@ -1585,961 +1585,4 @@ else
} }
} }
##### CALCULATE DIALABLE LEADS #####
function dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$drop_lockout_time,$call_count_limit,$single_status,$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)
{
if (strlen($dial_statuses)>2)
{
$g=0;
$p='13';
$GMT_gmt[0] = '';
$GMT_hour[0] = '';
$GMT_day[0] = '';
$YMD = date("Y-m-d");
while ($p > -13)
{
$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 call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$rowx=mysqli_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];
$Gct_holidays = $rowx[20];
### BEGIN Check for outbound holiday ###
$holiday_id = '';
if (strlen($Gct_holidays)>2)
{
$Gct_holidaysSQL = preg_replace("/\|/", "','", "$Gct_holidays");
$Gct_holidaysSQL = "'".$Gct_holidaysSQL."'";
$stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN($Gct_holidaysSQL) and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$sthCrows=mysqli_num_rows($rslt);
if ($sthCrows > 0)
{
$aryC=mysqli_fetch_row($rslt);
$holiday_id = $aryC[0];
$holiday_date = $aryC[1];
$holiday_name = $aryC[2];
if($Gct_default_start < $aryC[3]) {$Gct_default_start = $aryC[3];}
if($Gct_default_stop > $aryC[4]) {$Gct_default_stop = $aryC[4];}
if($Gct_sunday_start < $aryC[3]) {$Gct_sunday_start = $aryC[3];}
if($Gct_sunday_stop > $aryC[4]) {$Gct_sunday_stop = $aryC[4];}
if($Gct_monday_start < $aryC[3]) {$Gct_monday_start = $aryC[3];}
if($Gct_monday_stop > $aryC[4]) {$Gct_monday_stop = $aryC[4];}
if($Gct_tuesday_start < $aryC[3]) {$Gct_tuesday_start = $aryC[3];}
if($Gct_tuesday_stop > $aryC[4]) {$Gct_tuesday_stop = $aryC[4];}
if($Gct_wednesday_start < $aryC[3]) {$Gct_wednesday_start = $aryC[3];}
if($Gct_wednesday_stop > $aryC[4]) {$Gct_wednesday_stop = $aryC[4];}
if($Gct_thursday_start < $aryC[3]) {$Gct_thursday_start = $aryC[3];}
if($Gct_thursday_stop > $aryC[4]) {$Gct_thursday_stop = $aryC[4];}
if($Gct_friday_start < $aryC[3]) {$Gct_friday_start = $aryC[3];}
if($Gct_friday_stop > $aryC[4]) {$Gct_friday_stop = $aryC[4];}
if($Gct_saturday_start < $aryC[3]) {$Gct_saturday_start = $aryC[3];}
if($Gct_saturday_stop > $aryC[4]) {$Gct_saturday_stop = $aryC[4];}
if ($DB) {echo "CALL TIME HOLIDAY FOUND! $local_call_time|$holiday_id|$holiday_date|$holiday_name|$Gct_default_start|$Gct_default_stop|\n";}
}
}
### END Check for outbound holiday ###
$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 state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_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];
$Sct_holidays = $row[20];
$ct_states .="'$Gstate_call_time_state',";
### BEGIN Check for outbound state holiday ###
$Sholiday_id = '';
if ((strlen($Sct_holidays)>2) or ((strlen($holiday_id)>2) and (strlen($Sholiday_id)<2)))
{
# Apply state holiday
if (strlen($Sct_holidays)>2)
{
$Sct_holidaysSQL = preg_replace("/\|/", "','", "$Sct_holidays");
$Sct_holidaysSQL = "'".$Sct_holidaysSQL."'";
$stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN($Sct_holidaysSQL) and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
$holidaytype = "STATE CALL TIME HOLIDAY FOUND! ";
}
# Apply call time wide holiday
elseif ((strlen($holiday_id)>2) and (strlen($Sholiday_id)<2))
{
$stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id='$holiday_id' and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
$holidaytype = "NO STATE HOLIDAY APPLYING CALL TIME HOLIDAY! ";
}
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$sthCrows=mysqli_num_rows($rslt);
if ($sthCrows > 0)
{
$aryC=mysqli_fetch_row($rslt);
$Sholiday_id = $aryC[0];
$Sholiday_date = $aryC[1];
$Sholiday_name = $aryC[2];
if ( ($Gsct_default_start < $aryC[3]) && ($Gsct_default_stop > 0) ) {$Gsct_default_start = $aryC[3];}
if ( ($Gsct_default_stop > $aryC[4]) && ($Gsct_default_stop > 0) ) {$Gsct_default_stop = $aryC[4];}
if ( ($Gsct_sunday_start < $aryC[3]) && ($Gsct_sunday_stop > 0) ) {$Gsct_sunday_start = $aryC[3];}
if ( ($Gsct_sunday_stop > $aryC[4]) && ($Gsct_sunday_stop > 0) ) {$Gsct_sunday_stop = $aryC[4];}
if ( ($Gsct_monday_start < $aryC[3]) && ($Gsct_monday_stop > 0) ) {$Gsct_monday_start = $aryC[3];}
if ( ($Gsct_monday_stop > $aryC[4]) && ($Gsct_monday_stop > 0) ) {$Gsct_monday_stop = $aryC[4];}
if ( ($Gsct_tuesday_start < $aryC[3]) && ($Gsct_tuesday_stop > 0) ) {$Gsct_tuesday_start = $aryC[3];}
if ( ($Gsct_tuesday_stop > $aryC[4]) && ($Gsct_tuesday_stop > 0) ) {$Gsct_tuesday_stop = $aryC[4];}
if ( ($Gsct_wednesday_start < $aryC[3]) && ($Gsct_wednesday_stop > 0) ) {$Gsct_wednesday_start = $aryC[3];}
if ( ($Gsct_wednesday_stop > $aryC[4]) && ($Gsct_wednesday_stop > 0) ) {$Gsct_wednesday_stop = $aryC[4];}
if ( ($Gsct_thursday_start < $aryC[3]) && ($Gsct_thursday_stop > 0) ) {$Gsct_thursday_start = $aryC[3];}
if ( ($Gsct_thursday_stop > $aryC[4]) && ($Gsct_thursday_stop > 0) ) {$Gsct_thursday_stop = $aryC[4];}
if ( ($Gsct_friday_start < $aryC[3]) && ($Gsct_friday_stop > 0) ) {$Gsct_friday_start = $aryC[3];}
if ( ($Gsct_friday_stop > $aryC[4]) && ($Gsct_friday_stop > 0) ) {$Gsct_friday_stop = $aryC[4];}
if ( ($Gsct_saturday_start < $aryC[3]) && ($Gsct_saturday_stop > 0) ) {$Gsct_saturday_start = $aryC[3];}
if ( ($Gsct_saturday_stop > $aryC[4]) && ($Gsct_saturday_stop > 0) ) {$Gsct_saturday_stop = $aryC[4];}
if ($DB) {echo "$holidaytype |$Gstate_call_time_id|$Gstate_call_time_state|$Sholiday_id|$Sholiday_date|$Sholiday_name|$Gsct_default_start|$Gsct_default_stop|\n";}
}
}
$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 = preg_replace('/,$/i', '',$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) - 0);
$Dsql = '';
$o=0;
while ($Ds_to_print > $o)
{
$o++;
$Dsql .= "'$Dstatuses[$o]',";
}
$Dsql = preg_replace("/,$/","",$Dsql);
if (strlen($Dsql) < 2) {$Dsql = "''";}
$DLTsql='';
if ($drop_lockout_time > 0)
{
$DLseconds = ($drop_lockout_time * 3600);
$DLseconds = floor($DLseconds);
$DLseconds = intval("$DLseconds");
$DLTsql = "and ( ( (status IN('DROP','XDROP')) and (last_local_call_time < CONCAT(DATE_ADD(NOW(), INTERVAL -$DLseconds SECOND),' ',CURTIME()) ) ) or (status NOT IN('DROP','XDROP')) )";
}
$CCLsql='';
if ($call_count_limit > 0)
{
$CCLsql = "and (called_count < $call_count_limit)";
}
$EXPsql='';
$expired_lists='';
$REPORTdate = date("Y-m-d");
$stmt="SELECT list_id FROM vicidial_lists where list_id IN($camp_lists) and (active='Y') and (expiration_date < \"$REPORTdate\");";
#$DB=1;
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$rslt_rows = mysqli_num_rows($rslt);
$f=0;
while ($rslt_rows > $f)
{
$rowx=mysqli_fetch_row($rslt);
$expired_lists .= "'$rowx[0]',";
$f++;
}
$expired_lists = preg_replace("/,$/",'',$expired_lists);
if (strlen($expired_lists) < 2) {$expired_lists = "''";}
$EXPsql = "and list_id NOT IN($expired_lists)";
#################################
# Camp List
$stmt="SELECT list_id FROM vicidial_lists where list_id IN($camp_lists) and active='Y';";
$rslt_list=mysql_to_mysqli($stmt, $link);
$camplists_ct = mysqli_num_rows($rslt_list);
if ($DB) {echo "$camplists_ct|$stmt\n";}
$k=0;
$camp_lists='';
while ($camplists_ct > $k)
{
$rowA = mysqli_fetch_row($rslt_list);
$camp_lists .= "'$rowA[0]',";
##### Get Call List call time settings
##### BEGIN calculate what gmt_offset_now values are within the allowed local_call_time setting ###
$g=0;
$p='13';
$GMT_gmt[0] = '';
$GMT_hour[0] = '';
$GMT_day[0] = '';
$YMD = date("Y-m-d");
while ($p > -13)
{
$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++;
}
# Set List ID Variable
$cur_list_id = $rowA[0];
$list_local_call_time = "";
# Pull the call times for the lists
$stmt="SELECT local_call_time FROM vicidial_lists where list_id='$cur_list_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$rslt_ct = mysqli_num_rows($rslt);
if ($rslt_ct > 0)
{
#set Cur call_time
$row=mysqli_fetch_row($rslt);
$cur_call_time = $row[0];
}
# check that call time exists
if ($cur_call_time != "campaign")
{
$stmt="SELECT count(*) from vicidial_call_times where call_time_id='$cur_call_time';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$call_time_exists = $row[0];
if ($call_time_exists < 1)
{$cur_call_time = 'campaign';}
}
##### BEGIN local call time for list set different than campaign #####
if ($cur_call_time != "campaign")
{
##### BEGIN calculate what gmt_offset_now values are within the allowed local_call_time setting ###
$stmt = "SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times,ct_holidays FROM vicidial_call_times where call_time_id='$cur_call_time';";
if ($DB) {echo "$stmt\n";}
$rsltD=mysql_to_mysqli($stmt, $link);
$aryD=mysqli_fetch_row($rsltD);
$Gct_default_start = $aryD[3];
$Gct_default_stop = $aryD[4];
$Gct_sunday_start = $aryD[5];
$Gct_sunday_stop = $aryD[6];
$Gct_monday_start = $aryD[7];
$Gct_monday_stop = $aryD[8];
$Gct_tuesday_start = $aryD[9];
$Gct_tuesday_stop = $aryD[10];
$Gct_wednesday_start = $aryD[11];
$Gct_wednesday_stop = $aryD[12];
$Gct_thursday_start = $aryD[13];
$Gct_thursday_stop = $aryD[14];
$Gct_friday_start = $aryD[15];
$Gct_friday_stop = $aryD[16];
$Gct_saturday_start = $aryD[17];
$Gct_saturday_stop = $aryD[18];
$Gct_state_call_times = $aryD[19];
$Gct_holidays = $aryD[20];
### BEGIN Check for outbound holiday ###
$holiday_id = '';
if (strlen($Gct_holidays)>2)
{
$Gct_holidaysSQL = preg_replace("/\|/", "','", "$Gct_holidays");
$Gct_holidaysSQL = "'".$Gct_holidaysSQL."'";
$stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN($Gct_holidaysSQL) and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
$rslt=mysql_to_mysqli($stmt, $link);
$sthCrows=mysqli_num_rows($rslt);
if ($sthCrows > 0)
{
$aryC=mysqli_fetch_row($rslt);
$holiday_id = $aryC[0];
$holiday_date = $aryC[1];
$holiday_name = $aryC[2];
if ( ($Gct_default_start < $aryC[3]) && ($Gct_default_stop > 0) ) {$Gct_default_start = $aryC[3];}
if ( ($Gct_default_stop > $aryC[4]) && ($Gct_default_stop > 0) ) {$Gct_default_stop = $aryC[4];}
if ( ($Gct_sunday_start < $aryC[3]) && ($Gct_sunday_stop > 0) ) {$Gct_sunday_start = $aryC[3];}
if ( ($Gct_sunday_stop > $aryC[4]) && ($Gct_sunday_stop > 0) ) {$Gct_sunday_stop = $aryC[4];}
if ( ($Gct_monday_start < $aryC[3]) && ($Gct_monday_stop > 0) ) {$Gct_monday_start = $aryC[3];}
if ( ($Gct_monday_stop > $aryC[4]) && ($Gct_monday_stop > 0) ) {$Gct_monday_stop = $aryC[4];}
if ( ($Gct_tuesday_start < $aryC[3]) && ($Gct_tuesday_stop > 0) ) {$Gct_tuesday_start = $aryC[3];}
if ( ($Gct_tuesday_stop > $aryC[4]) && ($Gct_tuesday_stop > 0) ) {$Gct_tuesday_stop = $aryC[4];}
if ( ($Gct_wednesday_start < $aryC[3]) && ($Gct_wednesday_stop > 0) ) {$Gct_wednesday_start = $aryC[3];}
if ( ($Gct_wednesday_stop > $aryC[4]) && ($Gct_wednesday_stop > 0) ) {$Gct_wednesday_stop = $aryC[4];}
if ( ($Gct_thursday_start < $aryC[3]) && ($Gct_thursday_stop > 0) ) {$Gct_thursday_start = $aryC[3];}
if ( ($Gct_thursday_stop > $aryC[4]) && ($Gct_thursday_stop > 0) ) {$Gct_thursday_stop = $aryC[4];}
if ( ($Gct_friday_start < $aryC[3]) && ($Gct_friday_stop > 0) ) {$Gct_friday_start = $aryC[3];}
if ( ($Gct_friday_stop > $aryC[4]) && ($Gct_friday_stop > 0) ) {$Gct_friday_stop = $aryC[4];}
if ( ($Gct_saturday_start < $aryC[3]) && ($Gct_saturday_stop > 0) ) {$Gct_saturday_start = $aryC[3];}
if ( ($Gct_saturday_stop > $aryC[4]) && ($Gct_saturday_stop > 0) ) {$Gct_saturday_stop = $aryC[4];}
if ($DB) {echo "LIST CALL TIME HOLIDAY FOUND! $local_call_time|$holiday_id|$holiday_date|$holiday_name|$Gct_default_start|$Gct_default_stop|\n";}
}
}
### END Check for outbound holiday ###
$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 state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop,ct_holidays from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';";
$rslt=mysql_to_mysqli($stmt, $link);
$sthCrows=mysqli_num_rows($rslt);
if ($sthCrows > 0)
{
$aryC=mysqli_fetch_row($rslt);
$Gstate_call_time_id = $aryC[0];
$Gstate_call_time_state = $aryC[1];
$Gsct_default_start = $aryC[4];
$Gsct_default_stop = $aryC[5];
$Gsct_sunday_start = $aryC[6];
$Gsct_sunday_stop = $aryC[7];
$Gsct_monday_start = $aryC[8];
$Gsct_monday_stop = $aryC[9];
$Gsct_tuesday_start = $aryC[10];
$Gsct_tuesday_stop = $aryC[11];
$Gsct_wednesday_start = $aryC[12];
$Gsct_wednesday_stop = $aryC[13];
$Gsct_thursday_start = $aryC[14];
$Gsct_thursday_stop = $aryC[15];
$Gsct_friday_start = $aryC[16];
$Gsct_friday_stop = $aryC[17];
$Gsct_saturday_start = $aryC[18];
$Gsct_saturday_stop = $aryC[19];
$Sct_holidays = $aryC[20];
$ct_states .="'$Gstate_call_time_state',";
}
### BEGIN Check for outbound state holiday ###
$Sholiday_id = '';
if ((strlen($Sct_holidays)>2) or ((strlen($holiday_id)>2) and (strlen($Sholiday_id)<2)))
{
#Apply state holiday
if (strlen($Sct_holidays)>2)
{
$Sct_holidaysSQL = preg_replace("/\|/", "','", "$Sct_holidays");
$Sct_holidaysSQL = "'".$Sct_holidaysSQL."'";
$stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN($Sct_holidaysSQL) and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
$holidaytype = "LIST STATE CALL TIME HOLIDAY FOUND! ";
}
#Apply call time wide holiday
elseif ((strlen($holiday_id)>2) and (strlen($Sholiday_id)<2))
{
$stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id='$holiday_id' and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
$holidaytype = "LIST NO STATE HOLIDAY APPLYING CALL TIME HOLIDAY! ";
}
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$sthCrows=mysqli_num_rows($rslt);
if ($sthCrows > 0)
{
$aryC=mysqli_fetch_row($rslt);
$Sholiday_id = $aryC[0];
$Sholiday_date = $aryC[1];
$Sholiday_name = $aryC[2];
if ( ($Gsct_default_start < $aryC[3]) && ($Gsct_default_stop > 0) ) {$Gsct_default_start = $aryC[3];}
if ( ($Gsct_default_stop > $aryC[4]) && ($Gsct_default_stop > 0) ) {$Gsct_default_stop = $aryC[4];}
if ( ($Gsct_sunday_start < $aryC[3]) && ($Gsct_sunday_stop > 0) ) {$Gsct_sunday_start = $aryC[3];}
if ( ($Gsct_sunday_stop > $aryC[4]) && ($Gsct_sunday_stop > 0) ) {$Gsct_sunday_stop = $aryC[4];}
if ( ($Gsct_monday_start < $aryC[3]) && ($Gsct_monday_stop > 0) ) {$Gsct_monday_start = $aryC[3];}
if ( ($Gsct_monday_stop > $aryC[4]) && ($Gsct_monday_stop > 0) ) {$Gsct_monday_stop = $aryC[4];}
if ( ($Gsct_tuesday_start < $aryC[3]) && ($Gsct_tuesday_stop > 0) ) {$Gsct_tuesday_start = $aryC[3];}
if ( ($Gsct_tuesday_stop > $aryC[4]) && ($Gsct_tuesday_stop > 0) ) {$Gsct_tuesday_stop = $aryC[4];}
if ( ($Gsct_wednesday_start < $aryC[3]) && ($Gsct_wednesday_stop > 0) ) {$Gsct_wednesday_start = $aryC[3];}
if ( ($Gsct_wednesday_stop > $aryC[4]) && ($Gsct_wednesday_stop > 0) ) {$Gsct_wednesday_stop = $aryC[4];}
if ( ($Gsct_thursday_start < $aryC[3]) && ($Gsct_thursday_stop > 0) ) {$Gsct_thursday_start = $aryC[3];}
if ( ($Gsct_thursday_stop > $aryC[4]) && ($Gsct_thursday_stop > 0) ) {$Gsct_thursday_stop = $aryC[4];}
if ( ($Gsct_friday_start < $aryC[3]) && ($Gsct_friday_stop > 0) ) {$Gsct_friday_start = $aryC[3];}
if ( ($Gsct_friday_stop > $aryC[4]) && ($Gsct_friday_stop > 0) ) {$Gsct_friday_stop = $aryC[4];}
if ( ($Gsct_saturday_start < $aryC[3]) && ($Gsct_saturday_stop > 0) ) {$Gsct_saturday_start = $aryC[3];}
if ( ($Gsct_saturday_stop > $aryC[4]) && ($Gsct_saturday_stop > 0) ) {$Gsct_saturday_stop = $aryC[4];}
if ($DB) {echo "$holidaytype |$Gstate_call_time_id|$Gstate_call_time_state|$Sholiday_id|$Sholiday_date|$Sholiday_name|$Gsct_default_start|$Gsct_default_stop|\n";}
}
}
### END Check for outbound state holiday ###
$r=0;
$state_gmt='';
$del_state_gmt='';
while($r < $g)
{
if ($GMT_day[$r]==0) #### Sunday local time
{
if (($Gsct_sunday_start==0) && ($Gsct_sunday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_sunday_start) && ($GMT_hour[$r]<$Gsct_sunday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==1) #### Monday local time
{
if (($Gsct_monday_start==0) && ($Gsct_monday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_monday_start) && ($GMT_hour[$r]<$Gsct_monday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==2) #### Tuesday local time
{
if (($Gsct_tuesday_start==0) && ($Gsct_tuesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) && ($GMT_hour[$r]<$Gsct_tuesday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==3) #### Wednesday local time
{
if (($Gsct_wednesday_start==0) && ($Gsct_wednesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) && ($GMT_hour[$r]<$Gsct_wednesday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==4) #### Thursday local time
{
if (($Gsct_thursday_start==0) && ($Gsct_thursday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_thursday_start) && ($GMT_hour[$r]<$Gsct_thursday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==5) #### Friday local time
{
if (($Gsct_friday_start==0) && ($Gsct_friday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_friday_start) && ($GMT_hour[$r]<$Gsct_friday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==6) #### Saturday local time
{
if (($Gsct_saturday_start==0) && ($Gsct_saturday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_saturday_start) && ($GMT_hour[$r]<$Gsct_saturday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
$r++;
}
$state_gmt = "$state_gmt'99'";
$del_list_state_gmt_SQL .= "or (List_id=\"$cur_list_id\" and state='$Gstate_call_time_state' and gmt_offset_now NOT IN($state_gmt)) ";
$list_state_gmt_SQL .= "or (List_id=\"$cur_list_id\" and state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) ";
}
$b++;
}
if (strlen($ct_states)>2)
{
$ct_states = preg_replace("/,$/i",'',$ct_states);
$ct_statesSQL = "and state NOT IN($ct_states)";
}
else
{
$ct_statesSQL = "";
}
$r=0;
$dgA=0;
$list_default_gmt='';
while($r < $g)
{
if ($DB > 0)
{echo "LCT_gmt: $r|$GMT_day[$r]|$GMT_gmt[$r]|$Gct_sunday_start|$Gct_sunday_stop|$GMT_hour[$r]|$Gct_default_start|$Gct_default_stop\n";}
if ($GMT_day[$r]==0) #### Sunday local time
{
if (($Gct_sunday_start==0) && ($Gct_sunday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_sunday_start) && ($GMT_hour[$r]<$Gct_sunday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==1) #### Monday local time
{
if (($Gct_monday_start==0) && ($Gct_monday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_monday_start) && ($GMT_hour[$r]<$Gct_monday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==2) #### Tuesday local time
{
if (($Gct_tuesday_start==0) && ($Gct_tuesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_tuesday_start) && ($GMT_hour[$r]<$Gct_tuesday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==3) #### Wednesday local time
{
if (($Gct_wednesday_start==0) && ($Gct_wednesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_wednesday_start) && ($GMT_hour[$r]<$Gct_wednesday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==4) #### Thursday local time
{
if (($Gct_thursday_start==0) && ($Gct_thursday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_thursday_start) && ($GMT_hour[$r]<$Gct_thursday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==5) #### Friday local time
{
if (($Gct_friday_start==0) && ($Gct_friday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_friday_start) && ($GMT_hour[$r]<$Gct_friday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==6) #### Saturday local time
{
if (($Gct_saturday_start==0) && ($Gct_saturday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_saturday_start) && ($GMT_hour[$r]<$Gct_saturday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
$r++;
}
$list_default_gmt = "$list_default_gmt'99'";
$LCTlist_id_sql .= " or ((list_id='$cur_list_id' and gmt_offset_now NOT IN($list_default_gmt) $ct_statesSQL) $list_state_gmt_SQL)";
}
##### END local call time for list set different than campaign #####
else
{
if (strlen($list_id_sql) < 3)
{
$list_id_sql = "(list_id IN('$cur_list_id'";
}
else
{
$list_id_sql .= ",'$cur_list_id'";
}
}
$k++;
}
$camp_lists = preg_replace("/.$/i","",$camp_lists);
if (strlen($camp_lists) < 4) {$camp_lists="''";}
if (strlen($list_id_sql) < 4) {$list_id_sql="list_id=''";}
else {$list_id_sql .= '))';}
if (strlen($LCTlist_id_sql) > 1) {$list_id_sql .= "$LCTlist_id_sql";}
$stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($list_id_sql) and ($all_gmtSQL) $CCLsql $DLTsql $fSQL $EXPsql";
#$DB=1;
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$rslt_rows = mysqli_num_rows($rslt);
if ($rslt_rows)
{
$rowx=mysqli_fetch_row($rslt);
$active_leads = "$rowx[0]";
}
else {$active_leads = '0';}
if ($DB > 0) {echo "|$DB|\n";}
if ($single_status > 0)
{return $active_leads;}
else
{echo _QXZ("This campaign has")." $active_leads "._QXZ("leads to be dialed in those lists")."\n";}
}
else
{
echo _QXZ("no dial statuses selected for this campaign")."\n";
}
}
else
{
echo _QXZ("no active lists selected for this campaign")."\n";
}
}
else
{
echo _QXZ("no active lists selected for this campaign")."\n";
}
##### END calculate what gmt_offset_now values are within the allowed local_call_time setting ###
}
?> ?>
@@ -85,372 +85,4 @@ else
} }
##### CALCULATE DIALABLE LEADS #####
function dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$drop_lockout_time,$call_count_limit,$single_status,$fSQL)
{
global $full_dialable_SQL;
##### BEGIN calculate what gmt_offset_now values are within the allowed local_call_time setting ###
if (isset($camp_lists))
{
if (strlen($camp_lists)>1)
{
if (strlen($dial_statuses)>2)
{
$g=0;
$p='13';
$GMT_gmt[0] = '';
$GMT_hour[0] = '';
$GMT_day[0] = '';
while ($p > -13)
{
$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 call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';";
if ($DB) {$HTML_header.="$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$rowx=mysqli_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 state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_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) - 0);
$Dsql = '';
$o=0;
while ($Ds_to_print > $o)
{
$o++;
$Dsql .= "'$Dstatuses[$o]',";
}
$Dsql = preg_replace("/,$/","",$Dsql);
if (strlen($Dsql) < 2) {$Dsql = "''";}
$DLTsql='';
if ($drop_lockout_time > 0)
{
$DLseconds = ($drop_lockout_time * 3600);
$DLseconds = floor($DLseconds);
$DLseconds = intval("$DLseconds");
$DLTsql = "and ( ( (status IN('DROP','XDROP')) and (last_local_call_time < CONCAT(DATE_ADD(NOW(), INTERVAL -$DLseconds SECOND),' ',CURTIME()) ) ) or (status NOT IN('DROP','XDROP')) )";
}
$CCLsql='';
if ($call_count_limit > 0)
{
$CCLsql = "and (called_count < $call_count_limit)";
}
$stmt="SELECT count(*) FROM vicidial_list where status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $CCLsql $DLTsql $fSQL";
$full_dialable_SQL="status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) $CCLsql $DLTsql $fSQL";
#$DB=1;
if ($DB) {$HTML_header.="$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$rslt_rows = mysqli_num_rows($rslt);
if ($rslt_rows)
{
$rowx=mysqli_fetch_row($rslt);
$active_leads = "$rowx[0]";
}
else {$active_leads = '0';}
if ($DB > 0) {$HTML_header.="|$DB|\n";}
if ($single_status > 0)
{return $active_leads;}
else
{$HTML_header.=_QXZ("This campaign has $active_leads leads to be dialed in those lists")."\n";}
}
else
{
$HTML_header.=_QXZ("no dial statuses selected for this campaign")."\n";
}
}
else
{
$HTML_header.=_QXZ("no active lists selected for this campaign")."\n";
}
}
else
{
$HTML_header.=_QXZ("no active lists selected for this campaign")."\n";
}
##### END calculate what gmt_offset_now values are within the allowed local_call_time setting ###
}
?> ?>
+967
View File
@@ -37,6 +37,7 @@
# 200401-1920 - Added TimeToText function to convert integers to strings # 200401-1920 - Added TimeToText function to convert integers to strings
# 210311-2316 - Added 2FA check in user_authorization function # 210311-2316 - Added 2FA check in user_authorization function
# 210316-0924 - Small fix for 2FA consistency # 210316-0924 - Small fix for 2FA consistency
# 210406-1740 - Moved 'dialable_leads' function to this script
# #
##### BEGIN validate user login credentials, check for failed lock out ##### ##### BEGIN validate user login credentials, check for failed lock out #####
@@ -1544,4 +1545,970 @@ function createDateRangeArray($strDateFrom,$strDateTo)
return $aryRange; return $aryRange;
} }
##### CALCULATE DIALABLE LEADS #####
function dialable_leads($DB,$link,$local_call_time,$dial_statuses,$camp_lists,$drop_lockout_time,$call_count_limit,$single_status,$fSQL,$only_return)
{
global $full_dialable_SQL;
$dialable_output='';
##### BEGIN calculate what gmt_offset_now values are within the allowed local_call_time setting ###
if (isset($camp_lists))
{
if (strlen($camp_lists)>1)
{
if (strlen($dial_statuses)>2)
{
$g=0;
$p='13';
$GMT_gmt[0] = '';
$GMT_hour[0] = '';
$GMT_day[0] = '';
$YMD = date("Y-m-d");
while ($p > -13)
{
$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 call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times FROM vicidial_call_times where call_time_id='$local_call_time';";
if ($DB) {$dialable_output .= "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$rowx=mysqli_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];
$Gct_holidays = $rowx[20];
### BEGIN Check for outbound holiday ###
$holiday_id = '';
if (strlen($Gct_holidays)>2)
{
$Gct_holidaysSQL = preg_replace("/\|/", "','", "$Gct_holidays");
$Gct_holidaysSQL = "'".$Gct_holidaysSQL."'";
$stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN($Gct_holidaysSQL) and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {$dialable_output .= "$stmt\n";}
$sthCrows=mysqli_num_rows($rslt);
if ($sthCrows > 0)
{
$aryC=mysqli_fetch_row($rslt);
$holiday_id = $aryC[0];
$holiday_date = $aryC[1];
$holiday_name = $aryC[2];
if($Gct_default_start < $aryC[3]) {$Gct_default_start = $aryC[3];}
if($Gct_default_stop > $aryC[4]) {$Gct_default_stop = $aryC[4];}
if($Gct_sunday_start < $aryC[3]) {$Gct_sunday_start = $aryC[3];}
if($Gct_sunday_stop > $aryC[4]) {$Gct_sunday_stop = $aryC[4];}
if($Gct_monday_start < $aryC[3]) {$Gct_monday_start = $aryC[3];}
if($Gct_monday_stop > $aryC[4]) {$Gct_monday_stop = $aryC[4];}
if($Gct_tuesday_start < $aryC[3]) {$Gct_tuesday_start = $aryC[3];}
if($Gct_tuesday_stop > $aryC[4]) {$Gct_tuesday_stop = $aryC[4];}
if($Gct_wednesday_start < $aryC[3]) {$Gct_wednesday_start = $aryC[3];}
if($Gct_wednesday_stop > $aryC[4]) {$Gct_wednesday_stop = $aryC[4];}
if($Gct_thursday_start < $aryC[3]) {$Gct_thursday_start = $aryC[3];}
if($Gct_thursday_stop > $aryC[4]) {$Gct_thursday_stop = $aryC[4];}
if($Gct_friday_start < $aryC[3]) {$Gct_friday_start = $aryC[3];}
if($Gct_friday_stop > $aryC[4]) {$Gct_friday_stop = $aryC[4];}
if($Gct_saturday_start < $aryC[3]) {$Gct_saturday_start = $aryC[3];}
if($Gct_saturday_stop > $aryC[4]) {$Gct_saturday_stop = $aryC[4];}
if ($DB) {$dialable_output .= "CALL TIME HOLIDAY FOUND! $local_call_time|$holiday_id|$holiday_date|$holiday_name|$Gct_default_start|$Gct_default_stop|\n";}
}
}
### END Check for outbound holiday ###
$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 state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_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];
$Sct_holidays = $row[20];
$ct_states .="'$Gstate_call_time_state',";
### BEGIN Check for outbound state holiday ###
$Sholiday_id = '';
if ((strlen($Sct_holidays)>2) or ((strlen($holiday_id)>2) and (strlen($Sholiday_id)<2)))
{
# Apply state holiday
if (strlen($Sct_holidays)>2)
{
$Sct_holidaysSQL = preg_replace("/\|/", "','", "$Sct_holidays");
$Sct_holidaysSQL = "'".$Sct_holidaysSQL."'";
$stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN($Sct_holidaysSQL) and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
$holidaytype = "STATE CALL TIME HOLIDAY FOUND! ";
}
# Apply call time wide holiday
elseif ((strlen($holiday_id)>2) and (strlen($Sholiday_id)<2))
{
$stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id='$holiday_id' and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
$holidaytype = "NO STATE HOLIDAY APPLYING CALL TIME HOLIDAY! ";
}
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {$dialable_output .= "$stmt\n";}
$sthCrows=mysqli_num_rows($rslt);
if ($sthCrows > 0)
{
$aryC=mysqli_fetch_row($rslt);
$Sholiday_id = $aryC[0];
$Sholiday_date = $aryC[1];
$Sholiday_name = $aryC[2];
if ( ($Gsct_default_start < $aryC[3]) && ($Gsct_default_stop > 0) ) {$Gsct_default_start = $aryC[3];}
if ( ($Gsct_default_stop > $aryC[4]) && ($Gsct_default_stop > 0) ) {$Gsct_default_stop = $aryC[4];}
if ( ($Gsct_sunday_start < $aryC[3]) && ($Gsct_sunday_stop > 0) ) {$Gsct_sunday_start = $aryC[3];}
if ( ($Gsct_sunday_stop > $aryC[4]) && ($Gsct_sunday_stop > 0) ) {$Gsct_sunday_stop = $aryC[4];}
if ( ($Gsct_monday_start < $aryC[3]) && ($Gsct_monday_stop > 0) ) {$Gsct_monday_start = $aryC[3];}
if ( ($Gsct_monday_stop > $aryC[4]) && ($Gsct_monday_stop > 0) ) {$Gsct_monday_stop = $aryC[4];}
if ( ($Gsct_tuesday_start < $aryC[3]) && ($Gsct_tuesday_stop > 0) ) {$Gsct_tuesday_start = $aryC[3];}
if ( ($Gsct_tuesday_stop > $aryC[4]) && ($Gsct_tuesday_stop > 0) ) {$Gsct_tuesday_stop = $aryC[4];}
if ( ($Gsct_wednesday_start < $aryC[3]) && ($Gsct_wednesday_stop > 0) ) {$Gsct_wednesday_start = $aryC[3];}
if ( ($Gsct_wednesday_stop > $aryC[4]) && ($Gsct_wednesday_stop > 0) ) {$Gsct_wednesday_stop = $aryC[4];}
if ( ($Gsct_thursday_start < $aryC[3]) && ($Gsct_thursday_stop > 0) ) {$Gsct_thursday_start = $aryC[3];}
if ( ($Gsct_thursday_stop > $aryC[4]) && ($Gsct_thursday_stop > 0) ) {$Gsct_thursday_stop = $aryC[4];}
if ( ($Gsct_friday_start < $aryC[3]) && ($Gsct_friday_stop > 0) ) {$Gsct_friday_start = $aryC[3];}
if ( ($Gsct_friday_stop > $aryC[4]) && ($Gsct_friday_stop > 0) ) {$Gsct_friday_stop = $aryC[4];}
if ( ($Gsct_saturday_start < $aryC[3]) && ($Gsct_saturday_stop > 0) ) {$Gsct_saturday_start = $aryC[3];}
if ( ($Gsct_saturday_stop > $aryC[4]) && ($Gsct_saturday_stop > 0) ) {$Gsct_saturday_stop = $aryC[4];}
if ($DB) {$dialable_output .= "$holidaytype |$Gstate_call_time_id|$Gstate_call_time_state|$Sholiday_id|$Sholiday_date|$Sholiday_name|$Gsct_default_start|$Gsct_default_stop|\n";}
}
}
$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 = preg_replace('/,$/i', '',$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) - 0);
$Dsql = '';
$o=0;
while ($Ds_to_print > $o)
{
$o++;
$Dsql .= "'$Dstatuses[$o]',";
}
$Dsql = preg_replace("/,$/","",$Dsql);
if (strlen($Dsql) < 2) {$Dsql = "''";}
$DLTsql='';
if ($drop_lockout_time > 0)
{
$DLseconds = ($drop_lockout_time * 3600);
$DLseconds = floor($DLseconds);
$DLseconds = intval("$DLseconds");
$DLTsql = "and ( ( (status IN('DROP','XDROP')) and (last_local_call_time < CONCAT(DATE_ADD(NOW(), INTERVAL -$DLseconds SECOND),' ',CURTIME()) ) ) or (status NOT IN('DROP','XDROP')) )";
}
$CCLsql='';
if ($call_count_limit > 0)
{
$CCLsql = "and (called_count < $call_count_limit)";
}
$EXPsql='';
$expired_lists='';
$REPORTdate = date("Y-m-d");
$stmt="SELECT list_id FROM vicidial_lists where list_id IN($camp_lists) and (active='Y') and (expiration_date < \"$REPORTdate\");";
#$DB=1;
if ($DB) {$dialable_output .= "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$rslt_rows = mysqli_num_rows($rslt);
$f=0;
while ($rslt_rows > $f)
{
$rowx=mysqli_fetch_row($rslt);
$expired_lists .= "'$rowx[0]',";
$f++;
}
$expired_lists = preg_replace("/,$/",'',$expired_lists);
if (strlen($expired_lists) < 2) {$expired_lists = "''";}
$EXPsql = "and list_id NOT IN($expired_lists)";
#################################
# Camp List
$stmt="SELECT list_id FROM vicidial_lists where list_id IN($camp_lists) and active='Y';";
$rslt_list=mysql_to_mysqli($stmt, $link);
$camplists_ct = mysqli_num_rows($rslt_list);
if ($DB) {$dialable_output .= "$camplists_ct|$stmt\n";}
$k=0;
$camp_lists='';
while ($camplists_ct > $k)
{
$rowA = mysqli_fetch_row($rslt_list);
$camp_lists .= "'$rowA[0]',";
##### Get Call List call time settings
##### BEGIN calculate what gmt_offset_now values are within the allowed local_call_time setting ###
$g=0;
$p='13';
$GMT_gmt[0] = '';
$GMT_hour[0] = '';
$GMT_day[0] = '';
$YMD = date("Y-m-d");
while ($p > -13)
{
$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++;
}
# Set List ID Variable
$cur_list_id = $rowA[0];
$list_local_call_time = "";
# Pull the call times for the lists
$stmt="SELECT local_call_time FROM vicidial_lists where list_id='$cur_list_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$rslt_ct = mysqli_num_rows($rslt);
if ($rslt_ct > 0)
{
#set Cur call_time
$row=mysqli_fetch_row($rslt);
$cur_call_time = $row[0];
}
# check that call time exists
if ($cur_call_time != "campaign")
{
$stmt="SELECT count(*) from vicidial_call_times where call_time_id='$cur_call_time';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$call_time_exists = $row[0];
if ($call_time_exists < 1)
{$cur_call_time = 'campaign';}
}
##### BEGIN local call time for list set different than campaign #####
if ($cur_call_time != "campaign")
{
##### BEGIN calculate what gmt_offset_now values are within the allowed local_call_time setting ###
$stmt = "SELECT call_time_id,call_time_name,call_time_comments,ct_default_start,ct_default_stop,ct_sunday_start,ct_sunday_stop,ct_monday_start,ct_monday_stop,ct_tuesday_start,ct_tuesday_stop,ct_wednesday_start,ct_wednesday_stop,ct_thursday_start,ct_thursday_stop,ct_friday_start,ct_friday_stop,ct_saturday_start,ct_saturday_stop,ct_state_call_times,ct_holidays FROM vicidial_call_times where call_time_id='$cur_call_time';";
if ($DB) {$dialable_output .= "$stmt\n";}
$rsltD=mysql_to_mysqli($stmt, $link);
$aryD=mysqli_fetch_row($rsltD);
$Gct_default_start = $aryD[3];
$Gct_default_stop = $aryD[4];
$Gct_sunday_start = $aryD[5];
$Gct_sunday_stop = $aryD[6];
$Gct_monday_start = $aryD[7];
$Gct_monday_stop = $aryD[8];
$Gct_tuesday_start = $aryD[9];
$Gct_tuesday_stop = $aryD[10];
$Gct_wednesday_start = $aryD[11];
$Gct_wednesday_stop = $aryD[12];
$Gct_thursday_start = $aryD[13];
$Gct_thursday_stop = $aryD[14];
$Gct_friday_start = $aryD[15];
$Gct_friday_stop = $aryD[16];
$Gct_saturday_start = $aryD[17];
$Gct_saturday_stop = $aryD[18];
$Gct_state_call_times = $aryD[19];
$Gct_holidays = $aryD[20];
### BEGIN Check for outbound holiday ###
$holiday_id = '';
if (strlen($Gct_holidays)>2)
{
$Gct_holidaysSQL = preg_replace("/\|/", "','", "$Gct_holidays");
$Gct_holidaysSQL = "'".$Gct_holidaysSQL."'";
$stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN($Gct_holidaysSQL) and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
$rslt=mysql_to_mysqli($stmt, $link);
$sthCrows=mysqli_num_rows($rslt);
if ($sthCrows > 0)
{
$aryC=mysqli_fetch_row($rslt);
$holiday_id = $aryC[0];
$holiday_date = $aryC[1];
$holiday_name = $aryC[2];
if ( ($Gct_default_start < $aryC[3]) && ($Gct_default_stop > 0) ) {$Gct_default_start = $aryC[3];}
if ( ($Gct_default_stop > $aryC[4]) && ($Gct_default_stop > 0) ) {$Gct_default_stop = $aryC[4];}
if ( ($Gct_sunday_start < $aryC[3]) && ($Gct_sunday_stop > 0) ) {$Gct_sunday_start = $aryC[3];}
if ( ($Gct_sunday_stop > $aryC[4]) && ($Gct_sunday_stop > 0) ) {$Gct_sunday_stop = $aryC[4];}
if ( ($Gct_monday_start < $aryC[3]) && ($Gct_monday_stop > 0) ) {$Gct_monday_start = $aryC[3];}
if ( ($Gct_monday_stop > $aryC[4]) && ($Gct_monday_stop > 0) ) {$Gct_monday_stop = $aryC[4];}
if ( ($Gct_tuesday_start < $aryC[3]) && ($Gct_tuesday_stop > 0) ) {$Gct_tuesday_start = $aryC[3];}
if ( ($Gct_tuesday_stop > $aryC[4]) && ($Gct_tuesday_stop > 0) ) {$Gct_tuesday_stop = $aryC[4];}
if ( ($Gct_wednesday_start < $aryC[3]) && ($Gct_wednesday_stop > 0) ) {$Gct_wednesday_start = $aryC[3];}
if ( ($Gct_wednesday_stop > $aryC[4]) && ($Gct_wednesday_stop > 0) ) {$Gct_wednesday_stop = $aryC[4];}
if ( ($Gct_thursday_start < $aryC[3]) && ($Gct_thursday_stop > 0) ) {$Gct_thursday_start = $aryC[3];}
if ( ($Gct_thursday_stop > $aryC[4]) && ($Gct_thursday_stop > 0) ) {$Gct_thursday_stop = $aryC[4];}
if ( ($Gct_friday_start < $aryC[3]) && ($Gct_friday_stop > 0) ) {$Gct_friday_start = $aryC[3];}
if ( ($Gct_friday_stop > $aryC[4]) && ($Gct_friday_stop > 0) ) {$Gct_friday_stop = $aryC[4];}
if ( ($Gct_saturday_start < $aryC[3]) && ($Gct_saturday_stop > 0) ) {$Gct_saturday_start = $aryC[3];}
if ( ($Gct_saturday_stop > $aryC[4]) && ($Gct_saturday_stop > 0) ) {$Gct_saturday_stop = $aryC[4];}
if ($DB) {$dialable_output .= "LIST CALL TIME HOLIDAY FOUND! $local_call_time|$holiday_id|$holiday_date|$holiday_name|$Gct_default_start|$Gct_default_stop|\n";}
}
}
### END Check for outbound holiday ###
$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 state_call_time_id,state_call_time_state,state_call_time_name,state_call_time_comments,sct_default_start,sct_default_stop,sct_sunday_start,sct_sunday_stop,sct_monday_start,sct_monday_stop,sct_tuesday_start,sct_tuesday_stop,sct_wednesday_start,sct_wednesday_stop,sct_thursday_start,sct_thursday_stop,sct_friday_start,sct_friday_stop,sct_saturday_start,sct_saturday_stop,ct_holidays from vicidial_state_call_times where state_call_time_id='$state_rules[$b]';";
$rslt=mysql_to_mysqli($stmt, $link);
$sthCrows=mysqli_num_rows($rslt);
if ($sthCrows > 0)
{
$aryC=mysqli_fetch_row($rslt);
$Gstate_call_time_id = $aryC[0];
$Gstate_call_time_state = $aryC[1];
$Gsct_default_start = $aryC[4];
$Gsct_default_stop = $aryC[5];
$Gsct_sunday_start = $aryC[6];
$Gsct_sunday_stop = $aryC[7];
$Gsct_monday_start = $aryC[8];
$Gsct_monday_stop = $aryC[9];
$Gsct_tuesday_start = $aryC[10];
$Gsct_tuesday_stop = $aryC[11];
$Gsct_wednesday_start = $aryC[12];
$Gsct_wednesday_stop = $aryC[13];
$Gsct_thursday_start = $aryC[14];
$Gsct_thursday_stop = $aryC[15];
$Gsct_friday_start = $aryC[16];
$Gsct_friday_stop = $aryC[17];
$Gsct_saturday_start = $aryC[18];
$Gsct_saturday_stop = $aryC[19];
$Sct_holidays = $aryC[20];
$ct_states .="'$Gstate_call_time_state',";
}
### BEGIN Check for outbound state holiday ###
$Sholiday_id = '';
if ((strlen($Sct_holidays)>2) or ((strlen($holiday_id)>2) and (strlen($Sholiday_id)<2)))
{
#Apply state holiday
if (strlen($Sct_holidays)>2)
{
$Sct_holidaysSQL = preg_replace("/\|/", "','", "$Sct_holidays");
$Sct_holidaysSQL = "'".$Sct_holidaysSQL."'";
$stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id IN($Sct_holidaysSQL) and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
$holidaytype = "LIST STATE CALL TIME HOLIDAY FOUND! ";
}
#Apply call time wide holiday
elseif ((strlen($holiday_id)>2) and (strlen($Sholiday_id)<2))
{
$stmt = "SELECT holiday_id,holiday_date,holiday_name,ct_default_start,ct_default_stop from vicidial_call_time_holidays where holiday_id='$holiday_id' and holiday_status='ACTIVE' and holiday_date='$YMD' order by holiday_id;";
$holidaytype = "LIST NO STATE HOLIDAY APPLYING CALL TIME HOLIDAY! ";
}
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {$dialable_output .= "$stmt\n";}
$sthCrows=mysqli_num_rows($rslt);
if ($sthCrows > 0)
{
$aryC=mysqli_fetch_row($rslt);
$Sholiday_id = $aryC[0];
$Sholiday_date = $aryC[1];
$Sholiday_name = $aryC[2];
if ( ($Gsct_default_start < $aryC[3]) && ($Gsct_default_stop > 0) ) {$Gsct_default_start = $aryC[3];}
if ( ($Gsct_default_stop > $aryC[4]) && ($Gsct_default_stop > 0) ) {$Gsct_default_stop = $aryC[4];}
if ( ($Gsct_sunday_start < $aryC[3]) && ($Gsct_sunday_stop > 0) ) {$Gsct_sunday_start = $aryC[3];}
if ( ($Gsct_sunday_stop > $aryC[4]) && ($Gsct_sunday_stop > 0) ) {$Gsct_sunday_stop = $aryC[4];}
if ( ($Gsct_monday_start < $aryC[3]) && ($Gsct_monday_stop > 0) ) {$Gsct_monday_start = $aryC[3];}
if ( ($Gsct_monday_stop > $aryC[4]) && ($Gsct_monday_stop > 0) ) {$Gsct_monday_stop = $aryC[4];}
if ( ($Gsct_tuesday_start < $aryC[3]) && ($Gsct_tuesday_stop > 0) ) {$Gsct_tuesday_start = $aryC[3];}
if ( ($Gsct_tuesday_stop > $aryC[4]) && ($Gsct_tuesday_stop > 0) ) {$Gsct_tuesday_stop = $aryC[4];}
if ( ($Gsct_wednesday_start < $aryC[3]) && ($Gsct_wednesday_stop > 0) ) {$Gsct_wednesday_start = $aryC[3];}
if ( ($Gsct_wednesday_stop > $aryC[4]) && ($Gsct_wednesday_stop > 0) ) {$Gsct_wednesday_stop = $aryC[4];}
if ( ($Gsct_thursday_start < $aryC[3]) && ($Gsct_thursday_stop > 0) ) {$Gsct_thursday_start = $aryC[3];}
if ( ($Gsct_thursday_stop > $aryC[4]) && ($Gsct_thursday_stop > 0) ) {$Gsct_thursday_stop = $aryC[4];}
if ( ($Gsct_friday_start < $aryC[3]) && ($Gsct_friday_stop > 0) ) {$Gsct_friday_start = $aryC[3];}
if ( ($Gsct_friday_stop > $aryC[4]) && ($Gsct_friday_stop > 0) ) {$Gsct_friday_stop = $aryC[4];}
if ( ($Gsct_saturday_start < $aryC[3]) && ($Gsct_saturday_stop > 0) ) {$Gsct_saturday_start = $aryC[3];}
if ( ($Gsct_saturday_stop > $aryC[4]) && ($Gsct_saturday_stop > 0) ) {$Gsct_saturday_stop = $aryC[4];}
if ($DB) {$dialable_output .= "$holidaytype |$Gstate_call_time_id|$Gstate_call_time_state|$Sholiday_id|$Sholiday_date|$Sholiday_name|$Gsct_default_start|$Gsct_default_stop|\n";}
}
}
### END Check for outbound state holiday ###
$r=0;
$state_gmt='';
$del_state_gmt='';
while($r < $g)
{
if ($GMT_day[$r]==0) #### Sunday local time
{
if (($Gsct_sunday_start==0) && ($Gsct_sunday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_sunday_start) && ($GMT_hour[$r]<$Gsct_sunday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==1) #### Monday local time
{
if (($Gsct_monday_start==0) && ($Gsct_monday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_monday_start) && ($GMT_hour[$r]<$Gsct_monday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==2) #### Tuesday local time
{
if (($Gsct_tuesday_start==0) && ($Gsct_tuesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) && ($GMT_hour[$r]<$Gsct_tuesday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==3) #### Wednesday local time
{
if (($Gsct_wednesday_start==0) && ($Gsct_wednesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) && ($GMT_hour[$r]<$Gsct_wednesday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==4) #### Thursday local time
{
if (($Gsct_thursday_start==0) && ($Gsct_thursday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_thursday_start) && ($GMT_hour[$r]<$Gsct_thursday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==5) #### Friday local time
{
if (($Gsct_friday_start==0) && ($Gsct_friday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_friday_start) && ($GMT_hour[$r]<$Gsct_friday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==6) #### Saturday local time
{
if (($Gsct_saturday_start==0) && ($Gsct_saturday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_saturday_start) && ($GMT_hour[$r]<$Gsct_saturday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
}
}
$r++;
}
$state_gmt = "$state_gmt'99'";
$del_list_state_gmt_SQL .= "or (List_id=\"$cur_list_id\" and state='$Gstate_call_time_state' and gmt_offset_now NOT IN($state_gmt)) ";
$list_state_gmt_SQL .= "or (List_id=\"$cur_list_id\" and state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) ";
}
$b++;
}
if (strlen($ct_states)>2)
{
$ct_states = preg_replace("/,$/i",'',$ct_states);
$ct_statesSQL = "and state NOT IN($ct_states)";
}
else
{
$ct_statesSQL = "";
}
$r=0;
$dgA=0;
$list_default_gmt='';
while($r < $g)
{
if ($DB > 0)
{$dialable_output .= "LCT_gmt: $r|$GMT_day[$r]|$GMT_gmt[$r]|$Gct_sunday_start|$Gct_sunday_stop|$GMT_hour[$r]|$Gct_default_start|$Gct_default_stop\n";}
if ($GMT_day[$r]==0) #### Sunday local time
{
if (($Gct_sunday_start==0) && ($Gct_sunday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_sunday_start) && ($GMT_hour[$r]<$Gct_sunday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==1) #### Monday local time
{
if (($Gct_monday_start==0) && ($Gct_monday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_monday_start) && ($GMT_hour[$r]<$Gct_monday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==2) #### Tuesday local time
{
if (($Gct_tuesday_start==0) && ($Gct_tuesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_tuesday_start) && ($GMT_hour[$r]<$Gct_tuesday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==3) #### Wednesday local time
{
if (($Gct_wednesday_start==0) && ($Gct_wednesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_wednesday_start) && ($GMT_hour[$r]<$Gct_wednesday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==4) #### Thursday local time
{
if (($Gct_thursday_start==0) && ($Gct_thursday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_thursday_start) && ($GMT_hour[$r]<$Gct_thursday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==5) #### Friday local time
{
if (($Gct_friday_start==0) && ($Gct_friday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_friday_start) && ($GMT_hour[$r]<$Gct_friday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==6) #### Saturday local time
{
if (($Gct_saturday_start==0) && ($Gct_saturday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gct_saturday_start) && ($GMT_hour[$r]<$Gct_saturday_stop) )
{}
else
{$list_default_gmt.="'$GMT_gmt[$r]',";}
}
}
$r++;
}
$list_default_gmt = "$list_default_gmt'99'";
$LCTlist_id_sql .= " or ((list_id='$cur_list_id' and gmt_offset_now NOT IN($list_default_gmt) $ct_statesSQL) $list_state_gmt_SQL)";
}
##### END local call time for list set different than campaign #####
else
{
if (strlen($list_id_sql) < 3)
{
$list_id_sql = "(list_id IN('$cur_list_id'";
}
else
{
$list_id_sql .= ",'$cur_list_id'";
}
}
$k++;
}
$camp_lists = preg_replace("/.$/i","",$camp_lists);
if (strlen($camp_lists) < 4) {$camp_lists="''";}
if (strlen($list_id_sql) < 4) {$list_id_sql="list_id=''";}
else {$list_id_sql .= '))';}
if (strlen($LCTlist_id_sql) > 1) {$list_id_sql .= "$LCTlist_id_sql";}
$stmt="SELECT count(*) FROM vicidial_list where called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($list_id_sql) and ($all_gmtSQL) $CCLsql $DLTsql $fSQL $EXPsql";
$full_dialable_SQL="called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($list_id_sql) and ($all_gmtSQL) $CCLsql $DLTsql $fSQL $EXPsql";
#$DB=1;
if ($DB) {$dialable_output .= "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$rslt_rows = mysqli_num_rows($rslt);
if ($rslt_rows)
{
$rowx=mysqli_fetch_row($rslt);
$active_leads = "$rowx[0]";
}
else {$active_leads = '0';}
if ($DB > 0) {$dialable_output .= "|$DB|\n";}
if ( ($single_status > 0) or ($only_return > 0) )
{return $active_leads;}
else
{$dialable_output .= _QXZ("This campaign has")." $active_leads "._QXZ("leads to be dialed in those lists")."\n";}
}
else
{
$dialable_output .= _QXZ("no dial statuses selected for this campaign")."\n";
}
}
else
{
$dialable_output .= _QXZ("no active lists selected for this campaign")."\n";
}
}
else
{
$dialable_output .= _QXZ("no active lists selected for this campaign")."\n";
}
if ($only_return < 1)
{
echo $dialable_output;
}
##### END calculate what gmt_offset_now values are within the allowed local_call_time setting ###
}
?> ?>
@@ -1,4 +1,4 @@
# version: 20210404162701 # version: 20210405104301
users-user User ID <QXZ>This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.</QXZ> users-user User ID <QXZ>This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.</QXZ>
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. Only letters and numbers are allowed in user passwords. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ> users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. Only letters and numbers are allowed in user passwords. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage or the agent screen. Default is N.</QXZ> users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage or the agent screen. Default is N.</QXZ>
@@ -146,7 +146,7 @@ campaigns-call_count_limit Call Count Limit <QXZ>This enforces a limit on the nu
campaigns-call_count_target Call Count Target <QXZ>This option is only used for reporting purposes and has no effect on leads dialed. Default is 3.</QXZ> campaigns-call_count_target Call Count Target <QXZ>This option is only used for reporting purposes and has no effect on leads dialed. Default is 3.</QXZ>
campaigns-daily_call_count_limit Daily Call Count Limit <QXZ>This feature, if enabled, will limit the number of times a lead can be called in a single day. Once a lead has reached this set limit, if the lead is selected to be dialed again, the called-since-last-reset flag on the lead will be changed to -Y- and the call will not be dialed. If you want to raise this daily limit during the day, you might need to reset your lists to be able to dial the leads that hit the previous limit earlier in the day. This feature may conflict with Auto-Alt-Dial features if they are enabled on a campaign. Default is 0 for disabled.</QXZ> campaigns-daily_call_count_limit Daily Call Count Limit <QXZ>This feature, if enabled, will limit the number of times a lead can be called in a single day. Once a lead has reached this set limit, if the lead is selected to be dialed again, the called-since-last-reset flag on the lead will be changed to -Y- and the call will not be dialed. If you want to raise this daily limit during the day, you might need to reset your lists to be able to dial the leads that hit the previous limit earlier in the day. This feature may conflict with Auto-Alt-Dial features if they are enabled on a campaign. Default is 0 for disabled.</QXZ>
settings-daily_limit_manual Daily Call Limit Manual <QXZ>If the Daily Call Count Limit is enabled, this setting will determine if manual dial calls will be counted and or restricted in the daily call count limit. The DISABLED option will not count manual dial calls or restrict them as part of the daily call count limits, only auto-dial calls would be counted restricted. If one of the COUNT options is used, then manual dial calls would be included in the daily call counts. If one of the RESTRICT options is used, then manual dial calls would be restricted as part of the daily call count limit. Default is DISABLED.</QXZ> settings-daily_limit_manual Daily Call Limit Manual <QXZ>If the Daily Call Count Limit is enabled, this setting will determine if manual dial calls will be counted and or restricted in the daily call count limit. The DISABLED option will not count manual dial calls or restrict them as part of the daily call count limits, only auto-dial calls would be counted restricted. If one of the COUNT options is used, then manual dial calls would be included in the daily call counts. If one of the RESTRICT options is used, then manual dial calls would be restricted as part of the daily call count limit. Default is DISABLED.</QXZ>
campaigns-hopper_drop_run_trigger Hopper Drop-Run Trigger <QXZ>This setting, if activated, will ignore all hopper loading criteria for a single hopper run for this campaign and it will only load the DROP status leads from the active lists for the campaign into the hopper at the highest hopper priority, and once this single hopper run has happened, this setting will reset to N for this campaign and the hopper loading will go back to normal for the next minute when it runs. WARNING, when this runs it will not check to see if the lists have been reset, so you may be calling back DROP leads that were recently called. However, if the Drop Lockout Time has been enabled, that setting will be honored. Default is N for inactive.</QXZ> campaigns-hopper_drop_run_trigger Hopper Drop-Run Trigger <QXZ>This setting, if activated, will ignore all hopper loading criteria for a single hopper run for this campaign and it will only load the DROP status leads from the active lists for the campaign into the hopper at the highest hopper priority, and once this single hopper run has happened, this setting will reset to N for this campaign and the hopper loading will go back to normal for the next minute when it runs. If the -All Drops- checkbox is checked, then any status with -DROP- in the status or status name will be selected, including all system statuses and campaign statuses whether they are for outbound or inbound calls. WARNING, when this runs it will not check to see if the lists have been reset, so you may be calling back DROP leads that were recently called. However, if the Drop Lockout Time has been enabled, that setting will be honored. Default is N, unselected, for inactive.</QXZ>
campaigns-drop_lockout_time Drop Lockout Time <QXZ>This is a number of hours that DROP abandon calls will be prevented from being dialed, to disable set to 0. This setting is very useful in countries like the UK where there are regulations preventing the attempted calling of customers within 72 hours of an Abandon, or DROP. Default is 0.</QXZ> campaigns-drop_lockout_time Drop Lockout Time <QXZ>This is a number of hours that DROP abandon calls will be prevented from being dialed, to disable set to 0. This setting is very useful in countries like the UK where there are regulations preventing the attempted calling of customers within 72 hours of an Abandon, or DROP. Default is 0.</QXZ>
campaigns-force_reset_hopper Force Reset of Hopper <QXZ>This allows you to wipe out the hopper contents upon form submission. It should be filled again when the VDhopper script runs.</QXZ> campaigns-force_reset_hopper Force Reset of Hopper <QXZ>This allows you to wipe out the hopper contents upon form submission. It should be filled again when the VDhopper script runs.</QXZ>
campaigns-dial_method Dial Method <QXZ>This field is the way to define how dialing is to take place. If MANUAL then the auto_dial_level will be locked at 0 unless Dial Method is changed. If RATIO then the normal dialing a number of lines for Active agents. ADAPT_HARD_LIMIT will dial predictively up to the dropped percentage and then not allow aggressive dialing once the drop limit is reached until the percentage goes down again. ADAPT_TAPERED allows for running over the dropped percentage in the first half of the shift -as defined by call_time selected for campaign- and gets more strict as the shift goes on. ADAPT_AVERAGE tries to maintain an average or the dropped percentage not imposing hard limits as aggressively as the other two methods. You cannot change the Auto Dial Level if you are in any of the ADAPT dial methods. Only the Dialer can change the dial level when in predictive dialing mode. INBOUND_MAN allows the agent to place manual dial calls from a campaign list while being able to take inbound calls between manual dial calls.</QXZ> campaigns-dial_method Dial Method <QXZ>This field is the way to define how dialing is to take place. If MANUAL then the auto_dial_level will be locked at 0 unless Dial Method is changed. If RATIO then the normal dialing a number of lines for Active agents. ADAPT_HARD_LIMIT will dial predictively up to the dropped percentage and then not allow aggressive dialing once the drop limit is reached until the percentage goes down again. ADAPT_TAPERED allows for running over the dropped percentage in the first half of the shift -as defined by call_time selected for campaign- and gets more strict as the shift goes on. ADAPT_AVERAGE tries to maintain an average or the dropped percentage not imposing hard limits as aggressively as the other two methods. You cannot change the Auto Dial Level if you are in any of the ADAPT dial methods. Only the Dialer can change the dial level when in predictive dialing mode. INBOUND_MAN allows the agent to place manual dial calls from a campaign list while being able to take inbound calls between manual dial calls.</QXZ>
+47 -3
View File
@@ -175,10 +175,11 @@
# 210330-1633 - Added ability to use custom_fields_copy on update_list on a deleted list_id # 210330-1633 - Added ability to use custom_fields_copy on update_list on a deleted list_id
# 210401-1058 - Added 'custom_fields_update' option for update_list function # 210401-1058 - Added 'custom_fields_update' option for update_list function
# 210402-1102 - Added 'custom_fields_delete' option for update_list function # 210402-1102 - Added 'custom_fields_delete' option for update_list function
# 210406-1047 - Added 'dialable_count' option to list_info function
# #
$version = '2.14-152'; $version = '2.14-153';
$build = '210402-1102'; $build = '210406-1047';
$api_url_log = 0; $api_url_log = 0;
$startMS = microtime(); $startMS = microtime();
@@ -637,6 +638,8 @@ if (isset($_GET["custom_fields_update"])) {$custom_fields_update=$_GET["custom
elseif (isset($_POST["custom_fields_update"])) {$custom_fields_update=$_POST["custom_fields_update"];} elseif (isset($_POST["custom_fields_update"])) {$custom_fields_update=$_POST["custom_fields_update"];}
if (isset($_GET["custom_fields_delete"])) {$custom_fields_delete=$_GET["custom_fields_delete"];} if (isset($_GET["custom_fields_delete"])) {$custom_fields_delete=$_GET["custom_fields_delete"];}
elseif (isset($_POST["custom_fields_delete"])) {$custom_fields_delete=$_POST["custom_fields_delete"];} elseif (isset($_POST["custom_fields_delete"])) {$custom_fields_delete=$_POST["custom_fields_delete"];}
if (isset($_GET["dialable_count"])) {$dialable_count=$_GET["dialable_count"];}
elseif (isset($_POST["dialable_count"])) {$dialable_count=$_POST["dialable_count"];}
header ("Content-type: text/html; charset=utf-8"); header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@@ -914,6 +917,7 @@ $field_rerank = preg_replace('/[^_0-9a-zA-Z]/','',$field_rerank);
$custom_fields_add = preg_replace('/[^_0-9a-zA-Z]/','',$custom_fields_add); $custom_fields_add = preg_replace('/[^_0-9a-zA-Z]/','',$custom_fields_add);
$custom_fields_update = preg_replace('/[^_0-9a-zA-Z]/','',$custom_fields_update); $custom_fields_update = preg_replace('/[^_0-9a-zA-Z]/','',$custom_fields_update);
$custom_fields_delete = preg_replace('/[^_0-9a-zA-Z]/','',$custom_fields_delete); $custom_fields_delete = preg_replace('/[^_0-9a-zA-Z]/','',$custom_fields_delete);
$dialable_count = preg_replace('/[^_0-9a-zA-Z]/','',$dialable_count);
$USarea = substr($phone_number, 0, 3); $USarea = substr($phone_number, 0, 3);
$USprefix = substr($phone_number, 3, 3); $USprefix = substr($phone_number, 3, 3);
@@ -6433,10 +6437,50 @@ if ($function == 'list_info')
$leads_counts_output .= $DL . "$all_leads_count" . $DL . "$new_leads_count"; $leads_counts_output .= $DL . "$all_leads_count" . $DL . "$new_leads_count";
} }
$leads_dialable_output='';
if ($dialable_count == 'Y')
{
if ($header == 'YES')
{$output .= $DL . 'dialable_count';}
$stmt="SELECT dial_statuses,local_call_time,lead_filter_id,drop_lockout_time,call_count_limit from vicidial_campaigns where campaign_id='$campaign_id' $LOGallowed_campaignsSQL;";
$rslt=mysql_to_mysqli($stmt, $link);
$camps_to_print = mysqli_num_rows($rslt);
if ($camps_to_print > 0)
{
$row=mysqli_fetch_row($rslt);
$dial_statuses = $row[0];
$local_call_time = $row[1];
$lead_filter_id = $row[2];
$drop_lockout_time = $row[3];
$call_count_limit = $row[4];
}
$stmt="SELECT lead_filter_sql from vicidial_lead_filters where lead_filter_id='$lead_filter_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$filters_to_print = mysqli_num_rows($rslt);
$filterSQL='';
if ($filters_to_print > 0)
{
$rowx=mysqli_fetch_row($rslt);
$filterSQL = "$rowx[0]";
}
$filterSQL = preg_replace("/\\\\/","",$filterSQL);
$filterSQL = preg_replace('/^and|and$|^or|or$/i', '',$filterSQL);
if (strlen($filterSQL)>4)
{$fSQL = "and ($filterSQL)";}
else
{$fSQL = '';}
### call function to calculate and print dialable leads
$single_status=0;
$only_return=1;
$leads_dialable_output = dialable_leads($DB,$link,$local_call_time,$dial_statuses,"'$list_id'",$drop_lockout_time,$call_count_limit,$single_status,$fSQL,$only_return);
}
if ($header == 'YES') if ($header == 'YES')
{$output .= "\n";} {$output .= "\n";}
$output .= "$list_id" . $DL . "$list_name" . $DL . "$campaign_id" . $DL . "$active" . $DL . "$list_changedate" . $DL . "$list_lastcalldate" . $DL . "$expiration_date" . $DL . "$resets_today" . $leads_counts_output . "\n"; $output .= "$list_id" . $DL . "$list_name" . $DL . "$campaign_id" . $DL . "$active" . $DL . "$list_changedate" . $DL . "$list_lastcalldate" . $DL . "$expiration_date" . $DL . "$resets_today" . $leads_counts_output . $DL . $leads_dialable_output . "\n";
$result = 'SUCCESS'; $result = 'SUCCESS';
$result_reason = "list_info LIST INFORMATION SENT"; $result_reason = "list_info LIST INFORMATION SENT";