added time zone scheme for Brazil to CLI and web lead loaders script

fixed country field in CLI and web lead loaders

git-svn-id: svn://192.168.202.10@380 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2006-11-10 17:39:28 +00:00
parent 3fb5dcb0c6
commit c47dc2ea4e
6 changed files with 739 additions and 87 deletions
+181 -26
View File
@@ -13,12 +13,13 @@
# 60619-1652 - Added variable filtering to eliminate SQL injection attack threat
# 60822-1105 - fixed for nonwritable directories
# 60906-1059 - added filter of non-digits in alt_phone field
# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme
#
# 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.1';
$build = '60822-1105';
$version = '2.0.2';
$build = '61110-1222';
header ("Content-type: text/html; charset=utf-8");
@@ -300,14 +301,14 @@ if ($leadfile and filesize($LF_path)<=8388608) {
$dsec = ( ( ($hour * 3600) + ($min * 60) ) + $sec );
$AC_processed=0;
if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') )
if ( (!$AC_processed) and ($dst_range == 'SSM-FSN') )
{
if ($DBX) {print " First Sunday April to Last Sunday October\n";}
if ($DBX) {print " Second Sunday March to First Sunday November\n";}
#**********************************************************************
# FSA-LSO
# SSM-FSN
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am.
# Based on Second Sunday March to First Sunday November at 2 am.
# INPUTS:
# mm INTEGER Month.
# dd INTEGER Day of the month.
@@ -321,64 +322,147 @@ if ($leadfile and filesize($LF_path)<=8388608) {
# and 9:00 UTC in October
# OUTPUT:
# INTEGER 1 = DST, 0 = not DST
#
# S M T W T F S
# 1 2 3 4 5 6 7
# 8 9 10 11 12 13 14
#15 16 17 18 19 20 21
#22 23 24 25 26 27 28
#29 30 31
#
# S M T W T F S
# 1 2 3 4 5 6
# 7 8 9 10 11 12 13
#14 15 16 17 18 19 20
#21 22 23 24 25 26 27
#28 29 30 31
#
#**********************************************************************
$USACAN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 3 || $mm > 11) {
$USACAN_DST=0;
} elseif ($mm >= 4 and $mm <= 10) {
$USACAN_DST=1;
} elseif ($mm == 3) {
if ($dd > 13) {
$USACAN_DST=1;
} elseif ($dd >= ($dow+8)) {
if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$USACAN_DST=0;
} else {
$USACAN_DST=1;
}
} else {
if ($dow == 0 and $ns < 7200) {
$USACAN_DST=0;
} else {
$USACAN_DST=1;
}
}
} else {
$USACAN_DST=0;
}
} elseif ($mm == 11) {
if ($dd > 7) {
$USACAN_DST=0;
} elseif ($dd < ($dow+1)) {
$USACAN_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (7200+($timezone-1)*3600)) {
$USACAN_DST=1;
} else {
$USACAN_DST=0;
}
} else { # local time calculations
if ($ns < 7200) {
$USACAN_DST=1;
} else {
$USACAN_DST=0;
}
}
} else {
$USACAN_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $USACAN_DST\n";}
if ($USACAN_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'FSA-LSO') )
{
if ($DBX) {print " First Sunday April to Last Sunday October\n";}
#**********************************************************************
# FSA-LSO
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am.
#**********************************************************************
$USA_DST=0;
$NA_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 10) {
$USA_DST=0;
$NA_DST=0;
} elseif ($mm >= 5 and $mm <= 9) {
$USA_DST=1;
$NA_DST=1;
} elseif ($mm == 4) {
if ($dd > 7) {
$USA_DST=1;
$NA_DST=1;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$USA_DST=0;
$NA_DST=0;
} else {
$USA_DST=1;
$NA_DST=1;
}
} else {
if ($dow == 0 and $ns < 7200) {
$USA_DST=0;
$NA_DST=0;
} else {
$USA_DST=1;
$NA_DST=1;
}
}
} else {
$USA_DST=0;
$NA_DST=0;
}
} elseif ($mm == 10) {
if ($dd < 25) {
$USA_DST=1;
$NA_DST=1;
} elseif ($dd < ($dow+25)) {
$USA_DST=1;
$NA_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (7200+($timezone-1)*3600)) {
$USA_DST=1;
$NA_DST=1;
} else {
$USA_DST=0;
$NA_DST=0;
}
} else { # local time calculations
if ($ns < 7200) {
$USA_DST=1;
$NA_DST=1;
} else {
$USA_DST=0;
$NA_DST=0;
}
}
} else {
$USA_DST=0;
$NA_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $USA_DST\n";}
if ($USA_DST) {$gmt_offset++;}
if ($DBX) {print " DST: $NA_DST\n";}
if ($NA_DST) {$gmt_offset++;}
$AC_processed++;
}
@@ -652,6 +736,77 @@ if ($leadfile and filesize($LF_path)<=8388608) {
if ($NZL_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') )
{
if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
#**********************************************************************
# TSO-LSF
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. Brazil
# Based on Third Sunday October to Last Sunday February at 1 am.
#**********************************************************************
$BZL_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 2 || $mm > 10) {
$BZL_DST=1;
} elseif ($mm >= 3 and $mm <= 9) {
$BZL_DST=0;
} elseif ($mm == 2) {
if ($dd < 22) {
$BZL_DST=1;
} elseif ($dd < ($dow+22)) {
$BZL_DST=1;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$BZL_DST=1;
} else {
$BZL_DST=0;
}
} else { # local time calculations
if ($ns < 3600) {
$BZL_DST=1;
} else {
$BZL_DST=0;
}
}
} else {
$BZL_DST=0;
}
} elseif ($mm == 10) {
if ($dd < 22) {
$BZL_DST=0;
} elseif ($dd < ($dow+22)) {
$BZL_DST=0;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$BZL_DST=0;
} else {
$BZL_DST=1;
}
} else { # local time calculations
if ($ns < 3600) {
$BZL_DST=0;
} else {
$BZL_DST=1;
}
}
} else {
$BZL_DST=1;
}
} # end of month checks
if ($DBX) {print " DST: $BZL_DST\n";}
if ($BZL_DST) {$gmt_offset++;}
$AC_processed++;
}
if (!$AC_processed)
{
if ($DBX) {print " No DST Method Found\n";}
@@ -662,7 +817,7 @@ if ($leadfile and filesize($LF_path)<=8388608) {
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','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0);";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -670,7 +825,7 @@ if ($leadfile and filesize($LF_path)<=8388608) {
$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','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0),";
$multi_insert_counter++;
}