Added archived_lead option to multiple Non-Agent API functions

Updated 2FA doc

git-svn-id: svn://192.168.202.10@3772 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2023-11-09 20:06:50 +00:00
parent e4634ce1ff
commit 5c855f8bec
3 changed files with 56 additions and 36 deletions
@@ -1,26 +1,27 @@
2FA - TWO FACTOR AUTHENTICATION Updated: 2023-09-14 2FA - TWO FACTOR AUTHENTICATION Updated: 2023-11-09
This document covers the 2FA(Two-Factor-Authentication) features in VICIdial as This document covers the 2FA(Two-Factor-Authentication) features in VICIdial as
of admin.php build 210312-1239(svn/trunk revision 3373). of admin.php build 231109-0904(svn/trunk revision 3770).
What is 2FA (Two-Factor-Authentication)? What is 2FA (Two-Factor-Authentication)?
Two-Factor-Authentication adds a required second step to the admin web screen login process through a method other than a password, such as: an Email, Phone Call or Text-Message(SMS). This 2FA auth also lasts only a set amount of time(defined in System Settings[number of hours, from 1-9999 hours]), or until the user logs out. Currently, 2FA is not available or affected by agent screen logins. Two-Factor-Authentication adds a required second step to the admin web screen and/or agent web screen login process through a method other than a password, such as: an Email, Phone Call or Text-Message(SMS). This 2FA auth also lasts only a set amount of time(defined in System Settings[number of hours, from 1-9999 hours]), or until the user logs out in the case of the admin web screens. 2FA can be enabled for the admin web screens, the agent web screen or both.
To use 2FA on your system, you will need to have at least one of the following enabled on your VICIdial system: To use 2FA on your system, you will need to have AT LEAST ONE of the following enabled on your VICIdial system:
1. The ability for your webserver to send email through PHP 1. The ability for your webserver to send email through PHP
2. The ability to place phone calls from one of your dialers 2. The ability to place phone calls from one of your dialers
3. An SMS service that can send text messages by an HTTP or HTTPS API 3. An SMS service that can send text messages by an HTTP or HTTPS API
To enable and configure 2FA in VICIdial, there are two settings in the Admin -> System Settings web configuration page, and one override setting in the User Modify page: To enable and configure 2FA in VICIdial, there are three settings in the Admin -> System Settings web configuration page, and one override setting in the User Modify page:
SYSTEM SETTINGS: SYSTEM SETTINGS:
1. 2FA Auth Expire Hours - Must be set to a number higher than 0 to enable 1. Two-Factor Admin Auth Hours - Must be set to a number higher than 0 to enable for admin web users
2. 2FA Settings Container - Must be a valid 2FA_SETTINGS Container Type, with the following configuration options(example is below the field definitions): 2. Two-Factor Agent Auth Hours - Must be set to a number higher than 0 to enable for agent screen users
3. Two-Factor Auth Config Container - Must be a valid 2FA_SETTINGS Container Type, with the following configuration options(example is below the field definitions):
auth_code_expire_minutes = The number of minutes the Authorization code will be valid for, default is 30 minutes auth_code_expire_minutes = The number of minutes the Authorization code will be valid for, default is 30 minutes
auth_code_attempts = The number of attempts a person has to enter an auth code before their account is locked for 15 minutes, default is 10 auth_code_attempts = The number of attempts a person has to enter an auth code before their account is locked for 15 minutes, default is 10
+14 -2
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2023-03-08 NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2023-11-09
This document describes the functions of an API(Application Programming This document describes the functions of an API(Application Programming
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen. Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
@@ -206,6 +206,10 @@ Changes:
220920-0814 - Added more "XDAY" options to add_lead duplicate checks 220920-0814 - Added more "XDAY" options to add_lead duplicate checks
221108-1849 - Added include_ip option for agent_status function 221108-1849 - Added include_ip option for agent_status function
230122-1821 - Added reset_password option to update_user function 230122-1821 - Added reset_password option to update_user function
230308-1758 - Fix for update_lead list-restrict phone number update issue
230614-0828 - Added container_list function
230721-1753 - Added insert for daily RT monitoring
231109-0933 - Added archived_lead option to multiple functions
API Functions use the 'function' variable API Functions use the 'function' variable
@@ -542,6 +546,7 @@ stage - the format of the exported data: csv, tab, pipe(default)
header - include a header(YES) or not(NO). This is optional, default is not to include a header header - include a header(YES) or not(NO). This is optional, default is not to include a header
detail - (ALL) calls or only (LAST) call. default is (ALL) detail - (ALL) calls or only (LAST) call. default is (ALL)
type - (IN)inbound, (OUT)outbound or (ALL) calls. defauls is (OUT) calls type - (IN)inbound, (OUT)outbound or (ALL) calls. defauls is (OUT) calls
archived_lead - Y or N, Setting this to Y will query only the vicidial_list_archive leads for the leads details, default is N.
NOTES- NOTES-
There is a hard limit of 100000 results There is a hard limit of 100000 results
@@ -747,6 +752,7 @@ field_name - name of lead field to pull
OPTIONAL FIELDS- OPTIONAL FIELDS-
custom_fields - Y or N, default is N. If the field you want to pull is a custom field or not custom_fields - Y or N, default is N. If the field you want to pull is a custom field or not
list_id - override for the entry_list_id of a custom field list_id - override for the entry_list_id of a custom field
archived_lead - Y or N, Setting this to Y will query only the vicidial_list_archive leads for the leads details, default is N.
Example URL strings for API calls: Example URL strings for API calls:
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=lead_field_info&field_name=cc_value&lead_id=1139739&custom_fields=Y&list_id=999888999777 http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=lead_field_info&field_name=cc_value&lead_id=1139739&custom_fields=Y&list_id=999888999777
@@ -778,6 +784,7 @@ OPTIONAL FIELDS-
phone_number - 6-19 digits, can be used in place of a lead_id(may return multiple records, up to 1000, most recently added lead first) phone_number - 6-19 digits, can be used in place of a lead_id(may return multiple records, up to 1000, most recently added lead first)
custom_fields - Y or N, default is N. If the field you want to pull is a custom field or not custom_fields - Y or N, default is N. If the field you want to pull is a custom field or not
force_entry_list_id - 3-12 digits, will override the lead's assigned entry_list_id to look for custom fields data for this lead from a different list force_entry_list_id - 3-12 digits, will override the lead's assigned entry_list_id to look for custom fields data for this lead from a different list
archived_lead - Y or N, Setting this to Y will query only the vicidial_list_archive leads for the leads details, default is N.
SETTINGS FIELDS- SETTINGS FIELDS-
stage - the format of the exported data: csv, tab, newline, pipe(default) stage - the format of the exported data: csv, tab, newline, pipe(default)
@@ -817,6 +824,7 @@ OPTIONAL FIELDS-
lead_id - 1-10 digits, only used if status and date are empty lead_id - 1-10 digits, only used if status and date are empty
custom_fields - Y or N, default is N. Display custom fields values or not custom_fields - Y or N, default is N. Display custom fields values or not
list_id - override for the entry_list_id of a custom field list_id - override for the entry_list_id of a custom field
archived_lead - Y or N, Setting this to Y will query only the vicidial_list_archive leads for the leads search and details, default is N.
Example URL strings for API calls: Example URL strings for API calls:
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=lead_status_search&status=NP&date=2017-12-29&custom_fields=Y http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=lead_status_search&status=NP&date=2017-12-29&custom_fields=Y
@@ -856,6 +864,7 @@ source - description of what originated the API call (maximum 20 characters)
SETTINGS FIELDS- SETTINGS FIELDS-
records - number of records to display in results if more than 1 found (defaults to '1000'[most recently inserted leads displayed first]) records - number of records to display in results if more than 1 found (defaults to '1000'[most recently inserted leads displayed first])
archived_lead - Y or N, Setting this to Y will query only the vicidial_list_archive leads for the leads search and details, default is N.
SETTINGS FIELDS- SETTINGS FIELDS-
header - include a header(YES) or not(NO). This is optional, default is not to include a header header - include a header(YES) or not(NO). This is optional, default is not to include a header
@@ -1178,6 +1187,7 @@ remove_from_hopper - Y or N, default is N
hopper_priority - 99 to -99, the higher number the higher priority, default is 0 hopper_priority - 99 to -99, the higher number the higher priority, default is 0
hopper_local_call_time_check - Y or N, default is N. Validate the local call time and/or state call time before inserting lead in the hopper hopper_local_call_time_check - Y or N, default is N. Validate the local call time and/or state call time before inserting lead in the hopper
list_exists_check - Y or N, default is N. If the list_id_field is not a defined list in the system, it will ERROR and not update the lead. list_exists_check - Y or N, default is N. If the list_id_field is not a defined list in the system, it will ERROR and not update the lead.
archived_lead - Y or N, Setting this to Y will query only the vicidial_list_archive leads for the leads search, updates and details, default is N.
EDITABLE FIELDS- EDITABLE FIELDS-
user_field - 1-20 characters, this updates the 'user' field in the vicidial_list table user_field - 1-20 characters, this updates the 'user' field in the vicidial_list table
@@ -1301,6 +1311,7 @@ SETTINGS FIELDS-
list_exists_check - Y or N, default is N. If the list_id_field is not a defined list in the system, it will ERROR and not update the leads. list_exists_check - Y or N, default is N. If the list_id_field is not a defined list in the system, it will ERROR and not update the leads.
reset_lead - Y or N, Setting this to Y will reset the called-since-last-reset flag of the lead, default is N. reset_lead - Y or N, Setting this to Y will reset the called-since-last-reset flag of the lead, default is N.
records - maximum number of records to update (defaults to '100'[most recently created leads]) records - maximum number of records to update (defaults to '100'[most recently created leads])
archived_lead - Y or N, Setting this to Y will query only the vicidial_list_archive leads for the leads search, updates and details, default is N.
EDITABLE FIELDS- EDITABLE FIELDS-
user_field - 1-20 characters, this updates the 'user' field in the vicidial_list table user_field - 1-20 characters, this updates the 'user' field in the vicidial_list table
@@ -1854,6 +1865,7 @@ insert_if_not_found - Y or N, will attempt to insert as a new list if no match i
reset_list - Y or N, Setting this to Y will reset the Called-Since-Last-Reset flag for all of the leads in this list, default is N. reset_list - Y or N, Setting this to Y will reset the Called-Since-Last-Reset flag for all of the leads in this list, default is N.
delete_list - Y or N, Setting this to Y will delete the list from the vicidial_lists table, default is N. delete_list - Y or N, Setting this to Y will delete the list from the vicidial_lists table, default is N.
delete_leads - Y or N, Setting this to Y will delete all of the leads with this list_id from the vicidial_list table, default is N. delete_leads - Y or N, Setting this to Y will delete all of the leads with this list_id from the vicidial_list table, default is N.
archived_lead - Y or N, Setting this to Y will affect only the vicidial_list_archive leads, default is N.
EDITABLE FIELDS- EDITABLE FIELDS-
list_name - 6-30 characters list_name - 6-30 characters
@@ -1992,7 +2004,7 @@ leads_counts - Y or N, will include the counts of all leads and NEW status lead
dialable_count - Y or N, will use the list's campaign settings to provide a count of how many are dialable right now, default is 'N' dialable_count - Y or N, will use the list's campaign settings to provide a count of how many are dialable right now, default is 'N'
stage - the format of the exported data: csv, tab, pipe(default) stage - the format of the exported data: csv, tab, pipe(default)
header - include a header(YES) or not(NO). This is optional, default is not to include a header header - include a header(YES) or not(NO). This is optional, default is not to include a header
archived_lead - Y or N, Setting this to Y will query only the vicidial_list_archive leads for the leads count, default is N.
Example URL strings for API calls: Example URL strings for API calls:
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=list_info&list_id=1101&leads_counts=Y&header=YES http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=list_info&list_id=1101&leads_counts=Y&header=YES
+34 -27
View File
@@ -203,10 +203,11 @@
# 230308-1758 - Fix for update_lead list-restrict phone number update issue # 230308-1758 - Fix for update_lead list-restrict phone number update issue
# 230614-0828 - Added container_list function # 230614-0828 - Added container_list function
# 230721-1753 - Added insert for daily RT monitoring # 230721-1753 - Added insert for daily RT monitoring
# 231109-0933 - Added archived_lead option to multiple functions
# #
$version = '2.14-180'; $version = '2.14-181';
$build = '230721-1753'; $build = '231109-0933';
$php_script='non_agent_api.php'; $php_script='non_agent_api.php';
$api_url_log = 0; $api_url_log = 0;
@@ -716,6 +717,8 @@ if (isset($_GET["include_ip"])) {$include_ip=$_GET["include_ip"];}
elseif (isset($_POST["include_ip"])) {$include_ip=$_POST["include_ip"];} elseif (isset($_POST["include_ip"])) {$include_ip=$_POST["include_ip"];}
if (isset($_GET["reset_password"])) {$reset_password=$_GET["reset_password"];} if (isset($_GET["reset_password"])) {$reset_password=$_GET["reset_password"];}
elseif (isset($_POST["reset_password"])) {$reset_password=$_POST["reset_password"];} elseif (isset($_POST["reset_password"])) {$reset_password=$_POST["reset_password"];}
if (isset($_GET["archived_lead"])) {$archived_lead=$_GET["archived_lead"];}
elseif (isset($_POST["archived_lead"])) {$archived_lead=$_POST["archived_lead"];}
$DB=preg_replace('/[^0-9]/','',$DB); $DB=preg_replace('/[^0-9]/','',$DB);
@@ -871,6 +874,7 @@ $preset_dtmf = preg_replace('/[^- \,\*\#0-9a-zA-Z]/','',$preset_dtmf);
$action = preg_replace('/[^0-9a-zA-Z]/','',$action); $action = preg_replace('/[^0-9a-zA-Z]/','',$action);
$include_ip = preg_replace('/[^0-9a-zA-Z]/','',$include_ip); $include_ip = preg_replace('/[^0-9a-zA-Z]/','',$include_ip);
$reset_password = preg_replace('/[^0-9]/','',$reset_password); $reset_password = preg_replace('/[^0-9]/','',$reset_password);
$archived_lead = preg_replace('/[^0-9a-zA-Z]/','',$archived_lead);
if ($non_latin < 1) if ($non_latin < 1)
{ {
@@ -1258,6 +1262,9 @@ else
$LOCAL_GMT_OFF = $SERVER_GMT; $LOCAL_GMT_OFF = $SERVER_GMT;
$LOCAL_GMT_OFF_STD = $SERVER_GMT; $LOCAL_GMT_OFF_STD = $SERVER_GMT;
if ($archived_lead=="Y") {$vicidial_list_table="vicidial_list_archive";}
else {$vicidial_list_table="vicidial_list"; $archived_lead="N";}
@@ -6905,7 +6912,7 @@ if ($function == 'update_list')
$resets_today = ($resets_today + 1); $resets_today = ($resets_today + 1);
$stmtB="UPDATE vicidial_list SET called_since_last_reset='N' WHERE list_id='$list_id';"; $stmtB="UPDATE $vicidial_list_table SET called_since_last_reset='N' WHERE list_id='$list_id';";
$rslt=mysql_to_mysqli($stmtB, $link); $rslt=mysql_to_mysqli($stmtB, $link);
$affected_rowsB = mysqli_affected_rows($link); $affected_rowsB = mysqli_affected_rows($link);
if ($DB) {echo "|$stmtB|\n";} if ($DB) {echo "|$stmtB|\n";}
@@ -6993,7 +7000,7 @@ if ($function == 'update_list')
} }
else else
{ {
$stmt="DELETE FROM vicidial_list WHERE list_id='$list_id';"; $stmt="DELETE FROM $vicidial_list_table WHERE list_id='$list_id';";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$affected_rows = mysqli_affected_rows($link); $affected_rows = mysqli_affected_rows($link);
if ($DB) {echo "|$stmt|\n";} if ($DB) {echo "|$stmt|\n";}
@@ -7247,12 +7254,12 @@ if ($function == 'list_info')
if ($header == 'YES') if ($header == 'YES')
{$output .= $DL . 'all_leads_count' . $DL . 'new_leads_count';} {$output .= $DL . 'all_leads_count' . $DL . 'new_leads_count';}
$stmt="SELECT count(*) from vicidial_list where list_id='$list_id';"; $stmt="SELECT count(*) from $vicidial_list_table where list_id='$list_id';";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt); $row=mysqli_fetch_row($rslt);
$all_leads_count = $row[0]; $all_leads_count = $row[0];
$stmt="SELECT count(*) from vicidial_list where list_id='$list_id' and status='NEW';"; $stmt="SELECT count(*) from $vicidial_list_table where list_id='$list_id' and status='NEW';";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt); $row=mysqli_fetch_row($rslt);
$new_leads_count = $row[0]; $new_leads_count = $row[0];
@@ -11006,7 +11013,7 @@ if ($function == 'phone_number_log')
{ {
$DLlength_in_sec[$k]=0; $DLlength_in_sec[$k]=0;
$DLcloser_epoch[$k]=$DLepoch[$k]; $DLcloser_epoch[$k]=$DLepoch[$k];
$stmt="SELECT status,source_id from vicidial_list where lead_id='$DLlead_id[$p]';"; $stmt="SELECT status,source_id from $vicidial_list_table where lead_id='$DLlead_id[$p]';";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$vcl_recs = mysqli_num_rows($rslt); $vcl_recs = mysqli_num_rows($rslt);
if ($DB>0) {echo "DEBUG: phone_number_log list query - $vcl_recs|$stmt\n";} if ($DB>0) {echo "DEBUG: phone_number_log list query - $vcl_recs|$stmt\n";}
@@ -12875,7 +12882,7 @@ if ($function == 'lead_field_info')
$whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')"; $whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')";
} }
$stmt="SELECT list_id,entry_list_id from vicidial_list $lead_search_SQL;"; $stmt="SELECT list_id,entry_list_id from $vicidial_list_table $lead_search_SQL;";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
$lead_exists = mysqli_num_rows($rslt); $lead_exists = mysqli_num_rows($rslt);
@@ -12968,7 +12975,7 @@ if ($function == 'lead_field_info')
} }
else else
{ {
$stmt="SELECT $field_name from vicidial_list $lead_search_SQL;"; $stmt="SELECT $field_name from $vicidial_list_table $lead_search_SQL;";
} }
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
@@ -13026,7 +13033,7 @@ if ($function == 'lead_field_info')
{ {
$result = 'ERROR'; $result = 'ERROR';
$result_reason = "lead_field_info LIST NOT FOUND"; $result_reason = "lead_field_info LIST NOT FOUND";
$data = "$user|$lead_id"; $data = "$user|$lead_id|$lead_list_id";
echo "$result: $result_reason: $data\n"; echo "$result: $result_reason: $data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit; exit;
@@ -13144,7 +13151,7 @@ if ($function == 'lead_all_info')
if ($DLset < 1) if ($DLset < 1)
{$DL='|'; $stage='pipe';} {$DL='|'; $stage='pipe';}
$stmt="SELECT list_id,entry_list_id,lead_id from vicidial_list where $searchSQL order by lead_id desc limit 1000;"; $stmt="SELECT list_id,entry_list_id,lead_id from $vicidial_list_table where $searchSQL order by lead_id desc limit 1000;";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$lead_exists = mysqli_num_rows($rslt); $lead_exists = mysqli_num_rows($rslt);
if ($DB) {echo "$lead_exists|$stmt\n";} if ($DB) {echo "$lead_exists|$stmt\n";}
@@ -13312,7 +13319,7 @@ if ($function == 'lead_all_info')
$output .= 'status' . $DL . 'user' . $DL . 'vendor_lead_code' . $DL . 'source_id' . $DL . 'list_id' . $DL . 'gmt_offset_now' . $DL . 'phone_code' . $DL . 'phone_number' . $DL . 'title' . $DL . 'first_name' . $DL . 'middle_initial' . $DL . 'last_name' . $DL . 'address1' . $DL . 'address2' . $DL . 'address3' . $DL . 'city' . $DL . 'state' . $DL . 'province' . $DL . 'postal_code' . $DL . 'country_code' . $DL . 'gender' . $DL . 'date_of_birth' . $DL . 'alt_phone' . $DL . 'email' . $DL . 'security_phrase' . $DL . 'comments' . $DL . 'called_count' . $DL . 'last_local_call_time' . $DL . 'rank' . $DL . 'owner' . $DL . 'entry_list_id' . $DL . 'lead_id' . $CF_header_output . "\n"; $output .= 'status' . $DL . 'user' . $DL . 'vendor_lead_code' . $DL . 'source_id' . $DL . 'list_id' . $DL . 'gmt_offset_now' . $DL . 'phone_code' . $DL . 'phone_number' . $DL . 'title' . $DL . 'first_name' . $DL . 'middle_initial' . $DL . 'last_name' . $DL . 'address1' . $DL . 'address2' . $DL . 'address3' . $DL . 'city' . $DL . 'state' . $DL . 'province' . $DL . 'postal_code' . $DL . 'country_code' . $DL . 'gender' . $DL . 'date_of_birth' . $DL . 'alt_phone' . $DL . 'email' . $DL . 'security_phrase' . $DL . 'comments' . $DL . 'called_count' . $DL . 'last_local_call_time' . $DL . 'rank' . $DL . 'owner' . $DL . 'entry_list_id' . $DL . 'lead_id' . $CF_header_output . "\n";
} }
$stmt="SELECT status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,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,entry_list_id from vicidial_list where lead_id='$lead_lead_id';"; $stmt="SELECT status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,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,entry_list_id from $vicidial_list_table where lead_id='$lead_lead_id';";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
$standard_field_exists = mysqli_num_rows($rslt); $standard_field_exists = mysqli_num_rows($rslt);
@@ -13556,7 +13563,7 @@ if ($function == 'lead_status_search')
$output=''; $output='';
while ($leads_exist > $i) while ($leads_exist > $i)
{ {
$stmt="SELECT status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,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,entry_list_id from vicidial_list where lead_id='$export_lead_id[$i]';"; $stmt="SELECT status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,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,entry_list_id from $vicidial_list_table where lead_id='$export_lead_id[$i]';";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";} if ($DB) {echo "$stmt\n";}
$lead_to_list = mysqli_num_rows($rslt); $lead_to_list = mysqli_num_rows($rslt);
@@ -13997,7 +14004,7 @@ if ($function == 'lead_search')
$search_phone_code=array(); $search_phone_code=array();
if ($find_lead_id > 0) # search for the lead_id if ($find_lead_id > 0) # search for the lead_id
{ {
$stmt="SELECT lead_id,list_id,entry_list_id,phone_number,phone_code from vicidial_list where $lead_id_SQL $search_SQL order by lead_id desc limit $records;"; $stmt="SELECT lead_id,list_id,entry_list_id,phone_number,phone_code from $vicidial_list_table where $lead_id_SQL $search_SQL order by lead_id desc limit $records;";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$pc_recs = mysqli_num_rows($rslt); $pc_recs = mysqli_num_rows($rslt);
if ($DB>0) {echo "DEBUG: Checking for lead_id - $lead_id|$pc_recs|$stmt|\n";} if ($DB>0) {echo "DEBUG: Checking for lead_id - $lead_id|$pc_recs|$stmt|\n";}
@@ -14019,7 +14026,7 @@ if ($function == 'lead_search')
} }
if ( ($find_vendor_lead_code > 0) and ($search_found < 1) ) # search for the vendor_lead_code if ( ($find_vendor_lead_code > 0) and ($search_found < 1) ) # search for the vendor_lead_code
{ {
$stmt="SELECT lead_id,list_id,entry_list_id,phone_number,phone_code,vendor_lead_code from vicidial_list where $vendor_lead_code_SQL $search_SQL order by lead_id desc limit $records;"; $stmt="SELECT lead_id,list_id,entry_list_id,phone_number,phone_code,vendor_lead_code from $vicidial_list_table where $vendor_lead_code_SQL $search_SQL order by lead_id desc limit $records;";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$pc_recs = mysqli_num_rows($rslt); $pc_recs = mysqli_num_rows($rslt);
if ($DB>0) {echo "DEBUG: Checking for vendor_lead_code - $vendor_lead_code|$pc_recs|$stmt|\n";} if ($DB>0) {echo "DEBUG: Checking for vendor_lead_code - $vendor_lead_code|$pc_recs|$stmt|\n";}
@@ -14041,7 +14048,7 @@ if ($function == 'lead_search')
} }
if ( ($find_phone_number > 0) and ($search_found < 1) ) # search for the phone_number if ( ($find_phone_number > 0) and ($search_found < 1) ) # search for the phone_number
{ {
$stmt="SELECT lead_id,list_id,entry_list_id,phone_number,phone_code from vicidial_list where $phone_number_SQL $search_SQL order by lead_id desc limit $records;"; $stmt="SELECT lead_id,list_id,entry_list_id,phone_number,phone_code from $vicidial_list_table where $phone_number_SQL $search_SQL order by lead_id desc limit $records;";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$pc_recs = mysqli_num_rows($rslt); $pc_recs = mysqli_num_rows($rslt);
if ($DB>0) {echo "DEBUG: Checking for phone_number - $phone_number|$pc_recs|$stmt|\n";} if ($DB>0) {echo "DEBUG: Checking for phone_number - $phone_number|$pc_recs|$stmt|\n";}
@@ -15297,7 +15304,7 @@ if ($function == 'update_lead')
if ($find_lead_id > 0) # search for the lead_id if ($find_lead_id > 0) # search for the lead_id
{ {
if ($DB>0) {echo "DEBUG: Checking for lead_id - $lead_id\n";} if ($DB>0) {echo "DEBUG: Checking for lead_id - $lead_id\n";}
$stmt="SELECT lead_id,list_id,entry_list_id from vicidial_list where $lead_id_SQL $search_SQL order by entry_date desc limit $records;"; $stmt="SELECT lead_id,list_id,entry_list_id from $vicidial_list_table where $lead_id_SQL $search_SQL order by entry_date desc limit $records;";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$pc_recs = mysqli_num_rows($rslt); $pc_recs = mysqli_num_rows($rslt);
$n=0; $n=0;
@@ -15319,7 +15326,7 @@ if ($function == 'update_lead')
if ( ($find_vendor_lead_code > 0) and ($search_found < 1) ) # search for the vendor_lead_code if ( ($find_vendor_lead_code > 0) and ($search_found < 1) ) # search for the vendor_lead_code
{ {
if ($DB>0) {echo "DEBUG: Checking for vendor_lead_code - $vendor_lead_code\n";} if ($DB>0) {echo "DEBUG: Checking for vendor_lead_code - $vendor_lead_code\n";}
$stmt="SELECT lead_id,list_id,entry_list_id from vicidial_list where $vendor_lead_code_SQL $search_SQL order by entry_date desc limit $records;"; $stmt="SELECT lead_id,list_id,entry_list_id from $vicidial_list_table where $vendor_lead_code_SQL $search_SQL order by entry_date desc limit $records;";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$pc_recs = mysqli_num_rows($rslt); $pc_recs = mysqli_num_rows($rslt);
$n=0; $n=0;
@@ -15338,7 +15345,7 @@ if ($function == 'update_lead')
if ( ($find_phone_number > 0) and ($search_found < 1) ) # search for the phone_number if ( ($find_phone_number > 0) and ($search_found < 1) ) # search for the phone_number
{ {
if ($DB>0) {echo "DEBUG: Checking for phone_number - $phone_number\n";} if ($DB>0) {echo "DEBUG: Checking for phone_number - $phone_number\n";}
$stmt="SELECT lead_id,list_id,entry_list_id from vicidial_list where $phone_number_SQL $search_SQL order by entry_date desc limit $records;"; $stmt="SELECT lead_id,list_id,entry_list_id from $vicidial_list_table where $phone_number_SQL $search_SQL order by entry_date desc limit $records;";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$pc_recs = mysqli_num_rows($rslt); $pc_recs = mysqli_num_rows($rslt);
$n=0; $n=0;
@@ -15462,7 +15469,7 @@ if ($function == 'update_lead')
$VCFaffected_rows = mysqli_affected_rows($link); $VCFaffected_rows = mysqli_affected_rows($link);
} }
$stmt = "UPDATE vicidial_list SET entry_list_id=0 where lead_id='$search_lead_id[$n]';"; $stmt = "UPDATE $vicidial_list_table SET entry_list_id=0 where lead_id='$search_lead_id[$n]';";
$result_reason = "update_lead CUSTOM FIELDS DATA HAS BEEN DELETED"; $result_reason = "update_lead CUSTOM FIELDS DATA HAS BEEN DELETED";
if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";} if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
@@ -15478,7 +15485,7 @@ if ($function == 'update_lead')
{ {
if (strlen($VL_update_SQL)>6) if (strlen($VL_update_SQL)>6)
{ {
$stmt = "UPDATE vicidial_list SET $VL_update_SQL where lead_id='$search_lead_id[$n]';"; $stmt = "UPDATE $vicidial_list_table SET $VL_update_SQL where lead_id='$search_lead_id[$n]';";
$result_reason = "update_lead LEAD HAS BEEN UPDATED"; $result_reason = "update_lead LEAD HAS BEEN UPDATED";
} }
if ($delete_lead=='Y') if ($delete_lead=='Y')
@@ -15493,7 +15500,7 @@ if ($function == 'update_lead')
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$VCBaffected_rows = mysqli_affected_rows($link); $VCBaffected_rows = mysqli_affected_rows($link);
$stmt = "DELETE from vicidial_list where lead_id='$search_lead_id[$n]';"; $stmt = "DELETE from $vicidial_list_table where lead_id='$search_lead_id[$n]';";
$result_reason = "update_lead LEAD HAS BEEN DELETED $VCBaffected_rows|$VCBAaffected_rows"; $result_reason = "update_lead LEAD HAS BEEN DELETED $VCBaffected_rows|$VCBAaffected_rows";
} }
if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";} if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";}
@@ -15800,7 +15807,7 @@ if ($function == 'update_lead')
if ($custom_update_count > 0) if ($custom_update_count > 0)
{ {
$list_table_update_SQL = "UPDATE vicidial_list SET entry_list_id='$lead_custom_list' where lead_id='$search_lead_id[$n]';"; $list_table_update_SQL = "UPDATE $vicidial_list_table SET entry_list_id='$lead_custom_list' where lead_id='$search_lead_id[$n]';";
$rslt=mysql_to_mysqli($list_table_update_SQL, $link); $rslt=mysql_to_mysqli($list_table_update_SQL, $link);
$list_update_count = mysqli_affected_rows($link); $list_update_count = mysqli_affected_rows($link);
if ($DB) {echo "$list_update_count|$list_table_update_SQL\n";} if ($DB) {echo "$list_update_count|$list_table_update_SQL\n";}
@@ -16012,7 +16019,7 @@ if ($function == 'update_lead')
if ($custom_insert_count > 0) if ($custom_insert_count > 0)
{ {
# Update vicidial_list entry to put list_id as entry_list_id # Update vicidial_list entry to put list_id as entry_list_id
$vl_table_entry_update_SQL = "UPDATE vicidial_list SET entry_list_id='$temp_entry_list_id' where lead_id='$lead_id';"; $vl_table_entry_update_SQL = "UPDATE $vicidial_list_table SET entry_list_id='$temp_entry_list_id' where lead_id='$lead_id';";
$rslt=mysql_to_mysqli($vl_table_entry_update_SQL, $link); $rslt=mysql_to_mysqli($vl_table_entry_update_SQL, $link);
$vl_table_entry_update_count = mysqli_affected_rows($link); $vl_table_entry_update_count = mysqli_affected_rows($link);
@@ -16089,7 +16096,7 @@ if ($function == 'update_lead')
if ( ($list_local_call_time!='') and (!preg_match("/^campaign$/i",$list_local_call_time)) ) if ( ($list_local_call_time!='') and (!preg_match("/^campaign$/i",$list_local_call_time)) )
{$local_call_time = $list_local_call_time;} {$local_call_time = $list_local_call_time;}
$stmt="SELECT state,vendor_lead_code,gmt_offset_now from vicidial_list where lead_id='$lead_id';"; $stmt="SELECT state,vendor_lead_code,gmt_offset_now from $vicidial_list_table where lead_id='$lead_id';";
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$ulhi_recs = mysqli_num_rows($rslt); $ulhi_recs = mysqli_num_rows($rslt);
if ($ulhi_recs > 0) if ($ulhi_recs > 0)
@@ -16313,7 +16320,7 @@ if ($function == 'batch_update_lead')
{ {
if (strlen($allowed_listsSQL) > 3) if (strlen($allowed_listsSQL) > 3)
{$allowed_listsSQL = "and list_id IN($allowed_listsSQL)";} {$allowed_listsSQL = "and list_id IN($allowed_listsSQL)";}
$stmt="SELECT lead_id from vicidial_list where $lead_ids_SQL $allowed_listsSQL order by lead_id desc limit $records;"; $stmt="SELECT lead_id from $vicidial_list_table where $lead_ids_SQL $allowed_listsSQL order by lead_id desc limit $records;";
if ($DB>0) {echo "DEBUG: Checking for lead_ids - $lead_ids |$stmt|\n";} if ($DB>0) {echo "DEBUG: Checking for lead_ids - $lead_ids |$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link); $rslt=mysql_to_mysqli($stmt, $link);
$pc_recs = mysqli_num_rows($rslt); $pc_recs = mysqli_num_rows($rslt);
@@ -16371,7 +16378,7 @@ if ($function == 'batch_update_lead')
if (strlen($VL_update_SQL)>6) if (strlen($VL_update_SQL)>6)
{ {
$stmt = "UPDATE vicidial_list SET $VL_update_SQL where lead_id IN($found_lead_ids);"; $stmt = "UPDATE $vicidial_list_table SET $VL_update_SQL where lead_id IN($found_lead_ids);";
$result_reason = "batch_update_lead LEADS HAVE BEEN UPDATED"; $result_reason = "batch_update_lead LEADS HAVE BEEN UPDATED";
if ($DB>0) {echo "DEBUG: batch_update_lead query - $stmt\n";} if ($DB>0) {echo "DEBUG: batch_update_lead query - $stmt\n";}