added duplication checking by campaign and total system for lead loaders.
added phone_code override for lead loaders git-svn-id: svn://192.168.202.10@612 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -1,8 +1,22 @@
|
||||
################ UPGRADE
|
||||
|
||||
NOTE: Upgrading from 2.0.2 to 2.0.3 is below the first section
|
||||
NOTE: Upgrading from 2.0.1 to 2.0.2 is in the middle section
|
||||
NOTE: Upgrading from 1.1.12-3 to 2.0.1 is at the bottom
|
||||
|
||||
########## UPGRADING FROM 2.0.3 TO 2.0.4 ##########
|
||||
|
||||
1. install new files:
|
||||
perl ./install.pl
|
||||
NOTES: If you have customized any scripts in the bin or agi folders,
|
||||
then make sure you back them up before running the install.pl script.
|
||||
This script will replace existing files in the astguiclient installation.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
########## UPGRADING FROM 2.0.2 TO 2.0.3 ##########
|
||||
|
||||
1. install new files:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# VICIDIAL_IN_new_leads_file.pl version 0.5 *DBI-version*
|
||||
# VICIDIAL_IN_new_leads_file.pl version 0.6 *DBI-version*
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# script lets you insert leads into the vicidial_list table from a TAB-delimited
|
||||
@@ -8,7 +8,7 @@
|
||||
#
|
||||
# It is recommended that you run this program on the local Asterisk machine
|
||||
#
|
||||
# Copyright (C) 2006 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
# Copyright (C) 2007 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
|
||||
#
|
||||
#
|
||||
# CHANGES
|
||||
@@ -22,6 +22,7 @@
|
||||
# - added duplicate check flag option within same list
|
||||
# 61127-1132 - Added new DST methods
|
||||
# 61128-1037 - Added postal codes GMT lookup option
|
||||
# 70510-1518 - Added campaign and system duplicate check and phonecode override
|
||||
#
|
||||
|
||||
$secX = time();
|
||||
@@ -105,7 +106,10 @@ if (length($ARGV[0])>1)
|
||||
print " [--forcegmt] = forces gmt value of column after comments column\n";
|
||||
print " [--debug] = debug output\n";
|
||||
print " [--forcelistid=1234] = overrides the listID given in the file with the 1234\n";
|
||||
print " [--forcephonecode=44] = overrides the phone_code given in the lead with the 44\n";
|
||||
print " [--duplicate-check] = checks for the same phone number in the same list id before inserting lead\n";
|
||||
print " [--duplicate-campaign-check] = checks for the same phone number in the same campaign before inserting lead\n";
|
||||
print " [--duplicate-system-check] = checks for the same phone number in the entire system before inserting lead\n";
|
||||
print " [--postal-code-gmt] = checks for the time zone based on the postal code given where available\n";
|
||||
print " [-h] = this help screen\n\n";
|
||||
print "\n";
|
||||
@@ -150,11 +154,32 @@ if (length($ARGV[0])>1)
|
||||
}
|
||||
else
|
||||
{$forcelistid = '';}
|
||||
|
||||
if ($args =~ /--forcephonecode=/i)
|
||||
{
|
||||
@data_in = split(/--forcephonecode=/,$args);
|
||||
$forcephonecode = $data_in[1];
|
||||
$forcephonecode =~ s/ .*//gi;
|
||||
print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n";
|
||||
}
|
||||
else
|
||||
{$forcephonecode = '';}
|
||||
|
||||
if ($args =~ /-duplicate-check/i)
|
||||
{
|
||||
$dupcheck=1;
|
||||
print "\n----- DUPLICATE CHECK -----\n\n";
|
||||
}
|
||||
if ($args =~ /-duplicate-campaign-check/i)
|
||||
{
|
||||
$dupcheckcamp=1;
|
||||
print "\n----- DUPLICATE CAMPAIGN CHECK -----\n\n";
|
||||
}
|
||||
if ($args =~ /-duplicate-system-check/i)
|
||||
{
|
||||
$dupchecksys=1;
|
||||
print "\n----- DUPLICATE SYSTEM CHECK -----\n\n";
|
||||
}
|
||||
if ($args =~ /-postal-code-gmt/i)
|
||||
{
|
||||
$postalgmt=1;
|
||||
@@ -303,15 +328,26 @@ if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOC
|
||||
{
|
||||
$list_id = $forcelistid; # set list_id to override value
|
||||
}
|
||||
if ($dupcheck > 0)
|
||||
if (length($forcephonecode) > 0)
|
||||
{
|
||||
$phone_code = $forcephonecode; # set phone_code to override value
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table entire database #####
|
||||
if ($dupchecksys > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmtA = "select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';";
|
||||
$stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_lead = $aryA[0];
|
||||
$dup_lead_list=$list_id;
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
@@ -319,6 +355,86 @@ if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOC
|
||||
{$dup_lead++;}
|
||||
}
|
||||
}
|
||||
##### Check for duplicate phone numbers in vicidial_list table for one list_id #####
|
||||
if ($dupcheck > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmtA = "select llst_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_lead_list = $aryA[0];
|
||||
$dup_lead++;
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if ($phone_list =~ /\|$phone_number$US$list_id\|/)
|
||||
{$dup_lead++;}
|
||||
}
|
||||
}
|
||||
##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign #####
|
||||
if ($dupcheckcamp > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$dup_lists='';
|
||||
|
||||
$stmtA = "select count(*) from vicidial_lists where list_id='$list_id';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$ci_recs = $aryA[0];
|
||||
$sthA->finish();
|
||||
if ($ci_recs > 0)
|
||||
{
|
||||
$stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_camp = $aryA[0];
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$rec_count=0;
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_lists .= "'$aryA[0]',";
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
chop($dup_lists);
|
||||
$stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$rec_count=0;
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_lead_list = "'$aryA[0]',";
|
||||
$rec_count++;
|
||||
$dup_lead=1;
|
||||
}
|
||||
$sthA->finish();
|
||||
}
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if ($phone_list =~ /\|$phone_number$US$list_id\|/)
|
||||
{$dup_lead++;}
|
||||
}
|
||||
}
|
||||
|
||||
if ( (length($phone_number)>6) && ($dup_lead < 1) )
|
||||
{
|
||||
$phone_list .= "$phone_number$US$list_id|";
|
||||
@@ -547,7 +663,7 @@ if ($DB) {print "SEED TIME $secX : $year-$mon-$mday $hour:$min:$sec LOC
|
||||
else
|
||||
{
|
||||
if ($dup_lead > 0)
|
||||
{print "DUPLICATE: $phone|$list_id"; $f++;}
|
||||
{print "DUPLICATE: $phone|$list_id|$dup_lead_list|"; $f++;}
|
||||
else
|
||||
{print "BAD Home_Phone: $phone|$vendor_id"; $e++;}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
############################################################ ADMIN
|
||||
|
||||
CHECK FOR DUPLICATES BY PHONE IN ALL CAMPAIGN LISTS||
|
||||
CHECK FOR DUPLICATES BY PHONE IN ENTIRE SYSTEM||
|
||||
PHONE CODE OVERRIDE FOR THIS FILE||
|
||||
The VICIDIAL basic web-based lead loader is designed simply to take a lead file - up to 8MB in size - that is either tab or pipe delimited and load it into the vicidial_list table. The lead loader allows for field choosing and TXT- Plain Text, CSV- Comma Separated Values and XLS- Excel file formats. The lead loader does not do data validation, but it does allow you to check for duplicates in itself, within the campaign or within the entire system. Also, make sure that you have created the list that these leads are to be under so that you can use them. Here is a list of the fields in their proper order for the lead files:||
|
||||
NOTES: The Excel Lead loader functionality is enabled by a series of perl scripts and needs to have a properly configured /etc/astguiclient.conf file in place on the web server. Also, a couple perl modules must be loaded for it to work as well - OLE-Storage_Lite and Spreadsheet-ParseExcel. You can check for runtime errors in these by looking at your apache error_log file. Also, for duplication checks against gampaign lists, the list that has new leads going into it does need to be created in the system before you start to load the leads.||
|
||||
|
||||
|
||||
############################################################ CLIENT
|
||||
|
||||
@@ -2301,7 +2301,7 @@ echo "<TABLE WIDTH=98% BGCOLOR=#E6E6E6 cellpadding=2 cellspacing=0><TR><TD ALIGN
|
||||
<B><FONT SIZE=3>VICIDIAL LIST LOADER FUNCTIONALITY</FONT></B><BR><BR>
|
||||
<A NAME="vicidial_list_loader">
|
||||
<BR>
|
||||
The VICIDIAL basic web-based lead loader is designed simply to take a lead file - up to 8MB in size - that is either tab or pipe delimited and load it into the vicidial_list table. There is also a new beta version super lead loader that allows for field choosing and TXT- Plain Text, CSV- Comma Separated Values and XLS- Excel file formats. The lead loader does not do data validation or check for duplicates in itself or other lists, so that is something you need to do before you load the leads. Also, make sure that you have created the list that these leads are to be under so that you can use them. There is also the matter of time-zone-coding these leads. You may want to increase the frequency that the ADMIN_adjust_GMTnow_on_leads.pl is being run in the cron on your Asterisk server so that any loaded leads can be coded faster. Here is a list of the fields in their proper order for the lead files:
|
||||
The VICIDIAL basic web-based lead loader is designed simply to take a lead file - up to 8MB in size - that is either tab or pipe delimited and load it into the vicidial_list table. The lead loader allows for field choosing and TXT- Plain Text, CSV- Comma Separated Values and XLS- Excel file formats. The lead loader does not do data validation, but it does allow you to check for duplicates in itself, within the campaign or within the entire system. Also, make sure that you have created the list that these leads are to be under so that you can use them. Here is a list of the fields in their proper order for the lead files:
|
||||
<OL>
|
||||
<LI>Vendor Lead Code - shows up in the Vendor ID field of the GUI
|
||||
<LI>Source Code - internal use only for admins and DBAs
|
||||
@@ -2328,7 +2328,7 @@ The VICIDIAL basic web-based lead loader is designed simply to take a lead file
|
||||
<LI>Comments
|
||||
</OL>
|
||||
|
||||
<BR>NOTES: The Excel Lead loader functionality is enabled by a series of perl scripts and needs to have a properly configured /etc/astguiclient.conf file in place on the web server. Also, a couple perl modules must be loaded for it to work as well - OLE-Storage_Lite and Spreadsheet-ParseExcel. You can check for runtime errors in these by looking at your apache error_log file.
|
||||
<BR>NOTES: The Excel Lead loader functionality is enabled by a series of perl scripts and needs to have a properly configured /etc/astguiclient.conf file in place on the web server. Also, a couple perl modules must be loaded for it to work as well - OLE-Storage_Lite and Spreadsheet-ParseExcel. You can check for runtime errors in these by looking at your apache error_log file. Also, for duplication checks against gampaign lists, the list that has new leads going into it does need to be created in the system before you start to load the leads.
|
||||
|
||||
|
||||
|
||||
@@ -3225,7 +3225,7 @@ if (strlen($campaigns_hh) > 1) {
|
||||
<? }
|
||||
if (strlen($lists_hh) > 1) {
|
||||
?>
|
||||
<TR BGCOLOR=<?=$lists_color ?>><TD ALIGN=LEFT COLSPAN=10><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> <a href="<? echo $PHP_SELF ?>?ADD=100"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Show Lists </a> | <a href="<? echo $PHP_SELF ?>?ADD=111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Add A New List </a> | <a href="admin_search_lead.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Search For A Lead </a> | <a href="<? echo $PHP_SELF ?>?ADD=121"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Add Number To DNC </a> | <a href="./listloaderMAIN.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Load New Leads </a></TD></TR>
|
||||
<TR BGCOLOR=<?=$lists_color ?>><TD ALIGN=LEFT COLSPAN=10><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> <a href="<? echo $PHP_SELF ?>?ADD=100"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Show Lists </a> | <a href="<? echo $PHP_SELF ?>?ADD=111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Add A New List </a> | <a href="admin_search_lead.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Search For A Lead </a> | <a href="<? echo $PHP_SELF ?>?ADD=121"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Add Number To DNC </a> | <a href="./new_listloader_superL.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?=$subheader_font_size ?>> Load New Leads </a></TD></TR>
|
||||
<? }
|
||||
if (strlen($scripts_hh) > 1) {
|
||||
?>
|
||||
|
||||
+112
-5
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
### listloader.pl version 0.3 *DBI-version*
|
||||
### listloader.pl version 0.4 *DBI-version*
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: GPLv2
|
||||
### Copyright (C) 2007 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
#
|
||||
#
|
||||
@@ -17,6 +17,7 @@
|
||||
# 61128-1215 - added postal code GMT lookup and duplicate check options
|
||||
# 70205-1703 - Defaulted phone_code to 1 if not populated
|
||||
# 70417-1059 - Fixed default phone_code bug
|
||||
# 70510-1518 - Added campaign and system duplicate check and phonecode override
|
||||
#
|
||||
|
||||
### begin parsing run-time options ###
|
||||
@@ -39,6 +40,10 @@ if (length($ARGV[0])>1)
|
||||
{
|
||||
if ($args =~ /-duplicate-check/i)
|
||||
{$dupcheck=1;}
|
||||
if ($args =~ /-duplicate-campaign-check/i)
|
||||
{$dupcheckcamp=1;}
|
||||
if ($args =~ /-duplicate-system-check/i)
|
||||
{$dupchecksys=1;}
|
||||
if ($args =~ /-postal-code-gmt/i)
|
||||
{$postalgmt=1;}
|
||||
if ($args =~ /--forcelistid=/i)
|
||||
@@ -50,6 +55,17 @@ if (length($ARGV[0])>1)
|
||||
}
|
||||
else
|
||||
{$forcelistid = '';}
|
||||
|
||||
if ($args =~ /--forcephonecode=/i)
|
||||
{
|
||||
@data_in = split(/--forcephonecode=/,$args);
|
||||
$forcephonecode = $data_in[1];
|
||||
$forcephonecode =~ s/ .*//gi;
|
||||
print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n";
|
||||
}
|
||||
else
|
||||
{$forcephonecode = '';}
|
||||
|
||||
if ($args =~ /--lead-file=/i)
|
||||
{
|
||||
@data_in = split(/--lead-file=/,$args);
|
||||
@@ -229,15 +245,26 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
|
||||
{
|
||||
$list_id = $forcelistid; # set list_id to override value
|
||||
}
|
||||
if ($dupcheck > 0)
|
||||
if (length($forcephonecode) > 0)
|
||||
{
|
||||
$phone_code = $forcephonecode; # set phone_code to override value
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table entire database #####
|
||||
if ($dupchecksys > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmtA = "select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';";
|
||||
$stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_lead = $aryA[0];
|
||||
$dup_lead_list=$list_id;
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
@@ -245,6 +272,86 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
|
||||
{$dup_lead++;}
|
||||
}
|
||||
}
|
||||
##### Check for duplicate phone numbers in vicidial_list table for one list_id #####
|
||||
if ($dupcheck > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmtA = "select llst_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_lead_list = $aryA[0];
|
||||
$dup_lead++;
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if ($phone_list =~ /\|$phone_number$US$list_id\|/)
|
||||
{$dup_lead++;}
|
||||
}
|
||||
}
|
||||
##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign #####
|
||||
if ($dupcheckcamp > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$dup_lists='';
|
||||
|
||||
$stmtA = "select count(*) from vicidial_lists where list_id='$list_id';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$ci_recs = $aryA[0];
|
||||
$sthA->finish();
|
||||
if ($ci_recs > 0)
|
||||
{
|
||||
$stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_camp = $aryA[0];
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$rec_count=0;
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_lists .= "'$aryA[0]',";
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
chop($dup_lists);
|
||||
$stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$rec_count=0;
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_lead_list = "'$aryA[0]',";
|
||||
$rec_count++;
|
||||
$dup_lead=1;
|
||||
}
|
||||
$sthA->finish();
|
||||
}
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if ($phone_list =~ /\|$phone_number$US$list_id\|/)
|
||||
{$dup_lead++;}
|
||||
}
|
||||
}
|
||||
|
||||
if ( (length($phone_number)>6) && ($dup_lead < 1) )
|
||||
{
|
||||
$phone_list .= "$phone_number$US$list_id|";
|
||||
@@ -453,7 +560,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
|
||||
|
||||
$good++;
|
||||
} else {
|
||||
if ($bad < 10) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]|</font><b>\n";}
|
||||
if ($bad < 10000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list</font><b>\n";}
|
||||
$bad++;
|
||||
}
|
||||
$total++;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
### listloader_super.pl version 0.3 *DBI-version*
|
||||
### listloader_super.pl version 0.4 *DBI-version*
|
||||
###
|
||||
### Copyright (C) 2006 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: GPLv2
|
||||
### Copyright (C) 2007 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: GPLv2
|
||||
###
|
||||
#
|
||||
#
|
||||
@@ -16,6 +16,7 @@
|
||||
# 61128-1207 - added postal code GMT lookup and duplicate check options
|
||||
# 70205-1703 - Defaulted phone_code to 1 if not populated
|
||||
# 70417-1059 - Fixed default phone_code bug
|
||||
# 70510-1518 - Added campaign and system duplicate check and phonecode override
|
||||
#
|
||||
|
||||
### begin parsing run-time options ###
|
||||
@@ -38,6 +39,10 @@ if (length($ARGV[0])>1)
|
||||
{
|
||||
if ($args =~ /-duplicate-check/i)
|
||||
{$dupcheck=1;}
|
||||
if ($args =~ /-duplicate-campaign-check/i)
|
||||
{$dupcheckcamp=1;}
|
||||
if ($args =~ /-duplicate-system-check/i)
|
||||
{$dupchecksys=1;}
|
||||
if ($args =~ /-postal-code-gmt/i)
|
||||
{$postalgmt=1;}
|
||||
if ($args =~ /--forcelistid=/i)
|
||||
@@ -49,6 +54,17 @@ if (length($ARGV[0])>1)
|
||||
}
|
||||
else
|
||||
{$forcelistid = '';}
|
||||
|
||||
if ($args =~ /--forcephonecode=/i)
|
||||
{
|
||||
@data_in = split(/--forcephonecode=/,$args);
|
||||
$forcephonecode = $data_in[1];
|
||||
$forcephonecode =~ s/ .*//gi;
|
||||
print "\n----- FORCE PHONECODE OVERRIDE: $forcephonecode -----\n\n";
|
||||
}
|
||||
else
|
||||
{$forcephonecode = '';}
|
||||
|
||||
if ($args =~ /--lead-file=/i)
|
||||
{
|
||||
@data_in = split(/--lead-file=/,$args);
|
||||
@@ -231,15 +247,26 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
|
||||
{
|
||||
$list_id = $forcelistid; # set list_id to override value
|
||||
}
|
||||
if ($dupcheck > 0)
|
||||
if (length($forcephonecode) > 0)
|
||||
{
|
||||
$phone_code = $forcephonecode; # set phone_code to override value
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table entire database #####
|
||||
if ($dupchecksys > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmtA = "select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';";
|
||||
$stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_lead = $aryA[0];
|
||||
$dup_lead_list=$list_id;
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
@@ -247,6 +274,86 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
|
||||
{$dup_lead++;}
|
||||
}
|
||||
}
|
||||
##### Check for duplicate phone numbers in vicidial_list table for one list_id #####
|
||||
if ($dupcheck > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmtA = "select llst_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
if ($sthArows > 0)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_lead_list = $aryA[0];
|
||||
$dup_lead++;
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if ($phone_list =~ /\|$phone_number$US$list_id\|/)
|
||||
{$dup_lead++;}
|
||||
}
|
||||
}
|
||||
##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign #####
|
||||
if ($dupcheckcamp > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$dup_lists='';
|
||||
|
||||
$stmtA = "select count(*) from vicidial_lists where list_id='$list_id';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$ci_recs = $aryA[0];
|
||||
$sthA->finish();
|
||||
if ($ci_recs > 0)
|
||||
{
|
||||
$stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_camp = $aryA[0];
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$rec_count=0;
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_lists .= "'$aryA[0]',";
|
||||
$rec_count++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
chop($dup_lists);
|
||||
$stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
$rec_count=0;
|
||||
while ($sthArows > $rec_count)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$dup_lead_list = "'$aryA[0]',";
|
||||
$rec_count++;
|
||||
$dup_lead=1;
|
||||
}
|
||||
$sthA->finish();
|
||||
}
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if ($phone_list =~ /\|$phone_number$US$list_id\|/)
|
||||
{$dup_lead++;}
|
||||
}
|
||||
}
|
||||
|
||||
if ( (length($phone_number)>6) && ($dup_lead < 1) )
|
||||
{
|
||||
$phone_list .= "$phone_number$US$list_id|";
|
||||
@@ -455,7 +562,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
|
||||
|
||||
$good++;
|
||||
} else {
|
||||
if ($bad < 10) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]|</font><b>\n";}
|
||||
if ($bad < 10000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list</font><b>\n";}
|
||||
$bad++;
|
||||
}
|
||||
$total++;
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
# 61110-1222 - added new USA-Canada DST scheme and Brazil DST scheme
|
||||
# 61128-1149 - added postal code GMT lookup and duplicate check options
|
||||
# 70417-1059 - Fixed default phone_code bug
|
||||
# 70510-1518 - Added campaign and system duplicate check and phonecode override
|
||||
#
|
||||
# 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.3';
|
||||
$build = '70417-1059';
|
||||
$version = '2.0.4';
|
||||
$build = '70510-1518';
|
||||
|
||||
|
||||
require("dbconnect.php");
|
||||
@@ -105,6 +106,9 @@ if (isset($_GET["dupcheck"])) {$dupcheck=$_GET["dupcheck"];}
|
||||
elseif (isset($_POST["dupcheck"])) {$dupcheck=$_POST["dupcheck"];}
|
||||
if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];}
|
||||
elseif (isset($_POST["postalgmt"])) {$postalgmt=$_POST["postalgmt"];}
|
||||
if (isset($_GET["phone_code_override"])) {$phone_code_override=$_GET["phone_code_override"];}
|
||||
elseif (isset($_POST["phone_code_override"])) {$phone_code_override=$_POST["phone_code_override"];}
|
||||
$phone_code_override = (preg_replace("/\D/","",$phone_code_override));
|
||||
|
||||
# $country_field=$_GET["country_field"]; if (!$country_field) {$country_field=$_POST["country_field"];}
|
||||
|
||||
@@ -266,7 +270,7 @@ A.employee_standard { font-family: garamond, sans-serif; font-size: ".macfontfi
|
||||
|
||||
<script language="JavaScript1.2">
|
||||
function openNewWindow(url) {
|
||||
window.open (url,"",'width=500,height=300,scrollbars=yes,menubar=yes,address=yes');
|
||||
window.open (url,"",'width=700,height=300,scrollbars=yes,menubar=yes,address=yes');
|
||||
}
|
||||
function ShowProgress(good, bad, total, dup, post) {
|
||||
parent.lead_count.document.open();
|
||||
@@ -284,13 +288,13 @@ function ParseFileName() {
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<title>VICIDIAL ADMIN: Super Lead Loader</title>
|
||||
<title>VICIDIAL ADMIN: Lead Loader</title>
|
||||
</head>
|
||||
<body>
|
||||
<form action=<?=$PHP_SELF ?> method=post onSubmit="ParseFileName()" enctype="multipart/form-data">
|
||||
<input type=hidden name='leadfile_name' value="<?=$leadfile_name ?>">
|
||||
<? if ($file_layout!="custom") { ?>
|
||||
<table align=center width="500" border=0 cellpadding=5 cellspacing=0 bgcolor=#D9E6FE>
|
||||
<table align=center width="700" border=0 cellpadding=5 cellspacing=0 bgcolor=#D9E6FE>
|
||||
<tr>
|
||||
<td align=right width="35%"><B><font face="arial, helvetica" size=2>Load leads from this file:</font></B></td>
|
||||
<td align=left width="65%"><input type=file name="leadfile" value="<?=$leadfile ?>"> <? echo "$NWB#vicidial_list_loader$NWE"; ?></td>
|
||||
@@ -299,13 +303,22 @@ function ParseFileName() {
|
||||
<td align=right width="25%"><font face="arial, helvetica" size=2>List ID Override: </font></td>
|
||||
<td align=left width="75%"><font face="arial, helvetica" size=1><input type=text value="<?=$list_id_override ?>" name='list_id_override' size=10 maxlength=8> (numbers only or leave blank for values in the file)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=right width="25%"><font face="arial, helvetica" size=2>Phone Code Override: </font></td>
|
||||
<td align=left width="75%"><font face="arial, helvetica" size=1><input type=text value="<?=$phone_code_override ?>" name='phone_code_override' size=8 maxlength=6> (numbers only or leave blank for values in the file)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=right><B><font face="arial, helvetica" size=2>File layout to use:</font></B></td>
|
||||
<td align=left><font face="arial, helvetica" size=2><input type=radio name="file_layout" value="standard" checked>Standard VICIDIAL <input type=radio name="file_layout" value="custom">Custom layout</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=right width="25%"><font face="arial, helvetica" size=2>Lead Duplicate Check: </font></td>
|
||||
<td align=left width="75%"><font face="arial, helvetica" size=1><select size=1 name=dupcheck><option selected value="NONE">NO DUPLICATE CHECK</option><option value="DUP">CHECK FOR DUPLICATES BY PHONE IN LIST ID</option></select></td>
|
||||
<td align=left width="75%"><font face="arial, helvetica" size=1><select size=1 name=dupcheck>
|
||||
<option selected value="NONE">NO DUPLICATE CHECK</option>
|
||||
<option value="DUPLIST">CHECK FOR DUPLICATES BY PHONE IN LIST ID</option>
|
||||
<option value="DUPCAMP">CHECK FOR DUPLICATES BY PHONE IN ALL CAMPAIGN LISTS</option>
|
||||
<option value="DUPSYS">CHECK FOR DUPLICATES BY PHONE IN ENTIRE SYSTEM</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=right width="25%"><font face="arial, helvetica" size=2>Lead Time Zone Lookup: </font></td>
|
||||
@@ -314,15 +327,14 @@ function ParseFileName() {
|
||||
<tr>
|
||||
<td align=center colspan=2><input type=submit value="SUBMIT" name='submit_file'> <input type=button onClick="javascript:document.location='new_listloader_superL.php'" value="START OVER" name='reload_page'></td>
|
||||
</tr>
|
||||
<tr><td colspan=2><font size=1><a href="listloaderMAIN.php" target="_parent">CLICK HERE TO GO TO THE BASIC LEAD LOADER </a> <a href="admin.php" target="_parent">BACK TO ADMIN</a></font></td></tr>
|
||||
<tr><td colspan=2><font size=1>SUPER LIST LOADER- VERSION: <?=$version ?> BUILD: <?=$build ?></td></tr>
|
||||
<tr><td align=left><font size=1> <a href="admin.php?ADD=100" target="_parent">BACK TO ADMIN</a></font></td><td align=right><font size=1>LIST LOADER- VERSION: <?=$version ?> BUILD: <?=$build ?> </td></tr>
|
||||
</table>
|
||||
<? } ?>
|
||||
|
||||
<?
|
||||
|
||||
if ($OK_to_process) {
|
||||
print "<script language='JavaScript1.2'>document.forms[0].leadfile.disabled=true;document.forms[0].list_id_override.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;</script>";
|
||||
print "<script language='JavaScript1.2'>document.forms[0].leadfile.disabled=true;document.forms[0].list_id_override.disabled=true;document.forms[0].phone_code_override.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;</script>";
|
||||
flush();
|
||||
$total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list='';
|
||||
|
||||
@@ -350,6 +362,11 @@ function ParseFileName() {
|
||||
print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>";
|
||||
}
|
||||
|
||||
if (strlen($phone_code_override)>0)
|
||||
{
|
||||
print "<BR><BR>PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override<BR><BR>";
|
||||
}
|
||||
|
||||
while (!feof($file)) {
|
||||
$record++;
|
||||
$buffer=rtrim(fgets($file, 4096));
|
||||
@@ -396,9 +413,78 @@ function ParseFileName() {
|
||||
# print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>";
|
||||
$list_id = $list_id_override;
|
||||
}
|
||||
if (strlen($phone_code_override)>0)
|
||||
{
|
||||
$phone_code = $phone_code_override;
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table #####
|
||||
if (eregi("DUP",$dupcheck))
|
||||
##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign #####
|
||||
if (eregi("DUPCAMP",$dupcheck))
|
||||
{
|
||||
$dup_lead=0;
|
||||
$dup_lists='';
|
||||
$stmt="select campaign_id from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$ci_recs = mysql_num_rows($rslt);
|
||||
if ($ci_recs > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_camp = $row[0];
|
||||
|
||||
$stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$li_recs = mysql_num_rows($rslt);
|
||||
if ($li_recs > 0)
|
||||
{
|
||||
$L=0;
|
||||
while ($li_recs > $L)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lists .= "'$row[0]',";
|
||||
$L++;
|
||||
}
|
||||
$dup_lists = eregi_replace(",$",'',$dup_lists);
|
||||
|
||||
$stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$dup_lead=1;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lead_list = $row[0];
|
||||
}
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if (eregi("$phone_number$US$list_id",$phone_list))
|
||||
{$dup_lead++; $dup++;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table entire database #####
|
||||
if (eregi("DUPSYS",$dupcheck))
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmt="select list_id from vicidial_list where phone_number='$phone_number';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$dup_lead=1;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lead_list = $row[0];
|
||||
}
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if (eregi("$phone_number$US$list_id",$phone_list))
|
||||
{$dup_lead++; $dup++;}
|
||||
}
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table for one list_id #####
|
||||
if (eregi("DUPLIST",$dupcheck))
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';";
|
||||
@@ -408,6 +494,7 @@ function ParseFileName() {
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lead = $row[0];
|
||||
$dup_lead_list = $list_id;
|
||||
}
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
@@ -441,7 +528,7 @@ function ParseFileName() {
|
||||
|
||||
$good++;
|
||||
} else {
|
||||
if ($bad < 10) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
|
||||
if ($bad < 10000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";}
|
||||
$bad++;
|
||||
}
|
||||
$total++;
|
||||
@@ -473,11 +560,17 @@ function ParseFileName() {
|
||||
{
|
||||
print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>\n";
|
||||
}
|
||||
if (strlen($phone_code_override)>0)
|
||||
{
|
||||
print "<BR><BR>PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override<BR><BR>\n";
|
||||
}
|
||||
# print "|$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --lead_file=$lead_file|";
|
||||
$dupcheckCLI=''; $postalgmtCLI='';
|
||||
if (eregi("DUP",$dupcheck)) {$dupcheckCLI='--duplicate-check';}
|
||||
if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';}
|
||||
if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';}
|
||||
if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';}
|
||||
if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';}
|
||||
passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
|
||||
passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field, --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
|
||||
} else {
|
||||
# copy($leadfile, "./vicidial_temp_file.csv");
|
||||
$file=fopen("$lead_file", "r");
|
||||
@@ -491,6 +584,11 @@ function ParseFileName() {
|
||||
print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>";
|
||||
}
|
||||
|
||||
if (strlen($phone_code_override)>0)
|
||||
{
|
||||
print "<BR><BR>PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override<BR><BR>";
|
||||
}
|
||||
|
||||
while($row=fgetcsv($file, 1000, ",")) {
|
||||
|
||||
$pulldate=date("Y-m-d H:i:s");
|
||||
@@ -528,12 +626,80 @@ function ParseFileName() {
|
||||
|
||||
if (strlen($list_id_override)>0)
|
||||
{
|
||||
# print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>";
|
||||
$list_id = $list_id_override;
|
||||
}
|
||||
if (strlen($phone_code_override)>0)
|
||||
{
|
||||
$phone_code = $phone_code_override;
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table #####
|
||||
if (eregi("DUP",$dupcheck))
|
||||
##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign #####
|
||||
if (eregi("DUPCAMP",$dupcheck))
|
||||
{
|
||||
$dup_lead=0;
|
||||
$dup_lists='';
|
||||
$stmt="select campaign_id from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$ci_recs = mysql_num_rows($rslt);
|
||||
if ($ci_recs > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_camp = $row[0];
|
||||
|
||||
$stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$li_recs = mysql_num_rows($rslt);
|
||||
if ($li_recs > 0)
|
||||
{
|
||||
$L=0;
|
||||
while ($li_recs > $L)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lists .= "'$row[0]',";
|
||||
$L++;
|
||||
}
|
||||
$dup_lists = eregi_replace(",$",'',$dup_lists);
|
||||
|
||||
$stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$dup_lead=1;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lead_list = $row[0];
|
||||
}
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if (eregi("$phone_number$US$list_id",$phone_list))
|
||||
{$dup_lead++; $dup++;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table entire database #####
|
||||
if (eregi("DUPSYS",$dupcheck))
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmt="select list_id from vicidial_list where phone_number='$phone_number';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$dup_lead=1;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lead_list = $row[0];
|
||||
}
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if (eregi("$phone_number$US$list_id",$phone_list))
|
||||
{$dup_lead++; $dup++;}
|
||||
}
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table for one list_id #####
|
||||
if (eregi("DUPLIST",$dupcheck))
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';";
|
||||
@@ -577,7 +743,7 @@ function ParseFileName() {
|
||||
|
||||
$good++;
|
||||
} else {
|
||||
if ($bad < 10) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
|
||||
if ($bad < 10000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
|
||||
$bad++;
|
||||
}
|
||||
$total++;
|
||||
@@ -637,6 +803,10 @@ if ($leadfile && filesize($LF_path)<=8388608) {
|
||||
{
|
||||
print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>";
|
||||
}
|
||||
if (strlen($phone_code_override)>0)
|
||||
{
|
||||
print "<BR><BR>PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override<BR><BR>\n";
|
||||
}
|
||||
while (!feof($file)) {
|
||||
$record++;
|
||||
$buffer=rtrim(fgets($file, 4096));
|
||||
@@ -680,12 +850,80 @@ if ($leadfile && filesize($LF_path)<=8388608) {
|
||||
|
||||
if (strlen($list_id_override)>0)
|
||||
{
|
||||
# print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>";
|
||||
$list_id = $list_id_override;
|
||||
}
|
||||
if (strlen($phone_code_override)>0)
|
||||
{
|
||||
$phone_code = $phone_code_override;
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table #####
|
||||
if (eregi("DUP",$dupcheck))
|
||||
##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign #####
|
||||
if (eregi("DUPCAMP",$dupcheck))
|
||||
{
|
||||
$dup_lead=0;
|
||||
$dup_lists='';
|
||||
$stmt="select campaign_id from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$ci_recs = mysql_num_rows($rslt);
|
||||
if ($ci_recs > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_camp = $row[0];
|
||||
|
||||
$stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$li_recs = mysql_num_rows($rslt);
|
||||
if ($li_recs > 0)
|
||||
{
|
||||
$L=0;
|
||||
while ($li_recs > $L)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lists .= "'$row[0]',";
|
||||
$L++;
|
||||
}
|
||||
$dup_lists = eregi_replace(",$",'',$dup_lists);
|
||||
|
||||
$stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$dup_lead=1;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lead_list = $row[0];
|
||||
}
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if (eregi("$phone_number$US$list_id",$phone_list))
|
||||
{$dup_lead++; $dup++;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table entire database #####
|
||||
if (eregi("DUPSYS",$dupcheck))
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmt="select list_id from vicidial_list where phone_number='$phone_number';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$dup_lead=1;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lead_list = $row[0];
|
||||
}
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if (eregi("$phone_number$US$list_id",$phone_list))
|
||||
{$dup_lead++; $dup++;}
|
||||
}
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table for one list_id #####
|
||||
if (eregi("DUPLIST",$dupcheck))
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';";
|
||||
@@ -729,7 +967,7 @@ if ($leadfile && filesize($LF_path)<=8388608) {
|
||||
|
||||
$good++;
|
||||
} else {
|
||||
if ($bad < 10) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
|
||||
if ($bad < 10000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
|
||||
$bad++;
|
||||
}
|
||||
$total++;
|
||||
@@ -768,9 +1006,11 @@ if ($leadfile && filesize($LF_path)<=8388608) {
|
||||
|
||||
# echo "|$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --lead-file=$lead_file|";
|
||||
$dupcheckCLI=''; $postalgmtCLI='';
|
||||
if (eregi("DUP",$dupcheck)) {$dupcheckCLI='--duplicate-check';}
|
||||
if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';}
|
||||
if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';}
|
||||
if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';}
|
||||
if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';}
|
||||
passthru("$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
|
||||
passthru("$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
|
||||
|
||||
}
|
||||
else
|
||||
@@ -795,6 +1035,10 @@ if ($leadfile && filesize($LF_path)<=8388608) {
|
||||
{
|
||||
print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>";
|
||||
}
|
||||
if (strlen($phone_code_override)>0)
|
||||
{
|
||||
print "<BR><BR>PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override<BR><BR>";
|
||||
}
|
||||
|
||||
while($row=fgetcsv($file, 1000, ",")) {
|
||||
$pulldate=date("Y-m-d H:i:s");
|
||||
@@ -832,12 +1076,80 @@ if ($leadfile && filesize($LF_path)<=8388608) {
|
||||
|
||||
if (strlen($list_id_override)>0)
|
||||
{
|
||||
# print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>";
|
||||
$list_id = $list_id_override;
|
||||
}
|
||||
if (strlen($phone_code_override)>0)
|
||||
{
|
||||
$phone_code = $phone_code_override;
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table #####
|
||||
if (eregi("DUP",$dupcheck))
|
||||
##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign #####
|
||||
if (eregi("DUPCAMP",$dupcheck))
|
||||
{
|
||||
$dup_lead=0;
|
||||
$dup_lists='';
|
||||
$stmt="select campaign_id from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$ci_recs = mysql_num_rows($rslt);
|
||||
if ($ci_recs > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_camp = $row[0];
|
||||
|
||||
$stmt="select list_id from vicidial_lists where campaign_id='$dup_camp';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$li_recs = mysql_num_rows($rslt);
|
||||
if ($li_recs > 0)
|
||||
{
|
||||
$L=0;
|
||||
while ($li_recs > $L)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lists .= "'$row[0]',";
|
||||
$L++;
|
||||
}
|
||||
$dup_lists = eregi_replace(",$",'',$dup_lists);
|
||||
|
||||
$stmt="select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$dup_lead=1;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lead_list = $row[0];
|
||||
}
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if (eregi("$phone_number$US$list_id",$phone_list))
|
||||
{$dup_lead++; $dup++;}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table entire database #####
|
||||
if (eregi("DUPSYS",$dupcheck))
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmt="select list_id from vicidial_list where phone_number='$phone_number';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$pc_recs = mysql_num_rows($rslt);
|
||||
if ($pc_recs > 0)
|
||||
{
|
||||
$dup_lead=1;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$dup_lead_list = $row[0];
|
||||
}
|
||||
if ($dup_lead < 1)
|
||||
{
|
||||
if (eregi("$phone_number$US$list_id",$phone_list))
|
||||
{$dup_lead++; $dup++;}
|
||||
}
|
||||
}
|
||||
|
||||
##### Check for duplicate phone numbers in vicidial_list table for one list_id #####
|
||||
if (eregi("DUPLIST",$dupcheck))
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmt="select count(*) from vicidial_list where phone_number='$phone_number' and list_id='$list_id';";
|
||||
@@ -881,7 +1193,7 @@ if ($leadfile && filesize($LF_path)<=8388608) {
|
||||
|
||||
$good++;
|
||||
} else {
|
||||
if ($bad < 10) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
|
||||
if ($bad < 10000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
|
||||
$bad++;
|
||||
}
|
||||
$total++;
|
||||
@@ -906,7 +1218,7 @@ if ($leadfile && filesize($LF_path)<=8388608) {
|
||||
} else {
|
||||
print "<script language='JavaScript1.2'>document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;</script><HR>";
|
||||
flush();
|
||||
print "<table border=0 cellpadding=3 cellspacing=0 width=500 align=center>\r\n";
|
||||
print "<table border=0 cellpadding=3 cellspacing=0 width=700 align=center>\r\n";
|
||||
print " <tr bgcolor='#330099'>\r\n";
|
||||
print " <th align=right><font class='standard' color='white'>VICIDIAL Column</font></th>\r\n";
|
||||
print " <th><font class='standard' color='white'>File data</font></th>\r\n";
|
||||
@@ -945,6 +1257,10 @@ if ($leadfile && filesize($LF_path)<=8388608) {
|
||||
{
|
||||
print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>";
|
||||
}
|
||||
if (strlen($phone_code_override)>0)
|
||||
{
|
||||
print "<BR><BR>PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override<BR><BR>";
|
||||
}
|
||||
$buffer=rtrim(fgets($file, 4096));
|
||||
$buffer=stripslashes($buffer);
|
||||
$row=explode($delimiter, eregi_replace("[\'\"]", "", $buffer));
|
||||
@@ -1016,7 +1332,9 @@ if ($leadfile && filesize($LF_path)<=8388608) {
|
||||
|
||||
# echo "|$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file|";
|
||||
$dupcheckCLI=''; $postalgmtCLI='';
|
||||
if (eregi("DUP",$dupcheck)) {$dupcheckCLI='--duplicate-check';}
|
||||
if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';}
|
||||
if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';}
|
||||
if (eregi("DUPSYS",$dupcheck)) {$dupcheckCLI='--duplicate-system-check';}
|
||||
if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';}
|
||||
passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
|
||||
}
|
||||
@@ -1043,6 +1361,10 @@ if ($leadfile && filesize($LF_path)<=8388608) {
|
||||
{
|
||||
print "<BR><BR>LIST ID OVERRIDE FOR THIS FILE: $list_id_override<BR><BR>";
|
||||
}
|
||||
if (strlen($phone_code_override)>0)
|
||||
{
|
||||
print "<BR><BR>PHONE CODE OVERRIDE FOR THIS FILE: $phone_code_override<BR><BR>";
|
||||
}
|
||||
|
||||
$total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list='';
|
||||
$row=fgetcsv($file, 1000, ",");
|
||||
@@ -1102,6 +1424,7 @@ if ($leadfile && filesize($LF_path)<=8388608) {
|
||||
print " <input type=hidden name=postalgmt value=\"$postalgmt\">\r\n";
|
||||
print " <input type=hidden name=lead_file value=\"$lead_file\">\r\n";
|
||||
print " <input type=hidden name=list_id_override value=\"$list_id_override\">\r\n";
|
||||
print " <input type=hidden name=phone_code_override value=\"$phone_code_override\">\r\n";
|
||||
print " <th colspan=2><input type=submit name='OK_to_process' value='OK TO PROCESS'> <input type=button onClick=\"javascript:document.location='new_listloader_superL.php'\" value=\"START OVER\" name='reload_page'></th>\r\n";
|
||||
print " </tr>\r\n";
|
||||
print "</table>\r\n";
|
||||
|
||||
Reference in New Issue
Block a user