added last_local_call_time field to vicidial_list table. This change affected many scripts from the hopper loaders to the lead loaders to the vdc_db_query.php agent-side script. A script was created to populate this field from the logs: VICIDIAL_last_local_call_time_UPDATE.pl

git-svn-id: svn://192.168.202.10@921 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2008-07-13 15:45:22 +00:00
parent bfa7866277
commit 8c01f7b658
15 changed files with 663 additions and 174 deletions
+5
View File
@@ -135,6 +135,11 @@ NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
30. Added some basic agent interface API functions and an agc/api.php script
31. A field has been added to vicidial_list(last_local_call_time) to sort by
the last time a lead was called as well as for lead recycling changes.
########## UPGRADING FROM 2.0.3 TO 2.0.4 ##########
+15 -2
View File
@@ -67,6 +67,7 @@
# 71030-2054 - Added hopper priority sorting
# 80227-0406 - added queue_priority
# 80525-1040 - Added IVR vac status compatibility for inbound calls
# 80713-0624 - Added vicidial_list_last_local_call_time field
#
@@ -781,6 +782,18 @@ while($one_day_interval > 0)
}
else {$CSLR = 'Y';}
$LLCT_DATE_offset = ($LOCAL_GMT_OFF - $gmt_offset_now);
$LLCT_DATE_offset_epoch = ( $secX - ($LLCT_DATE_offset * 3600) );
($Lsec,$Lmin,$Lhour,$Lmday,$Lmon,$Lyear,$Lwday,$Lyday,$Lisdst) = localtime($LLCT_DATE_offset_epoch);
$Lyear = ($Lyear + 1900);
$Lmon++;
if ($Lmon < 10) {$Lmon = "0$Lmon";}
if ($Lmday < 10) {$Lmday = "0$Lmday";}
if ($Lhour < 10) {$Lhour = "0$Lhour";}
if ($Lmin < 10) {$Lmin = "0$Lmin";}
if ($Lsec < 10) {$Lsec = "0$Lsec";}
$LLCT_DATE = "$Lyear-$Lmon-$Lmday $Lhour:$Lmin:$Lsec";
if ( ($alt_dial =~ /ALT|ADDR3/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT|ADDR/) )
{
if ( ($alt_dial =~ /ALT/) && ($DBIPautoaltdial[$user_CIPct] =~ /ALT/) )
@@ -793,11 +806,11 @@ while($one_day_interval > 0)
$address3 =~ s/\D//gi;
$phone_number = $address3;
}
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR',user='VDAD' where lead_id='$lead_id'";
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id'";
}
else
{
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD' where lead_id='$lead_id'";
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id'";
}
$affected_rows = $dbhA->do($stmtA);
+15 -2
View File
@@ -21,6 +21,7 @@
# 71030-2054 - Added hopper priority sorting
# 71111-2349 - fixed overdialing bug
# 80227-0406 - fixed auto-alt-dial and added queue_priority
# 80713-0624 - Added vicidial_list_last_local_call_time field
#
@@ -631,6 +632,18 @@ while($one_day_interval > 0)
}
else {$CSLR = 'Y';}
$LLCT_DATE_offset = ($LOCAL_GMT_OFF - $gmt_offset_now);
$LLCT_DATE_offset_epoch = ( $secX - ($LLCT_DATE_offset * 3600) );
($Lsec,$Lmin,$Lhour,$Lmday,$Lmon,$Lyear,$Lwday,$Lyday,$Lisdst) = localtime($LLCT_DATE_offset_epoch);
$Lyear = ($Lyear + 1900);
$Lmon++;
if ($Lmon < 10) {$Lmon = "0$Lmon";}
if ($Lmday < 10) {$Lmday = "0$Lmday";}
if ($Lhour < 10) {$Lhour = "0$Lhour";}
if ($Lmin < 10) {$Lmin = "0$Lmin";}
if ($Lsec < 10) {$Lsec = "0$Lsec";}
$LLCT_DATE = "$Lyear-$Lmon-$Lmday $Lhour:$Lmin:$Lsec";
if ( ($alt_dial =~ /ALT|ADDR3/) && ($DBIPautoaltdial[$camp_CIPct] =~ /ALT|ADDR/) )
{
if ( ($alt_dial =~ /ALT/) && ($DBIPautoaltdial[$camp_CIPct] =~ /ALT/) )
@@ -643,11 +656,11 @@ while($one_day_interval > 0)
$address3 =~ s/\D//gi;
$phone_number = $address3;
}
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR',user='VDAD' where lead_id='$lead_id'";
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id'";
}
else
{
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD' where lead_id='$lead_id'";
$stmtA = "UPDATE vicidial_list set called_since_last_reset='$CSLR', called_count='$called_count',user='VDAD',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id'";
}
$affected_rows = $dbhA->do($stmtA);
+198 -70
View File
@@ -48,6 +48,7 @@
# 71030-2043 - Added hopper priority for callbacks
# 80112-0221 - Added 2nd, 3rd,... NEW for LAST NAME/PHONE Sort
# 80125-0821 - Added detail logging of each lead inserted
# 80713-0028 - Changed Recycling methodology
#
# constants
@@ -66,6 +67,7 @@ $secX = time();
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900);
$mon++;
$wtoday = $wday;
if ($mon < 10) {$mon = "0$mon";}
if ($mday < 10) {$mday = "0$mday";}
if ($hour < 10) {$Fhour = "0$hour";}
@@ -505,6 +507,101 @@ foreach(@campaign_id)
}
$sthA->finish();
### BEGIN For lead recycling find out the no-call gap time and begin dial time for today
$lct_gap=0; # number of seconds from stopping of calling to starting of calling based on local call time
$lct_begin=0; # hour and minute of the begin time for the local call time
$lct_end=0; # hour and minute of the end time for the local call time
$secYESTERDAY = ($secX - (24 * 3600));
($ksec,$kmin,$khour,$kmday,$kmon,$kyear,$wyesterday,$kyday,$kisdst) = localtime($secYESTERDAY);
if ($wtoday < 1) #### Sunday local time
{
if (($Gct_sunday_start < 1) && ($Gct_sunday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_sunday_start;}
}
if ($wtoday==1) #### Monday local time
{
if (($Gct_monday_start < 1) && ($Gct_monday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_monday_start;}
}
if ($wtoday==2) #### Tuesday local time
{
if (($Gct_tuesday_start < 1) && ($Gct_tuesday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_tuesday_start;}
}
if ($wtoday==3) #### Wednesday local time
{
if (($Gct_wednesday_start < 1) && ($Gct_wednesday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_wednesday_start;}
}
if ($wtoday==4) #### Thursday local time
{
if (($Gct_thursday_start < 1) && ($Gct_thursday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_thursday_start;}
}
if ($wtoday==5) #### Friday local time
{
if (($Gct_friday_start < 1) && ($Gct_friday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_friday_start;}
}
if ($wtoday==6) #### Saturday local time
{
if (($Gct_saturday_start < 1) && ($Gct_saturday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_saturday_start;}
}
if ($wyesterday < 1) #### Sunday local time
{
if (($Gct_sunday_start < 1) && ($Gct_sunday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_sunday_stop;}
}
if ($wyesterday==1) #### Monday local time
{
if (($Gct_monday_start < 1) && ($Gct_monday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_monday_stop;}
}
if ($wyesterday==2) #### Tuesday local time
{
if (($Gct_tuesday_start < 1) && ($Gct_tuesday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_tuesday_stop;}
}
if ($wyesterday==3) #### Wednesday local time
{
if (($Gct_wednesday_start < 1) && ($Gct_wednesday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_wednesday_stop;}
}
if ($wyesterday==4) #### Thursday local time
{
if (($Gct_thursday_start < 1) && ($Gct_thursday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_thursday_stop;}
}
if ($wyesterday==5) #### Friday local time
{
if (($Gct_friday_start < 1) && ($Gct_friday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_friday_stop;}
}
if ($wyesterday==6) #### Saturday local time
{
if (($Gct_saturday_start < 1) && ($Gct_saturday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_saturday_stop;}
}
$lct_end = sprintf("%04d", $lct_end);
$lct_end_hour = substr($lct_end, 0, 2);
$lct_end_min = substr($lct_end, 2, 2);
$lct_begin = sprintf("%04d", $lct_begin);
$lct_begin_hour = substr($lct_begin, 0, 2);
$lct_begin_min = substr($lct_begin, 2, 2);
$lct_gap = ( ( ( ( (24 - $lct_end_hour) + $lct_begin_hour) * 3600) + ($lct_begin_min * 60) ) - ($lct_end_min * 60) );
if ($DBX) {print "LocalCallTime No-Call Gap: |$lct_gap|$lct_end($lct_end_hour $lct_end_min)|$lct_begin($lct_begin_hour $lct_begin_min)|$wtoday|$wyesterday|\n";}
### END For lead recycling find out the no-call gap time and begin dial time for today
$ct_states = '';
$ct_state_gmt_SQL = '';
$del_state_gmt_SQL = '';
@@ -558,16 +655,16 @@ foreach(@campaign_id)
{
if ($GMT_day[$r]==0) #### Sunday local time
{
if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0))
if (($Gsct_sunday_start==0) && ($Gsct_sunday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_sunday_start) && ($GMT_hour[$r]<$Gsct_sunday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -575,16 +672,16 @@ foreach(@campaign_id)
}
if ($GMT_day[$r]==1) #### Monday local time
{
if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0))
if (($Gsct_monday_start==0) && ($Gsct_monday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_monday_start) && ($GMT_hour[$r]<$Gsct_monday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -592,16 +689,16 @@ foreach(@campaign_id)
}
if ($GMT_day[$r]==2) #### Tuesday local time
{
if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0))
if (($Gsct_tuesday_start==0) && ($Gsct_tuesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) && ($GMT_hour[$r]<$Gsct_tuesday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -609,16 +706,16 @@ foreach(@campaign_id)
}
if ($GMT_day[$r]==3) #### Wednesday local time
{
if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0))
if (($Gsct_wednesday_start==0) && ($Gsct_wednesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) && ($GMT_hour[$r]<$Gsct_wednesday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -626,16 +723,16 @@ foreach(@campaign_id)
}
if ($GMT_day[$r]==4) #### Thursday local time
{
if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0))
if (($Gsct_thursday_start==0) && ($Gsct_thursday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_thursday_start) && ($GMT_hour[$r]<$Gsct_thursday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -643,16 +740,16 @@ foreach(@campaign_id)
}
if ($GMT_day[$r]==5) #### Friday local time
{
if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0))
if (($Gsct_friday_start==0) && ($Gsct_friday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_friday_start) && ($GMT_hour[$r]<$Gsct_friday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -660,16 +757,16 @@ foreach(@campaign_id)
}
if ($GMT_day[$r]==6) #### Saturday local time
{
if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0))
if (($Gsct_saturday_start==0) && ($Gsct_saturday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_saturday_start) && ($GMT_hour[$r]<$Gsct_saturday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -679,8 +776,8 @@ foreach(@campaign_id)
}
$state_gmt = "$state_gmt'99'";
$del_state_gmt = "$del_state_gmt'99'";
$ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) ";
$del_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($del_state_gmt)) ";
$ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' && gmt_offset_now IN($state_gmt)) ";
$del_state_gmt_SQL .= "or (state='$Gstate_call_time_state' && gmt_offset_now IN($del_state_gmt)) ";
}
$b++;
@@ -696,125 +793,127 @@ foreach(@campaign_id)
}
$r=0;
@default_gmt_ARY=@MT;
$dgA=0;
$default_gmt='';
$del_default_gmt='';
while($r < $g)
{
if ($GMT_day[$r]==0) #### Sunday local time
{
if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0))
if (($Gct_sunday_start==0) && ($Gct_sunday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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_hour[$r]>=$Gct_sunday_start) && ($GMT_hour[$r]<$Gct_sunday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==1) #### Monday local time
{
if (($Gct_monday_start==0) and ($Gct_monday_stop==0))
if (($Gct_monday_start==0) && ($Gct_monday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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_hour[$r]>=$Gct_monday_start) && ($GMT_hour[$r]<$Gct_monday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==2) #### Tuesday local time
{
if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0))
if (($Gct_tuesday_start==0) && ($Gct_tuesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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_hour[$r]>=$Gct_tuesday_start) && ($GMT_hour[$r]<$Gct_tuesday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==3) #### Wednesday local time
{
if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0))
if (($Gct_wednesday_start==0) && ($Gct_wednesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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_hour[$r]>=$Gct_wednesday_start) && ($GMT_hour[$r]<$Gct_wednesday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==4) #### Thursday local time
{
if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0))
if (($Gct_thursday_start==0) && ($Gct_thursday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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_hour[$r]>=$Gct_thursday_start) && ($GMT_hour[$r]<$Gct_thursday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==5) #### Friday local time
{
if (($Gct_friday_start==0) and ($Gct_friday_stop==0))
if (($Gct_friday_start==0) && ($Gct_friday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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_hour[$r]>=$Gct_friday_start) && ($GMT_hour[$r]<$Gct_friday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==6) #### Saturday local time
{
if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0))
if (($Gct_saturday_start==0) && ($Gct_saturday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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]',";}
if ( ($GMT_hour[$r]>=$Gct_saturday_start) && ($GMT_hour[$r]<$Gct_saturday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
@@ -858,17 +957,6 @@ foreach(@campaign_id)
$recycle_SQL[$i] = "( ";
while($rc < $rec_ct[$i])
{
$secX = time();
$Rtarget = ($secX - $recycle_delay[$rc]);
($Rsec,$Rmin,$Rhour,$Rmday,$Rmon,$Ryear,$Rwday,$Ryday,$Risdst) = localtime($Rtarget);
$Ryear = ($Ryear + 1900);
$Rmon++;
if ($Rmon < 10) {$Rmon = "0$Rmon";}
if ($Rmday < 10) {$Rmday = "0$Rmday";}
if ($Rhour < 10) {$Rhour = "0$Rhour";}
if ($Rmin < 10) {$Rmin = "0$Rmin";}
if ($Rsec < 10) {$Rsec = "0$Rsec";}
$RSQLdate[$rc] = "$Ryear-$Rmon-$Rmday $Rhour:$Rmin:$Rsec";
$Y=1;
$recycle_Y = "'Y'";
while ($Y < $recycle_maximum[$rc])
@@ -879,9 +967,49 @@ foreach(@campaign_id)
if ($rc > 0) {$recycle_SQL[$i] .= " or ";}
$recycle_SQL[$i] .= "( (called_since_last_reset IN($recycle_Y)) and (status='$recycle_status[$rc]') and (modify_date < \"$RSQLdate[$rc]\") )";
$recycle_SQL[$i] .= "( (called_since_last_reset IN($recycle_Y)) and (status='$recycle_status[$rc]') and (";
$dgA=0;
foreach(@default_gmt_ARY)
{
$secX = time();
$LLCT_DATE_offset = ($LOCAL_GMT_OFF - $default_gmt_ARY[$dgA]);
$LLCT_DATE_offset_epoch = ( $secX - ($LLCT_DATE_offset * 3600) );
$Rtarget = ($LLCT_DATE_offset_epoch - $recycle_delay[$rc]);
($Rsec,$Rmin,$Rhour,$Rmday,$Rmon,$Ryear,$Rwday,$Ryday,$Risdst) = localtime($Rtarget);
$Ryear = ($Ryear + 1900);
$Rmon++;
if ($Rmon < 10) {$Rmon = "0$Rmon";}
if ($Rmday < 10) {$Rmday = "0$Rmday";}
if ($Rhour < 10) {$Rhour = "0$Rhour";}
if ($Rmin < 10) {$Rmin = "0$Rmin";}
if ($Rsec < 10) {$Rsec = "0$Rsec";}
$Rhourmin = "$Rhour$Rmin";
if ( ($Rhourmin < $lct_begin) || ($Rhourmin > $lct_end) )
{
$RGtarget = ($Rtarget - $lct_gap);
($Rsec,$Rmin,$Rhour,$Rmday,$Rmon,$Ryear,$Rwday,$Ryday,$Risdst) = localtime($RGtarget);
$Ryear = ($Ryear + 1900);
$Rmon++;
if ($Rmon < 10) {$Rmon = "0$Rmon";}
if ($Rmday < 10) {$Rmday = "0$Rmday";}
if ($Rhour < 10) {$Rhour = "0$Rhour";}
if ($Rmin < 10) {$Rmin = "0$Rmin";}
if ($Rsec < 10) {$Rsec = "0$Rsec";}
if ($DBX) {print "RECYCLE DELAY GAP: |$campaign_id[$i]|$Rhourmin|$RGtarget|Rtarget|($recycle_delay[$rc] $lct_gap)\n";}
}
$RSQLdate[$rc] = "$Ryear-$Rmon-$Rmday $Rhour:$Rmin:$Rsec";
if ($dgA > 0) {$recycle_SQL[$i] .= " or ";}
$recycle_SQL[$i] .= "( (gmt_offset_now='$default_gmt_ARY[$dgA]') and (last_local_call_time < \"$RSQLdate[$rc]\") )";
$dgA++;
}
if ($DBX) {print "RECYCLE: |$campaign_id[$i]|$recycle_status[$rc]|$recycle_delay[$rc]|$recycle_maximum[$rc]|$RSQLdate[$rc]|\n";}
$recycle_SQL[$i] .= " ) )";
$rc++;
}
+198 -70
View File
@@ -50,6 +50,7 @@
# 71030-2043 - Added hopper priority for callbacks
# 80112-0221 - Added 2nd, 3rd,... NEW for LAST NAME/PHONE Sort
# 80125-0821 - Added detail logging of each lead inserted
# 80713-0028 - Changed Recycling methodology
#
# constants
@@ -68,6 +69,7 @@ $secX = time();
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900);
$mon++;
$wtoday = $wday;
if ($mon < 10) {$mon = "0$mon";}
if ($mday < 10) {$mday = "0$mday";}
if ($hour < 10) {$Fhour = "0$hour";}
@@ -511,6 +513,101 @@ foreach(@campaign_id)
}
$sthA->finish();
### BEGIN For lead recycling find out the no-call gap time and begin dial time for today
$lct_gap=0; # number of seconds from stopping of calling to starting of calling based on local call time
$lct_begin=0; # hour and minute of the begin time for the local call time
$lct_end=0; # hour and minute of the end time for the local call time
$secYESTERDAY = ($secX - (24 * 3600));
($ksec,$kmin,$khour,$kmday,$kmon,$kyear,$wyesterday,$kyday,$kisdst) = localtime($secYESTERDAY);
if ($wtoday < 1) #### Sunday local time
{
if (($Gct_sunday_start < 1) && ($Gct_sunday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_sunday_start;}
}
if ($wtoday==1) #### Monday local time
{
if (($Gct_monday_start < 1) && ($Gct_monday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_monday_start;}
}
if ($wtoday==2) #### Tuesday local time
{
if (($Gct_tuesday_start < 1) && ($Gct_tuesday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_tuesday_start;}
}
if ($wtoday==3) #### Wednesday local time
{
if (($Gct_wednesday_start < 1) && ($Gct_wednesday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_wednesday_start;}
}
if ($wtoday==4) #### Thursday local time
{
if (($Gct_thursday_start < 1) && ($Gct_thursday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_thursday_start;}
}
if ($wtoday==5) #### Friday local time
{
if (($Gct_friday_start < 1) && ($Gct_friday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_friday_start;}
}
if ($wtoday==6) #### Saturday local time
{
if (($Gct_saturday_start < 1) && ($Gct_saturday_stop < 1)) {$lct_begin = $Gct_default_start;}
else {$lct_begin = $Gct_saturday_start;}
}
if ($wyesterday < 1) #### Sunday local time
{
if (($Gct_sunday_start < 1) && ($Gct_sunday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_sunday_stop;}
}
if ($wyesterday==1) #### Monday local time
{
if (($Gct_monday_start < 1) && ($Gct_monday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_monday_stop;}
}
if ($wyesterday==2) #### Tuesday local time
{
if (($Gct_tuesday_start < 1) && ($Gct_tuesday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_tuesday_stop;}
}
if ($wyesterday==3) #### Wednesday local time
{
if (($Gct_wednesday_start < 1) && ($Gct_wednesday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_wednesday_stop;}
}
if ($wyesterday==4) #### Thursday local time
{
if (($Gct_thursday_start < 1) && ($Gct_thursday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_thursday_stop;}
}
if ($wyesterday==5) #### Friday local time
{
if (($Gct_friday_start < 1) && ($Gct_friday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_friday_stop;}
}
if ($wyesterday==6) #### Saturday local time
{
if (($Gct_saturday_start < 1) && ($Gct_saturday_stop < 1)) {$lct_end = $Gct_default_stop;}
else {$lct_end = $Gct_saturday_stop;}
}
$lct_end = sprintf("%04d", $lct_end);
$lct_end_hour = substr($lct_end, 0, 2);
$lct_end_min = substr($lct_end, 2, 2);
$lct_begin = sprintf("%04d", $lct_begin);
$lct_begin_hour = substr($lct_begin, 0, 2);
$lct_begin_min = substr($lct_begin, 2, 2);
$lct_gap = ( ( ( ( (24 - $lct_end_hour) + $lct_begin_hour) * 3600) + ($lct_begin_min * 60) ) - ($lct_end_min * 60) );
if ($DBX) {print "LocalCallTime No-Call Gap: |$lct_gap|$lct_end($lct_end_hour $lct_end_min)|$lct_begin($lct_begin_hour $lct_begin_min)|$wtoday|$wyesterday|\n";}
### END For lead recycling find out the no-call gap time and begin dial time for today
$ct_states = '';
$ct_state_gmt_SQL = '';
$del_state_gmt_SQL = '';
@@ -564,16 +661,16 @@ foreach(@campaign_id)
{
if ($GMT_day[$r]==0) #### Sunday local time
{
if (($Gsct_sunday_start==0) and ($Gsct_sunday_stop==0))
if (($Gsct_sunday_start==0) && ($Gsct_sunday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_sunday_start) and ($GMT_hour[$r]<$Gsct_sunday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_sunday_start) && ($GMT_hour[$r]<$Gsct_sunday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -581,16 +678,16 @@ foreach(@campaign_id)
}
if ($GMT_day[$r]==1) #### Monday local time
{
if (($Gsct_monday_start==0) and ($Gsct_monday_stop==0))
if (($Gsct_monday_start==0) && ($Gsct_monday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_monday_start) and ($GMT_hour[$r]<$Gsct_monday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_monday_start) && ($GMT_hour[$r]<$Gsct_monday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -598,16 +695,16 @@ foreach(@campaign_id)
}
if ($GMT_day[$r]==2) #### Tuesday local time
{
if (($Gsct_tuesday_start==0) and ($Gsct_tuesday_stop==0))
if (($Gsct_tuesday_start==0) && ($Gsct_tuesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) and ($GMT_hour[$r]<$Gsct_tuesday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_tuesday_start) && ($GMT_hour[$r]<$Gsct_tuesday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -615,16 +712,16 @@ foreach(@campaign_id)
}
if ($GMT_day[$r]==3) #### Wednesday local time
{
if (($Gsct_wednesday_start==0) and ($Gsct_wednesday_stop==0))
if (($Gsct_wednesday_start==0) && ($Gsct_wednesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) and ($GMT_hour[$r]<$Gsct_wednesday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_wednesday_start) && ($GMT_hour[$r]<$Gsct_wednesday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -632,16 +729,16 @@ foreach(@campaign_id)
}
if ($GMT_day[$r]==4) #### Thursday local time
{
if (($Gsct_thursday_start==0) and ($Gsct_thursday_stop==0))
if (($Gsct_thursday_start==0) && ($Gsct_thursday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_thursday_start) and ($GMT_hour[$r]<$Gsct_thursday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_thursday_start) && ($GMT_hour[$r]<$Gsct_thursday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -649,16 +746,16 @@ foreach(@campaign_id)
}
if ($GMT_day[$r]==5) #### Friday local time
{
if (($Gsct_friday_start==0) and ($Gsct_friday_stop==0))
if (($Gsct_friday_start==0) && ($Gsct_friday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_friday_start) and ($GMT_hour[$r]<$Gsct_friday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_friday_start) && ($GMT_hour[$r]<$Gsct_friday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -666,16 +763,16 @@ foreach(@campaign_id)
}
if ($GMT_day[$r]==6) #### Saturday local time
{
if (($Gsct_saturday_start==0) and ($Gsct_saturday_stop==0))
if (($Gsct_saturday_start==0) && ($Gsct_saturday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gsct_default_start) and ($GMT_hour[$r]<$Gsct_default_stop) )
if ( ($GMT_hour[$r]>=$Gsct_default_start) && ($GMT_hour[$r]<$Gsct_default_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
}
else
{
if ( ($GMT_hour[$r]>=$Gsct_saturday_start) and ($GMT_hour[$r]<$Gsct_saturday_stop) )
if ( ($GMT_hour[$r]>=$Gsct_saturday_start) && ($GMT_hour[$r]<$Gsct_saturday_stop) )
{$state_gmt.="'$GMT_gmt[$r]',";}
else
{$del_state_gmt.="'$GMT_gmt[$r]',";}
@@ -685,8 +782,8 @@ foreach(@campaign_id)
}
$state_gmt = "$state_gmt'99'";
$del_state_gmt = "$del_state_gmt'99'";
$ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($state_gmt)) ";
$del_state_gmt_SQL .= "or (state='$Gstate_call_time_state' and gmt_offset_now IN($del_state_gmt)) ";
$ct_state_gmt_SQL .= "or (state='$Gstate_call_time_state' && gmt_offset_now IN($state_gmt)) ";
$del_state_gmt_SQL .= "or (state='$Gstate_call_time_state' && gmt_offset_now IN($del_state_gmt)) ";
}
$b++;
@@ -702,125 +799,127 @@ foreach(@campaign_id)
}
$r=0;
@default_gmt_ARY=@MT;
$dgA=0;
$default_gmt='';
$del_default_gmt='';
while($r < $g)
{
if ($GMT_day[$r]==0) #### Sunday local time
{
if (($Gct_sunday_start==0) and ($Gct_sunday_stop==0))
if (($Gct_sunday_start==0) && ($Gct_sunday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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_hour[$r]>=$Gct_sunday_start) && ($GMT_hour[$r]<$Gct_sunday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==1) #### Monday local time
{
if (($Gct_monday_start==0) and ($Gct_monday_stop==0))
if (($Gct_monday_start==0) && ($Gct_monday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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_hour[$r]>=$Gct_monday_start) && ($GMT_hour[$r]<$Gct_monday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==2) #### Tuesday local time
{
if (($Gct_tuesday_start==0) and ($Gct_tuesday_stop==0))
if (($Gct_tuesday_start==0) && ($Gct_tuesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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_hour[$r]>=$Gct_tuesday_start) && ($GMT_hour[$r]<$Gct_tuesday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==3) #### Wednesday local time
{
if (($Gct_wednesday_start==0) and ($Gct_wednesday_stop==0))
if (($Gct_wednesday_start==0) && ($Gct_wednesday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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_hour[$r]>=$Gct_wednesday_start) && ($GMT_hour[$r]<$Gct_wednesday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==4) #### Thursday local time
{
if (($Gct_thursday_start==0) and ($Gct_thursday_stop==0))
if (($Gct_thursday_start==0) && ($Gct_thursday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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_hour[$r]>=$Gct_thursday_start) && ($GMT_hour[$r]<$Gct_thursday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==5) #### Friday local time
{
if (($Gct_friday_start==0) and ($Gct_friday_stop==0))
if (($Gct_friday_start==0) && ($Gct_friday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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_hour[$r]>=$Gct_friday_start) && ($GMT_hour[$r]<$Gct_friday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
}
if ($GMT_day[$r]==6) #### Saturday local time
{
if (($Gct_saturday_start==0) and ($Gct_saturday_stop==0))
if (($Gct_saturday_start==0) && ($Gct_saturday_stop==0))
{
if ( ($GMT_hour[$r]>=$Gct_default_start) and ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',";}
if ( ($GMT_hour[$r]>=$Gct_default_start) && ($GMT_hour[$r]<$Gct_default_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_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]',";}
if ( ($GMT_hour[$r]>=$Gct_saturday_start) && ($GMT_hour[$r]<$Gct_saturday_stop) )
{$default_gmt.="'$GMT_gmt[$r]',"; $default_gmt_ARY[$dgA] = "$GMT_gmt[$r]"; $dgA++;}
else
{$del_default_gmt.="'$GMT_gmt[$r]',";}
}
@@ -864,17 +963,6 @@ foreach(@campaign_id)
$recycle_SQL[$i] = "( ";
while($rc < $rec_ct[$i])
{
$secX = time();
$Rtarget = ($secX - $recycle_delay[$rc]);
($Rsec,$Rmin,$Rhour,$Rmday,$Rmon,$Ryear,$Rwday,$Ryday,$Risdst) = localtime($Rtarget);
$Ryear = ($Ryear + 1900);
$Rmon++;
if ($Rmon < 10) {$Rmon = "0$Rmon";}
if ($Rmday < 10) {$Rmday = "0$Rmday";}
if ($Rhour < 10) {$Rhour = "0$Rhour";}
if ($Rmin < 10) {$Rmin = "0$Rmin";}
if ($Rsec < 10) {$Rsec = "0$Rsec";}
$RSQLdate[$rc] = "$Ryear-$Rmon-$Rmday $Rhour:$Rmin:$Rsec";
$Y=1;
$recycle_Y = "'Y'";
while ($Y < $recycle_maximum[$rc])
@@ -885,9 +973,49 @@ foreach(@campaign_id)
if ($rc > 0) {$recycle_SQL[$i] .= " or ";}
$recycle_SQL[$i] .= "( (called_since_last_reset IN($recycle_Y)) and (status='$recycle_status[$rc]') and (modify_date < \"$RSQLdate[$rc]\") )";
$recycle_SQL[$i] .= "( (called_since_last_reset IN($recycle_Y)) and (status='$recycle_status[$rc]') and (";
$dgA=0;
foreach(@default_gmt_ARY)
{
$secX = time();
$LLCT_DATE_offset = ($LOCAL_GMT_OFF - $default_gmt_ARY[$dgA]);
$LLCT_DATE_offset_epoch = ( $secX - ($LLCT_DATE_offset * 3600) );
$Rtarget = ($LLCT_DATE_offset_epoch - $recycle_delay[$rc]);
($Rsec,$Rmin,$Rhour,$Rmday,$Rmon,$Ryear,$Rwday,$Ryday,$Risdst) = localtime($Rtarget);
$Ryear = ($Ryear + 1900);
$Rmon++;
if ($Rmon < 10) {$Rmon = "0$Rmon";}
if ($Rmday < 10) {$Rmday = "0$Rmday";}
if ($Rhour < 10) {$Rhour = "0$Rhour";}
if ($Rmin < 10) {$Rmin = "0$Rmin";}
if ($Rsec < 10) {$Rsec = "0$Rsec";}
$Rhourmin = "$Rhour$Rmin";
if ( ($Rhourmin < $lct_begin) || ($Rhourmin > $lct_end) )
{
$RGtarget = ($Rtarget - $lct_gap);
($Rsec,$Rmin,$Rhour,$Rmday,$Rmon,$Ryear,$Rwday,$Ryday,$Risdst) = localtime($RGtarget);
$Ryear = ($Ryear + 1900);
$Rmon++;
if ($Rmon < 10) {$Rmon = "0$Rmon";}
if ($Rmday < 10) {$Rmday = "0$Rmday";}
if ($Rhour < 10) {$Rhour = "0$Rhour";}
if ($Rmin < 10) {$Rmin = "0$Rmin";}
if ($Rsec < 10) {$Rsec = "0$Rsec";}
if ($DBX) {print "RECYCLE DELAY GAP: |$campaign_id[$i]|$Rhourmin|$RGtarget|Rtarget|($recycle_delay[$rc] $lct_gap)\n";}
}
$RSQLdate[$rc] = "$Ryear-$Rmon-$Rmday $Rhour:$Rmin:$Rsec";
if ($dgA > 0) {$recycle_SQL[$i] .= " or ";}
$recycle_SQL[$i] .= "( (gmt_offset_now='$default_gmt_ARY[$dgA]') and (last_local_call_time < \"$RSQLdate[$rc]\") )";
$dgA++;
}
if ($DBX) {print "RECYCLE: |$campaign_id[$i]|$recycle_status[$rc]|$recycle_delay[$rc]|$recycle_maximum[$rc]|$RSQLdate[$rc]|\n";}
$recycle_SQL[$i] .= " ) )";
$rc++;
}
@@ -27,6 +27,7 @@
# 70815-2128 - Added entry_date to import leads format (field 26)
# 80128-0105 - Fixed bugs in file loading
# 80428-0320 - UTF8 update
# 80713-0023 - added last_local_call_time field default of 2008-01-01
#
$secX = time();
@@ -675,7 +676,7 @@ if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOC
if ($multi_insert_counter > 8)
{
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$insert_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','$called_count');";
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$insert_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','$called_count','2008-01-01 00:00:00');";
if (!$T) {$affected_rows = $dbhA->do($stmtZ); } # or die "Couldn't execute query: |$stmtZ|\n";
if($DB){print STDERR "\n|$affected_rows|$stmtZ|\n";}
@@ -685,7 +686,7 @@ if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOC
}
else
{
$multistmt .= "('','$insert_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','$called_count'),";
$multistmt .= "('','$insert_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','$called_count','2008-01-01 00:00:00'),";
$multi_insert_counter++;
}
@@ -0,0 +1,176 @@
#!/usr/bin/perl
#
# VICIDIAL_last_local_call_time_UPDATE.pl version 2.0.5
#
# DESCRIPTION:
# populates the new last_local_call_time field in the vicidial_list table from
# records in the vicidial_log and vicidial_closer_log table
#
# Copyright (C) 2008 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 80714-0530 - first build
#
$secX = time();
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year = ($year + 1900);
$mon++;
if ($hour < 10) {$hour = "0$hour";}
if ($min < 10) {$min = "0$min";}
if ($sec < 10) {$sec = "0$sec";}
if ($mon < 10) {$mon = "0$mon";}
if ($mday < 10) {$mday = "0$mday";}
$pulldate0 = "$year-$mon-$mday $hour:$min:$sec";
$inSD = $pulldate0;
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
# default path to astguiclient configuration file:
$PATHconf = '/etc/astguiclient.conf';
open(conf, "$PATHconf") || die "can't open $PATHconf: $!\n";
@conf = <conf>;
close(conf);
$i=0;
foreach(@conf)
{
$line = $conf[$i];
$line =~ s/ |>|\n|\r|\t|\#.*|;.*//gi;
if ( ($line =~ /^PATHhome/) && ($CLIhome < 1) )
{$PATHhome = $line; $PATHhome =~ s/.*=//gi;}
if ( ($line =~ /^PATHlogs/) && ($CLIlogs < 1) )
{$PATHlogs = $line; $PATHlogs =~ s/.*=//gi;}
if ( ($line =~ /^PATHagi/) && ($CLIagi < 1) )
{$PATHagi = $line; $PATHagi =~ s/.*=//gi;}
if ( ($line =~ /^PATHweb/) && ($CLIweb < 1) )
{$PATHweb = $line; $PATHweb =~ s/.*=//gi;}
if ( ($line =~ /^PATHsounds/) && ($CLIsounds < 1) )
{$PATHsounds = $line; $PATHsounds =~ s/.*=//gi;}
if ( ($line =~ /^PATHmonitor/) && ($CLImonitor < 1) )
{$PATHmonitor = $line; $PATHmonitor =~ s/.*=//gi;}
if ( ($line =~ /^VARserver_ip/) && ($CLIserver_ip < 1) )
{$VARserver_ip = $line; $VARserver_ip =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_server/) && ($CLIDB_server < 1) )
{$VARDB_server = $line; $VARDB_server =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_database/) && ($CLIDB_database < 1) )
{$VARDB_database = $line; $VARDB_database =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_user/) && ($CLIDB_user < 1) )
{$VARDB_user = $line; $VARDB_user =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_pass/) && ($CLIDB_pass < 1) )
{$VARDB_pass = $line; $VARDB_pass =~ s/.*=//gi;}
if ( ($line =~ /^VARDB_port/) && ($CLIDB_port < 1) )
{$VARDB_port = $line; $VARDB_port =~ s/.*=//gi;}
$i++;
}
# Customized Variables
$server_ip = $VARserver_ip; # Asterisk server IP
if (!$VARDB_port) {$VARDB_port='3306';}
use DBI;
$dbhA = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass")
or die "Couldn't connect to database: " . DBI->errstr;
#$DB=1;
$liveupdate=0;
if (!$VDHLOGfile) {$VDHLOGfile = "$PATHlogs/dupleads.$year-$mon-$mday";}
print "\n\n\n\n\n\n\n\n\n\n\n\n-- VICIDIAL_last_local_call_time_UPDATE.pl --\n\n";
print "populates the new last_local_call_time field in the vicidial_list table from records in the vicidial_log and vicidial_closer_log table. \n\n";
$stmtA = "select lead_id,list_id from vicidial_list;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$i=0;
$nonDUP='0';
while ( ($sthArows > $i) && ($nonDUP=='0') )
{
@aryA = $sthA->fetchrow_array;
if ($aryA[0] > 1)
{
$lead_id[$i] = "$aryA[0]";
$list_id[$i] = "$aryA[1]";
}
$i++;
}
$sthA->finish();
$b=0;
foreach(@lead_id)
{
$Ncall_date='2008-01-01 00:00:00';
$Nepoch=0;
$Ccall_date='2008-01-01 00:00:00';
$Cepoch=0;
$stmtA = "select call_date,start_epoch from vicidial_log where lead_id='$lead_id[$b]' order by call_date desc LIMIT 1;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$Ncall_date = $aryA[0];
$Nepoch = $aryA[1];
$rec_count++;
}
$sthA->finish();
$stmtA = "select call_date,start_epoch from vicidial_closer_log where lead_id='$lead_id[$b]' order by closecallid desc LIMIT 1;";
if($DBX){print STDERR "\n|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$Ccall_date = $aryA[0];
$Cepoch = $aryA[1];
$rec_count++;
}
$sthA->finish();
if ($Cepoch > $Nepoch) {$NEWcall_date = $Ccall_date;}
else {$NEWcall_date = $Ncall_date;}
$stmtA = "UPDATE vicidial_list set last_local_call_time='$NEWcall_date' where lead_id='$lead_id[$b]';";
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
if($DB){print STDERR "|$b|$lead_id[$b]|$Ncall_date|$Ccall_date|$list_id[$b]||$stmtA|\n";}
$b++;
if ($b =~ /100$/i) {print STDERR "0 $b\r";}
if ($b =~ /200$/i) {print STDERR "+ $b\r";}
if ($b =~ /300$/i) {print STDERR "| $b\r";}
if ($b =~ /400$/i) {print STDERR "\\ $b\r";}
if ($b =~ /500$/i) {print STDERR "- $b\r";}
if ($b =~ /600$/i) {print STDERR "/ $b\r";}
if ($b =~ /700$/i) {print STDERR "| $b\r";}
if ($b =~ /800$/i) {print STDERR "+ $b\r";}
if ($b =~ /900$/i) {print STDERR "0 $b\r";}
if ($b =~ /000$/i) {print "|$b|$lead_id[$b]|$Ncall_date|$Ccall_date|$list_id[$b]|\n";}
}
$dbhA->disconnect();
### calculate time to run script ###
$secY = time();
$secZ = ($secY - $secX);
$secZm = ($secZ /60);
print "script execution time in seconds: $secZ minutes: $secZm\n";
exit;
@@ -271,12 +271,14 @@ email VARCHAR(70),
security_phrase VARCHAR(100),
comments VARCHAR(255),
called_count SMALLINT(5) UNSIGNED default '0',
last_local_call_time DATETIME
index (phone_number),
index (list_id),
index (called_since_last_reset),
index (status),
index (gmt_offset_now),
index (postal_code)
index (postal_code),
index (last_local_call_time)
);
CREATE TABLE vicidial_hopper (
@@ -911,7 +913,7 @@ recycle_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
campaign_id VARCHAR(8),
status VARCHAR(6) NOT NULL,
attempt_delay SMALLINT(5) UNSIGNED default '1800',
attempt_maximum TINYINT(3) UNSIGNED default '32',
attempt_maximum TINYINT(3) UNSIGNED default '2',
active ENUM('Y','N') default 'N',
index (campaign_id)
);
@@ -1223,5 +1225,5 @@ INSERT INTO vicidial_state_call_times SET state_call_time_id='utah',state_call_t
INSERT INTO vicidial_state_call_times SET state_call_time_id='washington',state_call_time_state='WA',state_call_time_name='Washington 8am',sct_default_start='800',sct_default_stop='2100';
INSERT INTO vicidial_state_call_times SET state_call_time_id='wyoming',state_call_time_state='WY',state_call_time_name='Wyoming 8am-8pm',sct_default_start='800',sct_default_stop='2000';
UPDATE system_settings SET db_schema_version='1098';
UPDATE system_settings SET db_schema_version='1100';
+5
View File
@@ -309,3 +309,8 @@ UPDATE system_settings SET db_schema_version='1098';
ALTER TABLE vicidial_campaigns MODIFY manual_dial_list_id BIGINT(14) UNSIGNED default '998';
UPDATE system_settings SET db_schema_version='1099';
ALTER TABLE vicidial_list ADD last_local_call_time DATETIME;
CREATE INDEX last_local_call_time ON vicidial_list (last_local_call_time);
UPDATE system_settings SET db_schema_version='1100';
@@ -229,6 +229,7 @@ Agent Display Queue Count -<\/B> If set to Y, when a customer is waiting for an
Agent Display Queue Count: ||
agents in dead calls||
QC Last Pull Time: ||
and less than 43200 seconds or 12 hours||
############################################################ CLIENT
+18 -5
View File
@@ -152,10 +152,11 @@
# 80630-2153 - Added queue_log logging for Manual dial calls
# 80703-0139 - Added alter customer phone permissions
# 80707-2325 - Added vicidial_id to recording_log for tracking of vicidial or closer log to recording
# 80713-0624 - Added vicidial_list_last_local_call_time field
#
$version = '2.0.5-76';
$build = '80707-2325';
$version = '2.0.5-77';
$build = '80713-0624';
require("dbconnect.php");
@@ -608,7 +609,7 @@ if ($ACTION == 'manDiaLnextCaLL')
else
{
### insert a new lead in the system with this phone number
$stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';";
$stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
@@ -619,7 +620,7 @@ if ($ACTION == 'manDiaLnextCaLL')
else
{
### insert a new lead in the system with this phone number
$stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate';";
$stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='QUEUE',user='$user',called_since_last_reset='Y',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
@@ -740,8 +741,20 @@ if ($ACTION == 'manDiaLnextCaLL')
}
}
$stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$server_ct = mysql_num_rows($rslt);
if ($server_ct > 0)
{
$row=mysql_fetch_row($rslt);
$local_gmt = $row[0];
}
$LLCT_DATE_offset = ($local_gmt - $gmt_offset_now);
$LLCT_DATE = date("Y-m-d H:i:s", mktime(date("H")-$LLCT_DATE_offset,date("i"),date("s"),date("m"),date("d"),date("Y")));
### flag the lead as called and change it's status to INCALL
$stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user' where lead_id='$lead_id';";
$stmt = "UPDATE vicidial_list set status='INCALL', called_since_last_reset='Y', called_count='$called_count',user='$user',last_local_call_time='$LLCT_DATE' where lead_id='$lead_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
+4 -4
View File
@@ -5935,11 +5935,11 @@ if ($ADD==25)
{echo "<br>CAMPAIGN LEAD RECYCLE NOT ADDED - there is already a lead-recycle for this campaign with this status\n";}
else
{
if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) )
if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_delay >= 43200) or ($attempt_maximum < 1) or ($attempt_maximum > 10) )
{
echo "<br>CAMPAIGN LEAD RECYCLE NOT ADDED - Please go back and look at the data you entered\n";
echo "<br>status must be between 1 and 6 characters in length\n";
echo "<br>attempt delay must be at least 120 seconds\n";
echo "<br>attempt delay must be at least 120 seconds and less than 43200 seconds or 12 hours\n";
echo "<br>maximum attempts must be from 1 to 10\n";
}
else
@@ -7314,11 +7314,11 @@ if ($ADD==45)
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_maximum < 1) or ($attempt_maximum > 10) )
if ( (strlen($campaign_id) < 2) or (strlen($status) < 1) or ($attempt_delay < 120) or ($attempt_delay >= 43200) or ($attempt_maximum < 1) or ($attempt_maximum > 10) )
{
echo "<br>CAMPAIGN LEAD RECYCLE NOT MODIFIED - Please go back and look at the data you entered\n";
echo "<br>status must be between 1 and 6 characters in length\n";
echo "<br>attempt delay must be at least 120 seconds\n";
echo "<br>attempt delay must be at least 120 seconds and less than 43200 seconds or 12 hours\n";
echo "<br>maximum attempts must be from 1 to 10\n";
}
else
+3 -2
View File
@@ -18,6 +18,7 @@
# 70417-1059 - Fixed default phone_code bug
# 70510-1518 - Added campaign and system duplicate check and phonecode override
# 80428-0144 - UTF8 cleanup
# 80713-0023 - added last_local_call_time field default of 2008-01-01
#
### begin parsing run-time options ###
@@ -564,14 +565,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);";
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00');";
$affected_rows = $dbhA->do($stmtZ);
print STMT_FILE $stmtZ."\r\n";
$multistmt='';
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00'),";
$multi_insert_counter++;
}
@@ -17,6 +17,7 @@
# 70417-1059 - Fixed default phone_code bug
# 70510-1518 - Added campaign and system duplicate check and phonecode override
# 80428-0144 - UTF8 cleanup
# 80713-0023 - added last_local_call_time field default of 2008-01-01
#
### begin parsing run-time options ###
@@ -566,14 +567,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);";
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00');";
$affected_rows = $dbhA->do($stmtZ);
print STMT_FILE $stmtZ."\r\n";
$multistmt='';
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00'),";
$multi_insert_counter++;
}
@@ -21,11 +21,13 @@
# 70510-1518 - Added campaign and system duplicate check and phonecode override
# 80428-0417 - UTF8 changes
# 80514-1030 - removed filesize limit and raised number of errors to be displayed
# 80713-0023 - added last_local_call_time field default of 2008-01-01
#
#
# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time.
$version = '2.0.5-25';
$build = '80514-1030';
$version = '2.0.5-26';
$build = '80713-0023';
require("dbconnect.php");
@@ -538,7 +540,7 @@ function ParseFileName() {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);";
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -546,7 +548,7 @@ function ParseFileName() {
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00'),";
$multi_insert_counter++;
}
@@ -753,7 +755,7 @@ function ParseFileName() {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);";
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -761,7 +763,7 @@ function ParseFileName() {
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00'),";
$multi_insert_counter++;
}
@@ -977,7 +979,7 @@ if ($leadfile) {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);";
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -985,7 +987,7 @@ if ($leadfile) {
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00'),";
$multi_insert_counter++;
}
@@ -1203,7 +1205,7 @@ if ($leadfile) {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);";
$stmtZ = "INSERT INTO vicidial_list values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -1211,7 +1213,7 @@ if ($leadfile) {
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00'),";
$multi_insert_counter++;
}