Added 'delete_cf_data' setting to the update_lead Non-Agent API function

git-svn-id: svn://192.168.202.10@3540 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2021-11-19 01:55:33 +00:00
parent 7c2df7c241
commit 20979db704
2 changed files with 48 additions and 6 deletions
+6 -1
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2021-11-07 NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2021-11-18
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.
@@ -196,6 +196,7 @@ Changes:
210812-2640 - Added update of live agent records for ingroup_rank/ingroup_grade in the update_user function 210812-2640 - Added update of live agent records for ingroup_rank/ingroup_grade in the update_user function
210917-1615 - Added batch_update_lead function 210917-1615 - Added batch_update_lead function
211107-1556 - Added optional phone_number search for lead_all_info function 211107-1556 - Added optional phone_number search for lead_all_info function
211118-1946 - Added 'delete_cf_data' setting to the update_lead function
API Functions use the 'function' variable API Functions use the 'function' variable
@@ -1152,6 +1153,7 @@ custom_fields - Y or N, default is N. Defines whether the API will accept custo
no_update - Y or N, Setting this to Y will not perform any updates, but will instead only tell no_update - Y or N, Setting this to Y will not perform any updates, but will instead only tell
you if a lead exists that matches the search criteria, default is N. you if a lead exists that matches the search criteria, default is N.
delete_lead - Y or N, Setting this to Y will delete the lead from the vicidial_list table, default is N. delete_lead - Y or N, Setting this to Y will delete the lead from the vicidial_list table, default is N.
delete_cf_data - Y or N, Setting this to Y will delete the custom fields data for this lead and reset the entry_list_id, 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. reset_lead - Y or N, Setting this to Y will reset the called-since-last-reset flag of the lead, default is N.
callback - Y, N or REMOVE, default is N. Set this lead as a scheduled callback. REMOVE will delete the scheduled callback entry callback - Y, N or REMOVE, default is N. Set this lead as a scheduled callback. REMOVE will delete the scheduled callback entry
callback_status - 1-6 Character, callback status to use, default is CALLBK (vicidial_list status will be set to CBHOLD to lock) callback_status - 1-6 Character, callback status to use, default is CALLBK (vicidial_list status will be set to CBHOLD to lock)
@@ -1223,6 +1225,8 @@ http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&functio
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_lead&lead_id=27&delete_lead=Y&custom_fields=Y http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_lead&lead_id=27&delete_lead=Y&custom_fields=Y
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_lead&lead_id=27&delete_cf_data=Y
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_lead&lead_id=406757&campaign_id=TESTCAMP&callback=Y&callback_status=CALLBK&callback_datetime=NOW&callback_type=USERONLY&callback_user=1028&callback_comments=Comments+go+here+again http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_lead&lead_id=406757&campaign_id=TESTCAMP&callback=Y&callback_status=CALLBK&callback_datetime=NOW&callback_type=USERONLY&callback_user=1028&callback_comments=Comments+go+here+again
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_lead&search_location=SYSTEM&search_method=PHONE_NUMBER&phone_number=9998887112&no_update=Y&add_to_hopper=Y&hopper_priority=99&hopper_local_call_time_check=Y http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_lead&search_location=SYSTEM&search_method=PHONE_NUMBER&phone_number=9998887112&no_update=Y&add_to_hopper=Y&hopper_priority=99&hopper_local_call_time_check=Y
@@ -1245,6 +1249,7 @@ SUCCESS: update_lead LEAD HAS BEEN ADDED - 7275551111|6666|999|193716|-4
SUCCESS: update_lead LEAD HAS BEEN DELETED - 7275551111|6666|999|193716|-4 SUCCESS: update_lead LEAD HAS BEEN DELETED - 7275551111|6666|999|193716|-4
NOTICE: update_lead CUSTOM FIELDS ENTRY DELETED 1 - 7275551111|6666|999|193716|-4 NOTICE: update_lead CUSTOM FIELDS ENTRY DELETED 1 - 7275551111|6666|999|193716|-4
NOTICE: update_lead CUSTOM FIELDS DATA HAS BEEN DELETED - 6666|193716|1|1
NOTICE: update_lead LEADS FOUND IN THE SYSTEM: |6666|1010542|12345678901234|9998887112|3333444|0 NOTICE: update_lead LEADS FOUND IN THE SYSTEM: |6666|1010542|12345678901234|9998887112|3333444|0
(user|lead_id|vendorleadcode|phone |list_id|entry_list_id) (user|lead_id|vendorleadcode|phone |list_id|entry_list_id)
+42 -5
View File
@@ -186,10 +186,11 @@
# 210917-1615 - Added batch_update_lead function # 210917-1615 - Added batch_update_lead function
# 211027-0845 - Added lead_search function # 211027-0845 - Added lead_search function
# 211107-1556 - Added optional phone_number search for lead_all_info function # 211107-1556 - Added optional phone_number search for lead_all_info function
# 211118-1946 - Added 'delete_cf_data' setting to the update_lead function
# #
$version = '2.14-163'; $version = '2.14-164';
$build = '211107-1556'; $build = '211118-1946';
$php_script='non_agent_api.php'; $php_script='non_agent_api.php';
$api_url_log = 0; $api_url_log = 0;
@@ -665,6 +666,8 @@ if (isset($_GET["group_id"])) {$group_id=$_GET["group_id"];}
elseif (isset($_POST["group_id"])) {$group_id=$_POST["group_id"];} elseif (isset($_POST["group_id"])) {$group_id=$_POST["group_id"];}
if (isset($_GET["lead_ids"])) {$lead_ids=$_GET["lead_ids"];} if (isset($_GET["lead_ids"])) {$lead_ids=$_GET["lead_ids"];}
elseif (isset($_POST["lead_ids"])) {$lead_ids=$_POST["lead_ids"];} elseif (isset($_POST["lead_ids"])) {$lead_ids=$_POST["lead_ids"];}
if (isset($_GET["delete_cf_data"])) {$delete_cf_data=$_GET["delete_cf_data"];}
elseif (isset($_POST["delete_cf_data"])) {$delete_cf_data=$_POST["delete_cf_data"];}
if (file_exists('options.php')) if (file_exists('options.php'))
@@ -959,6 +962,7 @@ $custom_fields_delete = preg_replace('/[^_0-9a-zA-Z]/','',$custom_fields_delete)
$dialable_count = preg_replace('/[^_0-9a-zA-Z]/','',$dialable_count); $dialable_count = preg_replace('/[^_0-9a-zA-Z]/','',$dialable_count);
$call_handle_method = preg_replace('/[^_0-9a-zA-Z]/','',$call_handle_method); $call_handle_method = preg_replace('/[^_0-9a-zA-Z]/','',$call_handle_method);
$agent_search_method = preg_replace('/[^_0-9a-zA-Z]/','',$agent_search_method); $agent_search_method = preg_replace('/[^_0-9a-zA-Z]/','',$agent_search_method);
$delete_cf_data = preg_replace('/[^A-Z]/','',$delete_cf_data);
$USarea = substr($phone_number, 0, 3); $USarea = substr($phone_number, 0, 3);
$USprefix = substr($phone_number, 3, 3); $USprefix = substr($phone_number, 3, 3);
@@ -13876,6 +13880,39 @@ if ($function == 'update_lead')
} }
} }
if ($delete_cf_data=='Y')
{
$CFentry_list_id='';
if (strlen($entry_list_id) > 0)
{$CFentry_list_id=$entry_list_id;}
if (strlen($force_entry_list_id) > 0)
{$CFentry_list_id=$force_entry_list_id;}
if (strlen($CFentry_list_id) < 1)
{$CFentry_list_id=$search_entry_list[$n];}
$stmt="SHOW TABLES LIKE \"custom_$CFentry_list_id\";";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$tablecount_to_print = mysqli_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmt = "DELETE from custom_$CFentry_list_id where lead_id='$search_lead_id[$n]';";
if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$VCFaffected_rows = mysqli_affected_rows($link);
}
$stmt = "UPDATE vicidial_list SET entry_list_id=0 where lead_id='$search_lead_id[$n]';";
$result_reason = "update_lead CUSTOM FIELDS DATA HAS BEEN DELETED";
if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$VLaffected_rows = mysqli_affected_rows($link);
$result = 'NOTICE';
echo "$result: $result_reason - $user|$search_lead_id[$n]|$CFentry_list_id|$VLaffected_rows|$VCFaffected_rows\n";
$data = "$phone_number|$search_lead_list[$n]|$search_lead_id[$n]|$CFentry_list_id|$VLaffected_rows|$VCFaffected_rows";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
if ( (strlen($VL_update_SQL)>6) or ($delete_lead=='Y') ) if ( (strlen($VL_update_SQL)>6) or ($delete_lead=='Y') )
{ {
if ($delete_lead=='Y') if ($delete_lead=='Y')
@@ -13893,7 +13930,7 @@ if ($function == 'update_lead')
$stmt = "DELETE from vicidial_list where lead_id='$search_lead_id[$n]';"; $stmt = "DELETE from vicidial_list 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";
} }
else 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 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";
@@ -13903,7 +13940,7 @@ if ($function == 'update_lead')
$VLaffected_rows = mysqli_affected_rows($link); $VLaffected_rows = mysqli_affected_rows($link);
$result = 'SUCCESS'; $result = 'SUCCESS';
echo "$result: $result_reason - $user|$search_lead_id[$n]|$VLaffected_rows\n"; echo "$result: $result_reason - $user|$search_lead_id[$n]|$VLaffected_rows|$VCBAaffected_rows|$VCBAaffected_rows|\n";
$data = "$phone_number|$search_lead_list[$n]|$search_lead_id[$n]|$gmt_offset"; $data = "$phone_number|$search_lead_list[$n]|$search_lead_id[$n]|$gmt_offset";
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);
} }
@@ -14091,7 +14128,7 @@ if ($function == 'update_lead')
{ {
$result = 'NOTICE'; $result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS ENTRY DELETED"; $result_reason = "update_lead CUSTOM FIELDS ENTRY DELETED";
echo "$result: $result_reason - $phone_number|$search_lead_id[$n]|$search_lead_list[$n]|$search_entry_list[$n]|$lead_custom_list|$custom_update_count\n"; echo "$result: $result_reason - $phone_number|$search_lead_id[$n]|$search_lead_list[$n]|$search_entry_list[$n]|$lead_custom_list|$VCLDaffected_rows\n";
$data = "$phone_number|$search_lead_id[$n]|$search_lead_list[$n]|$VCLDaffected_rows"; $data = "$phone_number|$search_lead_id[$n]|$search_lead_list[$n]|$VCLDaffected_rows";
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);
} }