updated DST schemes for Australia and New Zealand

git-svn-id: svn://192.168.202.10@1310 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2010-01-18 11:17:24 +00:00
parent eddcc2ad45
commit 1a04ebedaf
18 changed files with 1615 additions and 109 deletions
@@ -45,6 +45,7 @@ code country areacode state GMT DST DST_RANGE GEOGRAPHIC DESCRIPTION
1 ATG 268 -4 N Antigua & Barbuda 1 ATG 268 -4 N Antigua & Barbuda
1 USA 269 MI -5 Y SSM-FSN 1 USA 269 MI -5 Y SSM-FSN
1 USA 270 KY -6 Y SSM-FSN 1 USA 270 KY -6 Y SSM-FSN
1 USA 274 WI -6 Y SSM-FSN
1 USA 276 VA -5 Y SSM-FSN 1 USA 276 VA -5 Y SSM-FSN
1 USA 278 MI -5 Y SSM-FSN 1 USA 278 MI -5 Y SSM-FSN
1 USA 280 MD -5 Y SSM-FSN 1 USA 280 MD -5 Y SSM-FSN
@@ -135,6 +136,7 @@ code country areacode state GMT DST DST_RANGE GEOGRAPHIC DESCRIPTION
1 USA 445 PA -5 Y SSM-FSN 1 USA 445 PA -5 Y SSM-FSN
1 USA 447 IL -6 Y SSM-FSN 1 USA 447 IL -6 Y SSM-FSN
1 CAN 450 QC -5 Y SSM-FSN 1 CAN 450 QC -5 Y SSM-FSN
1 USA 458 OR -8 Y SSM-FSN
1 USA 464 IL -6 Y SSM-FSN 1 USA 464 IL -6 Y SSM-FSN
1 USA 469 TX -6 Y SSM-FSN 1 USA 469 TX -6 Y SSM-FSN
1 USA 470 GA -5 Y SSM-FSN 1 USA 470 GA -5 Y SSM-FSN
@@ -164,6 +166,9 @@ code country areacode state GMT DST DST_RANGE GEOGRAPHIC DESCRIPTION
1 CAN 519 ON -5 Y SSM-FSN 1 CAN 519 ON -5 Y SSM-FSN
1 USA 520 AZ -7 N 1 USA 520 AZ -7 N
1 USA 530 CA -8 Y SSM-FSN 1 USA 530 CA -8 Y SSM-FSN
1 USA 531 NE -6 Y SSM-FSN
1 USA 534 WI -6 Y SSM-FSN
1 USA 539 OK -6 Y SSM-FSN
1 USA 540 VA -5 Y SSM-FSN 1 USA 540 VA -5 Y SSM-FSN
1 USA 541 OR -8 Y SSM-FSN 1 USA 541 OR -8 Y SSM-FSN
1 USA 546 MI -5 Y SSM-FSN 1 USA 546 MI -5 Y SSM-FSN
@@ -180,6 +185,7 @@ code country areacode state GMT DST DST_RANGE GEOGRAPHIC DESCRIPTION
1 USA 573 MO -6 Y SSM-FSN 1 USA 573 MO -6 Y SSM-FSN
1 USA 574 IN -5 Y SSM-FSN 1 USA 574 IN -5 Y SSM-FSN
1 USA 575 NM -7 Y SSM-FSN 1 USA 575 NM -7 Y SSM-FSN
1 USA 579 QU -5 Y SSM-FSN
1 USA 580 OK -6 Y SSM-FSN 1 USA 580 OK -6 Y SSM-FSN
1 CAN 581 QC -5 Y SSM-FSN 1 CAN 581 QC -5 Y SSM-FSN
1 USA 585 NY -5 Y SSM-FSN 1 USA 585 NY -5 Y SSM-FSN
@@ -254,6 +260,7 @@ code country areacode state GMT DST DST_RANGE GEOGRAPHIC DESCRIPTION
1 USA 718 NY -5 Y SSM-FSN 1 USA 718 NY -5 Y SSM-FSN
1 USA 719 CO -7 Y SSM-FSN 1 USA 719 CO -7 Y SSM-FSN
1 USA 720 CO -7 Y SSM-FSN 1 USA 720 CO -7 Y SSM-FSN
i NLD 721 -4 N St. Maarten
1 USA 724 PA -5 Y SSM-FSN 1 USA 724 PA -5 Y SSM-FSN
1 USA 727 FL -5 Y SSM-FSN 1 USA 727 FL -5 Y SSM-FSN
1 USA 730 IL -6 Y SSM-FSN 1 USA 730 IL -6 Y SSM-FSN
@@ -360,6 +367,7 @@ code country areacode state GMT DST DST_RANGE GEOGRAPHIC DESCRIPTION
1 USA 935 CA -8 Y SSM-FSN 1 USA 935 CA -8 Y SSM-FSN
1 USA 936 TX -6 Y SSM-FSN 1 USA 936 TX -6 Y SSM-FSN
1 USA 937 OH -5 Y SSM-FSN 1 USA 937 OH -5 Y SSM-FSN
1 USA 938 AL -6 Y SSM-FSN
1 USA 939 PR -4 N Puerto Rico 1 USA 939 PR -4 N Puerto Rico
1 USA 940 TX -6 Y SSM-FSN 1 USA 940 TX -6 Y SSM-FSN
1 USA 941 FL -5 Y SSM-FSN 1 USA 941 FL -5 Y SSM-FSN
@@ -7,7 +7,7 @@
# #
# run every time you load leads into the vicidial_list table # run every time you load leads into the vicidial_list table
# #
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# #
# CHANGES # CHANGES
@@ -25,10 +25,17 @@
# 90129-1114 - Added NANPA prefix lookup option # 90129-1114 - Added NANPA prefix lookup option
# 90401-1327 - Fixed quiet flag function # 90401-1327 - Fixed quiet flag function
# 91129-2155 - Replaced SELECT STAR queries with field lists, formatting fixes # 91129-2155 - Replaced SELECT STAR queries with field lists, formatting fixes
# 100117-2122 - Added force-date option and activated FSO-FSA and LSS-FSA
# #
use Time::Local;
$secX = time();
$time = $secX;
$MT[0]=''; $MT[0]='';
$q=0; $q=0;
$forcedate='';
### begin parsing run-time options ### ### begin parsing run-time options ###
if (length($ARGV[0])>1) if (length($ARGV[0])>1)
@@ -50,6 +57,7 @@ if (length($ARGV[0])>1)
print " [--postal-code-gmt] = Attempt postal codes lookup for timezones\n"; print " [--postal-code-gmt] = Attempt postal codes lookup for timezones\n";
print " [--nanpa-prefix-gmt] = Attempt nanpa prefix lookup for timezones\n"; print " [--nanpa-prefix-gmt] = Attempt nanpa prefix lookup for timezones\n";
print " [--singlelistid=XXX] = Only lookup and alter leads in one list_id\n"; print " [--singlelistid=XXX] = Only lookup and alter leads in one list_id\n";
print " [--force-date=YYYY-MM-DD] = Force this date as date to run\n";
print "\n"; print "\n";
exit; exit;
@@ -88,12 +96,25 @@ if (length($ARGV[0])>1)
if ($args =~ /-singlelistid=/i) if ($args =~ /-singlelistid=/i)
{ {
@data_in = split(/-singlelistid=/,$args); @data_in = split(/-singlelistid=/,$args);
$singlelistid = $data_in[1]; $singlelistid = $data_in[1];
if ($q < 1) {print "\n----- SINGLE LISTID OVERRIDE: $singlelistid -----\n\n";} if ($q < 1) {print "\n----- SINGLE LISTID OVERRIDE: $singlelistid -----\n\n";}
} }
else else
{$singlelistid = '';} {$singlelistid = '';}
if ($args =~ /-force-date=/i)
{
@data_in = split(/-force-date=/,$args);
$forcedate = $data_in[1];
@cli_date = split("-",$forcedate);
$year = $cli_date[0];
$mon = $cli_date[1];
$mday = $cli_date[2];
$cli_date[1] = ($cli_date[1] - 1);
$time = timelocal(0,0,2,$cli_date[2],$cli_date[1],$cli_date[0]);
if ($q < 1) {print "\n----- FORCE DATE OVERRIDE: $forcedate $time -----\n\n";}
}
} }
} }
else else
@@ -148,11 +169,7 @@ $server_ip = $VARserver_ip; # Asterisk server IP
if (!$VARDB_port) {$VARDB_port='3306';} if (!$VARDB_port) {$VARDB_port='3306';}
$secX = time(); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time);
# $secX = '1079989363'; # epoch for March 22, 2993
# $secX = '1097989363'; # epoch for October 17, 2004
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX);
$mon++; $mon++;
$year = ($year + 1900); $year = ($year + 1900);
if ($mon < 10) {$mon = "0$mon";} if ($mon < 10) {$mon = "0$mon";}
@@ -173,8 +190,7 @@ $stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERN
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows; $sthArows=$sthA->rows;
$rec_countY=0; if ($sthArows > 0)
while ($sthArows > $rec_countY)
{ {
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$DBtelnet_host = "$aryA[0]"; $DBtelnet_host = "$aryA[0]";
@@ -199,7 +215,6 @@ while ($sthArows > $rec_countY)
if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;}
if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;}
if ($DBext_context) {$ext_context = $DBext_context;} if ($DBext_context) {$ext_context = $DBext_context;}
$rec_countY++;
} }
$sthA->finish(); $sthA->finish();
@@ -207,7 +222,7 @@ $LOCAL_GMT_OFF = $SERVER_GMT;
$LOCAL_GMT_OFF_STD = $SERVER_GMT; $LOCAL_GMT_OFF_STD = $SERVER_GMT;
if ($isdst) {$LOCAL_GMT_OFF++;} if ($isdst) {$LOCAL_GMT_OFF++;}
if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} if ($DB) {print "SEED TIME $time : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";}
if (length($singlelistid)> 0) {$listSQL = "where list_id='$singlelistid'"; $XlistSQL=" and list_id='$singlelistid' ";} if (length($singlelistid)> 0) {$listSQL = "where list_id='$singlelistid'"; $XlistSQL=" and list_id='$singlelistid' ";}
else {$listSQL = ''; $XlistSQL='';} else {$listSQL = ''; $XlistSQL='';}
@@ -355,7 +370,7 @@ foreach (@phone_codes)
else else
{ {
$AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD); $AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD);
$AC_localtime = ($secX + (3600 * $AC_GMT_diff)); $AC_localtime = ($time + (3600 * $AC_GMT_diff));
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime);
$year = ($year + 1900); $year = ($year + 1900);
$mon++; $mon++;
@@ -537,7 +552,7 @@ foreach (@phone_codes)
else else
{ {
$AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD); $AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD);
$AC_localtime = ($secX + (3600 * $AC_GMT_diff)); $AC_localtime = ($time + (3600 * $AC_GMT_diff));
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime);
$year = ($year + 1900); $year = ($year + 1900);
$mon++; $mon++;
@@ -719,7 +734,7 @@ foreach (@phone_codes)
else else
{ {
$AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD); $AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD);
$AC_localtime = ($secX + (3600 * $AC_GMT_diff)); $AC_localtime = ($time + (3600 * $AC_GMT_diff));
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime);
$year = ($year + 1900); $year = ($year + 1900);
$mon++; $mon++;
@@ -877,6 +892,7 @@ exit;
sub USACAN_dstcalc { sub USACAN_dstcalc {
#********************************************************************** #**********************************************************************
# SSM-FSN # SSM-FSN
# USA and CANADA
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on Second Sunday March to First Sunday November at 2 am. # Based on Second Sunday March to First Sunday November at 2 am.
@@ -971,6 +987,7 @@ sub USACAN_dstcalc {
sub NA_dstcalc { sub NA_dstcalc {
#********************************************************************** #**********************************************************************
# FSA-LSO # FSA-LSO
# Mexico and parts of North America
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am. # Based on first Sunday in April and last Sunday in October at 2 am.
@@ -1037,6 +1054,7 @@ sub NA_dstcalc {
sub GBR_dstcalc { sub GBR_dstcalc {
#********************************************************************** #**********************************************************************
# LSM-LSO # LSM-LSO
# Europe
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on last Sunday in March and last Sunday in October at 1 am. # Based on last Sunday in March and last Sunday in October at 1 am.
@@ -1104,7 +1122,7 @@ sub GBR_dstcalc {
sub AUS_dstcalc { sub AUS_dstcalc {
#********************************************************************** #**********************************************************************
# LSO-LSM - Australia, for 2008-9 Western Australia only # LSO-LSM - Australia, for 2008-9 Western Australia only (stopped in 2009)
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on last Sunday in October and last Sunday in March at 1 am. # Based on last Sunday in October and last Sunday in March at 1 am.
@@ -1174,7 +1192,7 @@ sub AUS_dstcalc {
sub AUST_dstcalc { sub AUST_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-LSM # FSO-LSM
# TASMANIA ONLY # TASMANIA ONLY (stopped in 2008)
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in October and last Sunday in March at 1 am. # Based on first Sunday in October and last Sunday in March at 1 am.
@@ -1242,7 +1260,7 @@ sub AUST_dstcalc {
sub AUSE_dstcalc { sub AUSE_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-FSA # FSO-FSA
# 2008+ EASTERN AUSTRALIA ONLY # 2008+ AUSTRALIA ONLY (country code 61)
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in October and first Sunday in April at 1 am. # Based on first Sunday in October and first Sunday in April at 1 am.
@@ -1260,23 +1278,23 @@ sub AUSE_dstcalc {
$AUSE_DST=0; return 0; $AUSE_DST=0; return 0;
} elsif ($mm == 4) { } elsif ($mm == 4) {
if ($dd > 7) { if ($dd > 7) {
$AUSE_DST=0; return 0; $AUSE_DST=0; return 1;
} elsif ($dd >= ($dow+0)) { } elsif ($dd >= ($dow+1)) {
if ($timezone) { if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) { if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$AUSE_DST=1; return 1; $AUSE_DST=1; return 0;
} else { } else {
$AUSE_DST=0; return 0; $AUSE_DST=0; return 1;
} }
} else { } else {
if ($dow == 0 && $ns < 3600) { if ($dow == 0 && $ns < 7200) {
$AUSE_DST=1; return 1; $AUSE_DST=1; return 0;
} else { } else {
$AUSE_DST=0; return 0; $AUSE_DST=0; return 1;
} }
} }
} else { } else {
$AUSE_DST=0; return 0; $AUSE_DST=1; return 0;
} }
} elsif ($mm == 10) { } elsif ($mm == 10) {
if ($dd >= 8) { if ($dd >= 8) {
@@ -1307,7 +1325,7 @@ sub AUSE_dstcalc {
sub NZL_dstcalc { sub NZL_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-TSM # FSO-TSM (stopped in 2007)
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in October and third Sunday in March at 1 am. # Based on first Sunday in October and third Sunday in March at 1 am.
@@ -1374,7 +1392,7 @@ sub NZL_dstcalc {
sub NZLN_dstcalc { sub NZLN_dstcalc {
#********************************************************************** #**********************************************************************
# LSS-FSA # LSS-FSA
# 2007+ NEW ZEALAND # 2007+ NEW ZEALAND (country code 64)
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on last Sunday in September and first Sunday in April at 1 am. # Based on last Sunday in September and first Sunday in April at 1 am.
@@ -1392,23 +1410,23 @@ sub NZLN_dstcalc {
$NZLN_DST=0; return 0; $NZLN_DST=0; return 0;
} elsif ($mm == 4) { } elsif ($mm == 4) {
if ($dd > 7) { if ($dd > 7) {
$NZLN_DST=0; return 0; $NZLN_DST=0; return 1;
} elsif ($dd >= ($dow+0)) { } elsif ($dd >= ($dow+1)) {
if ($timezone) { if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) { if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$NZLN_DST=1; return 1; $NZLN_DST=1; return 0;
} else { } else {
$NZLN_DST=0; return 0; $NZLN_DST=0; return 1;
} }
} else { } else {
if ($dow == 0 && $ns < 3600) { if ($dow == 0 && $ns < 7200) {
$NZLN_DST=1; return 1; $NZLN_DST=1; return 0;
} else { } else {
$NZLN_DST=0; return 0; $NZLN_DST=0; return 1;
} }
} }
} else { } else {
$NZLN_DST=0; return 0; $NZLN_DST=1; return 0;
} }
} elsif ($mm == 9) { } elsif ($mm == 9) {
if ($dd < 25) { if ($dd < 25) {
@@ -1443,6 +1461,7 @@ sub NZLN_dstcalc {
sub BZL_dstcalc { sub BZL_dstcalc {
#********************************************************************** #**********************************************************************
# TSO-LSF # TSO-LSF
# BRAZIL
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. Brazil # Standard time is in effect. Brazil
# Based on Third Sunday October to Last Sunday February at 1 am. # Based on Third Sunday October to Last Sunday February at 1 am.
@@ -23,7 +23,8 @@
# default path to astguiclient configuration file: # default path to astguiclient configuration file:
$PATHconf = "/etc/astguiclient.conf"; $PATHconf = "/etc/astguiclient.conf";
$domain = "http://phonecodes.vicidial.com"; $domain = "http://phonecodes.vicidial.com";
$URL1 = "$domain/phone_codes_GMT-latest.txt"; #$URL1 = "$domain/phone_codes_GMT-latest.txt";
$URL1 = "$domain/phone_codes_GMT-latest-220.txt";
$URL2 = "$domain/GMT_USA_zip-latest.txt"; $URL2 = "$domain/GMT_USA_zip-latest.txt";
@@ -47,7 +48,7 @@ if (length($ARGV[0])>1)
print " [--load-NANPA-prefix] = Only loads the special NANPA list into the database\n"; print " [--load-NANPA-prefix] = Only loads the special NANPA list into the database\n";
print " [--purge-table] = Purges the table to be inserted before inserting\n"; print " [--purge-table] = Purges the table to be inserted before inserting\n";
print "\n files used by this script are:\n"; print "\n files used by this script are:\n";
print " phone_codes_GMT-latest.txt - Phone codes and country codes with time zone data\n"; print " phone_codes_GMT-latest-220.txt - Phone codes and country codes with time zone data\n";
print " GMT_USA_zip-latest.txt - USA zip code and time zone data\n"; print " GMT_USA_zip-latest.txt - USA zip code and time zone data\n";
print " NANPA_prefix-latest.txt - North American areacode, prefix and time zone data\n"; print " NANPA_prefix-latest.txt - North American areacode, prefix and time zone data\n";
@@ -286,8 +287,8 @@ else
`wget $URL2`; `wget $URL2`;
} }
#### BEGIN vicidial_phone_codes population from phone_codes_GMT-latest.txt file #### #### BEGIN vicidial_phone_codes population from phone_codes_GMT-latest-220.txt file ####
open(codefile, "$PATHhome/phone_codes_GMT-latest.txt") || die "can't open $PATHhome/phone_codes_GMT-latest.txt: $!\n"; open(codefile, "$PATHhome/phone_codes_GMT-latest-220.txt") || die "can't open $PATHhome/phone_codes_GMT-latest-220.txt: $!\n";
@codefile = <codefile>; @codefile = <codefile>;
close(codefile); close(codefile);
if ( ($purge_table > 0) && ($#codefile > 10) ) if ( ($purge_table > 0) && ($#codefile > 10) )
@@ -8,7 +8,7 @@
# #
# It is recommended that you run this program on the local Asterisk machine # It is recommended that you run this program on the local Asterisk machine
# #
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# #
# CHANGES # CHANGES
@@ -40,6 +40,7 @@
# 90830-0953 - Added forcelistfilename option # 90830-0953 - Added forcelistfilename option
# 91112-0645 - Added title/alt_phone duplicate checks # 91112-0645 - Added title/alt_phone duplicate checks
# 91129-2202 - removed SELECT STAR and formatting fixes # 91129-2202 - removed SELECT STAR and formatting fixes
# 100118-0527 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# #
$secX = time(); $secX = time();
@@ -1247,6 +1248,14 @@ foreach(@FILES)
if ($AUST_DST) {$gmt_offset++;} if ($AUST_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-FSA/) )
{
if ($DBX) {print " First Sunday October to First Sunday April\n";}
&AUSE_dstcalc;
if ($DBX) {print " DST: $AUSE_DST\n";}
if ($AUSE_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) )
{ {
if ($DBX) {print " First Sunday October to Third Sunday March\n";} if ($DBX) {print " First Sunday October to Third Sunday March\n";}
@@ -1255,6 +1264,14 @@ foreach(@FILES)
if ($NZL_DST) {$gmt_offset++;} if ($NZL_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($area_GMT_method =~ /LSS-FSA/) )
{
if ($DBX) {print " Last Sunday September to First Sunday April\n";}
&NZLN_dstcalc;
if ($DBX) {print " DST: $NZLN_DST\n";}
if ($NZLN_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) )
{ {
if ($DBX) {print " Third Sunday October to Last Sunday February\n";} if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
@@ -1791,6 +1808,72 @@ sub AUST_dstcalc {
sub AUSE_dstcalc {
#**********************************************************************
# FSO-FSA
# 2008+ AUSTRALIA ONLY (country code 61)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in October and first Sunday in April at 1 am.
#**********************************************************************
$AUSE_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 10) {
$AUSE_DST=1; return 1;
} elsif ($mm >= 5 && $mm <= 9) {
$AUSE_DST=0; return 0;
} elsif ($mm == 4) {
if ($dd > 7) {
$AUSE_DST=0; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$AUSE_DST=1; return 0;
} else {
$AUSE_DST=0; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$AUSE_DST=1; return 0;
} else {
$AUSE_DST=0; return 1;
}
}
} else {
$AUSE_DST=1; return 0;
}
} elsif ($mm == 10) {
if ($dd >= 8) {
$AUSE_DST=1; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (7200+$timezone*3600)) {
$AUSE_DST=0; return 0;
} else {
$AUSE_DST=1; return 1;
}
} else {
if ($dow == 0 && $ns < 3600) {
$AUSE_DST=0; return 0;
} else {
$AUSE_DST=1; return 1;
}
}
} else {
$AUSE_DST=0; return 0;
}
} # end of month checks
} # end of subroutine dstcalc
sub NZL_dstcalc { sub NZL_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-TSM # FSO-TSM
@@ -1857,6 +1940,74 @@ sub NZL_dstcalc {
sub NZLN_dstcalc {
#**********************************************************************
# LSS-FSA
# 2007+ NEW ZEALAND (country code 64)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on last Sunday in September and first Sunday in April at 1 am.
#**********************************************************************
$NZLN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 9) {
$NZLN_DST=1; return 1;
} elsif ($mm >= 5 && $mm <= 9) {
$NZLN_DST=0; return 0;
} elsif ($mm == 4) {
if ($dd > 7) {
$NZLN_DST=0; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$NZLN_DST=1; return 0;
} else {
$NZLN_DST=0; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$NZLN_DST=1; return 0;
} else {
$NZLN_DST=0; return 1;
}
}
} else {
$NZLN_DST=1; return 0;
}
} elsif ($mm == 9) {
if ($dd < 25) {
$NZLN_DST=0; return 0;
} elsif ($dd < ($dow+25)) {
$NZLN_DST=0; return 0;
} elsif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$NZLN_DST=0; return 0;
} else {
$NZLN_DST=1; return 1;
}
} else { # local time calculations
if ($ns < 3600) {
$NZLN_DST=0; return 0;
} else {
$NZLN_DST=1; return 1;
}
}
} else {
$NZLN_DST=1; return 1;
}
} # end of month checks
} # end of subroutine dstcalc
sub BZL_dstcalc { sub BZL_dstcalc {
#********************************************************************** #**********************************************************************
# TSO-LSF # TSO-LSF
@@ -402,8 +402,8 @@ else
$stmt="select did_route from vicidial_inbound_dids where did_pattern='default';"; $stmt="select did_route from vicidial_inbound_dids where did_pattern='default';";
$rslt=mysql_query($stmt, $link); $rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
$records_to_grab = mysql_num_rows($rslt); $Drecords_to_grab = mysql_num_rows($rslt);
if ($records_to_grab > 0) if ($Drecords_to_grab > 0)
{ {
$row=mysql_fetch_row($rslt); $row=mysql_fetch_row($rslt);
$default_route = $row[0]; $default_route = $row[0];
@@ -2,7 +2,7 @@
# #
# listloader.pl version 2.2.0 # listloader.pl version 2.2.0
# #
# Copyright (C) 2009 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
# #
# #
# CHANGES # CHANGES
@@ -21,6 +21,7 @@
# 80713-0023 - added last_local_call_time field default of 2008-01-01 # 80713-0023 - added last_local_call_time field default of 2008-01-01
# 90721-1425 - Added rank and owner as vicidial_list fields # 90721-1425 - Added rank and owner as vicidial_list fields
# 91112-0616 - Added title/alt-phone duplicate checking # 91112-0616 - Added title/alt-phone duplicate checking
# 100118-0537 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# #
### begin parsing run-time options ### ### begin parsing run-time options ###
@@ -598,6 +599,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($AUST_DST) {$gmt_offset++;} if ($AUST_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-FSA/) )
{
if ($DBX) {print " First Sunday October to First Sunday April\n";}
&AUSE_dstcalc;
if ($DBX) {print " DST: $AUSE_DST\n";}
if ($AUSE_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) )
{ {
if ($DBX) {print " First Sunday October to Third Sunday March\n";} if ($DBX) {print " First Sunday October to Third Sunday March\n";}
@@ -606,6 +615,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($NZL_DST) {$gmt_offset++;} if ($NZL_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($area_GMT_method =~ /LSS-FSA/) )
{
if ($DBX) {print " Last Sunday September to First Sunday April\n";}
&NZLN_dstcalc;
if ($DBX) {print " DST: $NZLN_DST\n";}
if ($NZLN_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) )
{ {
if ($DBX) {print " Third Sunday October to Last Sunday February\n";} if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
@@ -1028,6 +1045,72 @@ sub AUST_dstcalc {
sub AUSE_dstcalc {
#**********************************************************************
# FSO-FSA
# 2008+ AUSTRALIA ONLY (country code 61)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in October and first Sunday in April at 1 am.
#**********************************************************************
$AUSE_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 10) {
$AUSE_DST=1; return 1;
} elsif ($mm >= 5 && $mm <= 9) {
$AUSE_DST=0; return 0;
} elsif ($mm == 4) {
if ($dd > 7) {
$AUSE_DST=0; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$AUSE_DST=1; return 0;
} else {
$AUSE_DST=0; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$AUSE_DST=1; return 0;
} else {
$AUSE_DST=0; return 1;
}
}
} else {
$AUSE_DST=1; return 0;
}
} elsif ($mm == 10) {
if ($dd >= 8) {
$AUSE_DST=1; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (7200+$timezone*3600)) {
$AUSE_DST=0; return 0;
} else {
$AUSE_DST=1; return 1;
}
} else {
if ($dow == 0 && $ns < 3600) {
$AUSE_DST=0; return 0;
} else {
$AUSE_DST=1; return 1;
}
}
} else {
$AUSE_DST=0; return 0;
}
} # end of month checks
} # end of subroutine dstcalc
sub NZL_dstcalc { sub NZL_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-TSM # FSO-TSM
@@ -1094,6 +1177,74 @@ sub NZL_dstcalc {
sub NZLN_dstcalc {
#**********************************************************************
# LSS-FSA
# 2007+ NEW ZEALAND (country code 64)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on last Sunday in September and first Sunday in April at 1 am.
#**********************************************************************
$NZLN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 9) {
$NZLN_DST=1; return 1;
} elsif ($mm >= 5 && $mm <= 9) {
$NZLN_DST=0; return 0;
} elsif ($mm == 4) {
if ($dd > 7) {
$NZLN_DST=0; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$NZLN_DST=1; return 0;
} else {
$NZLN_DST=0; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$NZLN_DST=1; return 0;
} else {
$NZLN_DST=0; return 1;
}
}
} else {
$NZLN_DST=1; return 0;
}
} elsif ($mm == 9) {
if ($dd < 25) {
$NZLN_DST=0; return 0;
} elsif ($dd < ($dow+25)) {
$NZLN_DST=0; return 0;
} elsif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$NZLN_DST=0; return 0;
} else {
$NZLN_DST=1; return 1;
}
} else { # local time calculations
if ($ns < 3600) {
$NZLN_DST=0; return 0;
} else {
$NZLN_DST=1; return 1;
}
}
} else {
$NZLN_DST=1; return 1;
}
} # end of month checks
} # end of subroutine dstcalc
sub BZL_dstcalc { sub BZL_dstcalc {
#********************************************************************** #**********************************************************************
# TSO-LSF # TSO-LSF
@@ -2,7 +2,7 @@
# #
# listloader_super.pl version 2.2.0 # listloader_super.pl version 2.2.0
# #
# Copyright (C) 2009 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
# #
# #
# CHANGES # CHANGES
@@ -20,6 +20,7 @@
# 80713-0023 - added last_local_call_time field default of 2008-01-01 # 80713-0023 - added last_local_call_time field default of 2008-01-01
# 90721-1341 - Added rank and owner as vicidial_list fields # 90721-1341 - Added rank and owner as vicidial_list fields
# 91112-0616 - Added title/alt-phone duplicate checking # 91112-0616 - Added title/alt-phone duplicate checking
# 100118-0539 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# #
### begin parsing run-time options ### ### begin parsing run-time options ###
@@ -600,6 +601,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($AUST_DST) {$gmt_offset++;} if ($AUST_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-FSA/) )
{
if ($DBX) {print " First Sunday October to First Sunday April\n";}
&AUSE_dstcalc;
if ($DBX) {print " DST: $AUSE_DST\n";}
if ($AUSE_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) )
{ {
if ($DBX) {print " First Sunday October to Third Sunday March\n";} if ($DBX) {print " First Sunday October to Third Sunday March\n";}
@@ -608,6 +617,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($NZL_DST) {$gmt_offset++;} if ($NZL_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($area_GMT_method =~ /LSS-FSA/) )
{
if ($DBX) {print " Last Sunday September to First Sunday April\n";}
&NZLN_dstcalc;
if ($DBX) {print " DST: $NZLN_DST\n";}
if ($NZLN_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) )
{ {
if ($DBX) {print " Third Sunday October to Last Sunday February\n";} if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
@@ -1030,6 +1047,72 @@ sub AUST_dstcalc {
sub AUSE_dstcalc {
#**********************************************************************
# FSO-FSA
# 2008+ AUSTRALIA ONLY (country code 61)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in October and first Sunday in April at 1 am.
#**********************************************************************
$AUSE_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 10) {
$AUSE_DST=1; return 1;
} elsif ($mm >= 5 && $mm <= 9) {
$AUSE_DST=0; return 0;
} elsif ($mm == 4) {
if ($dd > 7) {
$AUSE_DST=0; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$AUSE_DST=1; return 0;
} else {
$AUSE_DST=0; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$AUSE_DST=1; return 0;
} else {
$AUSE_DST=0; return 1;
}
}
} else {
$AUSE_DST=1; return 0;
}
} elsif ($mm == 10) {
if ($dd >= 8) {
$AUSE_DST=1; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (7200+$timezone*3600)) {
$AUSE_DST=0; return 0;
} else {
$AUSE_DST=1; return 1;
}
} else {
if ($dow == 0 && $ns < 3600) {
$AUSE_DST=0; return 0;
} else {
$AUSE_DST=1; return 1;
}
}
} else {
$AUSE_DST=0; return 0;
}
} # end of month checks
} # end of subroutine dstcalc
sub NZL_dstcalc { sub NZL_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-TSM # FSO-TSM
@@ -1096,6 +1179,74 @@ sub NZL_dstcalc {
sub NZLN_dstcalc {
#**********************************************************************
# LSS-FSA
# 2007+ NEW ZEALAND (country code 64)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on last Sunday in September and first Sunday in April at 1 am.
#**********************************************************************
$NZLN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 9) {
$NZLN_DST=1; return 1;
} elsif ($mm >= 5 && $mm <= 9) {
$NZLN_DST=0; return 0;
} elsif ($mm == 4) {
if ($dd > 7) {
$NZLN_DST=0; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$NZLN_DST=1; return 0;
} else {
$NZLN_DST=0; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$NZLN_DST=1; return 0;
} else {
$NZLN_DST=0; return 1;
}
}
} else {
$NZLN_DST=1; return 0;
}
} elsif ($mm == 9) {
if ($dd < 25) {
$NZLN_DST=0; return 0;
} elsif ($dd < ($dow+25)) {
$NZLN_DST=0; return 0;
} elsif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$NZLN_DST=0; return 0;
} else {
$NZLN_DST=1; return 1;
}
} else { # local time calculations
if ($ns < 3600) {
$NZLN_DST=0; return 0;
} else {
$NZLN_DST=1; return 1;
}
}
} else {
$NZLN_DST=1; return 1;
}
} # end of month checks
} # end of subroutine dstcalc
sub BZL_dstcalc { sub BZL_dstcalc {
#********************************************************************** #**********************************************************************
# TSO-LSF # TSO-LSF
@@ -1,7 +1,7 @@
<?php <?php
# new_listloader_superL.php # new_listloader_superL.php
# #
# Copyright (C) 2009 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
# #
# AST GUI lead loader from formatted file # AST GUI lead loader from formatted file
# #
@@ -29,11 +29,12 @@
# 90522-0506 - Security fix # 90522-0506 - Security fix
# 90721-1339 - Added rank and owner as vicidial_list fields # 90721-1339 - Added rank and owner as vicidial_list fields
# 91112-0616 - Added title/alt-phone duplicate checking # 91112-0616 - Added title/alt-phone duplicate checking
# 100118-0543 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# #
# 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. # 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.2.0-33'; $version = '2.2.0-34';
$build = '91112-0616'; $build = '100118-0543';
require("dbconnect.php"); require("dbconnect.php");
@@ -2107,6 +2108,74 @@ if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') )
if ($AUST_DST) {$gmt_offset++;} if ($AUST_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') )
{
if ($DBX) {print " Sunday in October to First Sunday in April\n";}
#**********************************************************************
# FSO-FSA
# 2008+ AUSTRALIA ONLY (country code 61)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in October and first Sunday in April at 1 am.
#**********************************************************************
$AUSE_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 or $mm > 10) {
$AUSE_DST=1;
} elseif ($mm >= 5 and $mm <= 9) {
$AUSE_DST=0;
} elseif ($mm == 4) {
if ($dd > 7) {
$AUSE_DST=0;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 and $ns < (3600+$timezone*3600)) {
$AUSE_DST=1;
} else {
$AUSE_DST=0;
}
} else {
if ($dow == 0 and $ns < 7200) {
$AUSE_DST=1;
} else {
$AUSE_DST=0;
}
}
} else {
$AUSE_DST=1;
}
} elseif ($mm == 10) {
if ($dd >= 8) {
$AUSE_DST=1;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$AUSE_DST=0;
} else {
$AUSE_DST=1;
}
} else {
if ($dow == 0 and $ns < 3600) {
$AUSE_DST=0;
} else {
$AUSE_DST=1;
}
}
} else {
$AUSE_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $AUSE_DST\n";}
if ($AUSE_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
{ {
if ($DBX) {print " First Sunday October to Third Sunday March\n";} if ($DBX) {print " First Sunday October to Third Sunday March\n";}
@@ -2174,6 +2243,75 @@ if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') )
{
if ($DBX) {print " Last Sunday in September to First Sunday in April\n";}
#**********************************************************************
# LSS-FSA
# 2007+ NEW ZEALAND (country code 64)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on last Sunday in September and first Sunday in April at 1 am.
#**********************************************************************
$NZLN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 9) {
$NZLN_DST=1;
} elseif ($mm >= 5 && $mm <= 9) {
$NZLN_DST=0;
} elseif ($mm == 4) {
if ($dd > 7) {
$NZLN_DST=0;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$NZLN_DST=1;
} else {
$NZLN_DST=0;
}
} else {
if ($dow == 0 && $ns < 7200) {
$NZLN_DST=1;
} else {
$NZLN_DST=0;
}
}
} else {
$NZLN_DST=1;
}
} elseif ($mm == 9) {
if ($dd < 25) {
$NZLN_DST=0;
} elseif ($dd < ($dow+25)) {
$NZLN_DST=0;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$NZLN_DST=0;
} else {
$NZLN_DST=1;
}
} else { # local time calculations
if ($ns < 3600) {
$NZLN_DST=0;
} else {
$NZLN_DST=1;
}
}
} else {
$NZLN_DST=1;
}
} # end of month checks
if ($DBX) {print " DST: $NZLN_DST\n";}
if ($NZLN_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') )
{ {
if ($DBX) {print " Third Sunday October to Last Sunday February\n";} if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
@@ -1,7 +1,7 @@
<?php <?php
# non_agent_api.php # non_agent_api.php
# #
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# This script is designed as an API(Application Programming Interface) to allow # This script is designed as an API(Application Programming Interface) to allow
# other programs to interact with all non-agent-screen VICIDIAL functions # other programs to interact with all non-agent-screen VICIDIAL functions
@@ -30,10 +30,11 @@
# 91026-1059 - Added AREACODE DNC option # 91026-1059 - Added AREACODE DNC option
# 91203-1140 - Added agent_ingroup_info feature # 91203-1140 - Added agent_ingroup_info feature
# 91216-0331 - Added duplication check features to add_lead function # 91216-0331 - Added duplication check features to add_lead function
# 100118-0543 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# #
$version = '2.2.0-16'; $version = '2.2.0-17';
$build = '91216-0331'; $build = '100118-0543';
require("dbconnect.php"); require("dbconnect.php");
@@ -2046,6 +2047,74 @@ if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') )
if ($AUST_DST) {$gmt_offset++;} if ($AUST_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') )
{
if ($DBX) {print " Sunday in October to First Sunday in April\n";}
#**********************************************************************
# FSO-FSA
# 2008+ AUSTRALIA ONLY (country code 61)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in October and first Sunday in April at 1 am.
#**********************************************************************
$AUSE_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 or $mm > 10) {
$AUSE_DST=1;
} elseif ($mm >= 5 and $mm <= 9) {
$AUSE_DST=0;
} elseif ($mm == 4) {
if ($dd > 7) {
$AUSE_DST=0;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 and $ns < (3600+$timezone*3600)) {
$AUSE_DST=1;
} else {
$AUSE_DST=0;
}
} else {
if ($dow == 0 and $ns < 7200) {
$AUSE_DST=1;
} else {
$AUSE_DST=0;
}
}
} else {
$AUSE_DST=1;
}
} elseif ($mm == 10) {
if ($dd >= 8) {
$AUSE_DST=1;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$AUSE_DST=0;
} else {
$AUSE_DST=1;
}
} else {
if ($dow == 0 and $ns < 3600) {
$AUSE_DST=0;
} else {
$AUSE_DST=1;
}
}
} else {
$AUSE_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $AUSE_DST\n";}
if ($AUSE_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
{ {
if ($DBX) {print " First Sunday October to Third Sunday March\n";} if ($DBX) {print " First Sunday October to Third Sunday March\n";}
@@ -2113,6 +2182,75 @@ if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') )
{
if ($DBX) {print " Last Sunday in September to First Sunday in April\n";}
#**********************************************************************
# LSS-FSA
# 2007+ NEW ZEALAND (country code 64)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on last Sunday in September and first Sunday in April at 1 am.
#**********************************************************************
$NZLN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 9) {
$NZLN_DST=1;
} elseif ($mm >= 5 && $mm <= 9) {
$NZLN_DST=0;
} elseif ($mm == 4) {
if ($dd > 7) {
$NZLN_DST=0;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$NZLN_DST=1;
} else {
$NZLN_DST=0;
}
} else {
if ($dow == 0 && $ns < 7200) {
$NZLN_DST=1;
} else {
$NZLN_DST=0;
}
}
} else {
$NZLN_DST=1;
}
} elseif ($mm == 9) {
if ($dd < 25) {
$NZLN_DST=0;
} elseif ($dd < ($dow+25)) {
$NZLN_DST=0;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$NZLN_DST=0;
} else {
$NZLN_DST=1;
}
} else { # local time calculations
if ($ns < 3600) {
$NZLN_DST=0;
} else {
$NZLN_DST=1;
}
}
} else {
$NZLN_DST=1;
}
} # end of month checks
if ($DBX) {print " DST: $NZLN_DST\n";}
if ($NZLN_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') )
{ {
if ($DBX) {print " Third Sunday October to Last Sunday February\n";} if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
@@ -7,7 +7,7 @@
# #
# run every time you load leads into the vicidial_list table # run every time you load leads into the vicidial_list table
# #
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# #
# CHANGES # CHANGES
@@ -25,10 +25,17 @@
# 90129-1114 - Added NANPA prefix lookup option # 90129-1114 - Added NANPA prefix lookup option
# 90401-1327 - Fixed quiet flag function # 90401-1327 - Fixed quiet flag function
# 91129-2155 - Replaced SELECT STAR queries with field lists, formatting fixes # 91129-2155 - Replaced SELECT STAR queries with field lists, formatting fixes
# 100117-2122 - Added force-date option and activated FSO-FSA and LSS-FSA
# #
use Time::Local;
$secX = time();
$time = $secX;
$MT[0]=''; $MT[0]='';
$q=0; $q=0;
$forcedate='';
### begin parsing run-time options ### ### begin parsing run-time options ###
if (length($ARGV[0])>1) if (length($ARGV[0])>1)
@@ -50,6 +57,7 @@ if (length($ARGV[0])>1)
print " [--postal-code-gmt] = Attempt postal codes lookup for timezones\n"; print " [--postal-code-gmt] = Attempt postal codes lookup for timezones\n";
print " [--nanpa-prefix-gmt] = Attempt nanpa prefix lookup for timezones\n"; print " [--nanpa-prefix-gmt] = Attempt nanpa prefix lookup for timezones\n";
print " [--singlelistid=XXX] = Only lookup and alter leads in one list_id\n"; print " [--singlelistid=XXX] = Only lookup and alter leads in one list_id\n";
print " [--force-date=YYYY-MM-DD] = Force this date as date to run\n";
print "\n"; print "\n";
exit; exit;
@@ -88,12 +96,25 @@ if (length($ARGV[0])>1)
if ($args =~ /-singlelistid=/i) if ($args =~ /-singlelistid=/i)
{ {
@data_in = split(/-singlelistid=/,$args); @data_in = split(/-singlelistid=/,$args);
$singlelistid = $data_in[1]; $singlelistid = $data_in[1];
if ($q < 1) {print "\n----- SINGLE LISTID OVERRIDE: $singlelistid -----\n\n";} if ($q < 1) {print "\n----- SINGLE LISTID OVERRIDE: $singlelistid -----\n\n";}
} }
else else
{$singlelistid = '';} {$singlelistid = '';}
if ($args =~ /-force-date=/i)
{
@data_in = split(/-force-date=/,$args);
$forcedate = $data_in[1];
@cli_date = split("-",$forcedate);
$year = $cli_date[0];
$mon = $cli_date[1];
$mday = $cli_date[2];
$cli_date[1] = ($cli_date[1] - 1);
$time = timelocal(0,0,2,$cli_date[2],$cli_date[1],$cli_date[0]);
if ($q < 1) {print "\n----- FORCE DATE OVERRIDE: $forcedate $time -----\n\n";}
}
} }
} }
else else
@@ -148,11 +169,7 @@ $server_ip = $VARserver_ip; # Asterisk server IP
if (!$VARDB_port) {$VARDB_port='3306';} if (!$VARDB_port) {$VARDB_port='3306';}
$secX = time(); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time);
# $secX = '1079989363'; # epoch for March 22, 2993
# $secX = '1097989363'; # epoch for October 17, 2004
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($secX);
$mon++; $mon++;
$year = ($year + 1900); $year = ($year + 1900);
if ($mon < 10) {$mon = "0$mon";} if ($mon < 10) {$mon = "0$mon";}
@@ -173,8 +190,7 @@ $stmtA = "SELECT telnet_host,telnet_port,ASTmgrUSERNAME,ASTmgrSECRET,ASTmgrUSERN
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows; $sthArows=$sthA->rows;
$rec_countY=0; if ($sthArows > 0)
while ($sthArows > $rec_countY)
{ {
@aryA = $sthA->fetchrow_array; @aryA = $sthA->fetchrow_array;
$DBtelnet_host = "$aryA[0]"; $DBtelnet_host = "$aryA[0]";
@@ -199,7 +215,6 @@ while ($sthArows > $rec_countY)
if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;} if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;}
if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;} if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;}
if ($DBext_context) {$ext_context = $DBext_context;} if ($DBext_context) {$ext_context = $DBext_context;}
$rec_countY++;
} }
$sthA->finish(); $sthA->finish();
@@ -207,7 +222,7 @@ $LOCAL_GMT_OFF = $SERVER_GMT;
$LOCAL_GMT_OFF_STD = $SERVER_GMT; $LOCAL_GMT_OFF_STD = $SERVER_GMT;
if ($isdst) {$LOCAL_GMT_OFF++;} if ($isdst) {$LOCAL_GMT_OFF++;}
if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";} if ($DB) {print "SEED TIME $time : $year-$mon-$mday $hour:$min:$sec LOCAL GMT OFFSET NOW: $LOCAL_GMT_OFF\n";}
if (length($singlelistid)> 0) {$listSQL = "where list_id='$singlelistid'"; $XlistSQL=" and list_id='$singlelistid' ";} if (length($singlelistid)> 0) {$listSQL = "where list_id='$singlelistid'"; $XlistSQL=" and list_id='$singlelistid' ";}
else {$listSQL = ''; $XlistSQL='';} else {$listSQL = ''; $XlistSQL='';}
@@ -355,7 +370,7 @@ foreach (@phone_codes)
else else
{ {
$AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD); $AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD);
$AC_localtime = ($secX + (3600 * $AC_GMT_diff)); $AC_localtime = ($time + (3600 * $AC_GMT_diff));
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime);
$year = ($year + 1900); $year = ($year + 1900);
$mon++; $mon++;
@@ -537,7 +552,7 @@ foreach (@phone_codes)
else else
{ {
$AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD); $AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD);
$AC_localtime = ($secX + (3600 * $AC_GMT_diff)); $AC_localtime = ($time + (3600 * $AC_GMT_diff));
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime);
$year = ($year + 1900); $year = ($year + 1900);
$mon++; $mon++;
@@ -719,7 +734,7 @@ foreach (@phone_codes)
else else
{ {
$AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD); $AC_GMT_diff = ($area_GMT - $LOCAL_GMT_OFF_STD);
$AC_localtime = ($secX + (3600 * $AC_GMT_diff)); $AC_localtime = ($time + (3600 * $AC_GMT_diff));
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($AC_localtime);
$year = ($year + 1900); $year = ($year + 1900);
$mon++; $mon++;
@@ -877,6 +892,7 @@ exit;
sub USACAN_dstcalc { sub USACAN_dstcalc {
#********************************************************************** #**********************************************************************
# SSM-FSN # SSM-FSN
# USA and CANADA
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on Second Sunday March to First Sunday November at 2 am. # Based on Second Sunday March to First Sunday November at 2 am.
@@ -971,6 +987,7 @@ sub USACAN_dstcalc {
sub NA_dstcalc { sub NA_dstcalc {
#********************************************************************** #**********************************************************************
# FSA-LSO # FSA-LSO
# Mexico and parts of North America
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in April and last Sunday in October at 2 am. # Based on first Sunday in April and last Sunday in October at 2 am.
@@ -1037,6 +1054,7 @@ sub NA_dstcalc {
sub GBR_dstcalc { sub GBR_dstcalc {
#********************************************************************** #**********************************************************************
# LSM-LSO # LSM-LSO
# Europe
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on last Sunday in March and last Sunday in October at 1 am. # Based on last Sunday in March and last Sunday in October at 1 am.
@@ -1104,7 +1122,7 @@ sub GBR_dstcalc {
sub AUS_dstcalc { sub AUS_dstcalc {
#********************************************************************** #**********************************************************************
# LSO-LSM - Australia, for 2008-9 Western Australia only # LSO-LSM - Australia, for 2008-9 Western Australia only (stopped in 2009)
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on last Sunday in October and last Sunday in March at 1 am. # Based on last Sunday in October and last Sunday in March at 1 am.
@@ -1174,7 +1192,7 @@ sub AUS_dstcalc {
sub AUST_dstcalc { sub AUST_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-LSM # FSO-LSM
# TASMANIA ONLY # TASMANIA ONLY (stopped in 2008)
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in October and last Sunday in March at 1 am. # Based on first Sunday in October and last Sunday in March at 1 am.
@@ -1242,7 +1260,7 @@ sub AUST_dstcalc {
sub AUSE_dstcalc { sub AUSE_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-FSA # FSO-FSA
# 2008+ EASTERN AUSTRALIA ONLY # 2008+ AUSTRALIA ONLY (country code 61)
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in October and first Sunday in April at 1 am. # Based on first Sunday in October and first Sunday in April at 1 am.
@@ -1260,23 +1278,23 @@ sub AUSE_dstcalc {
$AUSE_DST=0; return 0; $AUSE_DST=0; return 0;
} elsif ($mm == 4) { } elsif ($mm == 4) {
if ($dd > 7) { if ($dd > 7) {
$AUSE_DST=0; return 0; $AUSE_DST=0; return 1;
} elsif ($dd >= ($dow+0)) { } elsif ($dd >= ($dow+1)) {
if ($timezone) { if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) { if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$AUSE_DST=1; return 1; $AUSE_DST=1; return 0;
} else { } else {
$AUSE_DST=0; return 0; $AUSE_DST=0; return 1;
} }
} else { } else {
if ($dow == 0 && $ns < 3600) { if ($dow == 0 && $ns < 7200) {
$AUSE_DST=1; return 1; $AUSE_DST=1; return 0;
} else { } else {
$AUSE_DST=0; return 0; $AUSE_DST=0; return 1;
} }
} }
} else { } else {
$AUSE_DST=0; return 0; $AUSE_DST=1; return 0;
} }
} elsif ($mm == 10) { } elsif ($mm == 10) {
if ($dd >= 8) { if ($dd >= 8) {
@@ -1307,7 +1325,7 @@ sub AUSE_dstcalc {
sub NZL_dstcalc { sub NZL_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-TSM # FSO-TSM (stopped in 2007)
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on first Sunday in October and third Sunday in March at 1 am. # Based on first Sunday in October and third Sunday in March at 1 am.
@@ -1374,7 +1392,7 @@ sub NZL_dstcalc {
sub NZLN_dstcalc { sub NZLN_dstcalc {
#********************************************************************** #**********************************************************************
# LSS-FSA # LSS-FSA
# 2007+ NEW ZEALAND # 2007+ NEW ZEALAND (country code 64)
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. # Standard time is in effect.
# Based on last Sunday in September and first Sunday in April at 1 am. # Based on last Sunday in September and first Sunday in April at 1 am.
@@ -1392,23 +1410,23 @@ sub NZLN_dstcalc {
$NZLN_DST=0; return 0; $NZLN_DST=0; return 0;
} elsif ($mm == 4) { } elsif ($mm == 4) {
if ($dd > 7) { if ($dd > 7) {
$NZLN_DST=0; return 0; $NZLN_DST=0; return 1;
} elsif ($dd >= ($dow+0)) { } elsif ($dd >= ($dow+1)) {
if ($timezone) { if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) { if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$NZLN_DST=1; return 1; $NZLN_DST=1; return 0;
} else { } else {
$NZLN_DST=0; return 0; $NZLN_DST=0; return 1;
} }
} else { } else {
if ($dow == 0 && $ns < 3600) { if ($dow == 0 && $ns < 7200) {
$NZLN_DST=1; return 1; $NZLN_DST=1; return 0;
} else { } else {
$NZLN_DST=0; return 0; $NZLN_DST=0; return 1;
} }
} }
} else { } else {
$NZLN_DST=0; return 0; $NZLN_DST=1; return 0;
} }
} elsif ($mm == 9) { } elsif ($mm == 9) {
if ($dd < 25) { if ($dd < 25) {
@@ -1443,6 +1461,7 @@ sub NZLN_dstcalc {
sub BZL_dstcalc { sub BZL_dstcalc {
#********************************************************************** #**********************************************************************
# TSO-LSF # TSO-LSF
# BRAZIL
# This is returns 1 if Daylight Savings Time is in effect and 0 if # This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect. Brazil # Standard time is in effect. Brazil
# Based on Third Sunday October to Last Sunday February at 1 am. # Based on Third Sunday October to Last Sunday February at 1 am.
@@ -23,7 +23,8 @@
# default path to astguiclient configuration file: # default path to astguiclient configuration file:
$PATHconf = "/etc/astguiclient.conf"; $PATHconf = "/etc/astguiclient.conf";
$domain = "http://phonecodes.vicidial.com"; $domain = "http://phonecodes.vicidial.com";
$URL1 = "$domain/phone_codes_GMT-latest.txt"; #$URL1 = "$domain/phone_codes_GMT-latest.txt";
$URL1 = "$domain/phone_codes_GMT-latest-220.txt";
$URL2 = "$domain/GMT_USA_zip-latest.txt"; $URL2 = "$domain/GMT_USA_zip-latest.txt";
@@ -47,7 +48,7 @@ if (length($ARGV[0])>1)
print " [--load-NANPA-prefix] = Only loads the special NANPA list into the database\n"; print " [--load-NANPA-prefix] = Only loads the special NANPA list into the database\n";
print " [--purge-table] = Purges the table to be inserted before inserting\n"; print " [--purge-table] = Purges the table to be inserted before inserting\n";
print "\n files used by this script are:\n"; print "\n files used by this script are:\n";
print " phone_codes_GMT-latest.txt - Phone codes and country codes with time zone data\n"; print " phone_codes_GMT-latest-220.txt - Phone codes and country codes with time zone data\n";
print " GMT_USA_zip-latest.txt - USA zip code and time zone data\n"; print " GMT_USA_zip-latest.txt - USA zip code and time zone data\n";
print " NANPA_prefix-latest.txt - North American areacode, prefix and time zone data\n"; print " NANPA_prefix-latest.txt - North American areacode, prefix and time zone data\n";
@@ -286,8 +287,8 @@ else
`wget $URL2`; `wget $URL2`;
} }
#### BEGIN vicidial_phone_codes population from phone_codes_GMT-latest.txt file #### #### BEGIN vicidial_phone_codes population from phone_codes_GMT-latest-220.txt file ####
open(codefile, "$PATHhome/phone_codes_GMT-latest.txt") || die "can't open $PATHhome/phone_codes_GMT-latest.txt: $!\n"; open(codefile, "$PATHhome/phone_codes_GMT-latest-220.txt") || die "can't open $PATHhome/phone_codes_GMT-latest-220.txt: $!\n";
@codefile = <codefile>; @codefile = <codefile>;
close(codefile); close(codefile);
if ( ($purge_table > 0) && ($#codefile > 10) ) if ( ($purge_table > 0) && ($#codefile > 10) )
+152 -1
View File
@@ -8,7 +8,7 @@
# #
# It is recommended that you run this program on the local Asterisk machine # It is recommended that you run this program on the local Asterisk machine
# #
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# #
# CHANGES # CHANGES
@@ -40,6 +40,7 @@
# 90830-0953 - Added forcelistfilename option # 90830-0953 - Added forcelistfilename option
# 91112-0645 - Added title/alt_phone duplicate checks # 91112-0645 - Added title/alt_phone duplicate checks
# 91129-2202 - removed SELECT STAR and formatting fixes # 91129-2202 - removed SELECT STAR and formatting fixes
# 100118-0527 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# #
$secX = time(); $secX = time();
@@ -1247,6 +1248,14 @@ foreach(@FILES)
if ($AUST_DST) {$gmt_offset++;} if ($AUST_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-FSA/) )
{
if ($DBX) {print " First Sunday October to First Sunday April\n";}
&AUSE_dstcalc;
if ($DBX) {print " DST: $AUSE_DST\n";}
if ($AUSE_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) )
{ {
if ($DBX) {print " First Sunday October to Third Sunday March\n";} if ($DBX) {print " First Sunday October to Third Sunday March\n";}
@@ -1255,6 +1264,14 @@ foreach(@FILES)
if ($NZL_DST) {$gmt_offset++;} if ($NZL_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($area_GMT_method =~ /LSS-FSA/) )
{
if ($DBX) {print " Last Sunday September to First Sunday April\n";}
&NZLN_dstcalc;
if ($DBX) {print " DST: $NZLN_DST\n";}
if ($NZLN_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) )
{ {
if ($DBX) {print " Third Sunday October to Last Sunday February\n";} if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
@@ -1791,6 +1808,72 @@ sub AUST_dstcalc {
sub AUSE_dstcalc {
#**********************************************************************
# FSO-FSA
# 2008+ AUSTRALIA ONLY (country code 61)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in October and first Sunday in April at 1 am.
#**********************************************************************
$AUSE_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 10) {
$AUSE_DST=1; return 1;
} elsif ($mm >= 5 && $mm <= 9) {
$AUSE_DST=0; return 0;
} elsif ($mm == 4) {
if ($dd > 7) {
$AUSE_DST=0; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$AUSE_DST=1; return 0;
} else {
$AUSE_DST=0; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$AUSE_DST=1; return 0;
} else {
$AUSE_DST=0; return 1;
}
}
} else {
$AUSE_DST=1; return 0;
}
} elsif ($mm == 10) {
if ($dd >= 8) {
$AUSE_DST=1; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (7200+$timezone*3600)) {
$AUSE_DST=0; return 0;
} else {
$AUSE_DST=1; return 1;
}
} else {
if ($dow == 0 && $ns < 3600) {
$AUSE_DST=0; return 0;
} else {
$AUSE_DST=1; return 1;
}
}
} else {
$AUSE_DST=0; return 0;
}
} # end of month checks
} # end of subroutine dstcalc
sub NZL_dstcalc { sub NZL_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-TSM # FSO-TSM
@@ -1857,6 +1940,74 @@ sub NZL_dstcalc {
sub NZLN_dstcalc {
#**********************************************************************
# LSS-FSA
# 2007+ NEW ZEALAND (country code 64)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on last Sunday in September and first Sunday in April at 1 am.
#**********************************************************************
$NZLN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 9) {
$NZLN_DST=1; return 1;
} elsif ($mm >= 5 && $mm <= 9) {
$NZLN_DST=0; return 0;
} elsif ($mm == 4) {
if ($dd > 7) {
$NZLN_DST=0; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$NZLN_DST=1; return 0;
} else {
$NZLN_DST=0; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$NZLN_DST=1; return 0;
} else {
$NZLN_DST=0; return 1;
}
}
} else {
$NZLN_DST=1; return 0;
}
} elsif ($mm == 9) {
if ($dd < 25) {
$NZLN_DST=0; return 0;
} elsif ($dd < ($dow+25)) {
$NZLN_DST=0; return 0;
} elsif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$NZLN_DST=0; return 0;
} else {
$NZLN_DST=1; return 1;
}
} else { # local time calculations
if ($ns < 3600) {
$NZLN_DST=0; return 0;
} else {
$NZLN_DST=1; return 1;
}
}
} else {
$NZLN_DST=1; return 1;
}
} # end of month checks
} # end of subroutine dstcalc
sub BZL_dstcalc { sub BZL_dstcalc {
#********************************************************************** #**********************************************************************
# TSO-LSF # TSO-LSF
+9 -9
View File
@@ -1,13 +1,13 @@
100001|10001|108|1|7275551213|MR|GREEK|P|Ενεργές|249 τηλ. συνδέσεις|||Καταγραμμένων|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|Ελεγχος τηλ.σύνδεσης διάσκεψης 100001|10001|108|1|7275551213|MR|GREEK|P|Ενεργές|249 τηλ. συνδέσεις|||Καταγραμμένων|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|Ελεγχος τηλ.σύνδεσης διάσκεψης
100002|10002|108|1|7275551213|MR|FRENCH|P|Vous êtes|249 maintenant déconnecté|||Numéro|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|VOUS DEVEZ ÊTRE Français 100002|10002|108|44|7275551213|MR|FRENCH|P|Vous êtes|249 maintenant déconnecté|||Numéro|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|England|VOUS DEVEZ ÊTRE Français
100003|10003|108|1|7275551213|MR|SPANISH|P|Español|249 LA GRABACIÓN DURARÁ|||Inválido|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|Inválido 100003|10003|108|61|864886000|MR|SPANISH|P|Español|249 LA GRABACIÓN DURARÁ|||Inválido|WA|AUS|33709|USA|M|1970-01-01|7275551212|test@test.com|WestAustralia|Inválido
100004|10004|108|1|7275551213|MR|RUSSIAN|P|языки|249 здравствулте! там|||MALDON|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|добро пожаловать 100004|10004|108|61|740421111|MR|RUSSIAN|P|языки|249 здравствулте! там|||MALDON|QL|AUS|33709|USA|M|1970-01-01|7275551212|test@test.com|Queensland|добро пожаловать
100005|10005|108|1|7275551213|MR|ARABIC|P|مرحبا|249 مرحبا هناك|||MALDON|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|اللغات 100005|10005|108|61|292507250|MR|ARABIC|P|مرحبا|249 مرحبا هناك|||MALDON|NS|AUS|33709|USA|M|1970-01-01|7275551212|test@test.com|NewSouthWales|اللغات
100006|10006|108|1|7275551213|MR|HEBREW|P|שפה, לשון|249 ברכת שלום, שלום, הלו|||MALDON|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|ברכת "ברוך הבא", קריאת ברכה לאורח או לפנים חדשות 100006|10006|108|64|93737999|MR|HEBREW|P|שפה, לשון|249 ברכת שלום, שלום, הלו|||MALDON|FL|NZL|33709|USA|M|1970-01-01|7275551212|test@test.com|AuklandNewZealand|ברכת "ברוך הבא", קריאת ברכה לאורח או לפנים חדשות
100007|10007|108|1|7275551213|MR|BULGARIAN|P|здравей!|249 говор|||MALDON|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|добре дошъл домашно огнище 100007|10007|108|61|362262999|MR|BULGARIAN|P|здравей!|249 говор|||MALDON|TA|AUS|33709|USA|M|1970-01-01|7275551212|test@test.com|Tasmania|добре дошъл домашно огнище
100007|10007|108|1|7275551213|MR|GERMAN|P|größer|249 Mädchen|||MALDON|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|Mais im Alter von Kartoffel-Käse-Salat-türig 100007|10007|108|39|286955277|MR|GERMAN|P|größer|249 Mädchen|||MALDON|FL|ITA|33709|USA|M|1970-01-01|7275551212|test@test.com|MilanItaly|Mais im Alter von Kartoffel-Käse-Salat-türig
100001|10001|108|1|7275551213|MR|GREEK|P|Ενεργές|249 τηλ. συνδέσεις|||Καταγραμμένων|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|Ελεγχος τηλ.σύνδεσης διάσκεψης 100001|10001|108|61|889466666|MR|GREEK|P|Ενεργές|249 τηλ. συνδέσεις|||Καταγραμμένων|NT|AUS|33709|USA|M|1970-01-01|7275551212|test@test.com|NorthernTerritory|Ελεγχος τηλ.σύνδεσης διάσκεψης
100002|10002|108|1|7275551213|MR|FRENCH|P|Vous êtes|249 maintenant déconnecté|||Numéro|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|VOUS DEVEZ ÊTRE Français 100002|10002|108|61|883026611|MR|FRENCH|P|Vous êtes|249 maintenant déconnecté|||Numéro|SA|AUS|33709|USA|M|1970-01-01|7275551212|test@test.com|SouthAustralia|VOUS DEVEZ ÊTRE Français
100003|10003|108|1|7275551213|MR|SPANISH|P|Español|249 LA GRABACIÓN DURARÁ|||Inválido|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|Inválido 100003|10003|108|1|7275551213|MR|SPANISH|P|Español|249 LA GRABACIÓN DURARÁ|||Inválido|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|Inválido
100004|10004|108|1|7275551213|MR|RUSSIAN|P|языки|249 здравствулте! там|||MALDON|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|добро пожаловать 100004|10004|108|1|7275551213|MR|RUSSIAN|P|языки|249 здравствулте! там|||MALDON|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|добро пожаловать
100005|10005|108|1|7275551213|MR|ARABIC|P|مرحبا|249 مرحبا هناك|||MALDON|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|اللغات 100005|10005|108|1|7275551213|MR|ARABIC|P|مرحبا|249 مرحبا هناك|||MALDON|FL||33709|USA|M|1970-01-01|7275551212|test@test.com|nothing|اللغات
+2 -2
View File
@@ -402,8 +402,8 @@ else
$stmt="select did_route from vicidial_inbound_dids where did_pattern='default';"; $stmt="select did_route from vicidial_inbound_dids where did_pattern='default';";
$rslt=mysql_query($stmt, $link); $rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
$records_to_grab = mysql_num_rows($rslt); $Drecords_to_grab = mysql_num_rows($rslt);
if ($records_to_grab > 0) if ($Drecords_to_grab > 0)
{ {
$row=mysql_fetch_row($rslt); $row=mysql_fetch_row($rslt);
$default_route = $row[0]; $default_route = $row[0];
+152 -1
View File
@@ -2,7 +2,7 @@
# #
# listloader.pl version 2.2.0 # listloader.pl version 2.2.0
# #
# Copyright (C) 2009 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
# #
# #
# CHANGES # CHANGES
@@ -21,6 +21,7 @@
# 80713-0023 - added last_local_call_time field default of 2008-01-01 # 80713-0023 - added last_local_call_time field default of 2008-01-01
# 90721-1425 - Added rank and owner as vicidial_list fields # 90721-1425 - Added rank and owner as vicidial_list fields
# 91112-0616 - Added title/alt-phone duplicate checking # 91112-0616 - Added title/alt-phone duplicate checking
# 100118-0537 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# #
### begin parsing run-time options ### ### begin parsing run-time options ###
@@ -598,6 +599,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($AUST_DST) {$gmt_offset++;} if ($AUST_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-FSA/) )
{
if ($DBX) {print " First Sunday October to First Sunday April\n";}
&AUSE_dstcalc;
if ($DBX) {print " DST: $AUSE_DST\n";}
if ($AUSE_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) )
{ {
if ($DBX) {print " First Sunday October to Third Sunday March\n";} if ($DBX) {print " First Sunday October to Third Sunday March\n";}
@@ -606,6 +615,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($NZL_DST) {$gmt_offset++;} if ($NZL_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($area_GMT_method =~ /LSS-FSA/) )
{
if ($DBX) {print " Last Sunday September to First Sunday April\n";}
&NZLN_dstcalc;
if ($DBX) {print " DST: $NZLN_DST\n";}
if ($NZLN_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) )
{ {
if ($DBX) {print " Third Sunday October to Last Sunday February\n";} if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
@@ -1028,6 +1045,72 @@ sub AUST_dstcalc {
sub AUSE_dstcalc {
#**********************************************************************
# FSO-FSA
# 2008+ AUSTRALIA ONLY (country code 61)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in October and first Sunday in April at 1 am.
#**********************************************************************
$AUSE_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 10) {
$AUSE_DST=1; return 1;
} elsif ($mm >= 5 && $mm <= 9) {
$AUSE_DST=0; return 0;
} elsif ($mm == 4) {
if ($dd > 7) {
$AUSE_DST=0; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$AUSE_DST=1; return 0;
} else {
$AUSE_DST=0; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$AUSE_DST=1; return 0;
} else {
$AUSE_DST=0; return 1;
}
}
} else {
$AUSE_DST=1; return 0;
}
} elsif ($mm == 10) {
if ($dd >= 8) {
$AUSE_DST=1; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (7200+$timezone*3600)) {
$AUSE_DST=0; return 0;
} else {
$AUSE_DST=1; return 1;
}
} else {
if ($dow == 0 && $ns < 3600) {
$AUSE_DST=0; return 0;
} else {
$AUSE_DST=1; return 1;
}
}
} else {
$AUSE_DST=0; return 0;
}
} # end of month checks
} # end of subroutine dstcalc
sub NZL_dstcalc { sub NZL_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-TSM # FSO-TSM
@@ -1094,6 +1177,74 @@ sub NZL_dstcalc {
sub NZLN_dstcalc {
#**********************************************************************
# LSS-FSA
# 2007+ NEW ZEALAND (country code 64)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on last Sunday in September and first Sunday in April at 1 am.
#**********************************************************************
$NZLN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 9) {
$NZLN_DST=1; return 1;
} elsif ($mm >= 5 && $mm <= 9) {
$NZLN_DST=0; return 0;
} elsif ($mm == 4) {
if ($dd > 7) {
$NZLN_DST=0; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$NZLN_DST=1; return 0;
} else {
$NZLN_DST=0; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$NZLN_DST=1; return 0;
} else {
$NZLN_DST=0; return 1;
}
}
} else {
$NZLN_DST=1; return 0;
}
} elsif ($mm == 9) {
if ($dd < 25) {
$NZLN_DST=0; return 0;
} elsif ($dd < ($dow+25)) {
$NZLN_DST=0; return 0;
} elsif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$NZLN_DST=0; return 0;
} else {
$NZLN_DST=1; return 1;
}
} else { # local time calculations
if ($ns < 3600) {
$NZLN_DST=0; return 0;
} else {
$NZLN_DST=1; return 1;
}
}
} else {
$NZLN_DST=1; return 1;
}
} # end of month checks
} # end of subroutine dstcalc
sub BZL_dstcalc { sub BZL_dstcalc {
#********************************************************************** #**********************************************************************
# TSO-LSF # TSO-LSF
+152 -1
View File
@@ -2,7 +2,7 @@
# #
# listloader_super.pl version 2.2.0 # listloader_super.pl version 2.2.0
# #
# Copyright (C) 2009 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
# #
# #
# CHANGES # CHANGES
@@ -20,6 +20,7 @@
# 80713-0023 - added last_local_call_time field default of 2008-01-01 # 80713-0023 - added last_local_call_time field default of 2008-01-01
# 90721-1341 - Added rank and owner as vicidial_list fields # 90721-1341 - Added rank and owner as vicidial_list fields
# 91112-0616 - Added title/alt-phone duplicate checking # 91112-0616 - Added title/alt-phone duplicate checking
# 100118-0539 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# #
### begin parsing run-time options ### ### begin parsing run-time options ###
@@ -600,6 +601,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($AUST_DST) {$gmt_offset++;} if ($AUST_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($area_GMT_method =~ /FSO-FSA/) )
{
if ($DBX) {print " First Sunday October to First Sunday April\n";}
&AUSE_dstcalc;
if ($DBX) {print " DST: $AUSE_DST\n";}
if ($AUSE_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) ) if ( (!$AC_processed) && ($dst_range =~ /FSO-TSM/) )
{ {
if ($DBX) {print " First Sunday October to Third Sunday March\n";} if ($DBX) {print " First Sunday October to Third Sunday March\n";}
@@ -608,6 +617,14 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($NZL_DST) {$gmt_offset++;} if ($NZL_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) && ($area_GMT_method =~ /LSS-FSA/) )
{
if ($DBX) {print " Last Sunday September to First Sunday April\n";}
&NZLN_dstcalc;
if ($DBX) {print " DST: $NZLN_DST\n";}
if ($NZLN_DST) {$area_GMT++;}
$AC_processed++;
}
if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) ) if ( (!$AC_processed) && ($dst_range =~ /TSO-LSF/) )
{ {
if ($DBX) {print " Third Sunday October to Last Sunday February\n";} if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
@@ -1030,6 +1047,72 @@ sub AUST_dstcalc {
sub AUSE_dstcalc {
#**********************************************************************
# FSO-FSA
# 2008+ AUSTRALIA ONLY (country code 61)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in October and first Sunday in April at 1 am.
#**********************************************************************
$AUSE_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 10) {
$AUSE_DST=1; return 1;
} elsif ($mm >= 5 && $mm <= 9) {
$AUSE_DST=0; return 0;
} elsif ($mm == 4) {
if ($dd > 7) {
$AUSE_DST=0; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$AUSE_DST=1; return 0;
} else {
$AUSE_DST=0; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$AUSE_DST=1; return 0;
} else {
$AUSE_DST=0; return 1;
}
}
} else {
$AUSE_DST=1; return 0;
}
} elsif ($mm == 10) {
if ($dd >= 8) {
$AUSE_DST=1; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (7200+$timezone*3600)) {
$AUSE_DST=0; return 0;
} else {
$AUSE_DST=1; return 1;
}
} else {
if ($dow == 0 && $ns < 3600) {
$AUSE_DST=0; return 0;
} else {
$AUSE_DST=1; return 1;
}
}
} else {
$AUSE_DST=0; return 0;
}
} # end of month checks
} # end of subroutine dstcalc
sub NZL_dstcalc { sub NZL_dstcalc {
#********************************************************************** #**********************************************************************
# FSO-TSM # FSO-TSM
@@ -1096,6 +1179,74 @@ sub NZL_dstcalc {
sub NZLN_dstcalc {
#**********************************************************************
# LSS-FSA
# 2007+ NEW ZEALAND (country code 64)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on last Sunday in September and first Sunday in April at 1 am.
#**********************************************************************
$NZLN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 9) {
$NZLN_DST=1; return 1;
} elsif ($mm >= 5 && $mm <= 9) {
$NZLN_DST=0; return 0;
} elsif ($mm == 4) {
if ($dd > 7) {
$NZLN_DST=0; return 1;
} elsif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$NZLN_DST=1; return 0;
} else {
$NZLN_DST=0; return 1;
}
} else {
if ($dow == 0 && $ns < 7200) {
$NZLN_DST=1; return 0;
} else {
$NZLN_DST=0; return 1;
}
}
} else {
$NZLN_DST=1; return 0;
}
} elsif ($mm == 9) {
if ($dd < 25) {
$NZLN_DST=0; return 0;
} elsif ($dd < ($dow+25)) {
$NZLN_DST=0; return 0;
} elsif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$NZLN_DST=0; return 0;
} else {
$NZLN_DST=1; return 1;
}
} else { # local time calculations
if ($ns < 3600) {
$NZLN_DST=0; return 0;
} else {
$NZLN_DST=1; return 1;
}
}
} else {
$NZLN_DST=1; return 1;
}
} # end of month checks
} # end of subroutine dstcalc
sub BZL_dstcalc { sub BZL_dstcalc {
#********************************************************************** #**********************************************************************
# TSO-LSF # TSO-LSF
@@ -1,7 +1,7 @@
<?php <?php
# new_listloader_superL.php # new_listloader_superL.php
# #
# Copyright (C) 2009 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
# #
# AST GUI lead loader from formatted file # AST GUI lead loader from formatted file
# #
@@ -29,11 +29,12 @@
# 90522-0506 - Security fix # 90522-0506 - Security fix
# 90721-1339 - Added rank and owner as vicidial_list fields # 90721-1339 - Added rank and owner as vicidial_list fields
# 91112-0616 - Added title/alt-phone duplicate checking # 91112-0616 - Added title/alt-phone duplicate checking
# 100118-0543 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# #
# 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. # 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.2.0-33'; $version = '2.2.0-34';
$build = '91112-0616'; $build = '100118-0543';
require("dbconnect.php"); require("dbconnect.php");
@@ -2107,6 +2108,74 @@ if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') )
if ($AUST_DST) {$gmt_offset++;} if ($AUST_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') )
{
if ($DBX) {print " Sunday in October to First Sunday in April\n";}
#**********************************************************************
# FSO-FSA
# 2008+ AUSTRALIA ONLY (country code 61)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in October and first Sunday in April at 1 am.
#**********************************************************************
$AUSE_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 or $mm > 10) {
$AUSE_DST=1;
} elseif ($mm >= 5 and $mm <= 9) {
$AUSE_DST=0;
} elseif ($mm == 4) {
if ($dd > 7) {
$AUSE_DST=0;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 and $ns < (3600+$timezone*3600)) {
$AUSE_DST=1;
} else {
$AUSE_DST=0;
}
} else {
if ($dow == 0 and $ns < 7200) {
$AUSE_DST=1;
} else {
$AUSE_DST=0;
}
}
} else {
$AUSE_DST=1;
}
} elseif ($mm == 10) {
if ($dd >= 8) {
$AUSE_DST=1;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$AUSE_DST=0;
} else {
$AUSE_DST=1;
}
} else {
if ($dow == 0 and $ns < 3600) {
$AUSE_DST=0;
} else {
$AUSE_DST=1;
}
}
} else {
$AUSE_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $AUSE_DST\n";}
if ($AUSE_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
{ {
if ($DBX) {print " First Sunday October to Third Sunday March\n";} if ($DBX) {print " First Sunday October to Third Sunday March\n";}
@@ -2174,6 +2243,75 @@ if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') )
{
if ($DBX) {print " Last Sunday in September to First Sunday in April\n";}
#**********************************************************************
# LSS-FSA
# 2007+ NEW ZEALAND (country code 64)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on last Sunday in September and first Sunday in April at 1 am.
#**********************************************************************
$NZLN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 9) {
$NZLN_DST=1;
} elseif ($mm >= 5 && $mm <= 9) {
$NZLN_DST=0;
} elseif ($mm == 4) {
if ($dd > 7) {
$NZLN_DST=0;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$NZLN_DST=1;
} else {
$NZLN_DST=0;
}
} else {
if ($dow == 0 && $ns < 7200) {
$NZLN_DST=1;
} else {
$NZLN_DST=0;
}
}
} else {
$NZLN_DST=1;
}
} elseif ($mm == 9) {
if ($dd < 25) {
$NZLN_DST=0;
} elseif ($dd < ($dow+25)) {
$NZLN_DST=0;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$NZLN_DST=0;
} else {
$NZLN_DST=1;
}
} else { # local time calculations
if ($ns < 3600) {
$NZLN_DST=0;
} else {
$NZLN_DST=1;
}
}
} else {
$NZLN_DST=1;
}
} # end of month checks
if ($DBX) {print " DST: $NZLN_DST\n";}
if ($NZLN_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') )
{ {
if ($DBX) {print " Third Sunday October to Last Sunday February\n";} if ($DBX) {print " Third Sunday October to Last Sunday February\n";}
+141 -3
View File
@@ -1,7 +1,7 @@
<?php <?php
# non_agent_api.php # non_agent_api.php
# #
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# #
# This script is designed as an API(Application Programming Interface) to allow # This script is designed as an API(Application Programming Interface) to allow
# other programs to interact with all non-agent-screen VICIDIAL functions # other programs to interact with all non-agent-screen VICIDIAL functions
@@ -30,10 +30,11 @@
# 91026-1059 - Added AREACODE DNC option # 91026-1059 - Added AREACODE DNC option
# 91203-1140 - Added agent_ingroup_info feature # 91203-1140 - Added agent_ingroup_info feature
# 91216-0331 - Added duplication check features to add_lead function # 91216-0331 - Added duplication check features to add_lead function
# 100118-0543 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# #
$version = '2.2.0-16'; $version = '2.2.0-17';
$build = '91216-0331'; $build = '100118-0543';
require("dbconnect.php"); require("dbconnect.php");
@@ -2046,6 +2047,74 @@ if ( (!$AC_processed) and ($dst_range == 'FSO-LSM') )
if ($AUST_DST) {$gmt_offset++;} if ($AUST_DST) {$gmt_offset++;}
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) and ($dst_range == 'FSO-FSA') )
{
if ($DBX) {print " Sunday in October to First Sunday in April\n";}
#**********************************************************************
# FSO-FSA
# 2008+ AUSTRALIA ONLY (country code 61)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on first Sunday in October and first Sunday in April at 1 am.
#**********************************************************************
$AUSE_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 or $mm > 10) {
$AUSE_DST=1;
} elseif ($mm >= 5 and $mm <= 9) {
$AUSE_DST=0;
} elseif ($mm == 4) {
if ($dd > 7) {
$AUSE_DST=0;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 and $ns < (3600+$timezone*3600)) {
$AUSE_DST=1;
} else {
$AUSE_DST=0;
}
} else {
if ($dow == 0 and $ns < 7200) {
$AUSE_DST=1;
} else {
$AUSE_DST=0;
}
}
} else {
$AUSE_DST=1;
}
} elseif ($mm == 10) {
if ($dd >= 8) {
$AUSE_DST=1;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 and $ns < (7200+$timezone*3600)) {
$AUSE_DST=0;
} else {
$AUSE_DST=1;
}
} else {
if ($dow == 0 and $ns < 3600) {
$AUSE_DST=0;
} else {
$AUSE_DST=1;
}
}
} else {
$AUSE_DST=0;
}
} # end of month checks
if ($DBX) {print " DST: $AUSE_DST\n";}
if ($AUSE_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') ) if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
{ {
if ($DBX) {print " First Sunday October to Third Sunday March\n";} if ($DBX) {print " First Sunday October to Third Sunday March\n";}
@@ -2113,6 +2182,75 @@ if ( (!$AC_processed) and ($dst_range == 'FSO-TSM') )
$AC_processed++; $AC_processed++;
} }
if ( (!$AC_processed) and ($dst_range == 'LSS-FSA') )
{
if ($DBX) {print " Last Sunday in September to First Sunday in April\n";}
#**********************************************************************
# LSS-FSA
# 2007+ NEW ZEALAND (country code 64)
# This is returns 1 if Daylight Savings Time is in effect and 0 if
# Standard time is in effect.
# Based on last Sunday in September and first Sunday in April at 1 am.
#**********************************************************************
$NZLN_DST=0;
$mm = $mon;
$dd = $mday;
$ns = $dsec;
$dow= $wday;
if ($mm < 4 || $mm > 9) {
$NZLN_DST=1;
} elseif ($mm >= 5 && $mm <= 9) {
$NZLN_DST=0;
} elseif ($mm == 4) {
if ($dd > 7) {
$NZLN_DST=0;
} elseif ($dd >= ($dow+1)) {
if ($timezone) {
if ($dow == 0 && $ns < (3600+$timezone*3600)) {
$NZLN_DST=1;
} else {
$NZLN_DST=0;
}
} else {
if ($dow == 0 && $ns < 7200) {
$NZLN_DST=1;
} else {
$NZLN_DST=0;
}
}
} else {
$NZLN_DST=1;
}
} elseif ($mm == 9) {
if ($dd < 25) {
$NZLN_DST=0;
} elseif ($dd < ($dow+25)) {
$NZLN_DST=0;
} elseif ($dow == 0) {
if ($timezone) { # UTC calculations
if ($ns < (3600+($timezone-1)*3600)) {
$NZLN_DST=0;
} else {
$NZLN_DST=1;
}
} else { # local time calculations
if ($ns < 3600) {
$NZLN_DST=0;
} else {
$NZLN_DST=1;
}
}
} else {
$NZLN_DST=1;
}
} # end of month checks
if ($DBX) {print " DST: $NZLN_DST\n";}
if ($NZLN_DST) {$gmt_offset++;}
$AC_processed++;
}
if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') ) if ( (!$AC_processed) and ($dst_range == 'TSO-LSF') )
{ {
if ($DBX) {print " Third Sunday October to Last Sunday February\n";} if ($DBX) {print " Third Sunday October to Last Sunday February\n";}