Added lead_all_info Non-Agent API function

Changed admin_modify_lead.php page links to javascript because of Chrome

git-svn-id: svn://192.168.202.10@3386 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2021-03-17 14:39:16 +00:00
parent 88a7a56372
commit 794556fe53
7 changed files with 420 additions and 34 deletions
+41 -5
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2021-03-03
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2021-03-16
This document describes the functions of an API(Application Programming
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
@@ -41,6 +41,10 @@ in_group_status - real-time status of one or more in groups
agent_status - real-time status of one user
callid_info - information about a call based upon the caller_code or call ID
lead_field_info - pulls the value of one field of a lead
lead_callback_info - outputs scheduled callback data for a specific lead
lead_all_info - outputs all lead data for a lead(optionally including custom fields)
lead_status_search - displays all field values of all leads that match the status and call date in request
ccc_lead_info - outputs lead data for cross-cluster-communication call
server_refresh - forces a conf file refresh on all telco servers in the cluster
check_phone_number - allows you to check if a phone number is valid and dialable
logged_in_agents - list of agents that are logged in to the system
@@ -48,11 +52,8 @@ update_campaign - updates campaign settings in the system
add_did - adds new Inbound DID entries to the system
update_did - updates Inbound DID information in the system
phone_number_log - exports list of calls placed to one of more phone numbers
ccc_lead_info - outputs lead data for cross-cluster-communication call
lead_status_search - displays all field values of all leads that match the status and call date in request
call_status_stats - report on number of calls made by campaign and ingroup, with hourly and status breakdowns
call_dispo_report - call disposition breakdown report
lead_callback_info - outputs scheduled callback data for a specific lead
agent_campaigns - looks up allowed campaigns/in-groups for a specific user
update_cid_group_entry - updates CID Group entries
add_dnc_phone - adds a phone number to one of the DNC lists
@@ -176,7 +177,7 @@ Changes:
210217-1454 - Added menu_id option for add_did and update_did functions
210227-1116 - Added xferconf number options to update_campaign, add_list & update_list functions
210303-1802 - Added list_exists_check option for update_lead function
210316-2207 - Added lead_all_info function
API Functions use the 'function' variable
@@ -733,6 +734,41 @@ A SUCCESS response will not show "SUCCESS", but instead will just print the valu
--------------------------------------------------------------------------------
lead_all_info - outputs all lead data for a lead(optionally including custom fields)
NOTE: api user for this function must have user_level set to 7 or higher and "view reports" enabled and modify_leads set to 1-4
REQUIRED FIELDS-
source - description of what originated the API call (maximum 20 characters)
lead_id - 1-10 digits
OPTIONAL FIELDS-
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
SETTINGS FIELDS-
stage - the format of the exported data: csv, tab, newline, pipe(default)
header - include a header(YES) or not(NO). This is optional, default is not to include a header
Example URL strings for API calls:
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=lead_all_info&lead_id=1079425
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=lead_all_info&lead_id=1079425&header=YES&custom_fields=Y
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=lead_all_info&lead_id=1079425&header=YES&custom_fields=Y&force_entry_list_id=999880
Example responses:
ERROR: lead_all_info USER DOES NOT HAVE PERMISSION TO GET LEAD INFO - 6666|0
ERROR: lead_all_info LIST NOT FOUND - 6666||
ERROR: lead_all_info LEAD NOT FOUND - 6666||
A SUCCESS response will not show "SUCCESS", but instead will just print the results in the following format:
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
TD|6666|554443||501|-4.00|1|9998887112|Mr|Billy'Oj|U|O'Reillyo|ad1|ad2|ad3|city next|FL|U|33777||U|0000-00-00|bobo'brien|test@test.com||2017-06-01 18:38:41|79|2017-06-09 14:53:27|0|4646|0
--------------------------------------------------------------------------------
lead_status_search - displays all field values of all leads that match the status and call date in request
+7 -5
View File
@@ -129,7 +129,7 @@ $UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summa
$Vtables = 'NONE,log_noanswer,did_agent_log,contact_information';
$APIfunctions = 'ALL_FUNCTIONS add_group_alias add_lead add_list add_phone add_phone_alias add_user agent_ingroup_info agent_stats_export agent_status audio_playback blind_monitor call_agent callid_info change_ingroups check_phone_number copy_user did_log_export external_add_lead external_dial external_hangup external_pause external_status in_group_status logout moh_list park_call pause_code preview_dial_action ra_call_control recording recording_lookup send_dtmf server_refresh set_timer_action sounds_list st_get_agent_active_lead st_login_log transfer_conference update_fields update_lead update_list list_info list_custom_fields update_log_entry update_phone update_phone_alias update_user user_group_status vm_list webphone_url webserver logged_in_agents update_campaign add_did update_did lead_field_info phone_number_log switch_lead ccc_lead_info lead_status_search call_status_stats calls_in_queue_count force_fronter_leave_3way force_fronter_audio_stop update_cid_group_entry add_dnc_phone add_fpg_phone';
$APIfunctions = 'ALL_FUNCTIONS add_group_alias add_lead add_list add_phone add_phone_alias add_user agent_ingroup_info agent_stats_export agent_status audio_playback blind_monitor call_agent callid_info change_ingroups check_phone_number copy_user did_log_export external_add_lead external_dial external_hangup external_pause external_status in_group_status logout moh_list park_call pause_code preview_dial_action ra_call_control recording recording_lookup send_dtmf server_refresh set_timer_action sounds_list st_get_agent_active_lead st_login_log transfer_conference update_fields update_lead update_list list_info list_custom_fields update_log_entry update_phone update_phone_alias update_user user_group_status vm_list webphone_url webserver logged_in_agents update_campaign add_did update_did lead_field_info lead_all_info phone_number_log switch_lead ccc_lead_info lead_status_search call_status_stats calls_in_queue_count force_fronter_leave_3way force_fronter_audio_stop update_cid_group_entry add_dnc_phone add_fpg_phone';
$browser_alert_sounds_list = 'bark_dog,beep_double,beep_five,beep_up,bell_double,bell_school,bird,blaster1,blaster2,buzz1,buzz2,cash_register,chat_alert,close_encounter,confirmation,ding,droplet,droplet_double,elephant,email_alert,hold_tone,horn_bike,horn_car,horn_car_triple,horn_clown,horn_double,horn_train,meow_cat,scream_wilhelm,silence_quick,siren,slide_down,slide_up,swish,teleport1,teleport2,whip,whoosh,xylophone1,xylophone2,xylophone3,xylophone4';
@@ -5536,12 +5536,13 @@ if ($SSscript_remove_js > 0)
# 210315-1730 - Added clear_form campaign option, Issue #1179
# 210315-2118 - Added new manual_dial_filter CALLBACK options, Issue #1139
# 210316-0923 - Small fix for 2FA consistency
# 210317-0819 - Added lead_all_info Non-Agent API function, Changed lead-modify page links to javascript because of Chrome
#
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time
$admin_version = '2.14-800a';
$build = '210316-0923';
$admin_version = '2.14-801a';
$build = '210317-0819';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -41646,7 +41647,7 @@ if ($ADD==82)
else
{$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';}
echo "<tr $bgcolor>";
echo "<td><font size=1><A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" target=\"_blank\">$row[1]</A></td>";
echo "<td><font size=1><A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[1]', '_blank');return false;\">$row[1]</A></font></td>\n";
echo "<td><font size=1><A HREF=\"$PHP_SELF?ADD=311&list_id=$row[2]\">$row[2]</A></td>";
echo "<td><font size=1><A HREF=\"$PHP_SELF?ADD=31&campaign_id=$row[3]\">$row[3]</A></td>";
echo "<td><font size=1>$row[5]</td>";
@@ -44652,6 +44653,7 @@ if ($ADD==700000000000000)
if (preg_match('/SYSTEM/i', $row[4])) {$record_link = "$PHP_SELF?ADD=311111111111111";}
if (preg_match('/CATEGOR/i', $row[4])) {$record_link = "$PHP_SELF?ADD=331111111111111";}
if (preg_match('/GROUPALIAS/i', $row[4])) {$record_link = "$PHP_SELF?ADD=33111111111&group_alias_id=$row[6]";}
if (preg_match('/LEADS/i',$row[4])) {$record_link = "admin_modify_lead.php?lead_id=$row[6]\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[6]', '_blank');return false;";}
if (preg_match('/1$|3$|5$|7$|9$/i', $o))
{$bgcolor='class="records_list_x"';}
@@ -44829,7 +44831,7 @@ if ($ADD==720000000000000)
if (preg_match('/SYSTEM/i', $row[4])) {$record_link = "$PHP_SELF?ADD=311111111111111";}
if (preg_match('/CATEGOR/i', $row[4])) {$record_link = "$PHP_SELF?ADD=331111111111111";}
if (preg_match('/GROUPALIAS/i', $row[4])) {$record_link = "$PHP_SELF?ADD=33111111111&group_alias_id=$row[6]";}
if (preg_match('/LEADS/i',$row[4])) {$record_link = "./admin_modify_lead.php?lead_id=$row[6]";}
if (preg_match('/LEADS/i',$row[4])) {$record_link = "admin_modify_lead.php?lead_id=$row[6]\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[6]', '_blank');return false;";}
if (preg_match('/EMAIL/i',$row[4])) {$record_link = "./admin_email_accounts.php?eact=UPDATE&email_account_id=$row[6]";}
if (preg_match('/1$|3$|5$|7$|9$/i', $o))
@@ -1447,7 +1447,17 @@ else
$lead_count = $row[0];
if ( ($lead_exists > 0) and ($lead_count < 1) )
{
echo _QXZ("lead does not exist")."\n";
echo "</script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "</head><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<span style=\"position:absolute;left:0px;top:0px;z-index:20;\" id=admin_header>";
$short_header=1;
require("admin_header.php");
echo "</span>\n";
echo "<BR><BR><b>"._QXZ("lead does not exist")."</b><BR>\n";
exit;
}
}
@@ -1,7 +1,7 @@
<?php
# admin_search_lead.php version 2.14
#
# Copyright (C) 2020 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# AST GUI database administration search for lead info
# admin_modify_lead.php
@@ -51,6 +51,7 @@
# 191014-1316 - Fix for foreign language, issue #1187
# 201111-1957 - Fix for side menu issue #1233
# 201117-2353 - Changes for better compatibility with non-latin data input
# 210316-2344 - Changed lead-modify page links to javascript because of Chrome
#
require("dbconnect_mysqli.php");
@@ -528,7 +529,7 @@ else
{$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';}
echo "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$o</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><a href=\"admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search\" target=\"_blank\">$row[0]</a></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><A HREF=\"admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search', '_blank');return false;\">$row[0]</A></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[1]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[2]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[3]</FONT></TD>\n";
@@ -593,7 +594,7 @@ else
{$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';}
echo "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$o</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><a href=\"admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search\" target=\"_blank\">$row[0]</a></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><A HREF=\"admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search', '_blank');return false;\">$row[0]</A></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[1]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[2]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[3]</FONT></TD>\n";
@@ -776,7 +777,7 @@ else
{$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';}
echo "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$o</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><a href=\"admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search&archive_log=$log_archive_link\" target=\"_blank\">$row[0]</a></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><A HREF=\"admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search&archive_log=$log_archive_link\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search&archive_log=$log_archive_link', '_blank');return false;\">$row[0]</A></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[1]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[2]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[3]</FONT></TD>\n";
@@ -841,7 +842,7 @@ else
{$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';}
echo "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$o</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><a href=\"admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search&archive_log=$log_archive_link\" target=\"_blank\">$row[0]</a></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><A HREF=\"admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search&archive_log=$log_archive_link\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search&archive_log=$log_archive_link', '_blank');return false;\">$row[0]</A></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[1]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[2]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[3]</FONT></TD>\n";
@@ -1198,7 +1199,7 @@ else
{$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';}
echo "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$o</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><a href=\"admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search&archive_log=$log_archive_link\" target=\"_blank\">$row[0]</a></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><A HREF=\"admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search&archive_log=$log_archive_link\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[0]&archive_search=$archive_search&archive_log=$log_archive_link', '_blank');return false;\">$row[0]</A></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[3]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[5]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[4]</FONT></TD>\n";
@@ -1,6 +1,6 @@
# version: 20210316091901
# version: 20210317081901
users-user User ID <QXZ>This field is where you put the users ID number, can be up to 8 digits in length, Must be at least 2 characters in length.</QXZ>
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
users-pass Password <QXZ>This field is where you put the users password. Must be at least 2 characters in length. Only letters and numbers are allowed in user passwords. A medium strength user password will be at least 10 characters in length, and a strong user password will be at least 20 characters in length and have letters as well as at least one number. It is recommended that you use a longer password if possible, stringing together several unrelated words with no spaces, and a number somewhere in the string. The maximum size of a password is 100 characters.</QXZ>
users-force_change_password Force Change Password <QXZ>If this option is set to Y then the user will be prompted to change their password the next time they log in to the administration webpage or the agent screen. Default is N.</QXZ>
users-last_login_date Last Login Info <QXZ>This shows the last login attempt date and time, and if there has been a recent failed login attempt. If this modify user form is submitted, then the failed login attempt counter will be reset and the agent can immediately attempt to log in again. If an agent has 10 failed login attempts in a row then they cannot attempt to log in again for at least 15 minutes unless their account is manually reset.</QXZ>
users-full_name Full Name <QXZ>This field is where you put the users full name. Must be at least 2 characters in length.</QXZ>
+340 -3
View File
@@ -165,10 +165,11 @@
# 210217-1454 - Added menu_id option for add_did and update_did functions
# 210227-1116 - Added xferconf number options to update_campaign, add_list & update_list functions
# 210303-1802 - Added list_exists_check option for update_lead function
# 210316-2207 - Added lead_all_info function
#
$version = '2.14-142';
$build = '210303-1802';
$version = '2.14-143';
$build = '210316-2207';
$api_url_log = 0;
$startMS = microtime();
@@ -10386,7 +10387,7 @@ if ($function == 'lead_callback_info')
exit;
}
################################################################################
### lead_callback_info - outputs lead data for cross-cluster-communication call
### lead_callback_info - outputs scheduled callback data for a specific lead
################################################################################
@@ -10646,6 +10647,342 @@ if ($function == 'lead_field_info')
################################################################################
### lead_all_info - outputs all lead data for a lead(including custom fields)
################################################################################
if ($function == 'lead_all_info')
{
if(strlen($source)<2)
{
$result = 'ERROR';
$result_reason = "Invalid Source";
echo "$result: $result_reason - $source\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
echo "ERROR: Invalid Source: |$source|\n";
exit;
}
else
{
if ( (!preg_match("/ $function /",$api_allowed_functions)) and (!preg_match("/ALL_FUNCTIONS/",$api_allowed_functions)) )
{
$result = 'ERROR';
$result_reason = "auth USER DOES NOT HAVE PERMISSION TO USE THIS FUNCTION";
echo "$result: $result_reason: |$user|$function|\n";
$data = "$allowed_user";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
$stmt="SELECT count(*) from vicidial_users where user='$user' and vdc_agent_api_access='1' and modify_leads IN('1','2','3','4') and view_reports='1' and user_level > 6 and active='Y';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$allowed_user=$row[0];
if ($allowed_user < 1)
{
$result = 'ERROR';
$result_reason = "lead_all_info USER DOES NOT HAVE PERMISSION TO GET LEAD INFO";
echo "$result: $result_reason: |$user|$allowed_user|\n";
$data = "$allowed_user";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$call_search_SQL='';
$search_ready=0;
$call_id = preg_replace("/\n|\r|\t| /",'',$call_id);
if (strlen($lead_id) < 1)
{
$result = 'ERROR';
$result_reason = "lead_all_info LEAD NOT FOUND";
$data = "$user|$lead_id";
echo "$result: $result_reason: $data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$stmt="SELECT admin_viewable_groups,allowed_campaigns from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {$MAIN.="|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$LOGadmin_viewable_groups = $row[0];
$LOGallowed_campaigns = $row[1];
$LOGallowed_campaignsSQL='';
if ( (!preg_match("/ALL-CAMPAIGNS/i",$LOGallowed_campaigns)) )
{
$LOGallowed_campaignsSQL = preg_replace('/\s-/i','',$LOGallowed_campaigns);
$LOGallowed_campaignsSQL = preg_replace('/\s/i',"','",$LOGallowed_campaignsSQL);
$LOGallowed_campaignsSQL = "and campaign_id IN('$LOGallowed_campaignsSQL')";
}
$DLset=0;
$output='';
if ($stage == 'csv')
{$DL = ','; $DLset++;}
if ($stage == 'tab')
{$DL = "\t"; $DLset++;}
if ($stage == 'newline')
{$DL = "\n"; $DLset++;}
if ($stage == 'pipe')
{$DL = '|'; $DLset++;}
if ($DLset < 1)
{$DL='|'; $stage='pipe';}
$stmt="SELECT list_id,entry_list_id from vicidial_list where lead_id='$lead_id';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$lead_exists = mysqli_num_rows($rslt);
if ($lead_exists > 0)
{
$row=mysqli_fetch_row($rslt);
$lead_list_id = $row[0];
$lead_entry_list_id = $row[1];
# check for custom list override
if (strlen($force_entry_list_id) > 0)
{$lead_entry_list_id = $force_entry_list_id;}
$stmt="SELECT count(*) from vicidial_lists where list_id='$lead_list_id' $LOGallowed_campaignsSQL;";
if ($DB) {$MAIN.="|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$list_exists = $row[0];
if ($list_exists > 0)
{
$CF_data_output='';
$CF_header_output='';
if ($custom_fields == 'Y')
{
$stmt="SELECT admin_hide_lead_data,admin_hide_phone_data,admin_cf_show_hidden from vicidial_users where user='$user';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$LOGadmin_hide_lead_data = $row[0];
$LOGadmin_hide_phone_data = $row[1];
$LOGadmin_cf_show_hidden = $row[2];
if ($DB) {echo "CF user: |$LOGadmin_hide_lead_data|$LOGadmin_hide_phone_data|$LOGadmin_cf_show_hidden|\n";}
if (preg_match("/cf_encrypt/",$active_modules))
{
$enc_fields=0;
$stmt = "SELECT count(*) from vicidial_lists_fields where field_encrypt='Y' and list_id='$lead_entry_list_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$enc_field_ct = mysqli_num_rows($rslt);
if ($DB) {echo "$enc_field_ct|$stmt\n";}
if ($enc_field_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$enc_fields = $row[0];
}
if ($enc_fields > 0)
{
$stmt = "SELECT field_label from vicidial_lists_fields where field_encrypt='Y' and list_id='$lead_entry_list_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$enc_field_ct = mysqli_num_rows($rslt);
if ($DB) {echo "$enc_field_ct|$stmt\n";}
$r=0;
while ($enc_field_ct > $r)
{
$row=mysqli_fetch_row($rslt);
$encrypt_list .= "$row[0],";
$r++;
}
$encrypt_list = ",$encrypt_list";
}
if ($LOGadmin_cf_show_hidden < 1)
{
$hide_fields=0;
$stmt = "SELECT count(*) from vicidial_lists_fields where field_show_hide!='DISABLED' and list_id='$lead_entry_list_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$hide_field_ct = mysqli_num_rows($rslt);
if ($DB) {echo "$hide_field_ct|$stmt\n";}
if ($hide_field_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$hide_fields = $row[0];
}
if ($hide_fields > 0)
{
$stmt = "SELECT field_label from vicidial_lists_fields where field_show_hide!='DISABLED' and list_id='$lead_entry_list_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$hide_field_ct = mysqli_num_rows($rslt);
if ($DB) {echo "$hide_field_ct|$stmt\n";}
$r=0;
while ($hide_field_ct > $r)
{
$row=mysqli_fetch_row($rslt);
$hide_list .= "$row[0],";
$r++;
}
$hide_list = ",$hide_list";
}
}
}
$custom_fields_list='';
$stmt = "SELECT field_label from vicidial_lists_fields where list_id='$lead_entry_list_id' and field_type NOT IN('DISPLAY','SCRIPT','SWITCH','BUTTON') and field_label NOT IN('lead_id','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') order by field_rank,field_order;";
$rslt=mysql_to_mysqli($stmt, $link);
$cust_field_ct = mysqli_num_rows($rslt);
if ($DB) {echo "$cust_field_ct|$stmt\n";}
$r=0;
while ($cust_field_ct > $r)
{
$row=mysqli_fetch_row($rslt);
if ($r > 0) {$custom_fields_list .= ",";}
$custom_fields_list .= "$row[0]";
$custom_fields_ARY[$r] = $row[0];
$r++;
}
$stmt="SELECT $custom_fields_list from custom_$lead_entry_list_id where lead_id='$lead_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$custom_fields_found = mysqli_num_rows($rslt);
if ($DB) {echo "$custom_fields_found|$stmt\n";}
if ($custom_fields_found > 0)
{
$row=mysqli_fetch_row($rslt);
$rc=0;
while ($r > $rc)
{
$temp_CF_value = $row[$rc];
$temp_CP_label = $custom_fields_ARY[$rc];
if ($enc_fields > 0)
{
$field_enc=''; $field_enc_all='';
if ($DB) {echo "|$temp_CP_label|$encrypt_list|$hide_list|\n";}
if ( (preg_match("/,$temp_CP_label,/",$encrypt_list)) and (strlen($temp_CF_value) > 0) )
{
if ($DB) {echo "DECRYPTING $temp_CP_label\n";}
exec("../agc/aes.pl --decrypt --text=$temp_CF_value", $field_enc);
$field_enc_ct = count($field_enc);
$k=0;
while ($field_enc_ct > $k)
{
$field_enc_all .= $field_enc[$k];
$k++;
}
$field_enc_all = preg_replace("/CRYPT: |\n|\r|\t/",'',$field_enc_all);
$temp_CF_value = base64_decode($field_enc_all);
}
}
if ( ( (preg_match("/,$temp_CP_label,/",$hide_list)) or ($LOGadmin_hide_lead_data > 0) ) and (strlen($temp_CF_value) > 0) )
{
$field_temp_val = $temp_CF_value;
$temp_CF_value = preg_replace("/./",'X',$field_temp_val);
}
$CF_data_output .= "$DL$temp_CF_value";
$CF_header_output .= "$DL$temp_CP_label";
$rc++;
}
}
if ($header == 'YES')
{
$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' . $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_id';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$standard_field_exists = mysqli_num_rows($rslt);
if ($standard_field_exists > 0)
{
$row=mysqli_fetch_row($rslt);
$LEADstatus = $row[0];
$LEADuser = $row[1];
$LEADvendor_lead_code = $row[2];
$LEADsource_id = $row[3];
$LEADlist_id = $row[4];
$LEADgmt_offset_now = $row[5];
$LEADphone_code = $row[6];
$LEADphone_number = $row[7];
$LEADtitle = $row[8];
$LEADfirst_name = $row[9];
$LEADmiddle_initial = $row[10];
$LEADlast_name = $row[11];
$LEADaddress1 = $row[12];
$LEADaddress2 = $row[13];
$LEADaddress3 = $row[14];
$LEADcity = $row[15];
$LEADstate = $row[16];
$LEADprovince = $row[17];
$LEADpostal_code = $row[18];
$LEADcountry_code = $row[19];
$LEADgender = $row[20];
$LEADdate_of_birth = $row[21];
$LEADalt_phone = $row[22];
$LEADemail = $row[23];
$LEADsecurity_phrase = $row[24];
$LEADcomments = $row[25];
$LEADcalled_count = $row[26];
$LEADlast_local_call_time = $row[27];
$LEADrank = $row[28];
$LEADowner = $row[29];
$LEADentry_list_id = $row[30];
$output .= "$LEADstatus$DL$LEADuser$DL$LEADvendor_lead_code$DL$LEADsource_id$DL$LEADlist_id$DL$LEADgmt_offset_now$DL$LEADphone_code$DL$LEADphone_number$DL$LEADtitle$DL$LEADfirst_name$DL$LEADmiddle_initial$DL$LEADlast_name$DL$LEADaddress1$DL$LEADaddress2$DL$LEADaddress3$DL$LEADcity$DL$LEADstate$DL$LEADprovince$DL$LEADpostal_code$DL$LEADcountry_code$DL$LEADgender$DL$LEADdate_of_birth$DL$LEADalt_phone$DL$LEADemail$DL$LEADsecurity_phrase$DL$LEADcomments$DL$LEADcalled_count$DL$LEADlast_local_call_time$DL$LEADrank$DL$LEADowner$DL$LEADentry_list_id$CF_data_output\n";
echo "$output";
$result = 'SUCCESS';
$data = "$user|$lead_id|$stage";
$result_reason = "lead_all_info $output";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'ERROR';
$result_reason = "lead_all_info LEAD NOT FOUND";
$data = "$user|$lead_id";
echo "$result: $result_reason: $data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
else
{
$result = 'ERROR';
$result_reason = "lead_all_info LIST NOT FOUND";
$data = "$user|$lead_id";
echo "$result: $result_reason: $data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
else
{
$result = 'ERROR';
$result_reason = "lead_all_info LEAD NOT FOUND";
$data = "$user|$agent_user";
echo "$result: $result_reason: $data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
}
}
exit;
}
################################################################################
### lead_all_info - outputs all lead data for a lead(including custom fields)
################################################################################
################################################################################
+12 -12
View File
@@ -1,7 +1,7 @@
<?php
# user_stats.php
#
# Copyright (C) 2020 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2021 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
#
@@ -62,6 +62,7 @@
# 191013-0843 - Fixes for PHP7
# 200501-0811 - Added NVAuser option for NVA recordings user column
# 200702-1710 - Added ANI to INBOUND/CLOSER records for NVAuser, added secondary check to find lead ID for DIDs
# 210317-0058 - Changed lead-modify page links to javascript because of Chrome
#
$startMS = microtime();
@@ -640,10 +641,9 @@ elseif ($park_rpt >= 1)
{$bgcolor='bgcolor="#'. $SSstd_row2_background .'"';}
else
{$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';}
$MAIN.="<tr $bgcolor><td><font size=2>$park_row[parked_time]</td>";
$MAIN.="<td align=right><font size=2> $park_row[status]</td>\n";
$MAIN.="<td align=right><font size=2> <a href=\"admin_modify_lead.php?lead_id=$park_row[lead_id]\">$park_row[lead_id]</a></td>\n";
$MAIN.="<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$park_row[lead_id]\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$park_row[lead_id]', '_blank');return false;\">$park_row[lead_id]</a></td>\n";
$MAIN.="<td align=right><font size=2> $park_row[parked_sec]</td></tr>\n";
$CSV_text12.="\"\",\"$park_row[parked_time]\",\"$park_row[status]\",\"$park_row[lead_id]\",\"$park_row[parked_sec]\"\n";
@@ -1043,7 +1043,7 @@ else
$MAIN.="<td align=right><font size=2> $row[3] </td>\n";
$MAIN.="<td align=right><font size=2> $row[14] </td>\n";
$MAIN.="<td align=right><font size=2> $row[2] </td>\n";
$MAIN.="<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" target=\"_blank\">$row[1]</A> </td>\n";
$MAIN.="<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[1]', '_blank');return false;\">$row[1]</A> </td>\n";
if ($firstlastname_display_user_stats > 0)
{
$MAIN.="<td align=right><font size=2> $row[17] $row[18] </td>\n";
@@ -1101,7 +1101,7 @@ else
$MAIN .= "<td align=left><font size=2> &nbsp; $row[7]</td>\n";
$MAIN .= "<td align=left><font size=1> &nbsp; $row[5]</td>\n";
$MAIN .= "<td align=left><font size=1> &nbsp; $row[8] </td>\n";
$MAIN .= "<td align=left><font size=1> &nbsp; <A HREF=\"admin_modify_lead.php?lead_id=$row[2]\" target=\"_blank\">$row[2]</A> </td>\n";
$MAIN .= "<td align=left><font size=1> &nbsp; <A HREF=\"admin_modify_lead.php?lead_id=$row[2]\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[2]', '_blank');return false;\">$row[2]</A> </td>\n";
$MAIN .= "</tr>\n";
$MAIN .= "<tr>";
$MAIN .= "<td><font size=1> &nbsp; </td>\n";
@@ -1218,7 +1218,7 @@ else
$MAIN.="<td align=right><font size=2> $row[5] </td>\n";
$MAIN.="<td align=right><font size=2> $AGENTseconds </td>\n";
$MAIN.="<td align=right><font size=2> $row[6] </td>\n";
$MAIN.="<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[7]\" target=\"_blank\">$row[7]</A> </td>\n";
$MAIN.="<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[7]\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[7]', '_blank');return false;\">$row[7]</A> </td>\n";
if ($firstlastname_display_user_stats > 0)
{$MAIN.="<td align=right><font size=2> $row[10] $row[11] </td>\n";}
$MAIN.="<td align=right><font size=2> $row[8] </td></tr>\n";
@@ -1335,7 +1335,7 @@ else
$MAIN.="<td align=right><font size=2> $dead_sec </td>\n";
$MAIN.="<td align=right><font size=2> $customer_sec </td>\n";
$MAIN.="<td align=right><font size=2> $status </td>\n";
$MAIN.="<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$lead_id\" target=\"_blank\">$lead_id</A> </td>\n";
$MAIN.="<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$lead_id\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$lead_id', '_blank');return false;\">$lead_id</A> </td>\n";
$call_type='';
if (strlen($lead_id) > 0)
{
@@ -1518,7 +1518,7 @@ else
$MAIN.="<td align=right><font size=2> $agent_user &nbsp; </td>\n";
$NVAuser_csv_record=",\"$agent_user\"";
}
$MAIN.="<td align=left><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[12]\" target=\"_blank\">$row[12]</A> </td>";
$MAIN.="<td align=left><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[12]\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[12]', '_blank');return false;\">$row[12]</A> </td>";
if ($NVAuser > 0)
{
$MAIN.="<td align=right><font size=2> $ANI &nbsp; </td>\n";
@@ -1614,7 +1614,7 @@ else
$MAIN.="<td align=left><font size=2> $row[2]</td>\n";
$MAIN.="<td align=left><font size=2> $row[3] </td>\n";
$MAIN.="<td align=right><font size=2> $row[4] </td>\n";
$MAIN.="<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[5]\" target=\"_blank\">$row[5]</A> </td>\n";
$MAIN.="<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[5]\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[5]', '_blank');return false;\">$row[5]</A> </td>\n";
$MAIN.="<td align=right><font size=2> $row[6] </td>\n";
$MAIN.="<td align=right><font size=2> $row[7] </td>\n";
$MAIN.="<td align=right><font size=2> $row[8] </td>\n";
@@ -1693,7 +1693,7 @@ else
$MAIN.="<tr $bgcolor>";
$MAIN.="<td><font size=1>$u</td>";
$MAIN.="<td><font size=2>$row[1]</td>";
$MAIN.="<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[2]\" target=\"_blank\">$row[2]</A> </td>\n";
$MAIN.="<td align=right><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[2]\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[2]', '_blank');return false;\">$row[2]</A> </td>\n";
$MAIN.="<td align=right><font size=2> $row[4] </td>\n";
$MAIN.="<td align=right><font size=2> $row[5] </td>\n";
$MAIN.="<td align=right><font size=2> $row[3] </td></tr>\n";
@@ -1725,8 +1725,8 @@ else
$MAIN.="<tr $bgcolor>";
$MAIN.="<td><font size=1>$u</td>";
$MAIN.="<td><font size=2>$row[0]</td>";
$MAIN.="<td align=center><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" target=\"_blank\">$row[1]</A> </td>\n";
$MAIN.="<td align=center><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[2]\" target=\"_blank\">$row[2]</A> </td>\n";
$MAIN.="<td align=center><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[1]\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[1]', '_blank');return false;\">$row[1]</A> </td>\n";
$MAIN.="<td align=center><font size=2> <A HREF=\"admin_modify_lead.php?lead_id=$row[2]\" onclick=\"javascript:window.open('admin_modify_lead.php?lead_id=$row[2]', '_blank');return false;\">$row[2]</A> </td>\n";
$MAIN.="<td><font size=2>$row[3]</td>";
$MAIN.="<td align=right><font size=2> $row[4] </td>\n";
$MAIN.="<td align=right><font size=2> $row[5] </td>\n";