Added basic lead management tools to the Admin Utilities

Fixed small variable filtering issues in the non-agent API
Fixed issue with manual dial lead preview and script custom variables

git-svn-id: svn://192.168.202.10@1874 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2012-11-14 23:15:42 +00:00
parent c410a3334a
commit 28490073a4
6 changed files with 1008 additions and 99 deletions
+3
View File
@@ -109,6 +109,9 @@ OTHER CHANGES:
22. Added campaign option to set owner field to user if the owner field is empty
23. Added Lead Tools web page from Admin Utilities. Allows for some basic lead
management through the web interface.
+97 -94
View File
@@ -314,10 +314,11 @@
# 120831-1438 - Added vicidial_dial_log logging of outbound phone calls
# 121018-2320 - Added blank option to owner only dialing
# 121029-0159 - Added owner_populate campaign option
# 121114-1749 - Fixed manual dial lead preview script variable issue
#
$version = '2.6-212';
$build = '121029-0159';
$version = '2.6-213';
$build = '121114-1749';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=443;
$one_mysql_log=0;
@@ -2634,32 +2635,6 @@ if ($ACTION == 'manDiaLnextCaLL')
}
##### find if script contains recording fields
$stmt="SELECT count(*) FROM vicidial_lists WHERE list_id='$list_id' and agent_script_override!='' and agent_script_override IS NOT NULL and agent_script_override!='NONE';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00259',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$vls_vc_ct = mysql_num_rows($rslt);
if ($vls_vc_ct > 0)
{
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$script_recording_delay=0;
##### find if script contains recording fields
$stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_lists vls WHERE list_id='$list_id' and vs.script_id=vls.agent_script_override and script_text LIKE \"%--A--recording_%\";";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00260',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$vs_vc_ct = mysql_num_rows($rslt);
if ($vs_vc_ct > 0)
{
$row=mysql_fetch_row($rslt);
$script_recording_delay = $row[0];
}
}
}
### Check for List ID override settings
$VDCL_xferconf_a_number='';
$VDCL_xferconf_b_number='';
@@ -2681,72 +2656,6 @@ if ($ACTION == 'manDiaLnextCaLL')
$VDCL_xferconf_e_number = $row[4];
}
if (strlen($list_id)>0)
{
$stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00278',$user,$server_ip,$session_name,$one_mysql_log);}
$VDIG_preset_ct = mysql_num_rows($rslt);
if ($VDIG_preset_ct > 0)
{
$row=mysql_fetch_row($rslt);
if (strlen($row[0]) > 0)
{$VDCL_xferconf_a_number = $row[0];}
if (strlen($row[1]) > 0)
{$VDCL_xferconf_b_number = $row[1];}
if (strlen($row[2]) > 0)
{$VDCL_xferconf_c_number = $row[2];}
if (strlen($row[3]) > 0)
{$VDCL_xferconf_d_number = $row[3];}
if (strlen($row[4]) > 0)
{$VDCL_xferconf_e_number = $row[4];}
}
$custom_field_names='|';
$custom_field_names_SQL='';
$custom_field_values='----------';
$custom_field_types='|';
### find the names of all custom fields, if any
$stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('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');";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00334',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$cffn_ct = mysql_num_rows($rslt);
$d=0;
while ($cffn_ct > $d)
{
$row=mysql_fetch_row($rslt);
$custom_field_names .= "$row[0]|";
$custom_field_names_SQL .= "$row[0],";
$custom_field_types .= "$row[1]|";
$custom_field_values .= "----------";
$d++;
}
if ($cffn_ct > 0)
{
$custom_field_names_SQL = eregi_replace(".$","",$custom_field_names_SQL);
### find the values of the named custom fields
$stmt = "SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00335',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$cffv_ct = mysql_num_rows($rslt);
if ($cffv_ct > 0)
{
$custom_field_values='----------';
$row=mysql_fetch_row($rslt);
$d=0;
while ($cffn_ct > $d)
{
$custom_field_values .= "$row[$d]----------";
$d++;
}
$custom_field_values = preg_replace("/\n/"," ",$custom_field_values);
$custom_field_values = preg_replace("/\r/","",$custom_field_values);
}
}
}
##### check if system is set to generate logfile for transfers
$stmt="SELECT enable_agc_xfer_log FROM system_settings;";
$rslt=mysql_query($stmt, $link);
@@ -2769,6 +2678,100 @@ if ($ACTION == 'manDiaLnextCaLL')
}
##### find if script contains recording fields
$stmt="SELECT count(*) FROM vicidial_lists WHERE list_id='$list_id' and agent_script_override!='' and agent_script_override IS NOT NULL and agent_script_override!='NONE';";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00259',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$vls_vc_ct = mysql_num_rows($rslt);
if ($vls_vc_ct > 0)
{
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$script_recording_delay=0;
##### find if script contains recording fields
$stmt="SELECT count(*) FROM vicidial_scripts vs,vicidial_lists vls WHERE list_id='$list_id' and vs.script_id=vls.agent_script_override and script_text LIKE \"%--A--recording_%\";";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00260',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$vs_vc_ct = mysql_num_rows($rslt);
if ($vs_vc_ct > 0)
{
$row=mysql_fetch_row($rslt);
$script_recording_delay = $row[0];
}
}
}
if (strlen($list_id)>0)
{
$stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00278',$user,$server_ip,$session_name,$one_mysql_log);}
$VDIG_preset_ct = mysql_num_rows($rslt);
if ($VDIG_preset_ct > 0)
{
$row=mysql_fetch_row($rslt);
if (strlen($row[0]) > 0)
{$VDCL_xferconf_a_number = $row[0];}
if (strlen($row[1]) > 0)
{$VDCL_xferconf_b_number = $row[1];}
if (strlen($row[2]) > 0)
{$VDCL_xferconf_c_number = $row[2];}
if (strlen($row[3]) > 0)
{$VDCL_xferconf_d_number = $row[3];}
if (strlen($row[4]) > 0)
{$VDCL_xferconf_e_number = $row[4];}
}
$custom_field_names='|';
$custom_field_names_SQL='';
$custom_field_values='----------';
$custom_field_types='|';
### find the names of all custom fields, if any
$stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('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');";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00334',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$cffn_ct = mysql_num_rows($rslt);
$d=0;
while ($cffn_ct > $d)
{
$row=mysql_fetch_row($rslt);
$custom_field_names .= "$row[0]|";
$custom_field_names_SQL .= "$row[0],";
$custom_field_types .= "$row[1]|";
$custom_field_values .= "----------";
$d++;
}
if ($cffn_ct > 0)
{
$custom_field_names_SQL = eregi_replace(".$","",$custom_field_names_SQL);
### find the values of the named custom fields
$stmt = "SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00335',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$cffv_ct = mysql_num_rows($rslt);
if ($cffv_ct > 0)
{
$custom_field_values='----------';
$row=mysql_fetch_row($rslt);
$d=0;
while ($cffn_ct > $d)
{
$custom_field_values .= "$row[$d]----------";
$d++;
}
$custom_field_values = preg_replace("/\n/"," ",$custom_field_values);
$custom_field_values = preg_replace("/\r/","",$custom_field_values);
}
}
}
$comments = eregi_replace("\r",'',$comments);
$comments = eregi_replace("\n",'!N',$comments);
+15 -2
View File
@@ -386,10 +386,11 @@
# 120914-1357 - Added group_alias to transfer_conference function
# 121025-2335 - Do not allow AGENTDIRECT transfers without a user defined
# 121029-0122 - Added pause_after_next_call and owner_populate campaign options
# 121114-1759 - Fixed manual dial lead preview script variable issue
#
$version = '2.6-354c';
$build = '121029-0122';
$version = '2.6-355c';
$build = '121114-1759';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=79;
$one_mysql_log=0;
@@ -6970,6 +6971,16 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
}
else
{
if (custom_fields_enabled > 0)
{
FormContentsLoad();
}
if ( (view_scripts == 1) && (campaign_script.length > 0) )
{
var SCRIPT_web_form = 'http://127.0.0.1/testing.php';
var TEMP_SCRIPT_web_form = URLDecode(SCRIPT_web_form,'YES','DEFAULT','1');
RefresHScript();
}
reselect_preview_dial = 1;
}
}
@@ -7121,6 +7132,8 @@ function set_length(SLnumber,SLlength_goal,SLdirection)
agent_dialed_number='';
agent_dialed_type='';
CalL_ScripT_id='';
RefresHScript('CLEAR');
// document.getElementById('vcFormIFrame').src='./vdc_form_display.php?lead_id=&list_id=&stage=WELCOME';
}
}
}
+1
View File
@@ -33315,6 +33315,7 @@ if ($ADD==999994)
echo "<LI><a href=\"AST_carrier_log_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Carrier Log Report</a></FONT>\n";
echo "<LI><a href=\"AST_hangup_cause_report.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Hangup Cause Report</a></FONT>\n";
echo "<LI><a href=\"admin_phones_bulk_insert.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Bulk Phone Insert Page</a></FONT>\n";
echo "<LI><a href=\"lead_tools.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Basic Lead Management Tools</a></FONT>\n";
echo "<LI><a href=\"callbacks_bulk_change.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Callbacks Transferral Page</a></FONT>\n";
echo "<LI><a href=\"send_CID_call.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Send a Call With Custom CID Page</a></FONT>\n";
echo "<LI><a href=\"voice_lab.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Speech Voice Lab Page</a></FONT>\n";
+889
View File
@@ -0,0 +1,889 @@
<?php
# lead_tools.php - Various tools for lead basic lead management.
#
# Copyright (C) 2012 Matt Florell,Michael Cargile <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 121110-1446 - Initial Build
# 121114-0956 - Added input filtering and vicidial_admin_log logging
#
$version = '2.6-2a';
$build = '121114-0956';
# This limit is to prevent data inconsistancies.
# If there are too many leads in a list this
# script might not finish before the php execution limit.
$list_lead_limit = 100000;
# maximum call count the script will work with
$max_count = 20;
require("dbconnect.php");
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
$ip = getenv("REMOTE_ADDR");
$SQLdate = date("Y-m-d H:i:s");
$DB=0;
$move_submit="";
$update_submit="";
$delete_submit="";
$confirm_move="";
$confirm_update="";
$confirm_delete="";
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["move_submit"])) {$move_submit=$_GET["move_submit"];}
elseif (isset($_POST["move_submit"])) {$move_submit=$_POST["move_submit"];}
if (isset($_GET["update_submit"])) {$update_submit=$_GET["update_submit"];}
elseif (isset($_POST["update_submit"])) {$update_submit=$_POST["update_submit"];}
if (isset($_GET["delete_submit"])) {$delete_submit=$_GET["delete_submit"];}
elseif (isset($_POST["delete_submit"])) {$delete_submit=$_POST["delete_submit"];}
if (isset($_GET["confirm_move"])) {$confirm_move=$_GET["confirm_move"];}
elseif (isset($_POST["confirm_move"])) {$confirm_move=$_POST["confirm_move"];}
if (isset($_GET["confirm_update"])) {$confirm_move=$_GET["confirm_update"];}
elseif (isset($_POST["confirm_update"])) {$confirm_update=$_POST["confirm_update"];}
if (isset($_GET["confirm_delete"])) {$confirm_delete=$_GET["confirm_delete"];}
elseif (isset($_POST["confirm_delete"])) {$confirm_delete=$_POST["confirm_delete"];}
$DB = ereg_replace("[^0-9]","",$DB);
$move_submit = ereg_replace("[^-_0-9a-zA-Z]","",$move_submit);
$update_submit = ereg_replace("[^-_0-9a-zA-Z]","",$update_submit);
$delete_submit = ereg_replace("[^-_0-9a-zA-Z]","",$delete_submit);
$confirm_move = ereg_replace("[^-_0-9a-zA-Z]","",$confirm_move);
$confirm_update = ereg_replace("[^-_0-9a-zA-Z]","",$confirm_update);
$confirm_delete = ereg_replace("[^-_0-9a-zA-Z]","",$confirm_delete);
$delete_status = ereg_replace("[^-_0-9a-zA-Z]","",$delete_status);
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$sys_settings_stmt = "SELECT use_non_latin, outbound_autodial_active, sounds_central_control_active FROM system_settings;";
$sys_settings_rslt=mysql_query($sys_settings_stmt, $link);
if ($DB) {echo "$sys_settings_stmt\n";}
$num_rows = mysql_num_rows($sys_settings_rslt);
if ($num_rows > 0)
{
$sys_settings_row=mysql_fetch_row($sys_settings_rslt);
$non_latin = $sys_settings_row[0];
$SSoutbound_autodial_active = $sys_settings_row[1];
$sounds_central_control_active = $sys_settings_row[2];
}
else
{
# there is something really weird if there are no system settings
exit;
}
##### END SETTINGS LOOKUP #####
###########################################
if ($non_latin < 1)
{
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$list_id_override = ereg_replace("[^0-9]","",$list_id_override);
}
else
{
$PHP_AUTH_PW = ereg_replace("'|\"|\\\\|;","",$PHP_AUTH_PW);
$PHP_AUTH_USER = ereg_replace("'|\"|\\\\|;","",$PHP_AUTH_USER);
}
$valid_user_stmt = "SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;";
if ($DB) {echo "|$valid_user_stmt|\n";}
if ($non_latin > 0) {$valid_user_rslt=mysql_query("SET NAMES 'UTF8'");}
$valid_user_rslt = mysql_query($valid_user_stmt, $link);
$valid_user_row = mysql_fetch_row($valid_user_rslt);
$auth = $valid_user_row[0];
if ( ( strlen($PHP_AUTH_USER) < 2 ) or ( strlen($PHP_AUTH_PW) < 2 ) or ( !$auth ) )
{
# Invalid user
Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
{
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
if ( $auth > 0 )
{
# valid user
$rights_stmt = "SELECT load_leads,user_group, delete_lists, modify_leads, modify_lists from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
if ($DB) {echo "|$stmt|\n";}
$rights_rslt=mysql_query($rights_stmt, $link);
$rights_row=mysql_fetch_row($rights_rslt);
$load_leads = $rights_row[0];
$user_group = $rights_row[1];
$delete_lists = $rights_row[2];
$modify_leads = $rights_row[3];
$modify_lists = $rights_row[4];
# check their permissions
if ( $load_leads < 1 )
{
echo "You do not have permissions to load leads\n";
exit;
}
if ( $modify_leads < 1 )
{
echo "You do not have permissions to modify leads\n";
exit;
}
if ( $modify_lists < 1 )
{
echo "You do not have permissions to modify lists\n";
exit;
}
}
}
echo "<html>\n";
echo "<head>\n";
echo "<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>\n";
echo "<!-- VERSION: <?php echo $version ?> BUILD: <?php echo $build ?> -->\n";
echo "<title>ADMINISTRATION: Lead Tools</title>\n";
##### BEGIN Set variables to make header show properly #####
$ADD = '999998';
$hh = 'admin';
$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='<b>';
$header_nonselected_bold='';
$admin_color = '#FFFF99';
$admin_font = 'BLACK';
$admin_color = '#E6E6E6';
$subcamp_color = '#C6C6C6';
##### END Set variables to make header show properly #####
require("admin_header.php");
echo "<table width=$page_width bgcolor=#E6E6E6 cellpadding=2 cellspacing=0>\n";
echo "<tr bgcolor='#E6E6E6'>\n";
echo "<td align=left>\n";
echo "<font face='ARIAL,HELVETICA' size=2>\n";
echo "<b> &nbsp; Lead Tools</b>\n";
echo "</font>\n";
echo "</td>\n";
echo "<td align=right><font face='ARIAL,HELVETICA' size=2><b> &nbsp; </td>\n";
echo "</tr>\n";
echo "<tr bgcolor='#F0F5FE'><td align=left colspan=2><font face='ARIAL,HELVETICA' color=black size=3> &nbsp; \n";
# move confirmation page
if ($move_submit == "move" )
{
# get the variables
$move_from_list="";
$move_to_list="";
$move_status="";
$move_count_op="";
$move_count_num="";
if (isset($_GET["move_from_list"])) {$move_from_list=$_GET["move_from_list"];}
elseif (isset($_POST["move_from_list"])) {$move_from_list=$_POST["move_from_list"];}
if (isset($_GET["move_to_list"])) {$move_to_list=$_GET["move_to_list"];}
elseif (isset($_POST["move_to_list"])) {$move_to_list=$_POST["move_to_list"];}
if (isset($_GET["move_status"])) {$move_status=$_GET["move_status"];}
elseif (isset($_POST["move_status"])) {$move_status=$_POST["move_status"];}
if (isset($_GET["move_count_op"])) {$move_count_op=$_GET["move_count_op"];}
elseif (isset($_POST["move_count_op"])) {$move_count_op=$_POST["move_count_op"];}
if (isset($_GET["move_count_num"])) {$move_count_num=$_GET["move_count_num"];}
elseif (isset($_POST["move_count_num"])) {$move_count_num=$_POST["move_count_num"];}
$move_status = ereg_replace("[^-_0-9a-zA-Z]","",$move_status);
$move_from_list = ereg_replace("[^0-9]","",$move_from_list);
$move_to_list = ereg_replace("[^0-9]","",$move_to_list);
$move_count_num = ereg_replace("[^0-9]","",$move_count_num);
$move_count_op = ereg_replace("[^<>=]","",$move_count_op);
$move_count_op_phrase="";
if ( $move_count_op == "<" )
{
$move_count_op_phrase= "less than ";
}
elseif ( $move_count_op == "<=" )
{
$move_count_op_phrase= "less than or equal to ";
}
elseif ( $move_count_op == ">" )
{
$move_count_op_phrase= "greater than ";
}
elseif ( $move_count_op == ">=" )
{
$move_count_op_phrase= "greater than or equal to ";
}
# get the number of leads this action will move
$move_lead_count=0;
$move_lead_count_stmt = "SELECT count(1) FROM vicidial_list WHERE list_id = '$move_from_list' and status = '$move_status' and called_count $move_count_op $move_count_num";
if ($DB) { echo "|$move_lead_count_stmt|\n"; }
$move_lead_count_rslt = mysql_query($move_lead_count_stmt, $link);
$move_lead_count_row = mysql_fetch_row($move_lead_count_rslt);
$move_lead_count = $move_lead_count_row[0];
# get the number of leads in the list this action will move to
$to_list_lead_count=0;
$to_list_lead_stmt = "SELECT count(1) FROM vicidial_list WHERE list_id = '$move_to_list'";
if ($DB) { echo "|$to_list_lead_stmt|\n"; }
$to_list_lead_rslt = mysql_query($to_list_lead_stmt, $link);
$to_list_lead_row = mysql_fetch_row($to_list_lead_rslt);
$to_list_lead_count = $to_list_lead_row[0];
# check to see if we will exceed list_lead_limit in the move to list
if ( $to_list_lead_count + $move_lead_count > $list_lead_limit )
{
echo "<html>\n";
echo "<head>\n";
echo "<!-- VERSION: $version BUILD: $build -->\n";
echo "</head>\n";
echo "<body>\n";
echo "<p>Sorry. This operation will cause list $move_to_list to exceed $list_lead_limit leads which is not allowed.</p>\n";
echo "<p><a href='$PHP_SELF'>Click here to start over.</a></p>\n";
echo "</body>\n</html>\n";
}
else
{
echo "<p>You are about to move $move_lead_count leads from list $move_from_list to $move_to_list with the status $move_status and that were called $move_count_op_phrase$move_count_num times. Please press confirm to continue.</p>\n";
echo "<center><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=move_from_list value='$move_from_list'>\n";
echo "<input type=hidden name=move_to_list value='$move_to_list'>\n";
echo "<input type=hidden name=move_status value='$move_status'>\n";
echo "<input type=hidden name=move_count_op value='$move_count_op'>\n";
echo "<input type=hidden name=move_count_num value='$move_count_num'>\n";
echo "<input type=submit name=confirm_move value=confirm>\n";
echo "</form></center>\n";
echo "<p><a href='$PHP_SELF'>Click here to start over.</a></p>\n";
echo "</body>\n</html>\n";
}
}
# actually do the move
if ($confirm_move == "confirm")
{
# get the variables
$move_from_list="";
$move_to_list="";
$move_status="";
$move_count_op="";
$move_count_num="";
if (isset($_GET["move_from_list"])) {$move_from_list=$_GET["move_from_list"];}
elseif (isset($_POST["move_from_list"])) {$move_from_list=$_POST["move_from_list"];}
if (isset($_GET["move_to_list"])) {$move_to_list=$_GET["move_to_list"];}
elseif (isset($_POST["move_to_list"])) {$move_to_list=$_POST["move_to_list"];}
if (isset($_GET["move_status"])) {$move_status=$_GET["move_status"];}
elseif (isset($_POST["move_status"])) {$move_status=$_POST["move_status"];}
if (isset($_GET["move_count_op"])) {$move_count_op=$_GET["move_count_op"];}
elseif (isset($_POST["move_count_op"])) {$move_count_op=$_POST["move_count_op"];}
if (isset($_GET["move_count_num"])) {$move_count_num=$_GET["move_count_num"];}
elseif (isset($_POST["move_count_num"])) {$move_count_num=$_POST["move_count_num"];}
$move_status = ereg_replace("[^-_0-9a-zA-Z]","",$move_status);
$move_from_list = ereg_replace("[^0-9]","",$move_from_list);
$move_to_list = ereg_replace("[^0-9]","",$move_to_list);
$move_count_num = ereg_replace("[^0-9]","",$move_count_num);
$move_count_op = ereg_replace("[^<>=]","",$move_count_op);
$move_count_op_phrase="";
if ( $move_count_op == "<" )
{
$move_count_op_phrase= "less than ";
}
elseif ( $move_count_op == "<=" )
{
$move_count_op_phrase= "less than or equal to ";
}
elseif ( $move_count_op == ">" )
{
$move_count_op_phrase= "greater than ";
}
elseif ( $move_count_op == ">=" )
{
$move_count_op_phrase= "greater than or equal to ";
}
$move_lead_stmt = "UPDATE vicidial_list SET list_id = '$move_to_list' WHERE list_id = '$move_from_list' and status = '$move_status' and called_count $move_count_op $move_count_num";
if ($DB) { echo "|$move_lead_stmt|\n"; }
$move_lead_rslt = mysql_query($move_lead_stmt, $link);
$move_lead_count = mysql_affected_rows( $link );
$move_sentence = "$move_lead_count leads have been moved from list $move_from_list to $move_to_list with the status $move_status and that were called $move_count_op_phrase$move_count_num times.";
$SQL_log = "$move_lead_stmt|";
$SQL_log = ereg_replace(';','',$SQL_log);
$SQL_log = addslashes($SQL_log);
$admin_log_stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LISTS', event_type='OTHER', record_id='$move_from_list', event_code='ADMIN MOVE LEADS', event_sql=\"$SQL_log\", event_notes='$move_sentence';";
if ($DB) {echo "|$admin_log_stmt|\n";}
$admin_log_rslt=mysql_query($admin_log_stmt, $link);
echo "<p>$move_sentence</p>";
echo "<p><a href='$PHP_SELF'>Click here to start over.</a></p>\n";
}
# update confirmation page
if ($update_submit == "update" )
{
# get the variables
$update_list="";
$update_from_status="";
$update_to_status="";
$update_count_op="";
$update_count_num="";
if (isset($_GET["update_list"])) {$update_list=$_GET["update_list"];}
elseif (isset($_POST["update_list"])) {$update_list=$_POST["update_list"];}
if (isset($_GET["update_from_status"])) {$update_from_status=$_GET["update_from_status"];}
elseif (isset($_POST["update_from_status"])) {$update_from_status=$_POST["update_from_status"];}
if (isset($_GET["update_to_status"])) {$update_to_status=$_GET["update_to_status"];}
elseif (isset($_POST["update_to_status"])) {$update_to_status=$_POST["update_to_status"];}
if (isset($_GET["update_count_op"])) {$update_count_op=$_GET["update_count_op"];}
elseif (isset($_POST["update_count_op"])) {$update_count_op=$_POST["update_count_op"];}
if (isset($_GET["update_count_num"])) {$update_count_num=$_GET["update_count_num"];}
elseif (isset($_POST["update_count_num"])) {$update_count_num=$_POST["update_count_num"];}
$update_from_status = ereg_replace("[^-_0-9a-zA-Z]","",$update_from_status);
$update_to_status = ereg_replace("[^-_0-9a-zA-Z]","",$update_to_status);
$update_list = ereg_replace("[^0-9]","",$update_list);
$update_count_num = ereg_replace("[^0-9]","",$update_count_num);
$update_count_op = ereg_replace("[^<>=]","",$update_count_op);
$update_count_op_phrase="";
if ( $update_count_op == "<" )
{
$update_count_op_phrase= "less than ";
}
elseif ( $update_count_op == "<=" )
{
$update_count_op_phrase= "less than or equal to ";
}
elseif ( $update_count_op == ">" )
{
$update_count_op_phrase= "greater than ";
}
elseif ( $update_count_op == ">=" )
{
$update_count_op_phrase= "greater than or equal to ";
}
# get the number of leads this action will move
$update_lead_count=0;
$update_lead_count_stmt = "SELECT count(1) FROM vicidial_list WHERE list_id = '$update_list' and status = '$update_from_status' and called_count $update_count_op $update_count_num";
if ($DB) { echo "|$update_lead_count_stmt|\n"; }
$update_lead_count_rslt = mysql_query($update_lead_count_stmt, $link);
$update_lead_count_row = mysql_fetch_row($update_lead_count_rslt);
$update_lead_count = $update_lead_count_row[0];
echo "<p>You are about to update $update_lead_count leads in list $update_list from the status $update_from_status to the status $update_to_status that were called $update_count_op_phrase$update_count_num times. Please press confirm to continue.</p>\n";
echo "<center><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=update_list value='$update_list'>\n";
echo "<input type=hidden name=update_from_status value='$update_from_status'>\n";
echo "<input type=hidden name=update_to_status value='$update_to_status'>\n";
echo "<input type=hidden name=update_count_op value='$update_count_op'>\n";
echo "<input type=hidden name=update_count_num value='$update_count_num'>\n";
echo "<input type=submit name=confirm_update value=confirm>\n";
echo "</form></center>\n";
echo "<p><a href='$PHP_SELF'>Click here to start over.</a></p>\n";
echo "</body>\n</html>\n";
}
# actually do the update
if ($confirm_update == "confirm")
{
# get the variables
$update_list="";
$update_from_status="";
$update_to_status="";
$update_count_op="";
$update_count_num="";
if (isset($_GET["update_list"])) {$update_list=$_GET["update_list"];}
elseif (isset($_POST["update_list"])) {$update_list=$_POST["update_list"];}
if (isset($_GET["update_from_status"])) {$update_from_status=$_GET["update_from_status"];}
elseif (isset($_POST["update_from_status"])) {$update_from_status=$_POST["update_from_status"];}
if (isset($_GET["update_to_status"])) {$update_to_status=$_GET["update_to_status"];}
elseif (isset($_POST["update_to_status"])) {$update_to_status=$_POST["update_to_status"];}
if (isset($_GET["update_count_op"])) {$update_count_op=$_GET["update_count_op"];}
elseif (isset($_POST["update_count_op"])) {$update_count_op=$_POST["update_count_op"];}
if (isset($_GET["update_count_num"])) {$update_count_num=$_GET["update_count_num"];}
elseif (isset($_POST["update_count_num"])) {$update_count_num=$_POST["update_count_num"];}
$update_from_status = ereg_replace("[^-_0-9a-zA-Z]","",$update_from_status);
$update_to_status = ereg_replace("[^-_0-9a-zA-Z]","",$update_to_status);
$update_list = ereg_replace("[^0-9]","",$update_list);
$update_count_num = ereg_replace("[^0-9]","",$update_count_num);
$update_count_op = ereg_replace("[^<>=]","",$update_count_op);
$update_count_op_phrase="";
if ( $update_count_op == "<" )
{
$update_count_op_phrase= "less than ";
}
elseif ( $update_count_op == "<=" )
{
$update_count_op_phrase= "less than or equal to ";
}
elseif ( $update_count_op == ">" )
{
$update_count_op_phrase= "greater than ";
}
elseif ( $update_count_op == ">=" )
{
$update_count_op_phrase= "greater than or equal to ";
}
$update_lead_stmt = "UPDATE vicidial_list SET status = '$update_to_status' WHERE list_id = '$update_list' and status = '$update_from_status' and called_count $update_count_op $update_count_num";
if ($DB) { echo "|$delete_lead_stmt|\n"; }
$update_lead_rslt = mysql_query($update_lead_stmt, $link);
$update_lead_count = mysql_affected_rows( $link );
$update_sentence = "$update_lead_count leads had their status changed from $update_from_status to $update_to_status in list $update_list that were called $update_count_op_phrase$update_count_num times.";
$SQL_log = "$update_lead_stmt|";
$SQL_log = ereg_replace(';','',$SQL_log);
$SQL_log = addslashes($SQL_log);
$admin_log_stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LISTS', event_type='MODIFY', record_id='$update_list', event_code='ADMIN UPDATE LEADS', event_sql=\"$SQL_log\", event_notes='$update_sentence';";
if ($DB) {echo "|$admin_log_stmt|\n";}
$admin_log_rslt=mysql_query($admin_log_stmt, $link);
echo "<p>$update_sentence</p>";
echo "<p><a href='$PHP_SELF'>Click here to start over.</a></p>\n";
}
# delete confirmation page
if ( ( $delete_submit == "delete" ) && ( $delete_lists > 0 ) )
{
# get the variables
$delete_list="";
$delete_status="";
$delete_count_op="";
$delete_count_num="";
if (isset($_GET["delete_list"])) {$delete_list=$_GET["delete_list"];}
elseif (isset($_POST["delete_list"])) {$delete_list=$_POST["delete_list"];}
if (isset($_GET["delete_status"])) {$delete_status=$_GET["delete_status"];}
elseif (isset($_POST["delete_status"])) {$delete_status=$_POST["delete_status"];}
if (isset($_GET["delete_count_op"])) {$delete_count_op=$_GET["delete_count_op"];}
elseif (isset($_POST["delete_count_op"])) {$delete_count_op=$_POST["delete_count_op"];}
if (isset($_GET["delete_count_num"])) {$delete_count_num=$_GET["delete_count_num"];}
elseif (isset($_POST["delete_count_num"])) {$delete_count_num=$_POST["delete_count_num"];}
$delete_status = ereg_replace("[^-_0-9a-zA-Z]","",$delete_status);
$delete_list = ereg_replace("[^0-9]","",$delete_list);
$delete_count_num = ereg_replace("[^0-9]","",$delete_count_num);
$delete_count_op = ereg_replace("[^<>=]","",$delete_count_op);
$delete_count_op_phrase="";
if ( $delete_count_op == "<" )
{
$delete_count_op_phrase= "less than ";
}
elseif ( $delete_count_op == "<=" )
{
$delete_count_op_phrase= "less than or equal to ";
}
elseif ( $delete_count_op == ">" )
{
$delete_count_op_phrase= "greater than ";
}
elseif ( $delete_count_op == ">=" )
{
$delete_count_op_phrase= "greater than or equal to ";
}
# get the number of leads this action will move
$delete_lead_count=0;
$delete_lead_count_stmt = "SELECT count(1) FROM vicidial_list WHERE list_id = '$delete_list' and status = '$delete_status' and called_count $delete_count_op $delete_count_num";
if ($DB) { echo "|$delete_lead_count_stmt|\n"; }
$delete_lead_count_rslt = mysql_query($delete_lead_count_stmt, $link);
$delete_lead_count_row = mysql_fetch_row($delete_lead_count_rslt);
$delete_lead_count = $delete_lead_count_row[0];
echo "<p>You are about to delete $delete_lead_count leads in list $delete_list with the status $delete_status that were called $delete_count_op_phrase$delete_count_num times. Please press confirm to continue.</p>\n";
echo "<center><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=delete_list value='$delete_list'>\n";
echo "<input type=hidden name=delete_status value='$delete_status'>\n";
echo "<input type=hidden name=delete_count_op value='$delete_count_op'>\n";
echo "<input type=hidden name=delete_count_num value='$delete_count_num'>\n";
echo "<input type=submit name=confirm_delete value=confirm>\n";
echo "</form></center>\n";
echo "<p><a href='$PHP_SELF'>Click here to start over.</a></p>\n";
echo "</body>\n</html>\n";
}
# actually do the delete
if ( ( $confirm_delete == "confirm" ) && ( $delete_lists > 0 ) )
{
# get the variables
$delete_list="";
$delete_status="";
$delete_count_op="";
$delete_count_num="";
if (isset($_GET["delete_list"])) {$delete_list=$_GET["delete_list"];}
elseif (isset($_POST["delete_list"])) {$delete_list=$_POST["delete_list"];}
if (isset($_GET["delete_status"])) {$delete_status=$_GET["delete_status"];}
elseif (isset($_POST["delete_status"])) {$delete_status=$_POST["delete_status"];}
if (isset($_GET["delete_count_op"])) {$delete_count_op=$_GET["delete_count_op"];}
elseif (isset($_POST["delete_count_op"])) {$delete_count_op=$_POST["delete_count_op"];}
if (isset($_GET["delete_count_num"])) {$delete_count_num=$_GET["delete_count_num"];}
elseif (isset($_POST["delete_count_num"])) {$delete_count_num=$_POST["delete_count_num"];}
$delete_status = ereg_replace("[^-_0-9a-zA-Z]","",$delete_status);
$delete_list = ereg_replace("[^0-9]","",$delete_list);
$delete_count_num = ereg_replace("[^0-9]","",$delete_count_num);
$delete_count_op = ereg_replace("[^<>=]","",$delete_count_op);
$delete_count_op_phrase="";
if ( $delete_count_op == "<" )
{
$delete_count_op_phrase= "less than ";
}
elseif ( $delete_count_op == "<=" )
{
$delete_count_op_phrase= "less than or equal to ";
}
elseif ( $delete_count_op == ">" )
{
$delete_count_op_phrase= "greater than ";
}
elseif ( $delete_count_op == ">=" )
{
$delete_count_op_phrase= "greater than or equal to ";
}
$delete_lead_stmt = "DELETE FROM vicidial_list WHERE list_id = '$delete_list' and status = '$delete_status' and called_count $delete_count_op $delete_count_num";
if ($DB) { echo "|$delete_lead_stmt|\n"; }
$delete_lead_rslt = mysql_query($delete_lead_stmt, $link);
$delete_lead_count = mysql_affected_rows( $link );
$delete_sentence = "$delete_lead_count leads delete from list $delete_list with the status $delete_status that were called $delete_count_op_phrase$delete_count_num times.";
$SQL_log = "$update_lead_stmt|";
$SQL_log = ereg_replace(';','',$SQL_log);
$SQL_log = addslashes($SQL_log);
$admin_log_stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='LISTS', event_type='DELETE', record_id='$delete_list', event_code='ADMIN DELETE LEADS', event_sql=\"$SQL_log\", event_notes='$delete_sentence';";
if ($DB) {echo "|$admin_log_stmt|\n";}
$admin_log_rslt=mysql_query($admin_log_stmt, $link);
echo "<p>$delete_sentence</p>";
echo "<p><a href='$PHP_SELF'>Click here to start over.</a></p>\n";
}
# main page display
if (
($move_submit != "move" ) && ($update_submit != "update") && ($delete_submit != "delete") &&
($confirm_move != "confirm") && ($confirm_update != "confirm") && ($confirm_delete != "confirm")
)
{
# figure out which campaigns this user is allowed to work on
$allowed_campaigns_stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$user_group';";
if ($DB) { echo "|$allowed_campaigns_stmt|\n"; }
$rslt = mysql_query($allowed_campaigns_stmt, $link);
$allowed_campaigns_row = mysql_fetch_row($rslt);
$allowed_campaigns = $allowed_campaigns_row[0];
if ($DB) { echo "|$allowed_campaigns|\n"; }
$allowed_campaigns_sql = "";
if ( eregi("ALL-CAMPAIGNS",$allowed_campaigns) )
{
if ($DB) { echo "|Processing All Campaigns|\n"; }
$campaign_id_stmt = "SELECT campaign_id FROM vicidial_campaigns";
$campaign_id_rslt = mysql_query($campaign_id_stmt, $link);
$campaign_id_num_rows = mysql_num_rows($campaign_id_rslt);
if ($DB) { echo "|campaign_id_num_rows = $campaign_id_num_rows|\n"; }
if ($campaign_id_num_rows > 0)
{
$i = 0;
while ( $i < $campaign_id_num_rows )
{
$campaign_id_row = mysql_fetch_row($campaign_id_rslt);
if ( $i == 0 )
{
$allowed_campaigns_sql = "'$campaign_id_row[0]'";
}
else
{
$allowed_campaigns_sql = "$allowed_campaigns_sql, '$campaign_id_row[0]'";
}
$i++;
}
}
}
else
{
$allowed_campaigns_sql = preg_replace("/ -/",'',$allowed_campaigns);
$allowed_campaigns_sql = preg_replace("/^ /",'',$allowed_campaigns_sql);
$allowed_campaigns_sql = preg_replace("/ $/",'',$allowed_campaigns_sql);
$allowed_campaigns_sql = preg_replace("/ /","','",$allowed_campaigns_sql);
$allowed_campaigns_sql = "'$allowed_campaigns_sql'";
}
# figure out which lists they are allowed to see
$lists_stmt = "SELECT list_id, list_name FROM vicidial_lists WHERE campaign_id IN ($allowed_campaigns_sql) and active = 'N' ORDER BY list_id";
if ($DB) { echo "|$lists_stmt|\n"; }
$lists_rslt = mysql_query($lists_stmt, $link);
$num_rows = mysql_num_rows($lists_rslt);
$i = 0;
$allowed_lists_count = 0;
while ( $i < $num_rows )
{
$lists_row = mysql_fetch_row($lists_rslt);
# check how many leads are in the list
$lead_count_stmt = "SELECT count(1) FROM vicidial_list WHERE list_id = '$lists_row[0]'";
if ($DB) { echo "|$lead_count_stmt|\n"; }
$lead_count_rslt = mysql_query($lead_count_stmt, $link);
$lead_count_row = mysql_fetch_row($lead_count_rslt);
$lead_count = $lead_count_row[0];
# only show lists that are under the list_lead_limit
if ( $lead_count <= $list_lead_limit )
{
$list_ary[$allowed_lists_count] = $lists_row[0];
$list_name_ary[$allowed_lists_count] = $lists_row[1];
$list_lead_count_ary[$allowed_lists_count] = $lead_count_row[0];
if ($allowed_lists_count == 0)
{
$allowed_lists_sql = "'$lists_row[0]'";
}
else
{
$allowed_lists_sql = "$allowed_lists_sql, '$lists_row[0]'";
}
$allowed_lists_count++;
}
$i++;
}
# figure out which statuses are in the lists they are allowed to look at
$status_stmt = "SELECT DISTINCT status FROM vicidial_list WHERE list_id IN ( $allowed_lists_sql ) ORDER BY status";
if ($DB) { echo "|$status_stmt|\n"; }
$status_rslt = mysql_query($status_stmt, $link);
$status_count=mysql_num_rows($status_rslt);
$i = 0;
while ( $i < $status_count )
{
$status_row = mysql_fetch_row($status_rslt);
$statuses[$i] = $status_row[0];
$i++;
}
# figure out which statuses are in the lists they are allowed to look at
$sys_status_stmt = "SELECT status FROM vicidial_statuses ORDER BY status";
if ($DB) { echo "|$sys_status_stmt|\n"; }
$sys_status_rslt = mysql_query($sys_status_stmt, $link);
$sys_status_count=mysql_num_rows($sys_status_rslt);
$i = 0;
while ( $i < $sys_status_count )
{
$sys_status_row = mysql_fetch_row($sys_status_rslt);
$sys_statuses[$i] = $sys_status_row[0];
$i++;
}
echo "<p>The following are basic lead management tools. They will only work on inactive lists with less than $list_lead_limit leads in them. This is to avoid data inconsistencies.</p>";
echo "<form action=$PHP_SELF method=POST>\n";
echo "<center><table width=$section_width cellspacing=3>\n";
# BEGIN lead move
echo "<tr bgcolor=#015B91><td colspan=2 align=center><font color=white><b>Move Leads</b></font></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>From List</td><td align=left>\n";
echo "<select size=1 name=move_from_list>\n";
echo "<option value='-'>Select A List</option>\n";
$i = 0;
while ( $i < $allowed_lists_count )
{
echo "<option value='$list_ary[$i]'>$list_ary[$i] - $list_name_ary[$i] ($list_lead_count_ary[$i] leads)</option>\n";
$i++;
}
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>To List</td><td align=left>\n";
echo "<select size=1 name=move_to_list>\n";
echo "<option value='-'>Select A List</option>\n";
$i = 0;
while ( $i < $allowed_lists_count )
{
echo "<option value='$list_ary[$i]'>$list_ary[$i] - $list_name_ary[$i] ($list_lead_count_ary[$i] leads)</option>\n";
$i++;
}
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Status</td><td align=left>\n";
echo "<select size=1 name=move_status>\n";
echo "<option value='-'>Select A Status</option>\n";
$i = 0;
while ( $i < $status_count )
{
echo "<option value='$statuses[$i]'>$statuses[$i]</option>\n";
$i++;
}
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Called Count</td><td align=left>\n";
echo "<select size=1 name=move_count_op>\n";
echo "<option value='<'><</option>\n";
echo "<option value='<='><=</option>\n";
echo "<option value='>'>></option>\n";
echo "<option value='>='>>=</option>\n";
echo "<option value='='>=</option>\n";
echo "</select>\n";
echo "<select size=1 name=move_count_num>\n";
$i=0;
while ( $i <= $max_count )
{
echo "<option value='$i'>$i</option>\n";
$i++;
}
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td colspan=2 align=center><input type=submit name=move_submit value=move></td></tr>\n";
echo "</table></center>\n";
# END lead move
# BEGIN Status Update
echo "<br /><center><table width=$section_width cellspacing=3>\n";
echo "<tr bgcolor=#015B91><td colspan=2 align=center><font color=white><b>Update Lead Statuses</b></font></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>List</td><td align=left>\n";
echo "<select size=1 name=update_list>\n";
echo "<option value='-'>Select A List</option>\n";
$i = 0;
while ( $i < $allowed_lists_count )
{
echo "<option value='$list_ary[$i]'>$list_ary[$i] - $list_name_ary[$i] ($list_lead_count_ary[$i] leads)</option>\n";
$i++;
}
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>From Status</td><td align=left>\n";
echo "<select size=1 name=update_from_status>\n";
echo "<option value='-'>Select A Status</option>\n";
$i = 0;
while ( $i < $status_count )
{
echo "<option value='$statuses[$i]'>$statuses[$i]</option>\n";
$i++;
}
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>To Status</td><td align=left>\n";
echo "<select size=1 name=update_to_status>\n";
echo "<option value='-'>Select A Status</option>\n";
$i = 0;
while ( $i < $sys_status_count )
{
echo "<option value='$sys_statuses[$i]'>$sys_statuses[$i]</option>\n";
$i++;
}
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Called Count</td><td align=left>\n";
echo "<select size=1 name=update_count_op>\n";
echo "<option value='<'><</option>\n";
echo "<option value='<='><=</option>\n";
echo "<option value='>'>></option>\n";
echo "<option value='>='>>=</option>\n";
echo "<option value='='>=</option>\n";
echo "</select>\n";
echo "<select size=1 name=update_count_num>\n";
$i=0;
while ( $i <= $max_count )
{
echo "<option value='$i'>$i</option>\n";
$i++;
}
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td colspan=2 align=center><input type=submit name=update_submit value=update></td></tr>\n";
# END Status Update
if ( $delete_lists > 0 )
{
# BEGIN Delete Leads
echo "</table></center>\n";
echo "<br /><center><table width=$section_width cellspacing=3>\n";
echo "<tr bgcolor=#015B91><td colspan=2 align=center><font color=white><b>Delete Leads</b></font></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>List</td><td align=left>\n";
echo "<select size=1 name=delete_list>\n";
echo "<option value='-'>Select A List</option>\n";
$i = 0;
while ( $i < $allowed_lists_count )
{
echo "<option value='$list_ary[$i]'>$list_ary[$i] - $list_name_ary[$i] ($list_lead_count_ary[$i] leads)</option>\n";
$i++;
}
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Status</td><td align=left>\n";
echo "<select size=1 name=delete_status>\n";
echo "<option value='-'>Select A Status</option>\n";
$i = 0;
while ( $i < $status_count )
{
echo "<option value='$statuses[$i]'>$statuses[$i]</option>\n";
$i++;
}
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Called Count</td><td align=left>\n";
echo "<select size=1 name=delete_count_op>\n";
echo "<option value='<'><</option>\n";
echo "<option value='<='><=</option>\n";
echo "<option value='>'>></option>\n";
echo "<option value='>='>>=</option>\n";
echo "<option value='='>=</option>\n";
echo "</select>\n";
echo "<select size=1 name=delete_count_num>\n";
$i=0;
while ( $i <= $max_count )
{
echo "<option value='$i'>$i</option>\n";
$i++;
}
echo "</select></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td colspan=2 align=center><input type=submit name=delete_submit value=delete></td></tr>\n";
# END Delete Leads
}
echo "</table></center>\n";
echo "</form>\n";
echo "</body></html>\n";
}
echo "</td></tr></table>\n";
?>
+3 -3
View File
@@ -466,10 +466,10 @@ if ($non_latin < 1)
$group_alias_name = ereg_replace("[^- \+\_0-9a-zA-Z]","",$group_alias_name);
$caller_id_number = ereg_replace("[^0-9]","",$caller_id_number);
$caller_id_name = ereg_replace("[^- \+\_0-9a-zA-Z]","",$caller_id_name);
$user_groups = ereg_replace("[^-\_0-9a-zA-Z]","",$user_groups);
$in_groups = ereg_replace("[^-\_0-9a-zA-Z]","",$in_groups);
$user_groups = ereg_replace("[^-\|\_0-9a-zA-Z]","",$user_groups);
$in_groups = ereg_replace("[^-\|\_0-9a-zA-Z]","",$in_groups);
$call_id = ereg_replace("[^0-9a-zA-Z]","",$call_id);
$group = ereg_replace("[^-\_0-9a-zA-Z]","",$group);
$group = ereg_replace("[^-\|\_0-9a-zA-Z]","",$group);
}
else
{