diff --git a/docs/NON-AGENT_API.txt b/docs/NON-AGENT_API.txt index a6d04da5..22e21b7c 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-02-27 +NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2021-03-03 This document describes the functions of an API(Application Programming Interface) for all functions NOT directly relating to the VICIDIAL Agent screen. @@ -175,6 +175,7 @@ Changes: 210216-1415 - Added list_exists_check option for add_lead function 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 API Functions use the 'function' variable @@ -1064,6 +1065,7 @@ add_to_hopper - Y or N, default is N remove_from_hopper - Y or N, default is N 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 +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. EDITABLE FIELDS- user_field - 1-20 characters, this updates the 'user' field in the vicidial_list table @@ -1158,6 +1160,7 @@ NOTICE: update_lead NOT REMOVED FROM HOPPER, LEAD IS NOT IN THE HOPPER - 7275551 ERROR: update_lead INVALID DATA FOR LEAD INSERTION - 6666||| ERROR: update_lead NO MATCHES FOUND IN THE SYSTEM - 6666||| ERROR: update_lead NO VALID SEARCH METHOD - 6666|SYSTEM||| +ERROR: update_lead NOT A DEFINED LIST ID, LIST EXISTS CHECK ENABLED - 6666|139 ERROR: update_lead USER DOES NOT HAVE PERMISSION TO UPDATE LEADS IN THE SYSTEM - 6666|0 ERROR: update_lead NOT AN ALLOWED LIST ID - 7275551212|98762 diff --git a/www/vicidial/non_agent_api.php b/www/vicidial/non_agent_api.php index a88d8538..81695f24 100644 --- a/www/vicidial/non_agent_api.php +++ b/www/vicidial/non_agent_api.php @@ -164,10 +164,11 @@ # 210216-1415 - Added list_exists_check option for add_lead function # 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 # -$version = '2.14-141'; -$build = '210227-1116'; +$version = '2.14-142'; +$build = '210303-1802'; $api_url_log = 0; $startMS = microtime(); @@ -12121,6 +12122,23 @@ if ($function == 'update_lead') exit; } } + if ( (preg_match("/Y/i",$list_exists_check)) and (strlen($list_id_field) > 0) ) + { + $stmt="SELECT count(*) from vicidial_lists where list_id='$list_id_field';"; + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + if ($DB>0) {echo "DEBUG: update_lead list_exists_check query - $row[0]|$stmt\n";} + $list_exists_count = $row[0]; + if ($list_exists_count < 1) + { + $result = 'ERROR'; + $result_reason = "update_lead NOT A DEFINED LIST ID, LIST EXISTS CHECK ENABLED"; + $data = "$phone_number|$list_id_field"; + echo "$result: $result_reason - $data\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + exit; + } + } if (preg_match("/CAMPAIGN/i",$search_location)) # find lists within campaign {