diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE
index 595ca41a..40a5d9c1 100644
--- a/agc_2-X/trunk/UPGRADE
+++ b/agc_2-X/trunk/UPGRADE
@@ -284,6 +284,8 @@ OTHER CHANGES:
77. Added ALT Multi Dispo URL option to restrict URL sending by list ID.
+78. Added Admin Bulk Tools page, linked from Admin Utilities page
+
diff --git a/agc_2-X/trunk/www/agc/dispo_move_list.php b/agc_2-X/trunk/www/agc/dispo_move_list.php
index 38ae9103..3c965810 100644
--- a/agc_2-X/trunk/www/agc/dispo_move_list.php
+++ b/agc_2-X/trunk/www/agc/dispo_move_list.php
@@ -19,7 +19,7 @@
# VARhttp://192.168.1.1/agc/dispo_move_list.php?lead_id=--A--lead_id--B--&dispo=--A--dispo--B--&user=--A--user--B--&pass=--A--pass--B--&new_list_id=10411099&sale_status=SALE---SSALE---XSALE&reset_dialed=Y&log_to_file=1
#
# Another example of what to put in the Dispo URL field(using status exclude with talk trigger):
-# VARhttp://192.168.1.1/agc/dispo_move_list.php?lead_id=--A--lead_id--B--&dispo=--A--dispo--B--&talk_time=--A--talk_time--B--&user=--A--user--B--&pass=--A--pass--B--&new_list_id=332&sale_status=DNC---BILLNW---POST&exclude_status=Y&talk_time_trigger=240&log_to_file=1
+# VARhttp://192.168.1.1/agc/dispo_move_list.php?lead_id=--A--lead_id--B--&dispo=--A--dispo--B--&talk_time=--A--talk_time--B--&called_count=--A--called_count--B--&user=--A--user--B--&pass=--A--pass--B--&new_list_id=332&sale_status=DNC---BILLNW---POST&exclude_status=Y&talk_time_trigger=240&called_count_trigger=4&log_to_file=1
#
# Example of what to put in the No Agent Call URL field:
# (user needs to be NOAGENTURL and pass needs to be set to the call_id)
@@ -30,10 +30,11 @@
# - sale_status - (SALE---XSALE) a triple-dash "---" delimited list of the statuses that are to be moved
# - exclude_status - (Y,N) if set to Y, will trigger for all statuses EXCEPT for those listed in sale_status, default is N
# - talk_time_trigger - (0,1,2,3,...) if set to number greater than 0, will only trigger for talk_time at or above set number, default is 0
+# - called_count_trigger - (1,2,3,...) if set to number greater than 0, will only trigger for called_count at or above set number, default is 0
# - new_list_id - (999,etc...) the list_id that you want the matching status leads to be moved to
# - reset_dialed - (Y,N) if set to Y, will reset the called_since_last_reset flag on the lead
# Multiple sets of statuses:
-# - sale_status_1, new_list_id_1, reset_dialed_1, exclude_status_1 - adding an underscore and number(1-99) will allow for another set of statuses to check for and what to do with them
+# - sale_status_1, new_list_id_1, reset_dialed_1, exclude_status_1, called_count_trigger_1 - adding an underscore and number(1-99) will allow for another set of statuses to check for and what to do with them
#
# CHANGES
# 100915-1600 - First Build
@@ -48,9 +49,10 @@
# 141216-2110 - Added language settings lookups and user/pass variable standardization
# 150703-1453 - Added options so it would work with No-Agent Call URL
# 160309-1239 - Added talk_time_trigger and exclude_status options
+# 160801-1032 - Added called_count_trigger options
#
-$api_script = 'deactivate';
+$api_script = 'movelist';
header ("Content-type: text/html; charset=utf-8");
@@ -81,6 +83,10 @@ if (isset($_GET["talk_time"])) {$talk_time=$_GET["talk_time"];}
elseif (isset($_POST["talk_time"])) {$talk_time=$_POST["talk_time"];}
if (isset($_GET["talk_time_trigger"])) {$talk_time_trigger=$_GET["talk_time_trigger"];}
elseif (isset($_POST["talk_time_trigger"])) {$talk_time_trigger=$_POST["talk_time_trigger"];}
+if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];}
+ elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];}
+if (isset($_GET["called_count_trigger"])) {$called_count_trigger=$_GET["called_count_trigger"];}
+ elseif (isset($_POST["called_count_trigger"])) {$called_count_trigger=$_POST["called_count_trigger"];}
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
@@ -139,14 +145,17 @@ if ($non_latin < 1)
$user=preg_replace("/[^-_0-9a-zA-Z]/","",$user);
}
-if ($DB>0) {echo "$lead_id|$search_field|$campaign_check|$sale_status|$dispo|$new_status|$user|$pass|$DB|$log_to_file|$talk_time|$talk_time_trigger|$exclude_status|\n";}
+if ($DB>0) {echo "$lead_id|$search_field|$campaign_check|$sale_status|$dispo|$new_status|$user|$pass|$DB|$log_to_file|$talk_time|$talk_time_trigger|$exclude_status|$called_count|$called_count_trigger|\n";}
-if ( ( (strlen($talk_time_trigger)>0) and ($talk_time > $talk_time_trigger) ) or (strlen($talk_time_trigger)<1) or ($talk_time_trigger < 1) )
+if ( ( (strlen($called_count_trigger)>0) and ($called_count >= $called_count_trigger) ) or (strlen($called_count_trigger)<1) or ($called_count_trigger < 1) )
{
- if ( ( (preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status!='Y') ) or ( (!preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status=='Y') ) )
- {$primary_match_found=1;}
+ if ( ( (strlen($talk_time_trigger)>0) and ($talk_time >= $talk_time_trigger) ) or (strlen($talk_time_trigger)<1) or ($talk_time_trigger < 1) )
+ {
+ if ( ( (preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status!='Y') ) or ( (!preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status=='Y') ) )
+ {$primary_match_found=1;}
+ }
}
-$first_pass_vars = "$new_list_id|$reset_dialed|$sale_status|$talk_time_trigger|$exclude_status";
+$first_pass_vars = "$new_list_id|$reset_dialed|$sale_status|$talk_time_trigger|$exclude_status$called_count_trigger|";
if ($primary_match_found > 0)
{$match_found=1;}
else
@@ -154,6 +163,7 @@ else
$sale_status='';
$exclude_status='';
$talk_time_trigger='';
+ $called_count_trigger='';
$new_list_id='';
$reset_dialed='';
while( ($match_found < 1) and ($k < 99) )
@@ -162,33 +172,40 @@ else
$sale_status='';
$exclude_status='';
$talk_time_trigger='';
+ $called_count_trigger='';
$statusfield = "sale_status_$k";
$excludefield = "exclude_status_$k";
$talktriggerfield = "talk_time_trigger_$k";
+ $counttriggerfield = "called_count_trigger_$k";
if (isset($_GET["$excludefield"])) {$exclude_status=$_GET["$excludefield"];}
elseif (isset($_POST["$excludefield"])) {$exclude_status=$_POST["$excludefield"];}
if (isset($_GET["$talktriggerfield"])) {$talk_time_trigger=$_GET["$talktriggerfield"];}
elseif (isset($_POST["$talktriggerfield"])) {$talk_time_trigger=$_POST["$talktriggerfield"];}
+ if (isset($_GET["$counttriggerfield"])) {$called_count_trigger=$_GET["$counttriggerfield"];}
+ elseif (isset($_POST["$counttriggerfield"])) {$called_count_trigger=$_POST["$counttriggerfield"];}
if (isset($_GET["$statusfield"])) {$sale_status=$_GET["$statusfield"];}
elseif (isset($_POST["$statusfield"])) {$sale_status=$_POST["$statusfield"];}
$sale_status = "$TD$sale_status$TD";
- if ($DB) {echo _QXZ("MULTI_MATCH CHECK:")." $k|$sale_status|$statusfield|$exclude_status|$excludefield|$talk_time_trigger|$talktriggerfield|\n";}
+ if ($DB) {echo _QXZ("MULTI_MATCH CHECK:")." $k|$sale_status|$statusfield|$exclude_status|$excludefield|$talk_time_trigger|$talktriggerfield|$called_count_trigger|$counttriggerfield|\n";}
- if ( ( (strlen($talk_time_trigger)>0) and ($talk_time > $talk_time_trigger) ) or (strlen($talk_time_trigger)<1) or ($talk_time_trigger < 1) )
+ if ( ( (strlen($called_count_trigger)>0) and ($called_count >= $called_count_trigger) ) or (strlen($called_count_trigger)<1) or ($called_count_trigger < 1) )
{
- if (strlen($sale_status)>0)
+ if ( ( (strlen($talk_time_trigger)>0) and ($talk_time >= $talk_time_trigger) ) or (strlen($talk_time_trigger)<1) or ($talk_time_trigger < 1) )
{
- if ( ( (preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status!='Y') ) or ( (!preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status=='Y') ) )
+ if (strlen($sale_status)>0)
{
- $match_found=1;
- $newlistfield = "new_list_id_$k";
- $resetfield = "reset_dialed_$k";
- if (isset($_GET["$newlistfield"])) {$new_list_id=$_GET["$newlistfield"];}
- elseif (isset($_POST["$newlistfield"])) {$new_list_id=$_POST["$newlistfield"];}
- if (isset($_GET["$resetfield"])) {$reset_dialed=$_GET["$resetfield"];}
- elseif (isset($_POST["$resetfield"])) {$reset_dialed=$_POST["$resetfield"];}
- if ($DB) {echo _QXZ("MULTI_MATCH:")." $k|$sale_status|$new_list_id|$reset_dialed|$exclude_status|$talk_time_trigger|\n";}
+ if ( ( (preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status!='Y') ) or ( (!preg_match("/$TD$dispo$TD/",$sale_status)) and ($exclude_status=='Y') ) )
+ {
+ $match_found=1;
+ $newlistfield = "new_list_id_$k";
+ $resetfield = "reset_dialed_$k";
+ if (isset($_GET["$newlistfield"])) {$new_list_id=$_GET["$newlistfield"];}
+ elseif (isset($_POST["$newlistfield"])) {$new_list_id=$_POST["$newlistfield"];}
+ if (isset($_GET["$resetfield"])) {$reset_dialed=$_GET["$resetfield"];}
+ elseif (isset($_POST["$resetfield"])) {$reset_dialed=$_POST["$resetfield"];}
+ if ($DB) {echo _QXZ("MULTI_MATCH:")." $k|$sale_status|$new_list_id|$reset_dialed|$exclude_status|$talk_time_trigger|$called_count_trigger|\n";}
+ }
}
}
}
@@ -318,6 +335,6 @@ else
if ($log_to_file > 0)
{
$fp = fopen ("./dispo_move_list.txt", "a");
- fwrite ($fp, "$NOW_TIME|$k|$lead_id|$dispo|$user|XXXX|$DB|$log_to_file|$talk_time|$first_pass_vars|$new_list_id|$sale_status|$talk_time_trigger|$exclude_status|$MESSAGE|\n");
+ fwrite ($fp, "$NOW_TIME|$k|$lead_id|$dispo|$user|XXXX|$DB|$log_to_file|$talk_time|$called_count|$first_pass_vars|$new_list_id|$sale_status|$talk_time_trigger|$exclude_status|$called_count_trigger|$MESSAGE|\n");
fclose($fp);
}
diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php
index af5ceb48..a1b4bb0b 100644
--- a/agc_2-X/trunk/www/vicidial/admin.php
+++ b/agc_2-X/trunk/www/vicidial/admin.php
@@ -3848,12 +3848,13 @@ else
# 160621-1733 - Added agent_screen_colors and script_remove_js settings to system settings
# 160708-0745 - Added more Automatic Hopper Multiplier options, up to 4
# 160731-1026 - Added campaign option to automatically manual dial next number in agent screen after X seconds
+# 160801-2119 - Added Admin Bulk Tools page link from Admin Utilities page
#
# 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-562a';
-$build = '160731-1026';
+$admin_version = '2.12-563a';
+$build = '160801-2119';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -37240,7 +37241,7 @@ if ($ADD==999994)
echo "
"._QXZ("Callbacks Transferral Page")." | "._QXZ("Callbacks Bulk Move")."\n";
diff --git a/agc_2-X/trunk/www/vicidial/admin_amm_multi.php b/agc_2-X/trunk/www/vicidial/admin_amm_multi.php
new file mode 100644
index 00000000..244e4c6f
--- /dev/null
+++ b/agc_2-X/trunk/www/vicidial/admin_amm_multi.php
@@ -0,0 +1,460 @@
+ LICENSE: AGPLv2
+#
+# this screen will control the *amd* settings needed when the Campaign setting
+# "AM Message Wildcards" is enabled. This screen allows for multiple messages
+# and fields to be entered and ranked in the order in which they are are to be
+# searched.
+#
+# changes:
+# 151109-1653 - First Build
+# 160801-1201 - Added colors features
+#
+
+$admin_version = '2.12-2';
+$build = '160801-1201';
+
+require("dbconnect_mysqli.php");
+require("functions.php");
+
+$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
+$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
+$PHP_SELF=$_SERVER['PHP_SELF'];
+if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
+ elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
+if (isset($_GET["action"])) {$action=$_GET["action"];}
+ elseif (isset($_POST["action"])) {$action=$_POST["action"];}
+if (isset($_GET["amm_id"])) {$amm_id=$_GET["amm_id"];}
+ elseif (isset($_POST["amm_id"])) {$amm_id=$_POST["amm_id"];}
+if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];}
+ elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];}
+if (isset($_GET["entry_type"])) {$entry_type=$_GET["entry_type"];}
+ elseif (isset($_POST["entry_type"])) {$entry_type=$_POST["entry_type"];}
+if (isset($_GET["active"])) {$active=$_GET["active"];}
+ elseif (isset($_POST["active"])) {$active=$_POST["active"];}
+if (isset($_GET["amm_field"])) {$amm_field=$_GET["amm_field"];}
+ elseif (isset($_POST["amm_field"])) {$amm_field=$_POST["amm_field"];}
+if (isset($_GET["amm_rank"])) {$amm_rank=$_GET["amm_rank"];}
+ elseif (isset($_POST["amm_rank"])) {$amm_rank=$_POST["amm_rank"];}
+if (isset($_GET["amm_wildcard"])) {$amm_wildcard=$_GET["amm_wildcard"];}
+ elseif (isset($_POST["amm_wildcard"])) {$amm_wildcard=$_POST["amm_wildcard"];}
+if (isset($_GET["amm_description"])) {$amm_description=$_GET["amm_description"];}
+ elseif (isset($_POST["amm_description"])) {$amm_description=$_POST["amm_description"];}
+if (isset($_GET["amm_filename"])) {$amm_filename=$_GET["amm_filename"];}
+ elseif (isset($_POST["amm_filename"])) {$amm_filename=$_POST["amm_filename"];}
+if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
+ elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];}
+
+if (strlen($action) < 2)
+ {$action = 'BLANK';}
+if (strlen($DB) < 1)
+ {$DB=0;}
+
+#############################################
+##### START SYSTEM_SETTINGS LOOKUP #####
+$stmt = "SELECT use_non_latin,webroot_writable,enable_languages,language_method FROM system_settings;";
+$rslt=mysql_to_mysqli($stmt, $link);
+if ($DB) {echo "$stmt\n";}
+$ss_conf_ct = mysqli_num_rows($rslt);
+if ($ss_conf_ct > 0)
+ {
+ $row=mysqli_fetch_row($rslt);
+ $non_latin = $row[0];
+ $webroot_writable = $row[1];
+ $SSenable_languages = $row[2];
+ $SSlanguage_method = $row[3];
+ }
+##### END SETTINGS LOOKUP #####
+###########################################
+
+if ($non_latin < 1)
+ {
+ $PHP_AUTH_USER = preg_replace('/[^-_0-9a-zA-Z]/','',$PHP_AUTH_USER);
+ $PHP_AUTH_PW = preg_replace('/[^-_0-9a-zA-Z]/','',$PHP_AUTH_PW);
+ $amm_id = preg_replace('/[^0-9]/','',$amm_id);
+ $campaign_id = preg_replace('/[^-_0-9a-zA-Z]/','',$campaign_id);
+ $entry_type = preg_replace('/[^_0-9a-zA-Z]/','',$entry_type);
+ $active = preg_replace('/[^A-Z]/','',$active);
+ $amm_field = preg_replace('/[^_0-9a-zA-Z]/','',$amm_field);
+ $amm_rank = preg_replace('/[^-0-9]/','',$amm_rank);
+ $amm_wildcard = preg_replace('/[^- _0-9a-zA-Z]/','',$amm_wildcard);
+ $amm_description = preg_replace('/[^- \.\,\_0-9a-zA-Z]/','',$amm_description);
+ $amm_filename = preg_replace('/[^- \|\.\,\_0-9a-zA-Z]/','',$amm_filename);
+ } # end of non_latin
+else
+ {
+ $PHP_AUTH_USER = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_USER);
+ $PHP_AUTH_PW = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_PW);
+ }
+
+$STARTtime = date("U");
+$TODAY = date("Y-m-d");
+$NOW_TIME = date("Y-m-d H:i:s");
+$date = date("r");
+$ip = getenv("REMOTE_ADDR");
+$browser = getenv("HTTP_USER_AGENT");
+$user = $PHP_AUTH_USER;
+$NWB = " ";
+
+$stmt="SELECT selected_language from vicidial_users where user='$PHP_AUTH_USER';";
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+$sl_ct = mysqli_num_rows($rslt);
+if ($sl_ct > 0)
+ {
+ $row=mysqli_fetch_row($rslt);
+ $VUselected_language = $row[0];
+ }
+
+$auth=0;
+$auth_message = user_authorization($PHP_AUTH_USER,$PHP_AUTH_PW,'',1);
+if ($auth_message == 'GOOD')
+ {$auth=1;}
+
+if ($auth < 1)
+ {
+ $VDdisplayMESSAGE = _QXZ("Login incorrect, please try again");
+ if ($auth_message == 'LOCK')
+ {
+ $VDdisplayMESSAGE = _QXZ("Too many login attempts, try again in 15 minutes");
+ Header ("Content-type: text/html; charset=utf-8");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
+ exit;
+ }
+ Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\"");
+ Header("HTTP/1.0 401 Unauthorized");
+ echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n";
+ exit;
+ }
+
+$stmt="SELECT full_name,modify_campaigns,user_level from vicidial_users where user='$PHP_AUTH_USER';";
+$rslt=mysql_to_mysqli($stmt, $link);
+$row=mysqli_fetch_row($rslt);
+$LOGfullname = $row[0];
+$LOGmodify_campaigns = $row[1];
+$LOGuser_level = $row[2];
+
+if ($LOGmodify_campaigns < 1)
+ {
+ Header ("Content-type: text/html; charset=utf-8");
+ echo _QXZ("You do not have permissions to modify campaigns")."\n";
+ exit;
+ }
+
+
+##### BEGIN Set variables to make header show properly #####
+$ADD = '31';
+$SUB = '26';
+$hh = 'campaigns';
+$sh = 'detail';
+$LOGast_admin_access = '1';
+$SSoutbound_autodial_active = '1';
+$ADMIN = 'admin.php';
+$page_width='770';
+$section_width='750';
+$header_font_size='3';
+$subheader_font_size='2';
+$subcamp_font_size='2';
+$header_selected_bold='';
+$header_nonselected_bold='';
+$campaigns_color = '#FFFF99';
+$campaigns_font = 'BLACK';
+$campaigns_color = '#E6E6E6';
+$subcamp_color = '#C6C6C6';
+$ingroups_font = 'BLACK';
+$ingroups_color = '#E6E6E6';
+$lists_font = 'BLACK';
+$lists_color = '#E6E6E6';
+##### END Set variables to make header show properly #####
+
+if (strlen($campaign_id) < 1)
+ {
+ echo _QXZ("ERROR: ID not defined:");
+ exit;
+ }
+if ($entry_type == 'campaign')
+ {
+ $ADD = '31';
+ $hh = 'campaigns';
+ $stmt_name="SELECT campaign_name from vicidial_campaigns where campaign_id='$campaign_id';";
+ $mod_link = "ADD=$ADD&campaign_id=";
+ $event_section = 'CAMPAIGNS';
+ $stmt="SELECT count(*) from vicidial_campaigns where campaign_id='$campaign_id' and am_message_wildcards='Y';";
+ }
+elseif ($entry_type == 'ingroup')
+ {
+ $ADD = '3111';
+ $hh = 'ingroups';
+ $stmt_name="SELECT group_name from vicidial_inbound_groups where group_id='$campaign_id';";
+ $mod_link = "ADD=$ADD&group_id=";
+ $event_section = 'INGROUPS';
+ $stmt="SELECT count(*) from vicidial_inbound_groups where group_id='$campaign_id' and am_message_wildcards='Y';";
+ }
+else
+ {
+ echo _QXZ("ERROR: no entry type defined:") . $entry_type;
+ exit;
+ }
+
+if ($DB) {echo "|$stmt|\n";}
+$rslt=mysql_to_mysqli($stmt, $link);
+$row=mysqli_fetch_row($rslt);
+$camp_multi=$row[0];
+
+$camp_name='';
+$rslt=mysql_to_mysqli($stmt_name, $link);
+$names_to_print = mysqli_num_rows($rslt);
+if ($names_to_print > 0)
+ {
+ $row=mysqli_fetch_row($rslt);
+ $camp_name = $row[0];
+ }
+
+?>
+
+
+
+
+
+ 0)
+ {
+ echo "$DB,$action,$campaign_id,$amm_id,$entry_type,$active,$amm_field,$amm_rank,$amm_wildcard,$amm_description\n ";
+ }
+
+
+################################################################################
+##### BEGIN AMM multi NEW section
+if ($action == "AMM_MULTI_NEW")
+ {
+ if ( (strlen($active)<1) or (strlen($amm_rank)<1) or (strlen($amm_wildcard)<1) or (strlen($amm_description)<1) or (strlen($amm_filename)<1) )
+ {
+ echo _QXZ("ERROR: You must fill in all fields").": |$active|$amm_rank|$amm_wildcard|$amm_description|$amm_filename|\n ";
+ exit;
+ }
+ $stmt="INSERT INTO vicidial_amm_multi SET campaign_id='$campaign_id',entry_type='$entry_type',amm_field='$amm_field',active='$active',amm_rank='$amm_rank',amm_wildcard='$amm_wildcard',amm_description='$amm_description',amm_filename='" . mysqli_real_escape_string($link, $amm_filename) . "';";
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $affected_rows = mysqli_affected_rows($link);
+ if ($DB > 0) {echo "$affected_rows|$stmt\n ";}
+ if ($affected_rows > 0)
+ {
+ ### 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='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='$event_section', event_type='ADD', record_id='$campaign_id', event_code='ADD MULTI AMM', event_sql=\"$SQL_log\", event_notes='$amm_field';";
+ $rslt=mysql_to_mysqli($stmt, $link);
+ if ($DB > 0) {echo "$campaign_id|$stmt\n ";}
+
+ echo " $affected_rows "._QXZ("MULTI AM MESSAGE ADDED")."
";
+ }
+ else
+ {echo _QXZ("ERROR: Problem adding AM Message").": $affected_rows|$stmt\n ";}
+ $action='BLANK';
+ }
+##### END AMM multi NEW section
+
+
+################################################################################
+##### BEGIN AMM multi MODIFY section
+if ($action == "AMM_MULTI_MODIFY")
+ {
+ if ( (strlen($amm_id)<1) or (strlen($active)<1) or (strlen($amm_rank)<1) or (strlen($amm_wildcard)<1) or (strlen($amm_description)<1) or (strlen($amm_filename)<1) )
+ {
+ echo _QXZ("ERROR: You must fill in all fields").": |$amm_id|$active|$amm_rank|$amm_wildcard|$amm_description|$amm_filename|\n ";
+ exit;
+ }
+ $stmt="SELECT count(*) from vicidial_amm_multi where campaign_id='$campaign_id' and entry_type='$entry_type' and amm_field='$amm_field' and amm_id='$amm_id';";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $row=mysqli_fetch_row($rslt);
+ $amm_count=$row[0];
+ if ($amm_count < 1)
+ {
+ echo _QXZ("ERROR: AM MESSAGE entry does not exist").": |$amm_id|$campaign_id|$entry_type|$amm_field|\n ";
+ exit;
+ }
+ $stmt="UPDATE vicidial_amm_multi SET active='$active',amm_rank='$amm_rank',amm_wildcard='$amm_wildcard',amm_description='$amm_description',amm_filename='" . mysqli_real_escape_string($link, $amm_filename) . "' where campaign_id='$campaign_id' and entry_type='$entry_type' and amm_field='$amm_field' and amm_id='$amm_id';";
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $affected_rows = mysqli_affected_rows($link);
+ if ($DB > 0) {echo "$affected_rows|$stmt\n ";}
+ if ($affected_rows > 0)
+ {
+ ### 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='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='$event_section', event_type='MODIFY', record_id='$campaign_id', event_code='MODIFY MULTI AMM', event_sql=\"$SQL_log\", event_notes='$amm_field ID: $amm_id';";
+ $rslt=mysql_to_mysqli($stmt, $link);
+ if ($DB > 0) {echo "$campaign_id|$stmt\n ";}
+
+ echo " $affected_rows "._QXZ("MULTI AM MESSAGE MODIFIED")." (ID: $amm_id)
";
+ }
+ else
+ {echo _QXZ("ERROR: Problem modifying AM MESSAGE").": $affected_rows|$stmt\n ";}
+ $action='BLANK';
+ }
+##### END AMM multi MODIFY section
+
+
+################################################################################
+##### BEGIN AMM multi DELETE section
+if ($action == "AMM_MULTI_DELETE")
+ {
+ if ( (strlen($amm_id)<1) or (strlen($campaign_id)<1) or (strlen($entry_type)<1) or (strlen($amm_field)<1) )
+ {
+ echo _QXZ("ERROR: You must fill in all fields").": |$amm_id|$campaign_id|$entry_type|$amm_field|\n ";
+ exit;
+ }
+ $stmt="SELECT count(*) from vicidial_amm_multi where campaign_id='$campaign_id' and entry_type='$entry_type' and amm_field='$amm_field' and amm_id='$amm_id' and active='N';";
+ if ($DB) {echo "|$stmt|\n";}
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $row=mysqli_fetch_row($rslt);
+ $amm_count=$row[0];
+ if ($amm_count < 1)
+ {
+ echo _QXZ("ERROR: AM MESSAGE entry must be set to not active before you delete it").": |$amm_id|$campaign_id|$entry_type|$amm_field|\n ";
+ }
+ else
+ {
+ $stmt="DELETE FROM vicidial_amm_multi where campaign_id='$campaign_id' and entry_type='$entry_type' and amm_field='$amm_field' and amm_id='$amm_id' and active='N';";
+ $rslt=mysql_to_mysqli($stmt, $link);
+ $affected_rows = mysqli_affected_rows($link);
+ if ($DB > 0) {echo "$affected_rows|$stmt\n ";}
+ if ($affected_rows > 0)
+ {
+ ### 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='$NOW_TIME', user='$PHP_AUTH_USER', ip_address='$ip', event_section='$event_section', event_type='DELETE', record_id='$campaign_id', event_code='DELETE MULTI AMM', event_sql=\"$SQL_log\", event_notes='$amm_field ID: $amm_id';";
+ $rslt=mysql_to_mysqli($stmt, $link);
+ if ($DB > 0) {echo "$campaign_id|$stmt\n ";}
+
+ echo " $affected_rows "._QXZ("MULTI AM MESSAGE DELETED")." (ID: $amm_id)
";
+ }
+ else
+ {echo _QXZ("ERROR: Problem deleting AM MESSAGE").": $affected_rows|$stmt\n ";}
+ }
+ $action='BLANK';
+ }
+##### END AMM multi DELETE section
+
+
+################################################################################
+##### BEGIN AMM multi control form
+if ($action == "BLANK")
+ {
+ $bgcolor='bgcolor="#'. $SSstd_row2_background .'"';
+ echo "