Allow for single quotes in vicidial_list and custom_ data fields
Added db schema version mismatch warning in System Settings git-svn-id: svn://192.168.202.10@2301 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
+14
-13
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# AST_VDhopper.pl version 2.10
|
||||
# AST_VDhopper.pl version 2.12
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Updates the VICIDIAL leads hopper for the streamlined approach of allocating
|
||||
@@ -83,10 +83,11 @@
|
||||
# 150111-1546 - Added lists option: local call time and enabled whole-campaign outbound call time holidays, Issue #812
|
||||
# 150114-1204 - Optimization of gmt code, Issue #812
|
||||
# 150117-1415 - Added list local call time validation
|
||||
# 150312-1459 - Allow for single quotes in data fields without crashing
|
||||
#
|
||||
|
||||
# constants
|
||||
$build = '150117-1415';
|
||||
$build = '150312-1459';
|
||||
$DB=0; # Debug flag, set to 0 for no debug messages. Can be overriden with CLI --debug flag
|
||||
$US='__';
|
||||
$MT[0]='';
|
||||
@@ -514,7 +515,7 @@ if ($CBHOLD_count > 0)
|
||||
$event_string = "|CALLBACKS LISTACT|$affected_rows|";
|
||||
&event_logger;
|
||||
|
||||
$stmtA = "INSERT INTO $vicidial_hopper SET lead_id='$CA_lead_id[$CAu]',campaign_id='$CA_campaign_id[$CAu]',list_id='$CA_list_id[$CAu]',gmt_offset_now='$CA_gmt_offset_now[$CAu]',user='',state='$CA_state[$CAu]',priority='50',source='C',vendor_lead_code='$CA_vendor_lead_code[$cba]';";
|
||||
$stmtA = "INSERT INTO $vicidial_hopper SET lead_id='$CA_lead_id[$CAu]',campaign_id='$CA_campaign_id[$CAu]',list_id='$CA_list_id[$CAu]',gmt_offset_now='$CA_gmt_offset_now[$CAu]',user='',state='$CA_state[$CAu]',priority='50',source='C',vendor_lead_code=\"$CA_vendor_lead_code[$cba]\";";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($DB) {print "ANYONE Scheduled Callback Inserted into hopper: $affected_rows|$CA_lead_id[$CAu]\n";}
|
||||
$CAu++;
|
||||
@@ -1100,7 +1101,7 @@ if ($ANY_hopper_vlc_dup_check =~ /Y/)
|
||||
{
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
if ( (length($aryA[0]) > 0) && ($aryA[0] !~ /^NULL/) )
|
||||
{$live_vlc .= "'$aryA[0]',";}
|
||||
{$live_vlc .= "\"$aryA[0]\",";}
|
||||
$vlLIVE++;
|
||||
}
|
||||
$sthA->finish();
|
||||
@@ -2539,12 +2540,12 @@ foreach(@campaign_id)
|
||||
@aryA = $sthA->fetchrow_array;
|
||||
$lead_id_lists .= "'$aryA[0]',";
|
||||
if (length($aryA[1]) > 0)
|
||||
{$vlc_lists .= "'$aryA[1]',";}
|
||||
{$vlc_lists .= "\"$aryA[1]\",";}
|
||||
$rec_countLISTS++;
|
||||
}
|
||||
$sthA->finish();
|
||||
$lead_id_lists .= "'0'";
|
||||
$vlc_lists .= "'--99999999987654321--'";
|
||||
$vlc_lists .= "\"--99999999987654321--\"";
|
||||
$order_stmt='';
|
||||
$NEW_count = 0;
|
||||
$NEW_level = 0;
|
||||
@@ -2627,7 +2628,7 @@ foreach(@campaign_id)
|
||||
$REC_rec_countLEADS++;
|
||||
|
||||
if (length($aryA[8]) > 0)
|
||||
{$vlc_lists .= ",'$aryA[8]'";}
|
||||
{$vlc_lists .= ",\"$aryA[8]\"";}
|
||||
}
|
||||
$sthA->finish();
|
||||
}
|
||||
@@ -2681,7 +2682,7 @@ foreach(@campaign_id)
|
||||
$NEW_rec_countLEADS++;
|
||||
|
||||
if (length($aryA[8]) > 0)
|
||||
{$vlc_lists .= ",'$aryA[8]'";}
|
||||
{$vlc_lists .= ",\"$aryA[8]\"";}
|
||||
}
|
||||
$OTHER_level = ($hopper_level[$i] - $NEW_rec_countLEADS);
|
||||
$sthA->finish();
|
||||
@@ -2775,7 +2776,7 @@ foreach(@campaign_id)
|
||||
$rec_count++;
|
||||
|
||||
if (length($aryA[8]) > 0)
|
||||
{$vlc_lists .= ",'$aryA[8]'";}
|
||||
{$vlc_lists .= ",\"$aryA[8]\"";}
|
||||
}
|
||||
$sthA->finish();
|
||||
}
|
||||
@@ -2886,7 +2887,7 @@ foreach(@campaign_id)
|
||||
$w++;
|
||||
|
||||
if (length($aryA[9]) > 0)
|
||||
{$vlc_lists .= ",'$aryA[9]'";}
|
||||
{$vlc_lists .= ",\"$aryA[9]\"";}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3006,7 +3007,7 @@ foreach(@campaign_id)
|
||||
$VLC_exist=0;
|
||||
if ( ($hopper_vlc_dup_check[$i] =~ /Y/) && (length($vlc_to_hopper[$h]) > 0) )
|
||||
{
|
||||
$stmtA="SELECT count(*) FROM $vicidial_hopper where vendor_lead_code='$vlc_to_hopper[$h]';";
|
||||
$stmtA="SELECT count(*) FROM $vicidial_hopper where vendor_lead_code=\"$vlc_to_hopper[$h]\";";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -3034,7 +3035,7 @@ foreach(@campaign_id)
|
||||
{
|
||||
if ($DNClead == '0')
|
||||
{
|
||||
$stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source,vendor_lead_code) values('$leads_to_hopper[$h]','$campaign_id[$i]','READY','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0','$source_to_hopper[$h]','$vlc_to_hopper[$h]');";
|
||||
$stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source,vendor_lead_code) values('$leads_to_hopper[$h]','$campaign_id[$i]','READY','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0','$source_to_hopper[$h]',\"$vlc_to_hopper[$h]\");";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($DBX) {print "LEAD INSERTED: $affected_rows|$leads_to_hopper[$h]|\n";}
|
||||
if ($DB_detail)
|
||||
@@ -3048,7 +3049,7 @@ foreach(@campaign_id)
|
||||
##### Auto-Alt-Dial if DNCC or DNCL are set to campaign auto-alt-dial statuses, insert lead into hopper as DNC status
|
||||
if ( ( ($auto_alt_dial_statuses[$i] =~ / DNCC /) && ($DNCC > 0) ) || ( ($auto_alt_dial_statuses[$i] =~ / DNCL /) && ($DNCL > 0) ) )
|
||||
{
|
||||
$stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source,vendor_lead_code) values('$leads_to_hopper[$h]','$campaign_id[$i]','DNC','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0','$source_to_hopper[$h]','$vlc_to_hopper[$h]');";
|
||||
$stmtA = "INSERT INTO $vicidial_hopper (lead_id,campaign_id,status,user,list_id,gmt_offset_now,state,priority,source,vendor_lead_code) values('$leads_to_hopper[$h]','$campaign_id[$i]','DNC','','$lists_to_hopper[$h]','$gmt_to_hopper[$h]','$state_to_hopper[$h]','0','$source_to_hopper[$h]',\"$vlc_to_hopper[$h]\");";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($DBX) {print "LEAD INSERTED AS DNC: $affected_rows|$leads_to_hopper[$h]|\n";}
|
||||
if ($DB_detail)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/perl
|
||||
#
|
||||
# VICIDIAL_IN_new_leads_file.pl version 2.6
|
||||
# VICIDIAL_IN_new_leads_file.pl version 2.12
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# script lets you insert leads into the vicidial_list table from a TAB-delimited
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# NOTE: the machine this is run on must have a servers entry in the database
|
||||
#
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# CHANGES
|
||||
@@ -57,9 +57,10 @@
|
||||
# 120907-1109 - Added vote17csv format
|
||||
# 121005-0728 - Added twotab format
|
||||
# 130419-2138 - Added --NANPA-ac-prefix-check and --nanpa-gmt options using add-on NANPA prefix database
|
||||
# 150312-1458 - Allow single quotes in standard formats
|
||||
#
|
||||
|
||||
$version = '130419-2138';
|
||||
$version = '150312-1458';
|
||||
|
||||
$secX = time();
|
||||
$MT[0]='';
|
||||
@@ -759,8 +760,7 @@ foreach(@FILES)
|
||||
chomp($number);
|
||||
# $number =~ s/,/\|/gi;
|
||||
$number =~ s/\t/\|/gi;
|
||||
$number =~ s/\'|\t|\r|\n|\l//gi;
|
||||
$number =~ s/\'|\t|\r|\n|\l//gi;
|
||||
$number =~ s/|\t|\r|\n|\l//gi;
|
||||
$number =~ s/\",,,,,,,\"/\|\|\|\|\|\|\|/gi;
|
||||
$number =~ s/\",,,,,,\"/\|\|\|\|\|\|/gi;
|
||||
$number =~ s/\",,,,,\"/\|\|\|\|\|/gi;
|
||||
@@ -1179,7 +1179,6 @@ foreach(@FILES)
|
||||
$number =~ s/,"0"//gi;
|
||||
$number =~ s/\t/\|/gi;
|
||||
$number =~ s/\'|\t|\r|\n|\l//gi;
|
||||
$number =~ s/\'|\t|\r|\n|\l//gi;
|
||||
$number =~ s/\",,,,,,,\"/\|\|\|\|\|\|\|/gi;
|
||||
$number =~ s/\",,,,,,\"/\|\|\|\|\|\|/gi;
|
||||
$number =~ s/\",,,,,\"/\|\|\|\|\|/gi;
|
||||
@@ -2347,7 +2346,7 @@ foreach(@FILES)
|
||||
|
||||
if ($map_count > 0)
|
||||
{
|
||||
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values('','$insert_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','$called_count','2008-01-01 00:00:00','$rank','$owner');";
|
||||
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values('',\"$insert_date\",\"$modify_date\",\"$status\",\"$user\",\"$vendor_lead_code\",\"$source_id\",\"$list_id\",\"$gmt_offset\",\"$called_since_last_reset\",\"$phone_code\",\"$phone_number\",\"$title\",\"$first_name\",\"$middle_initial\",\"$last_name\",\"$address1\",\"$address2\",\"$address3\",\"$city\",\"$state\",\"$province\",\"$postal_code\",\"$country\",\"$gender\",\"$date_of_birth\",\"$alt_phone\",\"$email\",\"$security_phrase\",\"$comments\",\"$called_count\",'2008-01-01 00:00:00',\"$rank\",\"$owner\");";
|
||||
if (!$T) {$affected_rows = $dbhA->do($stmtZ); } # or die "Couldn't execute query: |$stmtZ|\n";
|
||||
$lead_id = $dbhA->{'mysql_insertid'};
|
||||
if($DB){print STDERR "\n|$affected_rows|$stmtZ|\n";}
|
||||
@@ -2369,7 +2368,7 @@ foreach(@FILES)
|
||||
if ($multi_insert_counter > 8)
|
||||
{
|
||||
### insert good lead into pending_transactions table ###
|
||||
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$insert_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','$called_count','2008-01-01 00:00:00','$rank','$owner');";
|
||||
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('',\"$insert_date\",\"$modify_date\",\"$status\",\"$user\",\"$vendor_lead_code\",\"$source_id\",\"$list_id\",\"$gmt_offset\",\"$called_since_last_reset\",\"$phone_code\",\"$phone_number\",\"$title\",\"$first_name\",\"$middle_initial\",\"$last_name\",\"$address1\",\"$address2\",\"$address3\",\"$city\",\"$state\",\"$province\",\"$postal_code\",\"$country\",\"$gender\",\"$date_of_birth\",\"$alt_phone\",\"$email\",\"$security_phrase\",\"$comments\",\"$called_count\",'2008-01-01 00:00:00',\"$rank\",\"$owner\");";
|
||||
if (!$T) {$affected_rows = $dbhA->do($stmtZ); } # or die "Couldn't execute query: |$stmtZ|\n";
|
||||
if($DB){print STDERR "\n|$affected_rows|$stmtZ|\n";}
|
||||
|
||||
@@ -2379,7 +2378,7 @@ foreach(@FILES)
|
||||
}
|
||||
else
|
||||
{
|
||||
$multistmt .= "('','$insert_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments','$called_count','2008-01-01 00:00:00','$rank','$owner'),";
|
||||
$multistmt .= "('',\"$insert_date\",\"$modify_date\",\"$status\",\"$user\",\"$vendor_lead_code\",\"$source_id\",\"$list_id\",\"$gmt_offset\",\"$called_since_last_reset\",\"$phone_code\",\"$phone_number\",\"$title\",\"$first_name\",\"$middle_initial\",\"$last_name\",\"$address1\",\"$address2\",\"$address3\",\"$city\",\"$state\",\"$province\",\"$postal_code\",\"$country\",\"$gender\",\"$date_of_birth\",\"$alt_phone\",\"$email\",\"$security_phrase\",\"$comments\",\"$called_count\",'2008-01-01 00:00:00',\"$rank\",\"$owner\"),";
|
||||
$multi_insert_counter++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user