Added more settings to add_list & update_list

git-svn-id: svn://192.168.202.10@3254 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2020-06-06 14:17:49 +00:00
parent 06b5d74ae7
commit 80a86f1b39
2 changed files with 88 additions and 5 deletions
+10 -1
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2020-05-22
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2020-06-06
This document describes the functions of an API(Application Programming
Interface) for all functions NOT directly relating to the VICIDIAL Agent screen.
@@ -156,6 +156,7 @@ Changes:
191114-1637 - Added remove_from_hopper option to update_lead function
200331-1207 - Added list_custom_fields function
200418-0837 - Added custom_copy_method option for the add_list function
200606-0938 - Added more settings to add_list & update_list
API Functions use the 'function' variable
@@ -1462,6 +1463,8 @@ web_form_address - 6-100 characters
web_form_address_two - 6-100 characters
web_form_address_three - 6-100 characters
reset_time - 4-100 characters, must be in valid 4-digit groups of 24-hour time (i.e. 0900-1700-2359)
tz_method - one of the following: COUNTRY_AND_AREA_CODE,POSTAL_CODE,NANPA_PREFIX,OWNER_TIME_ZONE_CODE default is COUNTRY_AND_AREA_CODE
local_call_time - must be a valid call time ID in the system or 'campaign' which is the default
expiration_date - 10 characters, must be in valid date format YYYY-MM-DD (i.e. 2012-11-25)
custom_fields_copy - A valid list ID with custom fields to be copied to this new list, 2-14 digits
custom_copy_method - (APPEND,UPDATE,REPLACE) method for how to perform the 'custom_fields_copy', default is APPEND
@@ -1487,6 +1490,8 @@ ERROR: add_list SCRIPT DOES NOT EXIST, THIS IS AN OPTIONAL FIELD - 6666|TESTSCRI
ERROR: add_list IN-GROUP DOES NOT EXIST, THIS IS AN OPTIONAL FIELD - 6666|TEST_IN8
ERROR: add_list RESET TIME IS NOT VALID, THIS IS AN OPTIONAL FIELD - 6666|012
ERROR: add_list EXPIRATION DATE IS NOT VALID, THIS IS AN OPTIONAL FIELD - 6666|012
ERROR: add_list LOCAL CALL TIME DOES NOT EXIST, THIS IS AN OPTIONAL FIELD - 6666|012
ERROR: add_list TIME ZONE METHOD IS NOT VALID, THIS IS AN OPTIONAL FIELD - 6666|012
ERROR: add_list CUSTOM FIELDS LIST ID TO COPY FROM DOES NOT EXIST, THIS IS AN OPTIONAL FIELD - 6666|1101|1102|0
ERROR: add_list CUSTOM FIELDS LIST ID TO COPY FROM HAS NO CUSTOM FIELDS, THIS IS AN OPTIONAL FIELD - 6666|1101|1102|0
ERROR: add_list USER DOES NOT HAVE PERMISSION TO MODIFY CUSTOM FIELDS, THIS IS AN OPTIONAL FIELD - 6666|1101|1102|0
@@ -1525,6 +1530,8 @@ web_form_address - 6-100 characters
web_form_address_two - 6-100 characters
web_form_address_three - 6-100 characters
reset_time - 4-100 characters, must be in valid 4-digit groups of 24-hour time (i.e. 0900-1700-2359)
tz_method - one of the following: COUNTRY_AND_AREA_CODE,POSTAL_CODE,NANPA_PREFIX,OWNER_TIME_ZONE_CODE default is COUNTRY_AND_AREA_CODE
local_call_time - must be a valid call time ID in the system or 'campaign' which is the default
expiration_date - 10 characters, must be in valid date format YYYY-MM-DD (i.e. 2012-11-25)
custom_fields_copy - A valid list ID with custom fields to be copied to the list being updated, 2-14 digits
custom_copy_method - (APPEND,UPDATE,REPLACE) method for how to perform the 'custom_fields_copy', default is APPEND
@@ -1560,6 +1567,8 @@ ERROR: update_list OUTBOUND CID MUST BE FROM 6 TO 18 DIGITS, THIS IS AN OPTIONAL
ERROR: update_list ANSWERING MACHINE MESSAGE MUST LESS THAN 101 DIGITS, THIS IS AN OPTIONAL FIELD - 6666|123...
ERROR: update_list RESET TIME IS NOT VALID, THIS IS AN OPTIONAL FIELD - 6666|012
ERROR: update_list EXPIRATION DATE IS NOT VALID, THIS IS AN OPTIONAL FIELD - 6666|012
ERROR: update_list TIME ZONE METHOD IS NOT VALID, THIS IS AN OPTIONAL FIELD - 6666|012
ERROR: update_list LOCAL CALL TIME DOES NOT EXIST, THIS IS AN OPTIONAL FIELD - 6666|012
NOTICE: update_list NO UPDATES DEFINED - 6666|
SUCCESS: update_list LIST HAS BEEN UPDATED - 6666|1101
NOTICE: update_list LEADS IN LIST HAVE BEEN RESET - 6666|1101|324
+78 -4
View File
@@ -148,10 +148,11 @@
# 200502-0858 - Fix for update_lead --BLANK-- issue with custom fields
# 200508-1503 - Fix for PHP7 issues
# 200525-0118 - Fix for middle_initial --BLANK--
# 200606-0938 - Added more settings to add_list & update_list
#
$version = '2.14-125';
$build = '200525-0118';
$version = '2.14-126';
$build = '200606-0938';
$api_url_log = 0;
$startMS = microtime();
@@ -4443,6 +4444,8 @@ if ($function == 'update_list')
$resettimeSQL='';
$expiration_dateSQL='';
$list_descriptionSQL='';
$tz_methodSQL='';
$local_call_timeSQL='';
if (strlen($campaign_id) > 0)
{
$stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';";
@@ -4654,8 +4657,45 @@ if ($function == 'update_list')
else
{$list_descriptionSQL = " ,list_description='$list_description'";}
}
if (strlen($tz_method) > 0)
{
if (preg_match("/^COUNTRY_AND_AREA_CODE$|^POSTAL_CODE$|^NANPA_PREFIX$|^OWNER_TIME_ZONE_CODE$/",$tz_method))
{$tz_methodSQL = " ,time_zone_setting='$tz_method'";}
else
{
$result = 'ERROR';
$result_reason = "update_list TIME ZONE METHOD IS NOT VALID, THIS IS AN OPTIONAL FIELD";
$data = "$tz_method";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
if (strlen($local_call_time) > 0)
{
if (preg_match("/^campaign$/",$local_call_time))
{$local_call_timeSQL = " ,local_call_time='$local_call_time'";}
else
{
$stmt="SELECT count(*) from vicidial_call_times where call_time_id='$local_call_time';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$call_time_exists=$row[0];
if ($call_time_exists < 1)
{
$result = 'ERROR';
$result_reason = "update_list LOCAL CALL TIME DOES NOT EXIST, THIS IS AN OPTIONAL FIELD";
$data = "$local_call_time";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{$local_call_timeSQL = " ,local_call_time='$local_call_time'";}
}
}
$updateSQL = "$webformthreeSQL$webformtwoSQL$webformSQL$ammessageSQL$outboundcidSQL$activeSQL$listnameSQL$campaignSQL$scriptSQL$dropingroupSQL$resettimeSQL$expiration_dateSQL$list_descriptionSQL";
$updateSQL = "$webformthreeSQL$webformtwoSQL$webformSQL$ammessageSQL$outboundcidSQL$activeSQL$listnameSQL$campaignSQL$scriptSQL$dropingroupSQL$resettimeSQL$expiration_dateSQL$list_descriptionSQL$tz_methodSQL$local_call_timeSQL";
if (strlen($updateSQL)< 3)
{
@@ -5531,6 +5571,8 @@ if ($function == 'add_list')
$webformtwoSQL='';
$webformthreeSQL='';
$list_descriptionSQL='';
$tz_methodSQL='';
$local_call_timeSQL='';
if (strlen($web_form_address) > 0)
{
if (preg_match("/%3A%2F%2F/",$web_form_address))
@@ -5576,8 +5618,40 @@ if ($function == 'add_list')
else
{$list_descriptionSQL = " ,list_description='$list_description'";}
}
if (strlen($tz_method) > 0)
{
if (preg_match("/^COUNTRY_AND_AREA_CODE$|^POSTAL_CODE$|^NANPA_PREFIX$|^OWNER_TIME_ZONE_CODE$/",$tz_method))
{$tz_methodSQL = " ,time_zone_setting='$tz_method'";}
else
{
$result = 'ERROR';
$result_reason = "add_list TIME ZONE METHOD IS NOT VALID, THIS IS AN OPTIONAL FIELD";
$data = "$tz_method";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
if ( (strlen($local_call_time) > 0) and (!preg_match("/^campaign$/",$local_call_time)) )
{
$stmt="SELECT count(*) from vicidial_call_times where call_time_id='$local_call_time';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$call_time_exists=$row[0];
if ($call_time_exists < 1)
{
$result = 'ERROR';
$result_reason = "add_list LOCAL CALL TIME DOES NOT EXIST, THIS IS AN OPTIONAL FIELD";
$data = "$local_call_time";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{$local_call_timeSQL = " ,local_call_time='$local_call_time'";}
}
$stmt="INSERT INTO vicidial_lists SET list_id='$list_id', list_name='$list_name', campaign_id='$campaign_id', active='$active', campaign_cid_override='$outbound_cid', agent_script_override='$script', am_message_exten_override='$am_message', drop_inbound_group_override='$drop_inbound_group', reset_time='$reset_time', expiration_date='$expiration_date' $webformSQL $webformtwoSQL $webformthreeSQL $list_descriptionSQL;";
$stmt="INSERT INTO vicidial_lists SET list_id='$list_id', list_name='$list_name', campaign_id='$campaign_id', active='$active', campaign_cid_override='$outbound_cid', agent_script_override='$script', am_message_exten_override='$am_message', drop_inbound_group_override='$drop_inbound_group', reset_time='$reset_time', expiration_date='$expiration_date' $webformSQL $webformtwoSQL $webformthreeSQL $list_descriptionSQL $tz_methodSQL $local_call_timeSQL;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "|$stmt|\n";}