diff --git a/docs/NON-AGENT_API.txt b/docs/NON-AGENT_API.txt index 22e21b7c..b534b1e4 100644 --- a/docs/NON-AGENT_API.txt +++ b/docs/NON-AGENT_API.txt @@ -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 diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index 0289c4eb..42686fb1 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -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 ""; - echo "$row[1]"; + echo "$row[1]\n"; echo "$row[2]"; echo "$row[3]"; echo "$row[5]"; @@ -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)) diff --git a/www/vicidial/admin_modify_lead.php b/www/vicidial/admin_modify_lead.php index bf637e7f..58223b54 100644 --- a/www/vicidial/admin_modify_lead.php +++ b/www/vicidial/admin_modify_lead.php @@ -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 "\n"; + echo "\n"; + echo "\n"; + echo ""; + + $short_header=1; + + require("admin_header.php"); + + echo "\n"; + echo "

"._QXZ("lead does not exist")."
\n"; exit; } } diff --git a/www/vicidial/admin_search_lead.php b/www/vicidial/admin_search_lead.php index 652b28f8..38d4296f 100644 --- a/www/vicidial/admin_search_lead.php +++ b/www/vicidial/admin_search_lead.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2021 Matt Florell 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 "\n"; echo "$o\n"; - echo "$row[0]\n"; + echo "$row[0]\n"; echo "$row[1]\n"; echo "$row[2]\n"; echo "$row[3]\n"; @@ -593,7 +594,7 @@ else {$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';} echo "\n"; echo "$o\n"; - echo "$row[0]\n"; + echo "$row[0]\n"; echo "$row[1]\n"; echo "$row[2]\n"; echo "$row[3]\n"; @@ -776,7 +777,7 @@ else {$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';} echo "\n"; echo "$o\n"; - echo "$row[0]\n"; + echo "$row[0]\n"; echo "$row[1]\n"; echo "$row[2]\n"; echo "$row[3]\n"; @@ -841,7 +842,7 @@ else {$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';} echo "\n"; echo "$o\n"; - echo "$row[0]\n"; + echo "$row[0]\n"; echo "$row[1]\n"; echo "$row[2]\n"; echo "$row[3]\n"; @@ -1198,7 +1199,7 @@ else {$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';} echo "\n"; echo "$o\n"; - echo "$row[0]\n"; + echo "$row[0]\n"; echo "$row[3]\n"; echo "$row[5]\n"; echo "$row[4]\n"; diff --git a/www/vicidial/help_documentation.txt b/www/vicidial/help_documentation.txt index f89387ab..17d5d3ed 100644 --- a/www/vicidial/help_documentation.txt +++ b/www/vicidial/help_documentation.txt @@ -1,6 +1,6 @@ -# version: 20210316091901 +# version: 20210317081901 users-user User ID 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. -users-pass Password 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. +users-pass Password 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. users-force_change_password Force Change Password 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. users-last_login_date Last Login Info 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. users-full_name Full Name This field is where you put the users full name. Must be at least 2 characters in length. diff --git a/www/vicidial/non_agent_api.php b/www/vicidial/non_agent_api.php index 81695f24..005b36c1 100644 --- a/www/vicidial/non_agent_api.php +++ b/www/vicidial/non_agent_api.php @@ -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) +################################################################################ + + + + + + + + + + + + + + ################################################################################ diff --git a/www/vicidial/user_stats.php b/www/vicidial/user_stats.php index de6fc541..f1af6cfd 100644 --- a/www/vicidial/user_stats.php +++ b/www/vicidial/user_stats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2021 Matt Florell 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.="$park_row[parked_time]"; $MAIN.=" $park_row[status]\n"; - $MAIN.=" $park_row[lead_id]\n"; + $MAIN.=" $park_row[lead_id]\n"; $MAIN.=" $park_row[parked_sec]\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.=" $row[3] \n"; $MAIN.=" $row[14] \n"; $MAIN.=" $row[2] \n"; - $MAIN.=" $row[1] \n"; + $MAIN.=" $row[1] \n"; if ($firstlastname_display_user_stats > 0) { $MAIN.=" $row[17] $row[18] \n"; @@ -1101,7 +1101,7 @@ else $MAIN .= "   $row[7]\n"; $MAIN .= "   $row[5]\n"; $MAIN .= "   $row[8] \n"; - $MAIN .= "   $row[2] \n"; + $MAIN .= "   $row[2] \n"; $MAIN .= "\n"; $MAIN .= ""; $MAIN .= "   \n"; @@ -1218,7 +1218,7 @@ else $MAIN.=" $row[5] \n"; $MAIN.=" $AGENTseconds \n"; $MAIN.=" $row[6] \n"; - $MAIN.=" $row[7] \n"; + $MAIN.=" $row[7] \n"; if ($firstlastname_display_user_stats > 0) {$MAIN.=" $row[10] $row[11] \n";} $MAIN.=" $row[8] \n"; @@ -1335,7 +1335,7 @@ else $MAIN.=" $dead_sec \n"; $MAIN.=" $customer_sec \n"; $MAIN.=" $status \n"; - $MAIN.=" $lead_id \n"; + $MAIN.=" $lead_id \n"; $call_type=''; if (strlen($lead_id) > 0) { @@ -1518,7 +1518,7 @@ else $MAIN.=" $agent_user   \n"; $NVAuser_csv_record=",\"$agent_user\""; } - $MAIN.=" $row[12] "; + $MAIN.=" $row[12] "; if ($NVAuser > 0) { $MAIN.=" $ANI   \n"; @@ -1614,7 +1614,7 @@ else $MAIN.=" $row[2]\n"; $MAIN.=" $row[3] \n"; $MAIN.=" $row[4] \n"; - $MAIN.=" $row[5] \n"; + $MAIN.=" $row[5] \n"; $MAIN.=" $row[6] \n"; $MAIN.=" $row[7] \n"; $MAIN.=" $row[8] \n"; @@ -1693,7 +1693,7 @@ else $MAIN.=""; $MAIN.="$u"; $MAIN.="$row[1]"; - $MAIN.=" $row[2] \n"; + $MAIN.=" $row[2] \n"; $MAIN.=" $row[4] \n"; $MAIN.=" $row[5] \n"; $MAIN.=" $row[3] \n"; @@ -1725,8 +1725,8 @@ else $MAIN.=""; $MAIN.="$u"; $MAIN.="$row[0]"; - $MAIN.=" $row[1] \n"; - $MAIN.=" $row[2] \n"; + $MAIN.=" $row[1] \n"; + $MAIN.=" $row[2] \n"; $MAIN.="$row[3]"; $MAIN.=" $row[4] \n"; $MAIN.=" $row[5] \n";