Added DUPPHONEALT... options for duplicate_check within add_lead Non-Agent API function

git-svn-id: svn://192.168.202.10@3793 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2024-01-01 15:03:03 +00:00
parent bac897234d
commit 6084517700
3 changed files with 110 additions and 5 deletions
+4
View File
@@ -843,6 +843,10 @@ OTHER CHANGES:
239. Added a Multi-call option to the agent 3-way press-1 calls feature. 239. Added a Multi-call option to the agent 3-way press-1 calls feature.
240. Added DUPPHONEALT... duplicate_check options within the add_lead
Non-Agent API function. Checks for duplicate phone against both the
phone_number and alt_phone fields.
+9 -2
View File
@@ -1,4 +1,4 @@
NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2023-11-09 NON-AGENT API DOCUMENT Started: 2008-07-24 Updated: 2024-01-01
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.
@@ -212,6 +212,7 @@ Changes:
230721-1753 - Added insert for daily RT monitoring 230721-1753 - Added insert for daily RT monitoring
231109-0933 - Added archived_lead option to multiple functions 231109-0933 - Added archived_lead option to multiple functions
231109-2022 - Added lead_dearchive function 231109-2022 - Added lead_dearchive function
240101-0920 - Added DUPPHONEALT... options for duplicate_check within add_lead function
API Functions use the 'function' variable API Functions use the 'function' variable
@@ -1042,6 +1043,9 @@ duplicate_check - Check for duplicate records in the system, can select more tha
DUPLIST - check for duplicate phone_number in same list DUPLIST - check for duplicate phone_number in same list
DUPCAMP - check for duplicate phone_number in all lists for this list's campaign DUPCAMP - check for duplicate phone_number in all lists for this list's campaign
DUPSYS - check for duplicate phone_number in entire system DUPSYS - check for duplicate phone_number in entire system
DUPPHONEALTLIST - check for duplicate phone against phone_number and alt_phone in same list
DUPPHONEALTCAMP - check for duplicate phone against phone_number and alt_phone in all lists for this list's campaign
DUPPHONEALTSYS - check for duplicate phone against phone_number and alt_phone in entire system
DUPTITLEALTPHONELIST - check for duplicate title and alt_phone in same list DUPTITLEALTPHONELIST - check for duplicate title and alt_phone in same list
DUPTITLEALTPHONECAMP - check for duplicate title and alt_phone in all lists for this list's campaign DUPTITLEALTPHONECAMP - check for duplicate title and alt_phone in all lists for this list's campaign
DUPTITLEALTPHONESYS - check for duplicate title and alt_phone in entire system DUPTITLEALTPHONESYS - check for duplicate title and alt_phone in entire system
@@ -1114,7 +1118,7 @@ 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=add_lead&phone_number=7275551111&phone_code=1&list_id=999&dnc_check=N&campaign_dnc_check=Y&campaign_id=TESTCAMP&first_name=Bob&last_name=Wilson&address1=1234+Main+St.&city=Chicago+Heights&state=IL&add_to_hopper=Y&hopper_local_call_time_check=Y&multi_alt_phones=7275551212_1_work!7275551213_1_sister+house!1234567890_1_neighbor http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=add_lead&phone_number=7275551111&phone_code=1&list_id=999&dnc_check=N&campaign_dnc_check=Y&campaign_id=TESTCAMP&first_name=Bob&last_name=Wilson&address1=1234+Main+St.&city=Chicago+Heights&state=IL&add_to_hopper=Y&hopper_local_call_time_check=Y&multi_alt_phones=7275551212_1_work!7275551213_1_sister+house!1234567890_1_neighbor
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=add_lead&phone_number=7275551212&phone_code=1&list_id=999&dnc_check=N&first_name=Bob&last_name=Wilson&duplicate_check=DUPLIST-DUPNAMEPHONELIST http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=add_lead&phone_number=7275551212&phone_code=1&list_id=999&dnc_check=N&first_name=Bob&last_name=Wilson&duplicate_check=DUPPHONEALTLIST-DUPNAMEPHONELIST
http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=add_lead&phone_number=7275551212&phone_code=1&list_id=999&custom_fields=Y&favorite_color=blue http://server/vicidial/non_agent_api.php?source=test&user=6666&pass=1234&function=add_lead&phone_number=7275551212&phone_code=1&list_id=999&custom_fields=Y&favorite_color=blue
@@ -1152,6 +1156,9 @@ ERROR: NO FUNCTION SPECIFIED
ERROR: add_lead DUPLICATE PHONE NUMBER IN LIST - 7275551111|101|8765444 ERROR: add_lead DUPLICATE PHONE NUMBER IN LIST - 7275551111|101|8765444
ERROR: add_lead DUPLICATE PHONE NUMBER IN CAMPAIGN LISTS - 7275551111|101|8765444|101 ERROR: add_lead DUPLICATE PHONE NUMBER IN CAMPAIGN LISTS - 7275551111|101|8765444|101
ERROR: add_lead DUPLICATE PHONE NUMBER IN SYSTEM - 7275551111|101|8765444|101 ERROR: add_lead DUPLICATE PHONE NUMBER IN SYSTEM - 7275551111|101|8765444|101
ERROR: add_lead DUPLICATE PHONE NUMBER IN LIST - 7275551111|101|8765444|PHONE
ERROR: add_lead DUPLICATE PHONE NUMBER IN CAMPAIGN LISTS - 7275551111|101|8765444|101|ALT
ERROR: add_lead DUPLICATE PHONE NUMBER IN SYSTEM - 7275551111|101|8765444|101|PHONE
ERROR: add_lead DUPLICATE TITLE ALT_PHONE IN LIST - 1234|7275551111|101|8765444 ERROR: add_lead DUPLICATE TITLE ALT_PHONE IN LIST - 1234|7275551111|101|8765444
ERROR: add_lead DUPLICATE TITLE ALT_PHONE IN CAMPAIGN LISTS - 1234|7275551111|101|8765444|101 ERROR: add_lead DUPLICATE TITLE ALT_PHONE IN CAMPAIGN LISTS - 1234|7275551111|101|8765444|101
ERROR: add_lead DUPLICATE TITLE ALT_PHONE IN SYSTEM - 1234|7275551111|101|8765444|101 ERROR: add_lead DUPLICATE TITLE ALT_PHONE IN SYSTEM - 1234|7275551111|101|8765444|101
+97 -3
View File
@@ -205,10 +205,11 @@
# 230721-1753 - Added insert for daily RT monitoring # 230721-1753 - Added insert for daily RT monitoring
# 231109-0933 - Added archived_lead option to multiple functions # 231109-0933 - Added archived_lead option to multiple functions
# 231109-2022 - Added lead_dearchive function # 231109-2022 - Added lead_dearchive function
# 240101-0920 - Added DUPPHONEALT... options for duplicate_check within add_lead function
# #
$version = '2.14-182'; $version = '2.14-183';
$build = '231109-2022'; $build = '240101-0920';
$php_script='non_agent_api.php'; $php_script='non_agent_api.php';
$api_url_log = 0; $api_url_log = 0;
@@ -14722,6 +14723,7 @@ if ($function == 'add_lead')
if ($DB > 0) {echo "DEBUG: $day_val day SQL: |$multidaySQL|";} if ($DB > 0) {echo "DEBUG: $day_val day SQL: |$multidaySQL|";}
} }
### find list of list_ids in this campaign for the CAMP duplicate check options
if (preg_match("/CAMP/i",$duplicate_check)) # find lists within campaign if (preg_match("/CAMP/i",$duplicate_check)) # find lists within campaign
{ {
$stmt="SELECT campaign_id from vicidial_lists where list_id='$list_id';"; $stmt="SELECT campaign_id from vicidial_lists where list_id='$list_id';";
@@ -14748,7 +14750,7 @@ if ($function == 'add_lead')
} }
} }
} }
### find list of list_ids in this campaign
if (preg_match("/DUPLIST/i",$duplicate_check)) # duplicate check within list if (preg_match("/DUPLIST/i",$duplicate_check)) # duplicate check within list
{ {
if ($DB>0) {echo "DEBUG: Checking for duplicates - DUPLIST\n";} if ($DB>0) {echo "DEBUG: Checking for duplicates - DUPLIST\n";}
@@ -14824,6 +14826,98 @@ if ($function == 'add_lead')
exit; exit;
} }
} }
if (preg_match("/DUPPHONEALTLIST/i",$duplicate_check)) # duplicate check for phone against phone_number and alt_phone within list
{
if ($DB>0) {echo "DEBUG: Checking for duplicates - DUPPHONEALTLIST\n";}
$duplicate_found=0;
$stmt="SELECT lead_id,list_id,phone_number,alt_phone from vicidial_list where ( (phone_number='$phone_number') or (alt_phone='$phone_number') ) and list_id='$list_id' $multidaySQL limit 1;";
$rslt=mysql_to_mysqli($stmt, $link);
$pc_recs = mysqli_num_rows($rslt);
if ($DB>0) {echo "DEBUG 2: |$pc_recs|$stmt|\n";}
if ($pc_recs > 0)
{
$duplicate_found=1;
$row=mysqli_fetch_row($rslt);
$duplicate_lead_id = $row[0];
$duplicate_lead_list = $row[1];
$duplicate_phone_number = $row[2];
$duplicate_alt_phone = $row[3];
if ($phone_number == $duplicate_phone_number) {$duplicate_type='PHONE';}
else {$duplicate_type='ALT';}
}
if ($duplicate_found > 0)
{
$result = 'ERROR';
$result_reason = "add_lead DUPLICATE PHONE NUMBER IN LIST";
$data = "$phone_number|$list_id|$duplicate_lead_id|$duplicate_type";
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("/DUPPHONEALTCAMP/i",$duplicate_check)) # duplicate check for phone against phone_number and alt_phone within campaign lists
{
if ($DB>0) {echo "DEBUG: Checking for duplicates - DUPPHONEALTCAMP - $duplicate_lists\n";}
$duplicate_found=0;
$stmt="SELECT lead_id,list_id,phone_number,alt_phone from vicidial_list where ( (phone_number='$phone_number') or (alt_phone='$phone_number') ) and list_id IN($duplicate_lists) $multidaySQL limit 1;";
$rslt=mysql_to_mysqli($stmt, $link);
$pc_recs = mysqli_num_rows($rslt);
if ($DB>0) {echo "DEBUG 2: |$pc_recs|$stmt|\n";}
if ($pc_recs > 0)
{
$duplicate_found=1;
$row=mysqli_fetch_row($rslt);
$duplicate_lead_id = $row[0];
$duplicate_lead_list = $row[1];
$duplicate_phone_number = $row[2];
$duplicate_alt_phone = $row[3];
if ($phone_number == $duplicate_phone_number) {$duplicate_type='PHONE';}
else {$duplicate_type='ALT';}
}
if ($duplicate_found > 0)
{
$result = 'ERROR';
$result_reason = "add_lead DUPLICATE PHONE NUMBER IN CAMPAIGN LISTS";
$data = "$phone_number|$list_id|$duplicate_lead_id|$duplicate_lead_list|$duplicate_type";
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("/DUPPHONEALTSYS/i",$duplicate_check)) # duplicate check for phone against phone_number and alt_phone within entire system
{
if ($DB>0) {echo "DEBUG: Checking for duplicates - DUPPHONEALTSYS\n";}
$duplicate_found=0;
$stmt="SELECT lead_id,list_id,phone_number,alt_phone from vicidial_list where ( (phone_number='$phone_number') or (alt_phone='$phone_number') ) $multidaySQL limit 1;";
$rslt=mysql_to_mysqli($stmt, $link);
$pc_recs = mysqli_num_rows($rslt);
if ($DB>0) {echo "DEBUG 2: |$pc_recs|$stmt|\n";}
if ($pc_recs > 0)
{
$duplicate_found=1;
$row=mysqli_fetch_row($rslt);
$duplicate_lead_id = $row[0];
$duplicate_lead_list = $row[1];
$duplicate_phone_number = $row[2];
$duplicate_alt_phone = $row[3];
if ($phone_number == $duplicate_phone_number) {$duplicate_type='PHONE';}
else {$duplicate_type='ALT';}
}
if ($duplicate_found > 0)
{
$result = 'ERROR';
$result_reason = "add_lead DUPLICATE PHONE NUMBER IN SYSTEM";
$data = "$phone_number|$list_id|$duplicate_lead_id|$duplicate_lead_list|$duplicate_type";
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("/DUPTITLEALTPHONELIST/i",$duplicate_check)) # duplicate title/alt_phone check within list if (preg_match("/DUPTITLEALTPHONELIST/i",$duplicate_check)) # duplicate title/alt_phone check within list
{ {
if ($DB>0) {echo "DEBUG: Checking for duplicates - DUPTITLEALTPHONELIST\n";} if ($DB>0) {echo "DEBUG: Checking for duplicates - DUPTITLEALTPHONELIST\n";}