Added Admin -> Settings Containers to admin web interface to allow more easy

configuration of back end scripts and Dispo Email sending

Added agc/dispo_send_email.php script to be used with the Dispo Call URL
 option in campaigns and in-groups.

git-svn-id: svn://192.168.202.10@2368 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2015-08-06 21:57:16 +00:00
parent a95fd39b14
commit 11348fd6bf
8 changed files with 1004 additions and 13 deletions
+8 -1
View File
@@ -120,7 +120,7 @@ OTHER CHANGES:
23. Added option to Secondary Lead Sort by vendor lead code
24. Added option to User Status report to only show call logs with a specified
24. Added option to User Stats report to only show call logs with a specified
call status.
25. Added experimental Agent Whisper Monitoring from the Real-time Report.
@@ -129,6 +129,13 @@ OTHER CHANGES:
26. Added the ability in in-groups to set reset a lead's called status when a
call is ended by being abandoned, dropped, hung up or sent to voicemail
27. Added Admin -> Settings Containers to admin web interface to allow more easy
configuration of back end scripts and Dispo Email sending
28. Added agc/dispo_send_email.php script to be used with the Dispo Call URL
option in campaigns and in-groups. See DISPO_SEND_EMAIL.txt doc for
more information on this feature.
+104
View File
@@ -0,0 +1,104 @@
Sending email after agent dispositions a call 2015-08-06
These instructions will show you how to set up automatic emails to be sent out when an agent dispositions a call with a specific defined "sale status".
First, you should confirm that your web server is capable of sending emails, and that it is capable of sending emails from the email addresses that you want to be using in your configuration.
Second, you must be using a version of Vicidial that has Admin -> Settings Containers for this to work
Third, you will find an example below of how to configure a Settings Container as an email template
Forth, you will find an example below of how to configure the Dispo Call URL entry
HERE IS AN EXAMPLE DISPO CALL URL ENTRY FOR THIS FEATURE:
(in this example, only calls that are set by the agent as SALE, SSALE or XSALE status would have an email sent out, and the email would use the TEST_CONTAINER settings container as the email's template)
VARhttp://192.168.1.1/agc/dispo_send_email.php?container_id=TEST_CONTAINER&lead_id=--A--lead_id--B--&call_id=--A--call_id--B--&dispo=--A--dispo--B--&user=--A--user--B--&pass=--A--pass--B--&sale_status=SALE---SSALE---XSALE&log_to_file=1
HERE IS AN EXAMPLE SETTINGS CONTAINER TO SEND OUT AN EMAIL:
(The four keys you can use are: "email_to", "email_from", "email_subject" and "email_body_begin" will start your message while "email_body_end" will mark the finish of the message. You can use most standard SCRIPT variables in the subject and body fields, and you can use either fixed email addresses or "agent_email" and "customer_email" as variables for the email addresses as shown below. A semi-colon ";" at the beginning of a line will comment out that line and it will not be parsed.)
; destination email
;email_to => vicidialemailtesting@gmail.com
email_to => --A--customer_email--B--
; sending email address
;email_from => customertesting@vicidial.com
email_from => --A--agent_email--B--
; subject of the email
email_subject => Order confirmation --A--vendor_lead_code--B--
; body of the email
email_body_begin =>
Hello --A--first_name--B--,
This email is to welcome you to the wonderful ACME product-of-the-month club!
You spoke to agent --A--fullname--B--.
Here is a summary of your account information:
lead_id: --A--lead_id--B--
vendor_id: --A--vendor_id--B--
vendor_lead_code: --A--vendor_lead_code--B--
list_id: --A--list_id--B--
list_name: --A--list_name--B--
list_description: --A--list_description--B--
gmt_offset_now: --A--gmt_offset_now--B--
phone_code: --A--phone_code--B--
phone_number: --A--phone_number--B--
title: --A--title--B--
first_name: --A--first_name--B--
middle_initial: --A--middle_initial--B--
last_name: --A--last_name--B--
address1: --A--address1--B--
address2: --A--address2--B--
address3: --A--address3--B--
city: --A--city--B--
state: --A--state--B--
province: --A--province--B--
postal_code: --A--postal_code--B--
country_code: --A--country_code--B--
gender: --A--gender--B--
date_of_birth: --A--date_of_birth--B--
alt_phone: --A--alt_phone--B--
email: --A--email--B--
security_phrase: --A--security_phrase--B--
comments: --A--comments--B--
user: --A--user--B--
closer: --A--user--B--
SQLdate: --A--SQLdate--B--
source_id: --A--source_id--B--
rank: --A--rank--B--
owner: --A--owner--B--
entry_list_id: --A--entry_list_id--B--
call_id: --A--call_id--B--
entry_date: --A--entry_date--B--
fullname: --A--fullname--B--
agent_email: --A--agent_email--B--
user_custom_one: --A--user_custom_one--B--
user_custom_two: --A--user_custom_two--B--
user_custom_three: --A--user_custom_three--B--
user_custom_four: --A--user_custom_four--B--
user_custom_five: --A--user_custom_five--B--
user_group: --A--user_group--B--
We hope you enjoy your stuff, and happy roadrunner chasing!
ACME Support Department
312-555-1212
email_body_end
@@ -3303,6 +3303,14 @@ last_sql TEXT,
KEY ajax_dbtime_key (db_time)
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE vicidial_settings_containers (
container_id VARCHAR(40) PRIMARY KEY NOT NULL,
container_notes VARCHAR(255) default '',
container_type ENUM('OTHER','PERL_CLI','EMAIL_TEMPLATE') default 'OTHER',
user_group VARCHAR(20) default '---ALL---',
container_entry MEDIUMTEXT
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci;
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
@@ -3552,4 +3560,4 @@ UPDATE vicidial_configuration set value='1766' where name='qc_database_version';
UPDATE system_settings set vdc_agent_api_active='1';
UPDATE system_settings SET db_schema_version='1426',db_schema_update_date=NOW(),reload_timestamp=NOW();
UPDATE system_settings SET db_schema_version='1427',db_schema_update_date=NOW(),reload_timestamp=NOW();
+10
View File
@@ -261,3 +261,13 @@ ALTER TABLE vicidial_inbound_groups ADD wait_time_lead_reset ENUM('Y','N') defau
ALTER TABLE vicidial_inbound_groups ADD hold_time_lead_reset ENUM('Y','N') default 'N';
UPDATE system_settings SET db_schema_version='1426',db_schema_update_date=NOW() where db_schema_version < 1426;
CREATE TABLE vicidial_settings_containers (
container_id VARCHAR(40) PRIMARY KEY NOT NULL,
container_notes VARCHAR(255) default '',
container_type ENUM('OTHER','PERL_CLI','EMAIL_TEMPLATE') default 'OTHER',
user_group VARCHAR(20) default '---ALL---',
container_entry MEDIUMTEXT
) ENGINE=MyISAM CHARSET=utf8 COLLATE=utf8_unicode_ci;
UPDATE system_settings SET db_schema_version='1427',db_schema_update_date=NOW() where db_schema_version < 1427;
+514
View File
@@ -0,0 +1,514 @@
<?php
# dispo_send_email.php
#
# Copyright (C) 2015 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# This script is designed to be used in the "Dispo URL" field of a campaign
# or in-group. It will send out an email to a fixed email address as defined
# in a Settings Container as defined in the Admin web interface
#
# This script is part of the API group and any modifications of data are
# logged to the vicidial_api_log table.
#
# Example of what to put in the Dispo URL field:
# VARhttp://192.168.1.1/agc/dispo_send_email.php?container_id=TEST_CONTAINER&lead_id=--A--lead_id--B--&call_id=--A--call_id--B--&dispo=--A--dispo--B--&user=--A--user--B--&pass=--A--pass--B--&sale_status=SALE---SSALE---XSALE&log_to_file=1
#
# Definable Fields: (other fields should be left as they are)
# - log_to_file - (0,1) if set to 1, will create a log file in the agc directory
# - sale_status - (SALE---XSALE) a triple-dash "---" delimited list of the statuses that are to be moved
# - container_id - (999,etc...) the Settings Container ID that you want the phone number to be inserted into
#
# CHANGES
# 150806-1424 - First Build
#
$api_script = 'send_email';
header ("Content-type: text/html; charset=utf-8");
require_once("dbconnect_mysqli.php");
require_once("functions.php");
$filedate = date("Ymd");
$filetime = date("H:i:s");
$IP = getenv ("REMOTE_ADDR");
$BR = getenv ("HTTP_USER_AGENT");
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
if (isset($_GET["call_id"])) {$call_id=$_GET["call_id"];}
elseif (isset($_POST["call_id"])) {$call_id=$_POST["call_id"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["sale_status"])) {$sale_status=$_GET["sale_status"];}
elseif (isset($_POST["sale_status"])) {$sale_status=$_POST["sale_status"];}
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
if (isset($_GET["container_id"])) {$container_id=$_GET["container_id"];}
elseif (isset($_POST["container_id"])) {$container_id=$_POST["container_id"];}
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["log_to_file"])) {$log_to_file=$_GET["log_to_file"];}
elseif (isset($_POST["log_to_file"])) {$log_to_file=$_POST["log_to_file"];}
#$DB = '1'; # DEBUG override
$US = '_';
$TD = '---';
$STARTtime = date("U");
$NOW_TIME = date("Y-m-d H:i:s");
$sale_status = "$TD$sale_status$TD";
$search_value='';
$match_found=0;
$k=0;
$user=preg_replace("/\'|\"|\\\\|;| /","",$user);
$pass=preg_replace("/\'|\"|\\\\|;| /","",$pass);
#############################################
##### START SYSTEM_SETTINGS AND USER LANGUAGE LOOKUP #####
$VUselected_language = '';
$stmt="SELECT selected_language from vicidial_users where user='$user';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$sl_ct = mysqli_num_rows($rslt);
if ($sl_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$VUselected_language = $row[0];
}
$stmt = "SELECT use_non_latin,enable_languages,language_method FROM system_settings;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02001',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysqli_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$non_latin = $row[0];
$SSenable_languages = $row[1];
$SSlanguage_method = $row[2];
}
##### END SETTINGS LOOKUP #####
###########################################
if ($non_latin < 1)
{
$user=preg_replace("/[^-_0-9a-zA-Z]/","",$user);
}
if ($DB>0) {echo "$lead_id|$container_id|$call_id|$sale_status|$dispo|$new_status|$user|$pass|$DB|$log_to_file|\n";}
if (preg_match("/$TD$dispo$TD/",$sale_status))
{$match_found=1;}
if ($match_found > 0)
{
if ($non_latin < 1)
{
$user=preg_replace("/[^-_0-9a-zA-Z]/","",$user);
$pass=preg_replace("/[^-_0-9a-zA-Z]/","",$pass);
}
$session_name = preg_replace("/\'|\"|\\\\|;/","",$session_name);
$server_ip = preg_replace("/\'|\"|\\\\|;/","",$server_ip);
if (preg_match("/NOAGENTURL/",$user))
{
$PADlead_id = sprintf("%010s", $lead_id);
if ( (strlen($pass) > 15) and (preg_match("/$PADlead_id$/",$pass)) )
{
$four_hours_ago = date("Y-m-d H:i:s", mktime(date("H")-4,date("i"),date("s"),date("m"),date("d"),date("Y")));
$stmt="SELECT count(*) from vicidial_log_extended where caller_code='$pass' and call_date > \"$four_hours_ago\";";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$authlive=$row[0];
$auth=$row[0];
if ($authlive < 1)
{
echo _QXZ("Call Not Found:")." 2|$user|$pass|$authlive|\n";
exit;
}
}
else
{
echo _QXZ("Invalid Call ID:")." 1|$user|$pass|$PADlead_id|\n";
exit;
}
}
else
{
$auth=0;
$auth_message = user_authorization($user,$pass,'',0,0,0);
if ($auth_message == 'GOOD')
{$auth=1;}
$stmt="SELECT count(*) from vicidial_live_agents where user='$user';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$authlive=$row[0];
}
if ( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) or ($authlive==0))
{
echo _QXZ("Invalid Username/Password:")." |$user|$pass|$auth|$authlive|$auth_message|\n";
exit;
}
if ( (strlen($lead_id) > 0) and (strlen($container_id) > 1) )
{
$search_count=0;
$stmt = "SELECT count(*) FROM vicidial_settings_containers where container_id='$container_id';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($DB) {echo "$stmt\n";}
$sc_ct = mysqli_num_rows($rslt);
if ($sc_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$SC_count = $row[0];
}
if ($SC_count > 0)
{
$stmt = "SELECT container_entry FROM vicidial_settings_containers where container_id='$container_id';";
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$sc_ct = mysqli_num_rows($rslt);
if ($sc_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$container_entry = $row[0];
$container_ARY = explode("\n",$container_entry);
$email_body_gather=0;
$p=0;
$container_ct = count($container_ARY);
while ($p <= $container_ct)
{
$line = $container_ARY[$p];
if ($email_body_gather < 1)
{
$line = preg_replace("/>|\n|\r|\t|\#.*|;.*/",'',$line);
if (preg_match("/^email_to/",$line))
{$email_to = $line; $email_to = trim(preg_replace("/.*=/",'',$email_to));}
if (preg_match("/^email_from/",$line))
{$email_from = $line; $email_from = trim(preg_replace("/.*=/",'',$email_from));}
if (preg_match("/^email_subject/",$line))
{$email_subject = $line; $email_subject = trim(preg_replace("/.*=/",'',$email_subject));}
if (preg_match("/^email_body_begin/",$line))
{$email_body = $line; $email_body = trim(preg_replace("/.*=/",'',$email_body)) . "\n"; $email_body_gather++;}
}
else
{
if (preg_match("/^email_body_end/",$line))
{$email_body_gather=0;}
else
{$email_body .= $line;}
}
$p++;
}
if ( (strlen($email_to) > 5) and (strlen($email_from) > 5) and (strlen($email_subject) > 1) and (strlen($email_body) > 1) )
{
if ( (preg_match('/--A--/i',$email_subject)) or (preg_match('/--A--/i',$email_body)) or (preg_match('/--A--/i',$email_to)) or (preg_match('/--A--/i',$email_from)) )
{
##### grab the data from vicidial_list for the lead_id
$stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='$lead_id' LIMIT 1;";
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$list_lead_ct = mysqli_num_rows($rslt);
if ($list_lead_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$entry_date = urlencode(trim($row[1]));
$dispo = urlencode(trim($row[3]));
$tsr = urlencode(trim($row[4]));
$vendor_id = urlencode(trim($row[5]));
$vendor_lead_code = urlencode(trim($row[5]));
$source_id = urlencode(trim($row[6]));
$list_id = urlencode(trim($row[7]));
$gmt_offset_now = urlencode(trim($row[8]));
$phone_code = urlencode(trim($row[10]));
$phone_number = urlencode(trim($row[11]));
$title = urlencode(trim($row[12]));
$first_name = urlencode(trim($row[13]));
$middle_initial = urlencode(trim($row[14]));
$last_name = urlencode(trim($row[15]));
$address1 = urlencode(trim($row[16]));
$address2 = urlencode(trim($row[17]));
$address3 = urlencode(trim($row[18]));
$city = urlencode(trim($row[19]));
$state = urlencode(trim($row[20]));
$province = urlencode(trim($row[21]));
$postal_code = urlencode(trim($row[22]));
$country_code = urlencode(trim($row[23]));
$gender = urlencode(trim($row[24]));
$date_of_birth = urlencode(trim($row[25]));
$alt_phone = urlencode(trim($row[26]));
$email = urlencode(trim($row[27]));
$security_phrase = urlencode(trim($row[28]));
$comments = urlencode(trim($row[29]));
$called_count = urlencode(trim($row[30]));
$rank = urlencode(trim($row[32]));
$owner = urlencode(trim($row[33]));
$entry_list_id = urlencode(trim($row[34]));
}
if ( (preg_match('/list_name--B--|list_description--B--/i',$email_subject)) or (preg_match('/list_name--B--|list_description--B--/i',$email_body)) )
{
$stmt = "SELECT list_name,list_description from vicidial_lists where list_id='$list_id' limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$VL_ln_ct = mysqli_num_rows($rslt);
if ($VL_ln_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$list_name = urlencode(trim($row[0]));
$list_description = urlencode(trim($row[1]));
}
}
$stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five,full_name,user_group,email from vicidial_users where user='$user';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_to_mysqli($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$VUC_ct = mysqli_num_rows($rslt);
if ($VUC_ct > 0)
{
$row=mysqli_fetch_row($rslt);
$user_custom_one = urlencode(trim($row[0]));
$user_custom_two = urlencode(trim($row[1]));
$user_custom_three = urlencode(trim($row[2]));
$user_custom_four = urlencode(trim($row[3]));
$user_custom_five = urlencode(trim($row[4]));
$fullname = urlencode(trim($row[5]));
$user_group = urlencode(trim($row[6]));
$agent_email = urlencode(trim($row[7]));
}
}
### populate variables in email_subject
if (preg_match('/--A--/i',$email_subject))
{
$email_subject = preg_replace('/^VAR/','',$email_subject);
$email_subject = preg_replace('/--A--lead_id--B--/i',"$lead_id",$email_subject);
$email_subject = preg_replace('/--A--vendor_id--B--/i',"$vendor_id",$email_subject);
$email_subject = preg_replace('/--A--vendor_lead_code--B--/i',"$vendor_lead_code",$email_subject);
$email_subject = preg_replace('/--A--list_id--B--/i',"$list_id",$email_subject);
$email_subject = preg_replace('/--A--list_name--B--/i',"$list_name",$email_subject);
$email_subject = preg_replace('/--A--list_description--B--/i',"$list_description",$email_subject);
$email_subject = preg_replace('/--A--gmt_offset_now--B--/i',"$gmt_offset_now",$email_subject);
$email_subject = preg_replace('/--A--phone_code--B--/i',"$phone_code",$email_subject);
$email_subject = preg_replace('/--A--phone_number--B--/i',"$phone_number",$email_subject);
$email_subject = preg_replace('/--A--title--B--/i',"$title",$email_subject);
$email_subject = preg_replace('/--A--first_name--B--/i',"$first_name",$email_subject);
$email_subject = preg_replace('/--A--middle_initial--B--/i',"$middle_initial",$email_subject);
$email_subject = preg_replace('/--A--last_name--B--/i',"$last_name",$email_subject);
$email_subject = preg_replace('/--A--address1--B--/i',"$address1",$email_subject);
$email_subject = preg_replace('/--A--address2--B--/i',"$address2",$email_subject);
$email_subject = preg_replace('/--A--address3--B--/i',"$address3",$email_subject);
$email_subject = preg_replace('/--A--city--B--/i',"$city",$email_subject);
$email_subject = preg_replace('/--A--state--B--/i',"$state",$email_subject);
$email_subject = preg_replace('/--A--province--B--/i',"$province",$email_subject);
$email_subject = preg_replace('/--A--postal_code--B--/i',"$postal_code",$email_subject);
$email_subject = preg_replace('/--A--country_code--B--/i',"$country_code",$email_subject);
$email_subject = preg_replace('/--A--gender--B--/i',"$gender",$email_subject);
$email_subject = preg_replace('/--A--date_of_birth--B--/i',"$date_of_birth",$email_subject);
$email_subject = preg_replace('/--A--alt_phone--B--/i',"$alt_phone",$email_subject);
$email_subject = preg_replace('/--A--email--B--/i',"$email",$email_subject);
$email_subject = preg_replace('/--A--security_phrase--B--/i',"$security_phrase",$email_subject);
$email_subject = preg_replace('/--A--comments--B--/i',"$comments",$email_subject);
$email_subject = preg_replace('/--A--user--B--/i',"$user",$email_subject);
$email_subject = preg_replace('/--A--pass--B--/i',"$orig_pass",$email_subject);
$email_subject = preg_replace('/--A--original_phone_login--B--/i',"$original_phone_login",$email_subject);
$email_subject = preg_replace('/--A--phone_pass--B--/i',"$phone_pass",$email_subject);
$email_subject = preg_replace('/--A--fronter--B--/i',"$fronter",$email_subject);
$email_subject = preg_replace('/--A--closer--B--/i',"$user",$email_subject);
$email_subject = preg_replace('/--A--SQLdate--B--/i',"$NOW_TIME",$email_subject);
$email_subject = preg_replace('/--A--epoch--B--/i',"$epoch",$email_subject);
$email_subject = preg_replace('/--A--source_id--B--/i',"$source_id",$email_subject);
$email_subject = preg_replace('/--A--rank--B--/i',"$rank",$email_subject);
$email_subject = preg_replace('/--A--owner--B--/i',"$owner",$email_subject);
$email_subject = preg_replace('/--A--entry_list_id--B--/i',"$entry_list_id",$email_subject);
$email_subject = preg_replace('/--A--call_id--B--/i',urlencode(trim($call_id)),$email_subject);
$email_subject = preg_replace('/--A--entry_date--B--/i',"$entry_date",$email_subject);
$email_subject = preg_replace('/--A--fullname--B--/i',"$fullname",$email_subject);
$email_subject = preg_replace('/--A--user_custom_one--B--/i',"$user_custom_one",$email_subject);
$email_subject = preg_replace('/--A--user_custom_two--B--/i',"$user_custom_two",$email_subject);
$email_subject = preg_replace('/--A--user_custom_three--B--/i',"$user_custom_three",$email_subject);
$email_subject = preg_replace('/--A--user_custom_four--B--/i',"$user_custom_four",$email_subject);
$email_subject = preg_replace('/--A--user_custom_five--B--/i',"$user_custom_five",$email_subject);
$email_subject = preg_replace('/--A--user_group--B--/i',urlencode(trim($user_group)),$email_subject);
$email_subject = preg_replace('/--A--agent_email--B--/i',"$agent_email",$email_subject);
# not currently active
$email_subject = preg_replace('/--A--campaign--B--/i',"$campaign",$email_subject);
$email_subject = preg_replace('/--A--phone_login--B--/i',"$phone_login",$email_subject);
$email_subject = preg_replace('/--A--group--B--/i',"$VDADchannel_group",$email_subject);
$email_subject = preg_replace('/--A--channel_group--B--/i',"$VDADchannel_group",$email_subject);
$email_subject = preg_replace('/--A--uniqueid--B--/i',"$uniqueid",$email_subject);
$email_subject = preg_replace('/--A--customer_zap_channel--B--/i',"$customer_zap_channel",$email_subject);
$email_subject = preg_replace('/--A--customer_server_ip--B--/i',"$customer_server_ip",$email_subject);
$email_subject = preg_replace('/--A--server_ip--B--/i',"$server_ip",$email_subject);
$email_subject = preg_replace('/--A--SIPexten--B--/i',"$SIPexten",$email_subject);
$email_subject = preg_replace('/--A--session_id--B--/i',"$session_id",$email_subject);
$email_subject = preg_replace('/--A--phone--B--/i',"$phone",$email_subject);
$email_subject = preg_replace('/--A--parked_by--B--/i',"$parked_by",$email_subject);
$email_subject = preg_replace('/--A--camp_script--B--/i',"$camp_script",$email_subject);
$email_subject = preg_replace('/--A--in_script--B--/i',"$in_script",$email_subject);
$email_subject = preg_replace('/--A--dispo--B--/i',"$dispo",$email_subject);
$email_subject = preg_replace('/--A--dispo_name--B--/i',"$dispo_name",$email_subject);
$email_subject = preg_replace('/--A--dialed_number--B--/i',"$dialed_number",$email_subject);
$email_subject = preg_replace('/--A--dialed_label--B--/i',"$dialed_label",$email_subject);
$email_subject = preg_replace('/--A--talk_time--B--/i',"$talk_time",$email_subject);
$email_subject = preg_replace('/--A--talk_time_ms--B--/i',"$talk_time_ms",$email_subject);
$email_subject = preg_replace('/--A--talk_time_min--B--/i',"$talk_time_min",$email_subject);
$email_subject = preg_replace('/--A--agent_log_id--B--/i',"$CALL_agent_log_id",$email_subject);
$email_subject = preg_replace('/--A--did_id--B--/i',urlencode(trim($DID_id)),$email_subject);
$email_subject = preg_replace('/--A--did_extension--B--/i',urlencode(trim($DID_extension)),$email_subject);
$email_subject = preg_replace('/--A--did_pattern--B--/i',urlencode(trim($DID_pattern)),$email_subject);
$email_subject = preg_replace('/--A--did_description--B--/i',urlencode(trim($DID_description)),$email_subject);
$email_subject = preg_replace('/--A--closecallid--B--/i',urlencode(trim($INclosecallid)),$email_subject);
$email_subject = preg_replace('/--A--xfercallid--B--/i',urlencode(trim($INxfercallid)),$email_subject);
$email_subject = preg_replace('/--A--call_notes--B--/i',"$url_call_notes",$email_subject);
$email_subject = preg_replace('/--A--recording_id--B--/i',"$recording_id",$email_subject);
$email_subject = preg_replace('/--A--recording_filename--B--/i',"$recording_filename",$email_subject);
$email_subject = urldecode($email_subject);
}
### check for variables in email_body
if (preg_match('/--A--/i',$email_body))
{
$email_body = preg_replace('/^VAR/','',$email_body);
$email_body = preg_replace('/--A--lead_id--B--/i',"$lead_id",$email_body);
$email_body = preg_replace('/--A--vendor_id--B--/i',"$vendor_id",$email_body);
$email_body = preg_replace('/--A--vendor_lead_code--B--/i',"$vendor_lead_code",$email_body);
$email_body = preg_replace('/--A--list_id--B--/i',"$list_id",$email_body);
$email_body = preg_replace('/--A--list_name--B--/i',"$list_name",$email_body);
$email_body = preg_replace('/--A--list_description--B--/i',"$list_description",$email_body);
$email_body = preg_replace('/--A--gmt_offset_now--B--/i',"$gmt_offset_now",$email_body);
$email_body = preg_replace('/--A--phone_code--B--/i',"$phone_code",$email_body);
$email_body = preg_replace('/--A--phone_number--B--/i',"$phone_number",$email_body);
$email_body = preg_replace('/--A--title--B--/i',"$title",$email_body);
$email_body = preg_replace('/--A--first_name--B--/i',"$first_name",$email_body);
$email_body = preg_replace('/--A--middle_initial--B--/i',"$middle_initial",$email_body);
$email_body = preg_replace('/--A--last_name--B--/i',"$last_name",$email_body);
$email_body = preg_replace('/--A--address1--B--/i',"$address1",$email_body);
$email_body = preg_replace('/--A--address2--B--/i',"$address2",$email_body);
$email_body = preg_replace('/--A--address3--B--/i',"$address3",$email_body);
$email_body = preg_replace('/--A--city--B--/i',"$city",$email_body);
$email_body = preg_replace('/--A--state--B--/i',"$state",$email_body);
$email_body = preg_replace('/--A--province--B--/i',"$province",$email_body);
$email_body = preg_replace('/--A--postal_code--B--/i',"$postal_code",$email_body);
$email_body = preg_replace('/--A--country_code--B--/i',"$country_code",$email_body);
$email_body = preg_replace('/--A--gender--B--/i',"$gender",$email_body);
$email_body = preg_replace('/--A--date_of_birth--B--/i',"$date_of_birth",$email_body);
$email_body = preg_replace('/--A--alt_phone--B--/i',"$alt_phone",$email_body);
$email_body = preg_replace('/--A--email--B--/i',"$email",$email_body);
$email_body = preg_replace('/--A--security_phrase--B--/i',"$security_phrase",$email_body);
$email_body = preg_replace('/--A--comments--B--/i',"$comments",$email_body);
$email_body = preg_replace('/--A--user--B--/i',"$user",$email_body);
$email_body = preg_replace('/--A--pass--B--/i',"$orig_pass",$email_body);
$email_body = preg_replace('/--A--original_phone_login--B--/i',"$original_phone_login",$email_body);
$email_body = preg_replace('/--A--phone_pass--B--/i',"$phone_pass",$email_body);
$email_body = preg_replace('/--A--fronter--B--/i',"$fronter",$email_body);
$email_body = preg_replace('/--A--closer--B--/i',"$user",$email_body);
$email_body = preg_replace('/--A--SQLdate--B--/i',"$NOW_TIME",$email_body);
$email_body = preg_replace('/--A--epoch--B--/i',"$epoch",$email_body);
$email_body = preg_replace('/--A--source_id--B--/i',"$source_id",$email_body);
$email_body = preg_replace('/--A--rank--B--/i',"$rank",$email_body);
$email_body = preg_replace('/--A--owner--B--/i',"$owner",$email_body);
$email_body = preg_replace('/--A--entry_list_id--B--/i',"$entry_list_id",$email_body);
$email_body = preg_replace('/--A--call_id--B--/i',urlencode(trim($call_id)),$email_body);
$email_body = preg_replace('/--A--entry_date--B--/i',"$entry_date",$email_body);
$email_body = preg_replace('/--A--fullname--B--/i',"$fullname",$email_body);
$email_body = preg_replace('/--A--user_custom_one--B--/i',"$user_custom_one",$email_body);
$email_body = preg_replace('/--A--user_custom_two--B--/i',"$user_custom_two",$email_body);
$email_body = preg_replace('/--A--user_custom_three--B--/i',"$user_custom_three",$email_body);
$email_body = preg_replace('/--A--user_custom_four--B--/i',"$user_custom_four",$email_body);
$email_body = preg_replace('/--A--user_custom_five--B--/i',"$user_custom_five",$email_body);
$email_body = preg_replace('/--A--user_group--B--/i',urlencode(trim($user_group)),$email_body);
$email_body = preg_replace('/--A--agent_email--B--/i',"$agent_email",$email_body);
$email_body = urldecode($email_body);
}
### check for variables in email_to
if (preg_match('/--A--/i',$email_to))
{
$email_to = preg_replace('/^VAR/','',$email_to);
$email_to = preg_replace('/--A--email--B--/i',"$email",$email_to);
$email_to = preg_replace('/--A--customer_email--B--/i',"$email",$email_to);
$email_to = preg_replace('/--A--agent_email--B--/i',"$agent_email",$email_to);
$email_to = urldecode($email_to);
}
### check for variables in email_from
if (preg_match('/--A--/i',$email_from))
{
$email_from = preg_replace('/^VAR/','',$email_from);
$email_from = preg_replace('/--A--email--B--/i',"$email",$email_from);
$email_from = preg_replace('/--A--customer_email--B--/i',"$email",$email_from);
$email_from = preg_replace('/--A--agent_email--B--/i',"$agent_email",$email_from);
$email_from = urldecode($email_from);
}
##### sending email through PHP #####
mail("$email_to","$email_subject","$email_body", "From: $email_from");
$SQL_log = "$stmt|$stmtB|$CBaffected_rows|$email_from|$email_to|$email_subject|";
$SQL_log = preg_replace('/;/','',$SQL_log);
$SQL_log = addslashes($SQL_log);
$stmt="INSERT INTO vicidial_api_log set user='$user',agent_user='$user',function='dispo_send_email',value='$call_id',result='$affected_rows',result_reason='$container_id',source='vdc',data='$SQL_log',api_date='$NOW_TIME',api_script='$api_script';";
$rslt=mysql_to_mysqli($stmt, $link);
$MESSAGE = _QXZ("DONE: %1s match found, %2s email sent using %3s with %4s status",0,'',$SC_count,$affected_rows,$container_id,$dispo);
echo "$MESSAGE\n";
}
else
{
$MESSAGE = _QXZ("DONE: problem with settings %1s, not all required fields filled in",0,'',$container_id);
echo "$MESSAGE\n";
}
}
else
{
$MESSAGE = _QXZ("DONE: no settings container found %1s",0,'',$container_id);
echo "$MESSAGE\n";
}
}
else
{
$MESSAGE = _QXZ("DONE: no settings container found %1s",0,'',$container_id);
echo "$MESSAGE\n";
}
}
else
{
$MESSAGE = _QXZ("DONE: %1s or %2s are invalid",0,'',$lead_id,$container_id);
echo "$MESSAGE\n";
}
}
else
{
$MESSAGE = _QXZ("DONE: dispo is not a sale status: %1s",0,'',$dispo);
echo "$MESSAGE\n";
}
if ($log_to_file > 0)
{
$fp = fopen ("./send_email.txt", "a");
fwrite ($fp, "$NOW_TIME|$k|$lead_id|$call_id|$container_id|$sale_status|$dispo|$user|XXXX|$DB|$log_to_file|$MESSAGE|\n");
fclose($fp);
}
+311 -10
View File
@@ -100,6 +100,7 @@ $reports_color = '#E6E6E6';
$tts_color = '#C6C6C6';
$cc_color = '#C6C6C6';
$cts_color = '#C6C6C6';
$sc_color = '#C6C6C6';
$subcamp_color = '#C6C6C6';
###
@@ -1962,6 +1963,14 @@ if (isset($_GET["wait_time_lead_reset"])) {$wait_time_lead_reset=$_GET["wait_t
elseif (isset($_POST["wait_time_lead_reset"])) {$wait_time_lead_reset=$_POST["wait_time_lead_reset"];}
if (isset($_GET["hold_time_lead_reset"])) {$hold_time_lead_reset=$_GET["hold_time_lead_reset"];}
elseif (isset($_POST["hold_time_lead_reset"])) {$hold_time_lead_reset=$_POST["hold_time_lead_reset"];}
if (isset($_GET["container_id"])) {$container_id=$_GET["container_id"];}
elseif (isset($_POST["container_id"])) {$container_id=$_POST["container_id"];}
if (isset($_GET["container_notes"])) {$container_notes=$_GET["container_notes"];}
elseif (isset($_POST["container_notes"])) {$container_notes=$_POST["container_notes"];}
if (isset($_GET["container_type"])) {$container_type=$_GET["container_type"];}
elseif (isset($_POST["container_type"])) {$container_type=$_POST["container_type"];}
if (isset($_GET["container_entry"])) {$container_entry=$_GET["container_entry"];}
elseif (isset($_POST["container_entry"])) {$container_entry=$_POST["container_entry"];}
if (isset($script_id)) {$script_id= strtoupper($script_id);}
@@ -2755,6 +2764,8 @@ if ($non_latin < 1)
$manual_dial_override_field = preg_replace('/[^-_0-9a-zA-Z]/','',$manual_dial_override_field);
$max_queue_ingroup_id = preg_replace('/[^-_0-9a-zA-Z]/','',$max_queue_ingroup_id);
$agent_debug_logging = preg_replace('/[^-_0-9a-zA-Z]/','',$agent_debug_logging);
$container_id = preg_replace('/[^-_0-9a-zA-Z]/','',$container_id);
$container_type = preg_replace('/[^-_0-9a-zA-Z]/','',$container_type);
### ALPHA-NUMERIC and underscore and dash and slash and dot
$menu_timeout_prompt = preg_replace('/[^-\/\|\._0-9a-zA-Z]/','',$menu_timeout_prompt);
@@ -2921,6 +2932,7 @@ if ($non_latin < 1)
$holiday_comments = preg_replace('/[^- \.\,\_0-9a-zA-Z]/','',$holiday_comments);
$api_allowed_functions = preg_replace('/[^- \.\,\_0-9a-zA-Z]/','',$api_allowed_functions);
$agent_display_fields = preg_replace('/[^- \.\,\_0-9a-zA-Z]/','',$agent_display_fields);
$container_notes = preg_replace('/[^- \.\,\_0-9a-zA-Z]/','',$container_notes);
### ALPHA-NUMERIC and underscore and dash and slash and at and dot
$call_out_number_group = preg_replace('/[^-\.\:\/\@\_0-9a-zA-Z]/','',$call_out_number_group);
@@ -3029,6 +3041,7 @@ if ($non_latin < 1)
# $filter_url
# $na_call_url
# $web_form_address_three
# $container_entry
### VARIABLES not filtered at all ###
# $script_text
@@ -3563,12 +3576,13 @@ else
# 150728-1048 - Added option for secondary sorting by vendor_lead_code, Issue #833
# 150804-1107 - Added agent_whisper_enabled system settings option
# 150804-1608 - Added inbound group _lead_reset options
# 150806-1348 - Added Admin -> Settings Containers
#
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time
$admin_version = '2.12-504a';
$build = '150804-1608';
$admin_version = '2.12-505a';
$build = '150806-1348';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -4049,6 +4063,7 @@ if ($ADD==161111111111) {$hh='admin'; $sh='moh'; echo _QXZ("ADD NEW MUSIC ON HOL
if ($ADD==171111111111) {$hh='admin'; $sh='vm'; echo _QXZ("ADD NEW VOICEMAIL BOX");}
if ($ADD==181111111111) {$hh='admin'; $sh='label'; echo _QXZ("ADD NEW SCREEN LABEL");}
if ($ADD==191111111111) {$hh='admin'; $sh='cts'; echo _QXZ("ADD NEW CONTACT");}
if ($ADD==192111111111) {$hh='admin'; $sh='sc'; echo _QXZ("ADD SETTINGS CONTAINER");}
if ($ADD==1111111111111) {$hh='admin'; $sh='conference'; echo _QXZ("ADD NEW CONFERENCE");}
if ($ADD==11111111111111) {$hh='admin'; $sh='conference'; echo _QXZ("ADD NEW AGENT CONFERENCE");}
if ($ADD=='2') {$hh='users'; echo _QXZ("New User Addition");}
@@ -4097,6 +4112,7 @@ if ($ADD==261111111111) {$hh='admin'; $sh='moh'; echo _QXZ("ADDING NEW MUSIC ON
if ($ADD==271111111111) {$hh='admin'; $sh='vm'; echo _QXZ("ADDING NEW VOICEMAIL BOX");}
if ($ADD==281111111111) {$hh='admin'; $sh='label'; echo _QXZ("ADDING NEW SCREEN LABEL");}
if ($ADD==291111111111) {$hh='admin'; $sh='cts'; echo _QXZ("ADDING NEW CONTACT");}
if ($ADD==292111111111) {$hh='admin'; $sh='sc'; echo _QXZ("ADDING NEW SETTINGS CONTAINER");}
if ($ADD==2111111111111) {$hh='admin'; $sh='conference'; echo _QXZ("ADDING NEW CONFERENCE");}
if ($ADD==21111111111111) {$hh='admin'; $sh='conference'; echo _QXZ("ADDING NEW AGENT CONFERENCE");}
if ($ADD==221111111111111) {$hh='admin'; $sh='status'; echo _QXZ("ADDING SYSTEM STATUSES");}
@@ -4171,6 +4187,7 @@ if ($ADD==361111111111) {$hh='admin'; $sh='moh'; echo _QXZ("MODIFY MUSIC ON HOLD
if ($ADD==371111111111) {$hh='admin'; $sh='vm'; echo _QXZ("MODIFY VOICEMAIL BOX");}
if ($ADD==381111111111) {$hh='admin'; $sh='label'; echo _QXZ("MODIFY SCREEN LABEL");}
if ($ADD==391111111111) {$hh='admin'; $sh='cts'; echo _QXZ("MODIFY CONTACT");}
if ($ADD==392111111111) {$hh='admin'; $sh='sc'; echo _QXZ("MODIFY SETTINGS CONTAINER");}
if ($ADD==3111111111111) {$hh='admin'; $sh='conference'; echo _QXZ("MODIFY CONFERENCE");}
if ($ADD==31111111111111) {$hh='admin'; $sh='conference'; echo _QXZ("MODIFY AGENT CONFERENCE");}
if ($ADD==311111111111111) {$hh='admin'; $sh='settings'; echo _QXZ("MODIFY SYSTEM SETTINGS");}
@@ -4218,6 +4235,7 @@ if ($ADD==461111111111) {$hh='admin'; $sh='moh'; echo _QXZ("MODIFY MUSIC ON HOLD
if ($ADD==471111111111) {$hh='admin'; $sh='vm'; echo _QXZ("MODIFY VOICEMAIL BOX");}
if ($ADD==481111111111) {$hh='admin'; $sh='label'; echo _QXZ("MODIFY SCREEN LABEL");}
if ($ADD==491111111111) {$hh='admin'; $sh='cts'; echo _QXZ("MODIFY CONTACT");}
if ($ADD==492111111111) {$hh='admin'; $sh='sc'; echo _QXZ("MODIFY SETTINGS CONTAINER");}
if ($ADD==4111111111111) {$hh='admin'; $sh='conference'; echo _QXZ("MODIFY CONFERENCE");}
if ($ADD==41111111111111) {$hh='admin'; $sh='conference'; echo _QXZ("MODIFY CONFERENCE");}
if ($ADD==411111111111111) {$hh='admin'; $sh='settings'; echo _QXZ("MODIFY SYSTEM SETTINGS");}
@@ -4254,6 +4272,7 @@ if ($ADD==561111111111) {$hh='admin'; $sh='moh'; echo _QXZ("DELETE MUSIC ON HOLD
if ($ADD==571111111111) {$hh='admin'; $sh='vm'; echo _QXZ("DELETE VOICEMAIL BOX");}
if ($ADD==581111111111) {$hh='admin'; $sh='label'; echo _QXZ("DELETE SCREEN LABEL");}
if ($ADD==591111111111) {$hh='admin'; $sh='cts'; echo _QXZ("DELETE CONTACT");}
if ($ADD==591111111111) {$hh='admin'; $sh='sc'; echo _QXZ("DELETE SETTINGS CONTAINER");}
if ($ADD==5111111111111) {$hh='admin'; $sh='conference'; echo _QXZ("DELETE CONFERENCE");}
if ($ADD==51111111111111) {$hh='admin'; $sh='conference'; echo _QXZ("DELETE AGENT CONFERENCE");}
if ($ADD==6) {$hh='users'; echo _QXZ("Delete User");}
@@ -4293,6 +4312,7 @@ if ($ADD==661111111111) {$hh='admin'; $sh='moh'; echo _QXZ("DELETE MUSIC ON HOLD
if ($ADD==671111111111) {$hh='admin'; $sh='vm'; echo _QXZ("DELETE VOICEMAIL BOX");}
if ($ADD==681111111111) {$hh='admin'; $sh='label'; echo _QXZ("DELETE SCREEN LABEL");}
if ($ADD==691111111111) {$hh='admin'; $sh='cts'; echo _QXZ("DELETE CONTACT");}
if ($ADD==692111111111) {$hh='admin'; $sh='sc'; echo _QXZ("DELETE SETTINGS CONTAINER");}
if ($ADD==6111111111111) {$hh='admin'; $sh='conference'; echo _QXZ("DELETE CONFERENCE");}
if ($ADD==61111111111111) {$hh='admin'; $sh='conference'; echo _QXZ("DELETE AGENT CONFERENCE");}
if ($ADD==73) {$hh='campaigns'; echo _QXZ("Dialable Lead Count");}
@@ -4338,6 +4358,7 @@ if ($ADD==160000000000) {$hh='admin'; $sh='moh'; echo _QXZ("MUSIC ON HOLD ENTRY
if ($ADD==170000000000) {$hh='admin'; $sh='vm'; echo _QXZ("VOICEMAIL BOXES LIST");}
if ($ADD==180000000000) {$hh='admin'; $sh='label'; echo _QXZ("SCREEN LABELS LIST");}
if ($ADD==190000000000) {$hh='admin'; $sh='cts'; echo _QXZ("CONTACTS LIST");}
if ($ADD==192000000000) {$hh='admin'; $sh='sc'; echo _QXZ("SETTINGS CONTAINTER LIST");}
if ($ADD==1000000000000) {$hh='admin'; $sh='conference'; echo _QXZ("CONFERENCE LIST");}
if ($ADD==10000000000000) {$hh='admin'; $sh='conference'; echo _QXZ("AGENT CONFERENCE LIST");}
if ($ADD==100000000000000) {$hh='qc'; echo _QXZ("Quality Control");}
@@ -7583,7 +7604,7 @@ if ($ADD==191111111111)
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
echo "<br>"._QXZ("ADD NEW SCREEN LABEL")."<form action=$PHP_SELF method=POST>\n";
echo "<br>"._QXZ("ADD NEW CONTACT")."<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=291111111111>\n";
echo "<center><TABLE width=$section_width cellspacing=3>\n";
@@ -7610,6 +7631,40 @@ if ($ADD==191111111111)
}
######################
# ADD=192111111111 display the ADD NEW SETTINGS CONTAINER
######################
if ($ADD==192111111111)
{
if ($LOGmodify_servers==1)
{
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
echo "<br>"._QXZ("ADD NEW SETTINGS CONTAINER")."<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=292111111111>\n";
echo "<center><TABLE width=$section_width cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Container ID").": </td><td align=left><input type=text name=container_id size=40 maxlength=40>$NWB#settings_containers-container_id$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Container Notes").": </td><td align=left><input type=text name=container_notes size=50 maxlength=255>$NWB#settings_containers-container_notes$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Container Type").": </td><td align=left><select size=1 name=container_type><option value='OTHER'>"._QXZ("OTHER")."</option><option value='PERL_CLI'>"._QXZ("PERL_CLI")."</option><option value='EMAIL_TEMPLATE'>"._QXZ("EMAIL_TEMPLATE")."</option>$NWB#settings_containers-container_type$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Admin User Group").": </td><td align=left><select size=1 name=user_group>\n";
echo "$UUgroups_list";
echo "<option SELECTED value=\"---ALL---\">"._QXZ("All Admin User Groups")."</option>\n";
echo "</select>$NWB#settings_containers-user_group$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=submit value='"._QXZ("SUBMIT")."'</td></tr>\n";
echo "</TABLE></center>\n";
}
else
{
echo _QXZ("You do not have permission to view this page")."\n";
exit;
}
}
######################
# ADD=1111111111111 display the ADD NEW CONFERENCE SCREEN
######################
@@ -10642,7 +10697,7 @@ if ($ADD==23111111111)
if ($ADD==211111111111)
{
if ($add_copy_disabled > 0)
if ( ($LOGmodify_servers!=1) or ($add_copy_disabled > 0) )
{
echo "<br>"._QXZ("You do not have permission to add records on this system")." -system_settings-\n";
}
@@ -11124,6 +11179,49 @@ if ($ADD==291111111111)
}
######################
# ADD=292111111111 adds new settings container to the system
######################
if ($ADD==292111111111)
{
if ( ($LOGmodify_servers!=1) or ($add_copy_disabled > 0) )
{
echo "<br>"._QXZ("You do not have permission to add records on this system")." -system_settings-\n";
}
else
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT count(*) from vicidial_settings_containers where container_id='$container_id';";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
if ($row[0] > 0)
{echo "<br>"._QXZ("SETTINGS CONTAINER NOT ADDED - there is already a container in the system with this ID")."\n";}
else
{
if ( (strlen($container_id) < 2) or (strlen($container_notes) < 2) )
{echo "<br>"._QXZ("SETTINGS CONTAINER NOT ADDED - Please go back and look at the data you entered")."\n";}
else
{
echo "<br>"._QXZ("SETTINGS CONTAINER ADDED")."\n";
$stmt="INSERT INTO vicidial_settings_containers SET container_id='$container_id',container_notes='$container_notes',container_type='$container_type',user_group='$user_group';";
$rslt=mysql_to_mysqli($stmt, $link);
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|";
$SQL_log = preg_replace('/;/', '', $SQL_log);
$SQL_log = addslashes($SQL_log);
$stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='CONTAINERS', event_type='ADD', record_id='$container_id', event_code='ADMIN ADD CONTAINER', event_sql=\"$SQL_log\", event_notes='';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
}
}
}
$ADD=392111111111;
}
######################
# ADD=2111111111111 adds new conference to the system
######################
@@ -14946,6 +15044,43 @@ if ($ADD==491111111111)
}
######################
# ADD=492111111111 modify settings container record in the system
######################
if ($ADD==492111111111)
{
if ($LOGmodify_servers==1)
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
if ( (strlen($container_id) < 2) or (strlen($container_notes) < 2) )
{echo "<br>"._QXZ("SETTINGS CONTAINER NOT MODIFIED - Please go back and look at the data you entered")."\n";}
else
{
$stmt="UPDATE vicidial_settings_containers set container_notes='$container_notes',container_type='$container_type',user_group='$user_group',container_entry='" . mysqli_real_escape_string($link, $container_entry) ."' where container_id='$container_id';";
$rslt=mysql_to_mysqli($stmt, $link);
echo "<br>"._QXZ("SETTINGS CONTAINER MODIFIED").": $container_id\n";
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|";
$SQL_log = preg_replace('/;/', '', $SQL_log);
$SQL_log = addslashes($SQL_log);
$stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='CONTAINERS', event_type='MODIFY', record_id='$container_id', event_code='ADMIN MODIFY CONTAINER', event_sql=\"$SQL_log\", event_notes='';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
}
}
else
{
echo _QXZ("You do not have permission to view this page")."\n";
exit;
}
$ADD=392111111111; # go to settings container entry modification form below
}
######################
# ADD=4111111111111 modify conference record in the system
######################
@@ -15972,6 +16107,28 @@ if ($ADD==591111111111)
}
######################
# ADD=592111111111 confirmation before deletion of settings container record
######################
if ($ADD==592111111111)
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
if (strlen($container_id) < 2)
{
echo "<br>"._QXZ("SETTINGS CONTAINER NOT DELETED - Please go back and look at the data you entered")."\n";
echo "<br>"._QXZ("Container ID be at least 2 characters in length")."\n";
}
else
{
echo "<br><B>"._QXZ("SCREEN LABEL DELETION CONFIRMATION").": $container_id - $container_notes</B>\n";
echo "<br><br><a href=\"$PHP_SELF?ADD=692111111111&container_id=$container_id&CoNfIrM=YES\">"._QXZ("Click here to delete settings container")." $container_id - $container_notes</a><br><br><br>\n";
}
$ADD='392111111111'; # go to settings container entry modification below
}
######################
# ADD=5111111111111 confirmation before deletion of conference record
######################
@@ -17471,7 +17628,7 @@ if ($ADD==611111111111)
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) )
if ( (strlen($server_id) < 2) or (strlen($server_ip) < 7) or ($CoNfIrM != 'YES') or ($LOGast_delete_phones < 1) or ($LOGmodify_servers!=1) )
{
echo "<br>"._QXZ("SERVER NOT DELETED - Please go back and look at the data you entered")."\n";
echo "<br>"._QXZ("Server ID must be at least 2 characters in length")."\n";
@@ -17807,6 +17964,39 @@ if ($ADD==691111111111)
}
######################
# ADD=692111111111 delete settings container record
######################
if ($ADD==692111111111)
{
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
if ( (strlen($container_id) < 2) or ($CoNfIrM != 'YES') or ($LOGmodify_servers!=1) )
{
echo "<br>"._QXZ("SETTINGS CONTAINER NOT DELETED - Please go back and look at the data you entered")."\n";
echo "<br>"._QXZ("Container ID must be at least 2 characters in length")."\n";
}
else
{
$stmt="DELETE from vicidial_settings_containers where container_id='$container_id' $LOGadmin_viewable_groupsSQL;";
$rslt=mysql_to_mysqli($stmt, $link);
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|";
$SQL_log = preg_replace('/;/', '', $SQL_log);
$SQL_log = addslashes($SQL_log);
$stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='CONTAINERS', event_type='DELETE', record_id='$container_id', event_code='ADMIN DELETE CONTAINER', event_sql=\"$SQL_log\", event_notes='';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_to_mysqli($stmt, $link);
echo "<br><B>"._QXZ("SETTINGS CONTAINER DELETION COMPLETED").": $container_id</B>\n";
echo "<br><br>\n";
}
$ADD='192000000000'; # go to settings container entry list
}
######################
# ADD=6111111111111 delete conference record
######################
@@ -30005,7 +30195,6 @@ if ($ADD==381111111111)
}
######################
# ADD=391111111111 modify contact in the system
######################
@@ -30086,6 +30275,73 @@ if ($ADD==391111111111)
######################
# ADD=392111111111 modify settings container in the system
######################
if ($ADD==392111111111)
{
if ( ($LOGast_admin_access==1) and ($LOGmodify_servers==1) )
{
if ( ($SSadmin_modify_refresh > 1) and ($modify_refresh_set < 1) )
{
$modify_url = "$PHP_SELF?ADD=392111111111&container_id=$container_id";
$modify_footer_refresh=1;
}
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT container_notes,container_type,user_group,container_entry from vicidial_settings_containers where container_id='$container_id' $LOGadmin_viewable_groupsSQL;";
$rslt=mysql_to_mysqli($stmt, $link);
$row=mysqli_fetch_row($rslt);
$container_notes = $row[0];
$container_type = $row[1];
$user_group = $row[2];
$container_entry = $row[3];
echo "<br>"._QXZ("MODIFY SETTINGS CONTAINER").": $tts_id<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=ADD value=492111111111>\n";
echo "<input type=hidden name=container_id value=\"$container_id\">\n";
echo "<center><TABLE width=$section_width cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Container ID").": </td><td align=left><B>$container_id</B></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Container Notes").": </td><td align=left><input type=text name=container_notes size=50 maxlength=255 value=\"$container_notes\">$NWB#settings_containers-container_notes$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Container Type").": </td><td align=left><select size=1 name=container_type><option value='OTHER'>"._QXZ("OTHER")."</option><option value='PERL_CLI'>"._QXZ("PERL_CLI")."</option><option value='EMAIL_TEMPLATE'>"._QXZ("EMAIL_TEMPLATE")."</option><option SELECTED value='$container_type'>"._QXZ("$container_type")."</option>$NWB#settings_containers-container_type$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Admin User Group").": </td><td align=left><select size=1 name=user_group>\n";
echo "$UUgroups_list";
echo "<option SELECTED value=\"$user_group\">$user_group</option>\n";
echo "</select>$NWB#settings_containers-user_group$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Container Entry").": </td><td align=left><TEXTAREA NAME=container_entry ROWS=25 COLS=75>$container_entry</TEXTAREA> $NWB#settings_containers-container_entry$NWE</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=submit value='"._QXZ("SUBMIT")."'</td></tr>\n";
echo "</TABLE></center>\n";
echo "<center><b>\n";
echo "</TABLE><BR><BR>\n";
if ($LOGast_delete_phones > 0)
{
echo "<br><br><a href=\"$PHP_SELF?ADD=592111111111&container_id=$container_id&container_notes=$container_notes\">"._QXZ("DELETE THIS SETTINGS CONTAINER")."</a>\n";
}
if ( ($LOGuser_level >= 9) and ( (preg_match("/Administration Change Log/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) )
{
echo "<br><br><a href=\"$PHP_SELF?ADD=720000000000000&category=CONTAINERS&stage=$container_id\">"._QXZ("Click here to see Admin changes to this settings container")."</FONT>\n";
}
}
else
{
echo _QXZ("You do not have permission to view this page")."\n";
exit;
}
}
######################
# ADD=3111111111111 modify conference record in the system
######################
@@ -33044,6 +33300,50 @@ if ($ADD==190000000000)
}
######################
# ADD=192000000000 display all settings containers entries
######################
if ($ADD==192000000000)
{
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
$stmt="SELECT container_id,container_notes,container_type,user_group,container_entry from vicidial_settings_containers $whereLOGadmin_viewable_groupsSQL order by container_type,container_id";
$rslt=mysql_to_mysqli($stmt, $link);
$sc_to_print = mysqli_num_rows($rslt);
echo "<br>"._QXZ("Settings Containers").":\n";
echo "<center><TABLE width=$section_width cellspacing=0 cellpadding=1>\n";
echo "<tr bgcolor=black>";
echo "<td><font size=1 color=white align=left><B>"._QXZ("Container ID")."</B></td>";
echo "<td><font size=1 color=white><B>"._QXZ("Notes")."</B></td>";
echo "<td><font size=1 color=white><B>"._QXZ("Type")."</B></td>";
echo "<td><font size=1 color=white><B>"._QXZ("Length")."</B></td>";
echo "<td><font size=1 color=white><B>"._QXZ("ADMIN GROUP")."</B></td>";
echo "<td align=center><font size=1 color=white><B>"._QXZ("MODIFY")."</B></td></tr>\n";
$o=0;
while ($sc_to_print > $o)
{
$row=mysqli_fetch_row($rslt);
if (preg_match('/1$|3$|5$|7$|9$/i', $o))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
echo "<tr $bgcolor><td><font size=1><a href=\"$PHP_SELF?ADD=392111111111&container_id=$row[0]\">$row[0]</a></td>";
echo "<td><font size=1>$row[1]</td>";
echo "<td><font size=1>$row[2]</td>";
echo "<td><font size=1>".strlen($row[4])."</td>";
echo "<td><font size=1>$row[3]</td>";
echo "<td align=center><font size=1><a href=\"$PHP_SELF?ADD=392111111111&container_id=$row[0]\">"._QXZ("MODIFY")."</a></td></tr>\n";
$o++;
}
echo "</TABLE></center>\n";
}
######################
# ADD=1000000000000 display all conferences
######################
@@ -34174,6 +34474,10 @@ if ($ADD==999998)
echo "<LI><a href=\"audio_store.php\"><FONT FACE=\"ARIAL,HELVETICA\" SIZE=3> "._QXZ("Audio Store")." </a>\n";
echo "<LI><a href=\"$PHP_SELF?ADD=160000000000\"><FONT FACE=\"ARIAL,HELVETICA\" SIZE=3> "._QXZ("Music On Hold")." </a>\n";
}
if ($SSenable_languages > 0)
{
echo "<LI><a href=\"admin_languages.php?ADD=163000000000\"><FONT FACE=\"ARIAL,HELVETICA\" SIZE=3> "._QXZ("Languages")." </a>\n";
}
if ($SSenable_tts_integration > 0)
{
echo "<LI><a href=\"$PHP_SELF?ADD=150000000000\"><FONT FACE=\"ARIAL,HELVETICA\" SIZE=3> "._QXZ("Text To Speech")." </a>\n";
@@ -34186,11 +34490,8 @@ if ($ADD==999998)
{
echo "<LI><a href=\"$PHP_SELF?ADD=190000000000\"><FONT FACE=\"ARIAL,HELVETICA\" SIZE=3> "._QXZ("Contacts")." </a>\n";
}
if ($SSenable_languages > 0)
{
echo "<LI><a href=\"admin_languages.php?ADD=163000000000\"><FONT FACE=\"ARIAL,HELVETICA\" SIZE=3> "._QXZ("Languages")." </a>\n";
}
echo "<LI><a href=\"$PHP_SELF?ADD=192000000000\"><FONT FACE=\"ARIAL,HELVETICA\" SIZE=3> "._QXZ("Settings Containers")." </a>\n";
echo "</UL>\n";
echo "</TD><TD WIDTH=400> &nbsp; \n";
}
+12 -1
View File
@@ -51,6 +51,7 @@
# 141230-0927 - Changed single-quote QXZ arguments to double-quotes
# 150227-1614 - Formatting issue #831
# 150307-0915 - Fixes for QXZ
# 150806-1023 - Added code for Admin -> Settings Containers
#
@@ -1508,6 +1509,8 @@ $SSenable_languages = $row[7];
else {$cc_sh=''; $cc_fc='BLACK';}
if ($sh=='cts') {$cts_sh="bgcolor=\"$cts_color\""; $cts_fc="$cc_font";}
else {$cts_sh=''; $cts_fc='BLACK';}
if ($sh=='sc') {$sc_sh="bgcolor=\"$sc_color\""; $sc_fc="$cc_font";}
else {$sc_sh=''; $sc_fc='BLACK';}
if ($sh=='emails') {$emails_sh="bgcolor=\"$subcamp_color\""; $emails_fc="$subcamp_font";}
else {$emails_sh=''; $emails_fc='BLACK';}
@@ -1590,7 +1593,11 @@ $SSenable_languages = $row[7];
</TR>
<?php }
?>
</TR><TR BGCOLOR=<?php echo $admin_color ?>><TD ALIGN=LEFT <?php echo $sc_sh ?>> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=192000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $sc_fc ?> SIZE=<?php echo $header_font_size ?>> <?php echo _QXZ("Settings Containers"); ?> </a></TD>
</TR>
<?php
}
?>
<!-- REPORTS NAVIGATION -->
@@ -1754,6 +1761,10 @@ if ($SSenable_languages == '1')
?>
<TR BGCOLOR=<?php echo $cts_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=190000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo _QXZ("Contacts"); ?> </a> &nbsp; |<?php if ($add_copy_disabled < 1) { ?> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=191111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo _QXZ("Add A Contact"); ?> </a><?php } ?></TD></TR>
<?php }
if (strlen($sc_sh) > 1) {
?>
<TR BGCOLOR=<?php echo $sc_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=192000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo _QXZ("Settings Containers"); ?> </a> &nbsp; |<?php if ($add_copy_disabled < 1) { ?> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=192111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo _QXZ("Add A Settings Container"); ?> </a><?php } ?></TD></TR>
<?php }
if ( (strlen($status_sh) > 1) and (!preg_match('/campaign/i',$hh) ) ) {
?>
<TR BGCOLOR=<?php echo $status_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=321111111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo _QXZ("System Statuses"); ?> </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=331111111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo _QXZ("Status Categories"); ?> </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=341111111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo _QXZ("QC Status Codes"); ?> </a></TD></TR>
+36
View File
@@ -58,6 +58,7 @@
# 150728-0904 - Added state_conversion for list loader
# 150804-1108 - Added agent_whisper_enabled system settings option
# 150804-1631 - Added multiple in-group _lead_reset options
# 150806-1346 - Added Settings Containers
#
require("dbconnect_mysqli.php");
@@ -5137,6 +5138,41 @@ FR_SPAC 00 00 00 00 00 - <?php echo _QXZ("France space separated phone number");
<BR><BR><BR><BR>
<B><FONT SIZE=3>SETTINGS CONTAINERS TABLE</FONT></B><BR><BR>
<A NAME="settings_containers">
<BR>
<B><?php echo _QXZ("Settings Containers allow for an easy way to add, modify and delete large configurations of settings, or for elements like email templates to be used by PHP and Perl scripts within the codebase."); ?></B>
<A NAME="settings_containers-container_id">
<BR>
<B><?php echo _QXZ("Container ID"); ?> -</B><?php echo _QXZ("This field needs to be at least 2 characters in length and no more than 40 characters in length, no spaces or special characters. This is the ID that will be used to identify the Settings Container throughout the system."); ?>
<BR>
<A NAME="settings_containers-container_notes">
<BR>
<B><?php echo _QXZ("Container Notes"); ?> -</B><?php echo _QXZ("This is the descriptive name of the Settings Container entry."); ?>
<BR>
<A NAME="settings_containers-container_type">
<BR>
<B><?php echo _QXZ("Container Type"); ?> -</B><?php echo _QXZ("This is the type of Container entry. This is only used for categorization."); ?>
<BR>
<A NAME="settings_containers-user_group">
<BR>
<B><?php echo _QXZ("Admin User Group"); ?> -</B><?php echo _QXZ("This is the administrative user group for this record, this allows admin viewing of this recoird restricted by user group. Default is --ALL-- which allows any admin user to view this record."); ?>
<BR>
<A NAME="settings_containers-container_entry">
<BR>
<B><?php echo _QXZ("Container Entry"); ?> -</B><?php echo _QXZ("This is where you put the contents of the settings that you want in this container."); ?>
<BR><BR><BR><BR>
<B><FONT SIZE=3>STATUS_CATEGORIES TABLE</FONT></B><BR><BR>