diff --git a/docs/NON-AGENT_API.txt b/docs/NON-AGENT_API.txt index b534b1e4..22252b0d 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-16 +NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2021-03-20 This document describes the functions of an API(Application Programming Interface) for all functions NOT directly relating to the VICIDIAL Agent screen. @@ -178,6 +178,8 @@ Changes: 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 +210319-1720 - Added special 'xDAYS' value option for callback_datetime +210320-2127 - Added 'custom_fields_add' option for update_list function API Functions use the 'function' variable @@ -953,7 +955,8 @@ tz_method - , POSTAL, TZCODE or NANPA, default is which will use NANPA relies on the optional NANPA areacode prefix data being loaded on your system callback - Y or N, default is N. Set this lead as a scheduled callback. campaign_id field is REQUIRED for callbacks callback_status - 1-6 Character, callback status to use, default is CALLBK (vicidial_list status will be set to CBHOLD to lock) -callback_datetime - YYYY-MM-DD+HH:MM:SS, date and time of scheduled callback. REQUIRED if callback is set. NOW can be used for current datetime. +callback_datetime - YYYY-MM-DD+HH:MM:SS, date and time of scheduled callback. REQUIRED if callback is set. + 'NOW' can be used for current datetime. 'xDAYS' can also be used where 'x' is replaced with a number of days in the future callback_type - USERONLY or ANYONE, default is ANYONE callback_user - User ID the USERONLY callback is assigned to callback_comments - Optional comments to appear when the callback is called back @@ -1092,7 +1095,8 @@ delete_lead - Y or N, Setting this to Y will delete the lead from the vicidial_ 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_status - 1-6 Character, callback status to use, default is CALLBK (vicidial_list status will be set to CBHOLD to lock) -callback_datetime - YYYY-MM-DD+HH:MM:SS, date and time of scheduled callback. REQUIRED if callback is set. NOW can be used for current datetime. +callback_datetime - YYYY-MM-DD+HH:MM:SS, date and time of scheduled callback. REQUIRED if callback is set. + 'NOW' can be used for current datetime. 'xDAYS' can also be used where 'x' is replaced with a number of days in the future callback_type - USERONLY or ANYONE, default is ANYONE callback_user - User ID the USERONLY callback is assigned to callback_comments - Optional comments to appear when the callback is called back @@ -1726,6 +1730,26 @@ custom_copy_method - (APPEND,UPDATE,REPLACE) method for how to perform the 'cust APPEND - the only 100% safe method, will not result in any lost existing data, only adds fields not present in the destination list UPDATE - will only update existing custom fields definitions to match the source list, will not add new fields REPLACE - will delete all existing custom field lead data in destination list and start clean with new fields +custom_fields_add - Must be one of these: 'Y','N', will default to 'N'. The fields below marked with a star(*) are required for this to work: + field_label* - The label to use in the database for this custom field(only letters, numbers and underscore allowed) + field_name* - The visible name of the field in the form + field_size* - The size of the form field + field_type* - The type of field: TEXT, SELECT, AREA, etc... (see the Custom List Fields adminn web page HELP for more info) + field_rank* - The order from top to bottom of where this field will appear in the form + field_order - The horizontal order of the field, if there is more than one of the same rank + field_rerank - If there is an existing field of the same rank, move the existing ones down the list, 'YES','NO' default is 'NO' + field_max - The maximum size of data allowed in the field + field_default - The default value of the field + field_options - The field options for this field + field_duplicate - If this is a duplicate of another existing field for this list ID: 'Y','N' default is 'N' + field_description - Description of the field + field_help - The help text for this field as it appears to the agent in the custom form + field_required - If this field is considered Required: 'Y','N' default is 'N' + multi_position - The position of the field element: 'HORIZONTAL','VERTICAL' default is 'HORIZONTAL' + name_position - The position of the name of the field: 'TOP','LEFT' default is 'LEFT' + field_encrypt - If this is to be an encrypted field(a VICIhost-only feature, if enabled): 'Y','N' default is 'N' + field_show_hide - If the field is to be hidden(a VICIhost-only feature, if enabled): 'DISABLED','X_OUT_ALL','LAST_1','LAST_2','LAST_3','LAST_4','FIRST_1_LAST_4' + NOTES: - in order to set a field to empty('') set it equal to --BLANK--, i.e. "&drop_inbound_group=--BLANK--" - please use no special characters like apostrophes, quotes or amphersands @@ -1739,6 +1763,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_list&list_id=1102&reset_list=Y http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_list&list_id=1102&delete_list=Y&delete_leads=Y http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_list&list_id=1102&campaign_id=ASTRICON +http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_list&list_id=99883&custom_copy_method=APPEND&custom_fields_copy=9988 +http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=update_list&list_id=9988&custom_fields_add=Y&field_label=new_api_field4&field_name=new+API+field4&field_size=20&field_type=TEXT&field_rank=16 Example responses: ERROR: update_list USER DOES NOT HAVE PERMISSION TO UPDATE LISTS - 6666 @@ -1773,7 +1799,12 @@ NOTICE: update_list LEADS IN LIST HAVE BEEN DELETED - 6666|1101|324 NOTICE: update_list CUSTOM FIELDS LIST ID TO COPY FROM DOES NOT EXIST, THIS IS AN OPTIONAL FIELD - 6666|1101|1102|0 NOTICE: update_list CUSTOM FIELDS LIST ID TO COPY FROM HAS NO CUSTOM FIELDS, THIS IS AN OPTIONAL FIELD - 6666|1101|1102|0 NOTICE: update_list USER DOES NOT HAVE PERMISSION TO MODIFY CUSTOM FIELDS, THIS IS AN OPTIONAL FIELD - 6666|1101|1102|0 -NOTICE: update_list COPY CUSTOM FIELDS COMMAND SENT - 6666|1101|APPEND +NOTICE: update_list COPY CUSTOM FIELDS COMMAND SENT - 6666|1101|APPEND|ERROR: Fields not copied| +NOTICE: update_list COPY CUSTOM FIELDS COMMAND SENT - 6666|1101|APPEND|SUCCESS: Fields copied| +NOTICE: update_list CUSTOM FIELDS LIST ID TO ADD TO HAS NO CUSTOM FIELDS, THIS IS AN OPTIONAL FIELD - 6666|1101 +NOTICE: update_list REQUIRED CUSTOM FIELDS VARIABLES ARE MISSING, FIELD NOT ADDED, THIS IS AN OPTIONAL FIELD - 6666|1101|||||| +NOTICE: update_list ADD CUSTOM FIELD COMMAND SENT - 6666|1101|new_field|TEXT|ERROR: Field not added| +NOTICE: update_list ADD CUSTOM FIELD COMMAND SENT - 6666|1101|new_field|TEXT|SUCCESS: Field added| diff --git a/www/vicidial/admin_lists_custom.php b/www/vicidial/admin_lists_custom.php index c7681a37..de47497b 100644 --- a/www/vicidial/admin_lists_custom.php +++ b/www/vicidial/admin_lists_custom.php @@ -187,6 +187,7 @@ if ($non_latin < 1) $field_options = preg_replace('/[^ \'\&\.\n\|\,-\_0-9a-zA-Z]/', '',$field_options); if ($field_type != 'SCRIPT') {$field_options = preg_replace('/[^ \.\n\|\,-\_0-9a-zA-Z]/', '',$field_options);} + $field_help = preg_replace('/[^ \'\&\.\n\|\,-\_0-9a-zA-Z]/', '',$field_help); $field_default = preg_replace('/[^ \.\n\,-\_0-9a-zA-Z]/', '',$field_default); } # end of non_latin else diff --git a/www/vicidial/non_agent_api.php b/www/vicidial/non_agent_api.php index 005b36c1..d42f7bf9 100644 --- a/www/vicidial/non_agent_api.php +++ b/www/vicidial/non_agent_api.php @@ -15,7 +15,7 @@ # optional callback variables for add_lead/update_lead # - $callback - ('Y,'N','REMOVE') # - $callback_status - ('CALLBK','CBXYZ',...) -# - $callback_datetime - ('YYYY-MM-DD+HH:MM:SS','NOW') +# - $callback_datetime - ('YYYY-MM-DD+HH:MM:SS','NOW','273DAYS') # - $callback_type - ('USERONLY','ANYONE') # - $callback_user - ('6666','1001',...) # - $callback_comments - ('Comments go here',...) @@ -166,10 +166,12 @@ # 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 +# 210319-1720 - Added special 'xDAYS' value option for callback_datetime +# 210320-2127 - Added 'custom_fields_add' option for update_list function # -$version = '2.14-143'; -$build = '210316-2207'; +$version = '2.14-145'; +$build = '210320-2127'; $api_url_log = 0; $startMS = microtime(); @@ -582,6 +584,48 @@ if (isset($_GET["xferconf_four"])) {$xferconf_four=$_GET["xferconf_four"];} elseif (isset($_POST["xferconf_four"])) {$xferconf_four=$_POST["xferconf_four"];} if (isset($_GET["xferconf_five"])) {$xferconf_five=$_GET["xferconf_five"];} elseif (isset($_POST["xferconf_five"])) {$xferconf_five=$_POST["xferconf_five"];} +if (isset($_GET["use_internal_webserver"])) {$use_internal_webserver=$_GET["use_internal_webserver"];} + elseif (isset($_POST["use_internal_webserver"])) {$use_internal_webserver=$_POST["use_internal_webserver"];} +if (isset($_GET["field_label"])) {$field_label=$_GET["field_label"];} + elseif (isset($_POST["field_label"])) {$field_label=$_POST["field_label"];} +if (isset($_GET["field_name"])) {$field_name=$_GET["field_name"];} + elseif (isset($_POST["field_name"])) {$field_name=$_POST["field_name"];} +if (isset($_GET["field_description"])) {$field_description=$_GET["field_description"];} + elseif (isset($_POST["field_description"])) {$field_description=$_POST["field_description"];} +if (isset($_GET["field_rank"])) {$field_rank=$_GET["field_rank"];} + elseif (isset($_POST["field_rank"])) {$field_rank=$_POST["field_rank"];} +if (isset($_GET["field_help"])) {$field_help=$_GET["field_help"];} + elseif (isset($_POST["field_help"])) {$field_help=$_POST["field_help"];} +if (isset($_GET["field_type"])) {$field_type=$_GET["field_type"];} + elseif (isset($_POST["field_type"])) {$field_type=$_POST["field_type"];} +if (isset($_GET["field_options"])) {$field_options=$_GET["field_options"];} + elseif (isset($_POST["field_options"])) {$field_options=$_POST["field_options"];} +if (isset($_GET["field_size"])) {$field_size=$_GET["field_size"];} + elseif (isset($_POST["field_size"])) {$field_size=$_POST["field_size"];} +if (isset($_GET["field_max"])) {$field_max=$_GET["field_max"];} + elseif (isset($_POST["field_max"])) {$field_max=$_POST["field_max"];} +if (isset($_GET["field_default"])) {$field_default=$_GET["field_default"];} + elseif (isset($_POST["field_default"])) {$field_default=$_POST["field_default"];} +if (isset($_GET["field_cost"])) {$field_cost=$_GET["field_cost"];} + elseif (isset($_POST["field_cost"])) {$field_cost=$_POST["field_cost"];} +if (isset($_GET["field_required"])) {$field_required=$_GET["field_required"];} + elseif (isset($_POST["field_required"])) {$field_required=$_POST["field_required"];} +if (isset($_GET["name_position"])) {$name_position=$_GET["name_position"];} + elseif (isset($_POST["name_position"])) {$name_position=$_POST["name_position"];} +if (isset($_GET["multi_position"])) {$multi_position=$_GET["multi_position"];} + elseif (isset($_POST["multi_position"])) {$multi_position=$_POST["multi_position"];} +if (isset($_GET["field_order"])) {$field_order=$_GET["field_order"];} + elseif (isset($_POST["field_order"])) {$field_order=$_POST["field_order"];} +if (isset($_GET["field_encrypt"])) {$field_encrypt=$_GET["field_encrypt"];} + elseif (isset($_POST["field_encrypt"])) {$field_encrypt=$_POST["field_encrypt"];} +if (isset($_GET["field_show_hide"])) {$field_show_hide=$_GET["field_show_hide"];} + elseif (isset($_POST["field_show_hide"])) {$field_show_hide=$_POST["field_show_hide"];} +if (isset($_GET["field_duplicate"])) {$field_duplicate=$_GET["field_duplicate"];} + elseif (isset($_POST["field_duplicate"])) {$field_duplicate=$_POST["field_duplicate"];} +if (isset($_GET["field_rerank"])) {$field_rerank=$_GET["field_rerank"];} + elseif (isset($_POST["field_rerank"])) {$field_rerank=$_POST["field_rerank"];} +if (isset($_GET["custom_fields_add"])) {$custom_fields_add=$_GET["custom_fields_add"];} + elseif (isset($_POST["custom_fields_add"])) {$custom_fields_add=$_POST["custom_fields_add"];} header ("Content-type: text/html; charset=utf-8"); @@ -590,7 +634,7 @@ header ("Pragma: no-cache"); // HTTP/1.0 ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,custom_fields_enabled,pass_hash_enabled,agent_whisper_enabled,active_modules,auto_dial_limit,enable_languages,language_method,admin_web_directory FROM system_settings;"; +$stmt = "SELECT use_non_latin,custom_fields_enabled,pass_hash_enabled,agent_whisper_enabled,active_modules,auto_dial_limit,enable_languages,language_method,admin_web_directory,sounds_web_server FROM system_settings;"; $rslt=mysql_to_mysqli($stmt, $link); $qm_conf_ct = mysqli_num_rows($rslt); if ($qm_conf_ct > 0) @@ -607,6 +651,7 @@ if ($qm_conf_ct > 0) $SSenable_languages = $row[6]; $SSlanguage_method = $row[7]; $SSadmin_web_directory = $row[8]; + $SSsounds_web_server = $row[9]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -825,6 +870,25 @@ if ($non_latin < 1) $xferconf_three=preg_replace('/[^-_0-9a-zA-Z]/','',$xferconf_three); $xferconf_four=preg_replace('/[^-_0-9a-zA-Z]/','',$xferconf_four); $xferconf_five=preg_replace('/[^-_0-9a-zA-Z]/','',$xferconf_five); + $field_rank = preg_replace('/[^0-9]/','',$field_rank); + $field_size = preg_replace('/[^0-9]/','',$field_size); + $field_max = preg_replace('/[^0-9]/','',$field_max); + $field_order = preg_replace('/[^0-9]/','',$field_order); + $field_required = preg_replace('/[^_A-Z]/','',$field_required); + $field_encrypt = preg_replace('/[^NY]/','',$field_encrypt); + $field_duplicate = preg_replace('/[^_A-Z]/','',$field_duplicate); + $field_type = preg_replace('/[^0-9a-zA-Z]/','',$field_type); + $name_position = preg_replace('/[^0-9a-zA-Z]/','',$name_position); + $multi_position = preg_replace('/[^0-9a-zA-Z]/','',$multi_position); + $field_label = preg_replace('/[^_0-9a-zA-Z]/','',$field_label); + $field_show_hide = preg_replace('/[^_0-9a-zA-Z]/','',$field_show_hide); + $field_name = preg_replace('/[^ \.\,-\_0-9a-zA-Z]/','',$field_name); + $field_description = preg_replace('/[^ \.\,-\_0-9a-zA-Z]/','',$field_description); + $field_options = preg_replace('/[^ \'\&\.\n\|\,-\_0-9a-zA-Z]/', '',$field_options); + if ($field_type != 'SCRIPT') + {$field_options = preg_replace('/[^ \.\n\|\,-\_0-9a-zA-Z]/', '',$field_options);} + $field_help = preg_replace('/[^ \'\&\.\n\|\,-\_0-9a-zA-Z]/', '',$field_help); + $field_default = preg_replace('/[^ \.\n\,-\_0-9a-zA-Z]/', '',$field_default); } else { @@ -835,6 +899,9 @@ else $menu_id = preg_replace("/'|\"|\\\\|;|#/",'',$menu_id); } $list_exists_check = preg_replace('/[^0-9a-zA-Z]/','',$list_exists_check); +$use_internal_webserver = preg_replace('/[^0-9a-zA-Z]/','',$use_internal_webserver); +$field_rerank = preg_replace('/[^_0-9a-zA-Z]/','',$field_rerank); +$custom_fields_add = preg_replace('/[^_0-9a-zA-Z]/','',$custom_fields_add); $USarea = substr($phone_number, 0, 3); $USprefix = substr($phone_number, 3, 3); @@ -5152,7 +5219,7 @@ if ($function == 'update_list') $rslt=mysql_to_mysqli($stmt, $link); $row=mysqli_fetch_row($rslt); $list_exists=$row[0]; - if ($list_exists < 1) + if ( ($list_exists < 1) and ($custom_fields_add != 'Y') ) { if ($insert_if_not_found == 'Y') { @@ -5176,6 +5243,111 @@ if ($function == 'update_list') } else { + ### BEGIN 'custom_fields_add' section + if ($custom_fields_add == 'Y') + { + $add_custom_fields_trigger=0; + + if ($list_exists < 1) + { + $stmt="SELECT count(*) from vicidial_lists_fields where list_id='$list_id';"; + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $list_exists=$row[0]; + if ($DB>0) {echo "$list_exists|$stmt|\n";} + if ($list_exists < 1) + { + $result = 'NOTICE'; + $result_reason = "update_list CUSTOM FIELDS LIST ID TO ADD TO HAS NO CUSTOM FIELDS, THIS IS AN OPTIONAL FIELD"; + $data = "$list_id|$list_exists"; + echo "$result: $result_reason: |$user|$data\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + } + if ($list_exists > 0) + { + $stmt="SELECT count(*) from vicidial_users where user='$user' and custom_fields_modify='1';"; + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $custom_fields_modify_exists=$row[0]; + if ($DB>0) {echo "$custom_fields_modify_exists|$stmt|\n";} + if ($custom_fields_modify_exists < 1) + { + $result = 'NOTICE'; + $result_reason = "update_list USER DOES NOT HAVE PERMISSION TO MODIFY CUSTOM FIELDS, THIS IS AN OPTIONAL FIELD"; + $data = "$list_id|$custom_fields_copy|$custom_fields_modify_exists"; + echo "$result: $result_reason: |$user|$data\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + else + { + if ($DB>0) {echo "Add custom field triggered|$add_custom_fields_trigger|\n";} + $add_custom_fields_trigger++; + } + } + + if ( ($add_custom_fields_trigger > 0) and (strlen($list_id) > 1) ) + { + if ( (strlen($field_label) < 1) or (strlen($field_name) < 1) or (strlen($field_size) < 1) or (strlen($field_type) < 1) or (strlen($field_rank) < 1) ) + { + $result = 'NOTICE'; + $result_reason = "update_list REQUIRED CUSTOM FIELDS VARIABLES ARE MISSING, FIELD NOT ADDED, THIS IS AN OPTIONAL FIELD"; + $data = "$list_id|$field_label|$field_name|$field_size|$field_type|$field_rank|"; + echo "$result: $result_reason: |$user|$data\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + else + { + ### BEGIN add custom fields ### + $admin_lists_custom = 'admin_lists_custom.php'; + if (!preg_match("/^Y$|^N$/",$field_encrypt)) {$field_encrypt = 'N';} + if (!preg_match("/^DISABLED$|^X_OUT_ALL$|LAST_1|LAST_2|LAST_3|LAST_4|FIRST_1_LAST_4/",$field_show_hide)) {$field_show_hide = 'DISABLED';} + if (!preg_match("/^TOP$|^LEFT$/",$name_position)) {$name_position = 'LEFT';} + if (!preg_match("/^HORIZONTAL$|^VERTICAL$/",$multi_position)) {$multi_position = 'HORIZONTAL';} + if (!preg_match("/^Y$|^N$/",$field_required)) {$field_required = 'N';} + if (!preg_match("/^Y$|^N$/",$field_duplicate)) {$field_duplicate = 'N';} + if (!preg_match("/^YES$|^NO$/",$field_rerank)) {$field_rerank = 'NO';} + if (strlen($field_order) < 1) {$field_order = '1';} + $temp_webserver = (isset($_SERVER['HTTPS']) ? 's' : '') . "://$_SERVER[HTTP_HOST]"; + if ($use_internal_webserver == 'Y') {$temp_webserver = "://$SSsounds_web_server";} + + $url = "http$temp_webserver/$SSadmin_web_directory/" . $admin_lists_custom; + $url_post_fields = "action=ADD_CUSTOM_FIELD&list_id=$list_id&field_label=$field_label&field_name=$field_name&field_size=$field_size&field_type=$field_type&field_rank=$field_rank&field_order=$field_order&field_rerank=$field_rerank&field_max=$field_max&field_default=$field_default&field_options=$field_options&field_duplicate=$field_duplicate&field_description=$field_description&field_help=$field_help&field_required=$field_required&multi_position=$multi_position&name_position=$name_position&field_encrypt=$field_encrypt&field_show_hide=$field_show_hide"; + + if ($DB>0) {echo "Add custom fields url|$url|$url_post_fields|\n";} + # use cURL to call the copy custom fields code + $curl = curl_init(); + + # Set some options - we are passing in a useragent too here + curl_setopt_array($curl, array( + CURLOPT_RETURNTRANSFER => 1, + CURLOPT_URL => $url, + CURLOPT_USERPWD => "$user:$pass", + CURLOPT_USERAGENT => 'non_agent_api.php', + CURLOPT_POST => 1, + CURLOPT_POSTFIELDS => "$url_post_fields" + )); + + # Send the request & save response to $resp + $resp = curl_exec($curl); + $temp_response = 'NONE'; + if (preg_match('/ERROR:/',$resp)) {$temp_response = 'ERROR: Field not added';} + if (preg_match('/SUCCESS:/',$resp)) {$temp_response = 'SUCCESS: Field added';} + + # Close request to clear up some resources + curl_close($curl); + ### END copy custom fields ### + + $result = 'NOTICE'; + $result_reason = "update_list ADD CUSTOM FIELD COMMAND SENT"; + $data = "$list_id|$field_label|$field_type|$temp_response|"; + echo "$result: $result_reason - $user|$data\n"; + api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); + } + } + } + ### END 'custom_fields_add' section + $campaignSQL=''; $scriptSQL=''; $dropingroupSQL=''; @@ -5770,8 +5942,10 @@ if ($function == 'update_list') $admin_lists_custom = 'admin_lists_custom.php'; if (!preg_match("/^APPEND$|^UPDATE$|^REPLACE$/",$custom_copy_method)) {$custom_copy_method = 'APPEND';} + $temp_webserver = (isset($_SERVER['HTTPS']) ? 's' : '') . "://$_SERVER[HTTP_HOST]"; + if ($use_internal_webserver == 'Y') {$temp_webserver = "://$SSsounds_web_server";} - $url = "http" . (isset($_SERVER['HTTPS']) ? 's' : '') . "://$_SERVER[HTTP_HOST]/$SSadmin_web_directory/" . $admin_lists_custom . "?copy_option=" . $custom_copy_method . "&action=COPY_FIELDS_SUBMIT&list_id=$list_id&source_list_id=$custom_fields_copy"; + $url = "http$temp_webserver/$SSadmin_web_directory/" . $admin_lists_custom . "?copy_option=" . $custom_copy_method . "&action=COPY_FIELDS_SUBMIT&list_id=$list_id&source_list_id=$custom_fields_copy"; if ($DB>0) {echo "Copy custom fields url|$url|\n";} # use cURL to call the copy custom fields code @@ -5787,6 +5961,9 @@ if ($function == 'update_list') # Send the request & save response to $resp $resp = curl_exec($curl); + $temp_response = 'NONE'; + if (preg_match('/ERROR:/',$resp)) {$temp_response = 'ERROR: Fields not copied';} + if (preg_match('/SUCCESS:/',$resp)) {$temp_response = 'SUCCESS: Fields copied';} # Close request to clear up some resources curl_close($curl); @@ -5794,7 +5971,7 @@ if ($function == 'update_list') $result = 'NOTICE'; $result_reason = "update_list COPY CUSTOM FIELDS COMMAND SENT"; - $data = "$list_id|$custom_fields_copy|$custom_copy_method|"; + $data = "$list_id|$custom_fields_copy|$custom_copy_method|$temp_response|"; echo "$result: $result_reason - $user|$data\n"; api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data); } @@ -6582,8 +6759,10 @@ if ($function == 'add_list') $admin_lists_custom = 'admin_lists_custom.php'; if (!preg_match("/^APPEND$|^UPDATE$|^REPLACE$/",$custom_copy_method)) {$custom_copy_method = 'APPEND';} + $temp_webserver = (isset($_SERVER['HTTPS']) ? 's' : '') . "://$_SERVER[HTTP_HOST]"; + if ($use_internal_webserver == 'Y') {$temp_webserver = "://$SSsounds_web_server";} - $url = "http" . (isset($_SERVER['HTTPS']) ? 's' : '') . "://$_SERVER[HTTP_HOST]/$SSadmin_web_directory/" . $admin_lists_custom . "?copy_option=" . $custom_copy_method . "&action=COPY_FIELDS_SUBMIT&list_id=$list_id&source_list_id=$custom_fields_copy"; + $url = "http$temp_webserver/$SSadmin_web_directory/" . $admin_lists_custom . "?copy_option=" . $custom_copy_method . "&action=COPY_FIELDS_SUBMIT&list_id=$list_id&source_list_id=$custom_fields_copy"; if ($DB>0) {echo "Copy custom fields url|$url|\n";} # use cURL to call the copy custom fields code @@ -6599,7 +6778,10 @@ if ($function == 'add_list') # Send the request & save response to $resp $resp = curl_exec($curl); - + $temp_response = 'NONE'; + if (preg_match('/ERROR:/',$resp)) {$temp_response = 'ERROR: Fields not copied';} + if (preg_match('/SUCCESS:/',$resp)) {$temp_response = 'SUCCESS: Fields copied';} + # Close request to clear up some resources curl_close($curl); ### END copy custom fields ### @@ -6609,7 +6791,7 @@ if ($function == 'add_list') $SQL_log = "$stmt|"; $SQL_log = preg_replace('/;/', '', $SQL_log); $SQL_log = addslashes($SQL_log); - $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$user', ip_address='$ip', event_section='LISTS', event_type='ADD', record_id='$list_id', event_code='ADMIN API ADD LIST', event_sql=\"$SQL_log\", event_notes='list: $list_id|$campaign_id|$custom_fields_copy';"; + $stmt="INSERT INTO vicidial_admin_log set event_date='$NOW_TIME', user='$user', ip_address='$ip', event_section='LISTS', event_type='ADD', record_id='$list_id', event_code='ADMIN API ADD LIST', event_sql=\"$SQL_log\", event_notes='list: $list_id|$campaign_id|$custom_fields_copy|$temp_response';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link); @@ -12317,6 +12499,11 @@ if ($function == 'add_lead') { if ($callback_datetime == 'NOW') {$callback_datetime=$NOW_TIME;} + if (preg_match("/\dDAYS$/i",$callback_datetime)) + { + $callback_days = preg_replace('/[^0-9]/','',$callback_datetime); + $callback_datetime = date("Y-m-d H:i:s", mktime(date("H"),date("i"),date("s"),date("m"),date("d")+$callback_days,date("Y"))); + } if (strlen($callback_status)<1) {$callback_status='CALLBK';} @@ -12706,6 +12893,11 @@ if ($function == 'update_lead') { if ($callback_datetime == 'NOW') {$callback_datetime=$NOW_TIME;} + if (preg_match("/\dDAYS$/i",$callback_datetime)) + { + $callback_days = preg_replace('/[^0-9]/','',$callback_datetime); + $callback_datetime = date("Y-m-d H:i:s", mktime(date("H"),date("i"),date("s"),date("m"),date("d")+$callback_days,date("Y"))); + } $callback_datetimeSQL=",callback_time='$callback_datetime'"; } if (strlen($campaign_id)>0) @@ -12758,7 +12950,6 @@ if ($function == 'update_lead') } if ($camp_count > 0) { - $valid_callback=0; $user_group=''; if ($callback_type == 'USERONLY') @@ -12791,6 +12982,11 @@ if ($function == 'update_lead') { if ($callback_datetime == 'NOW') {$callback_datetime=$NOW_TIME;} + if (preg_match("/\dDAYS$/i",$callback_datetime)) + { + $callback_days = preg_replace('/[^0-9]/','',$callback_datetime); + $callback_datetime = date("Y-m-d H:i:s", mktime(date("H"),date("i"),date("s"),date("m"),date("d")+$callback_days,date("Y"))); + } if (strlen($callback_status)<1) {$callback_status='CALLBK';}