Added reset_time to add_list and update_list API functions

Added NAMEPHONE duplicate check options to add_lead
Fixed DST error in manual dial last_local_call_time

git-svn-id: svn://192.168.202.10@1623 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2011-03-17 01:12:25 +00:00
parent 2a3c580273
commit 7db4b26307
5 changed files with 133 additions and 9 deletions
+9 -2
View File
@@ -53,7 +53,7 @@ Changes:
101206-2126 - Added recording_lookup and did_log_export functions
110127-2245 - Added add_user and add_phone functions
110306-1044 - Added add_list and update_list functions
110316-2035 - Added reset_time variable and NAMEPHONE dup search
@@ -292,6 +292,9 @@ duplicate_check - Check for duplicate records in the system, can select more tha
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
DUPTITLEALTPHONESYS - check for duplicate title and alt_phone in entire system
DUPNAMEPHONELIST - check for duplicate first_name, last_name and phone_number in same list
DUPNAMEPHONECAMP - check for duplicate first_name, last_name and phone_number in all lists for this list's campaign
DUPNAMEPHONESYS - check for duplicate first_name, last_name and phone_number in entire system
custom_fields - Y or N, default is N. Defines whether the API will accept custom field data when inserting leads into the vicidial_list table
For custom fields to be inserted, just add the field label as a variable to the URL string
For example, if the field_label is "favorite_color" you would add "&favorite_color=blue"
@@ -341,7 +344,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=7275551212&phone_code=1&list_id=999&dnc_check=N&first_name=Bob&last_name=Wilson&duplicate_check=DUPLIST-DUPTITLEALTPHONELIST
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&custom_fields=Y&favorite_color=blue
@@ -583,6 +586,7 @@ am_message - 2-100 characters
drop_inbound_group - 1-10 characters, must be a valid in-group
web_form_address - 6-100 characters
web_form_address_two - 6-100 characters
reset_time - 4-100 characters, must be in valid 4-digit groups of 24-hour time (i.e. 0900-1700-2359)
Example URL strings for API calls:
@@ -596,6 +600,7 @@ ERROR: add_list CAMPAIGN DOES NOT EXIST - 6666|TESTCIMP
ERROR: add_list LIST ALREADY EXISTS - 6666|1101
ERROR: add_list SCRIPT DOES NOT EXIST, THIS IS AN OPTIONAL FIELD - 6666|TESTSCRIPT
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
SUCCESS: add_list LIST HAS BEEN ADDED - 6666|1101|TESTCAMP
@@ -627,6 +632,7 @@ am_message - 2-100 characters
drop_inbound_group - 1-10 characters, must be a valid in-group
web_form_address - 6-100 characters
web_form_address_two - 6-100 characters
reset_time - 4-100 characters, must be in valid 4-digit groups of 24-hour time (i.e. 0900-1700-2359)
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
@@ -652,6 +658,7 @@ ERROR: update_list LIST NAME MUST BE FROM 6 TO 30 CHARACTERS, THIS IS AN OPTIONA
ERROR: update_list ACTIVE MUST BE Y OR N, THIS IS AN OPTIONAL FIELD - 6666|U
ERROR: update_list OUTBOUND CID MUST BE FROM 6 TO 18 DIGITS, THIS IS AN OPTIONAL FIELD - 6666|12345
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
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
+3 -3
View File
@@ -877,7 +877,7 @@ country_code SMALLINT(5) UNSIGNED,
country CHAR(3),
areacode CHAR(3),
state VARCHAR(4),
GMT_offset VARCHAR(5),
GMT_offset VARCHAR(6),
DST enum('Y','N'),
DST_range VARCHAR(8),
geographic_description VARCHAR(30)
@@ -1282,7 +1282,7 @@ index (server_ip)
CREATE TABLE vicidial_postal_codes (
postal_code VARCHAR(10) NOT NULL,
state VARCHAR(4),
GMT_offset VARCHAR(5),
GMT_offset VARCHAR(6),
DST enum('Y','N'),
DST_range VARCHAR(8),
country CHAR(3),
@@ -2453,7 +2453,7 @@ ALTER TABLE vicidial_call_notes_archive MODIFY notesid INT(9) UNSIGNED NOT NULL;
CREATE TABLE vicidial_lead_search_log_archive LIKE vicidial_lead_search_log;
ALTER TABLE vicidial_lead_search_log_archive MODIFY search_log_id INT(9) UNSIGNED NOT NULL;
UPDATE system_settings SET db_schema_version='1266',db_schema_update_date=NOW();
UPDATE system_settings SET db_schema_version='1267',db_schema_update_date=NOW();
GRANT RELOAD ON *.* TO cron@'%';
GRANT RELOAD ON *.* TO cron@localhost;
+7
View File
@@ -721,3 +721,10 @@ ALTER TABLE vicidial_campaigns ADD auto_pause_precall_code VARCHAR(6) default 'P
ALTER TABLE vicidial_campaigns ADD auto_resume_precall ENUM('Y','N') default 'N';
UPDATE system_settings SET db_schema_version='1266',db_schema_update_date=NOW();
ALTER TABLE vicidial_postal_codes MODIFY GMT_offset VARCHAR(6) default '';
ALTER TABLE vicidial_phone_codes MODIFY GMT_offset VARCHAR(6) default '';
UPDATE system_settings SET db_schema_version='1267',db_schema_update_date=NOW();
+2
View File
@@ -2158,6 +2158,8 @@ if ($ACTION == 'manDiaLnextCaLL')
{
$row=mysql_fetch_row($rslt);
$local_gmt = $row[0];
$isdst = date("I");
if ($isdst) {$local_gmt++;}
}
$LLCT_DATE_offset = ($local_gmt - $gmt_offset_now);
$LLCT_DATE = date("Y-m-d H:i:s", mktime(date("H")-$LLCT_DATE_offset,date("i"),date("s"),date("m"),date("d"),date("Y")));
+112 -4
View File
@@ -43,10 +43,11 @@
# 110127-2245 - Added add_user and add_phone functions
# 110303-2122 - Added information on agent-on-hook phone to real-time report popup
# 110306-1044 - Added add_list and update_list functions
# 110316-2035 - Added reset_time variable and NAMEPHONE dup search
#
$version = '2.4-29';
$build = '110306-1044';
$version = '2.4-30';
$build = '110316-2035';
require("dbconnect.php");
@@ -231,6 +232,8 @@ if (isset($_GET["delete_list"])) {$delete_list=$_GET["delete_list"];}
elseif (isset($_POST["delete_list"])) {$delete_list=$_POST["delete_list"];}
if (isset($_GET["delete_leads"])) {$delete_leads=$_GET["delete_leads"];}
elseif (isset($_POST["delete_leads"])) {$delete_leads=$_POST["delete_leads"];}
if (isset($_GET["reset_time"])) {$reset_time=$_GET["reset_time"];}
elseif (isset($_POST["reset_time"])) {$reset_time=$_POST["reset_time"];}
header ("Content-type: text/html; charset=utf-8");
@@ -354,6 +357,7 @@ if ($non_latin < 1)
$reset_list=ereg_replace("[^A-Z]","",$reset_list);
$delete_list=ereg_replace("[^A-Z]","",$delete_list);
$delete_leads=ereg_replace("[^A-Z]","",$delete_leads);
$reset_time=ereg_replace("[^-_0-9]","",$reset_time);
}
else
{
@@ -1528,6 +1532,7 @@ if ($function == 'update_list')
$ammessageSQL='';
$webformSQL='';
$webformtwoSQL='';
$resettimeSQL='';
if (strlen($campaign_id) > 0)
{
$stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id';";
@@ -1658,6 +1663,25 @@ if ($function == 'update_list')
{$ammessageSQL = " ,am_message_exten_override='$am_message'";}
}
}
if (strlen($reset_time) > 0)
{
if ($reset_time == '--BLANK--')
{$resettimeSQL = " ,reset_time=''";}
else
{
if (strlen($reset_time) < 4)
{
$result = 'ERROR';
$result_reason = "update_list RESET TIME IS NOT VALID, THIS IS AN OPTIONAL FIELD";
$data = "$reset_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
{$resettimeSQL = " ,reset_time='$reset_time'";}
}
}
if (strlen($web_form_address) > 0)
{
if ($web_form_address == '--BLANK--')
@@ -1673,7 +1697,7 @@ if ($function == 'update_list')
{$webformtwoSQL = " ,web_form_address_two='$web_form_address_two'";}
}
$updateSQL = "$webformtwoSQL$webformSQL$ammessageSQL$outboundcidSQL$activeSQL$listnameSQL$campaignSQL$scriptSQL$dropingroupSQL";
$updateSQL = "$webformtwoSQL$webformSQL$ammessageSQL$outboundcidSQL$activeSQL$listnameSQL$campaignSQL$scriptSQL$dropingroupSQL$resettimeSQL";
if (strlen($updateSQL)< 3)
{
@@ -1953,9 +1977,18 @@ if ($function == 'add_list')
exit;
}
}
if ( (strlen($reset_time) > 0) and (strlen($reset_time) < 4) )
{
$result = 'ERROR';
$result_reason = "add_list RESET TIME IS NOT VALID, THIS IS AN OPTIONAL FIELD";
$data = "$reset_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;
}
if (strlen($active)<1) {$active='N';}
$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', web_form_address='$web_form_address', web_form_address_two='$web_form_address_two';";
$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', web_form_address='$web_form_address', web_form_address_two='$web_form_address_two', reset_time='$reset_time';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "|$stmt|\n";}
@@ -2669,6 +2702,81 @@ if ($function == 'add_lead')
exit;
}
}
if (eregi("DUPNAMEPHONELIST",$duplicate_check)) # duplicate name/phone check within list
{
if ($DB>0) {echo "DEBUG: Checking for duplicates - DUPNAMEPHONELIST\n";}
$duplicate_found=0;
$stmt="SELECT lead_id,list_id from vicidial_list where first_name='$first_name' and last_name='$last_name' and phone_number='$phone_number' and list_id='$list_id' limit 1;";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
{
$duplicate_found=1;
$row=mysql_fetch_row($rslt);
$duplicate_lead_id = $row[0];
$duplicate_lead_list = $row[1];
}
if ($duplicate_found > 0)
{
$result = 'ERROR';
$result_reason = "add_lead DUPLICATE NAME PHONE IN LIST";
$data = "$title|$alt_phone|$list_id|$duplicate_lead_id";
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 (eregi("DUPNAMEPHONECAMP",$duplicate_check)) # duplicate name/phone check within campaign lists
{
if ($DB>0) {echo "DEBUG: Checking for duplicates - DUPNAMEPHONECAMP\n";}
$duplicate_found=0;
$stmt="SELECT lead_id,list_id from vicidial_list where first_name='$first_name' and last_name='$last_name' and phone_number='$phone_number' and list_id IN($duplicate_lists) limit 1;";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
{
$duplicate_found=1;
$row=mysql_fetch_row($rslt);
$duplicate_lead_id = $row[0];
$duplicate_lead_list = $row[1];
}
if ($duplicate_found > 0)
{
$result = 'ERROR';
$result_reason = "add_lead DUPLICATE NAME PHONE IN CAMPAIGN LISTS";
$data = "$title|$alt_phone|$list_id|$duplicate_lead_id|$duplicate_lead_list";
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 (eregi("DUPNAMEPHONESYS",$duplicate_check)) # duplicate name/phone check within entire system
{
if ($DB>0) {echo "DEBUG: Checking for duplicates - DUPNAMEPHONESYS\n";}
$duplicate_found=0;
$stmt="SELECT lead_id,list_id from vicidial_list where first_name='$first_name' and last_name='$last_name' and phone_number='$phone_number' limit 1;";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
if ($pc_recs > 0)
{
$duplicate_found=1;
$row=mysql_fetch_row($rslt);
$duplicate_lead_id = $row[0];
$duplicate_lead_list = $row[1];
}
if ($duplicate_found > 0)
{
$result = 'ERROR';
$result_reason = "add_lead DUPLICATE NAME PHONE IN SYSTEM";
$data = "$title|$alt_phone|$list_id|$duplicate_lead_id|$duplicate_lead_list";
echo "$result: $result_reason - $data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
}
### END checking for duplicate if defined ###