Added List Merge utility
Added User List NEW Lead Limit options(only works in No Hopper dialiing) Fixed rare issue with email parsing Added option in Agent Performance Detail report to only show live agents git-svn-id: svn://192.168.202.10@2594 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -291,6 +291,12 @@ OTHER CHANGES:
|
|||||||
|
|
||||||
80. Added the User Group Hourly Report
|
80. Added the User Group Hourly Report
|
||||||
|
|
||||||
|
81. Added User List NEW Lead Limits, with User overrides. Allows you to set a
|
||||||
|
limit on the number of NEW status leads that an agent can call on a per
|
||||||
|
list basis per day.
|
||||||
|
|
||||||
|
82. Added List Merge admin utility
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -110,9 +110,10 @@
|
|||||||
# Limited max-stats process to only run on voicemail server, also added alt-logging flags to cm.agi calls
|
# Limited max-stats process to only run on voicemail server, also added alt-logging flags to cm.agi calls
|
||||||
# 160306-1040 - Added option for carriers to be defined for all active asterisk servers
|
# 160306-1040 - Added option for carriers to be defined for all active asterisk servers
|
||||||
# 160324-1655 - Added callback_useronly_move_minutes option
|
# 160324-1655 - Added callback_useronly_move_minutes option
|
||||||
|
# 161014-0839 - Added vicidial_user_list_new_lead daily reset
|
||||||
#
|
#
|
||||||
|
|
||||||
$build = '160324-1655';
|
$build = '161014-0839';
|
||||||
|
|
||||||
$DB=0; # Debug flag
|
$DB=0; # Debug flag
|
||||||
$teodDB=0; # flag to log Timeclock End of Day processes to log file
|
$teodDB=0; # flag to log Timeclock End of Day processes to log file
|
||||||
@@ -1160,6 +1161,21 @@ if ($timeclock_end_of_day_NOW > 0)
|
|||||||
if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";}
|
if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";}
|
||||||
$sthA->finish();
|
$sthA->finish();
|
||||||
|
|
||||||
|
$stmtA = "update vicidial_user_list_new_lead SET new_count=0;";
|
||||||
|
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||||
|
$affected_rows = $dbhA->do($stmtA);
|
||||||
|
if($DB){print STDERR "\n|$affected_rows vicidial_user_list_new_lead call counts reset|\n";}
|
||||||
|
if ($teodDB) {$event_string = "vicidial_user_list_new_lead records reset: $affected_rows"; &teod_logger;}
|
||||||
|
|
||||||
|
$stmtA = "optimize table vicidial_user_list_new_lead;";
|
||||||
|
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||||
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||||
|
$sthArows=$sthA->rows;
|
||||||
|
@aryA = $sthA->fetchrow_array;
|
||||||
|
if ($DB) {print "|",$aryA[0],"|",$aryA[1],"|",$aryA[2],"|",$aryA[3],"|","\n";}
|
||||||
|
$sthA->finish();
|
||||||
|
|
||||||
$stmtA = "optimize table vicidial_daily_max_stats;";
|
$stmtA = "optimize table vicidial_daily_max_stats;";
|
||||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ use MIME::QuotedPrint;
|
|||||||
# 151030-0557 - Small change to catch more attachments properly
|
# 151030-0557 - Small change to catch more attachments properly
|
||||||
# 160120-2149 - Added missing entry_date field on vicidial_list insert
|
# 160120-2149 - Added missing entry_date field on vicidial_list insert
|
||||||
# 160414-0930 - Added missing phone_code field on vicidial_list insert
|
# 160414-0930 - Added missing phone_code field on vicidial_list insert
|
||||||
|
# 161014-2200 - Bug patch for " " string in email message
|
||||||
#
|
#
|
||||||
|
|
||||||
# default path to astguiclient configuration file:
|
# default path to astguiclient configuration file:
|
||||||
@@ -1004,6 +1005,7 @@ sub StripHTML()
|
|||||||
{
|
{
|
||||||
$message=~s/^\s*(.*?)\s*$/$1/;
|
$message=~s/^\s*(.*?)\s*$/$1/;
|
||||||
$message=~s/[\r\n]/ /g;
|
$message=~s/[\r\n]/ /g;
|
||||||
|
$message=~s/\ \;/ /gi;
|
||||||
if ($message=~/<html.*?<\/html>/i) {
|
if ($message=~/<html.*?<\/html>/i) {
|
||||||
$message=$&;
|
$message=$&;
|
||||||
my $hs = HTML::Strip->new();
|
my $hs = HTML::Strip->new();
|
||||||
|
|||||||
@@ -18,3 +18,5 @@ CX - Consultative Transfer (CXAR2420160116094751)
|
|||||||
XLvdc - Agent ReQueue Call (XLvdcW13739431946666) [epoch + user...]
|
XLvdc - Agent ReQueue Call (XLvdcW13739431946666) [epoch + user...]
|
||||||
XBvdc - Agent blind transfer (XBvdcW14528875091001100110011001) [epoch + user...]
|
XBvdc - Agent blind transfer (XBvdcW14528875091001100110011001) [epoch + user...]
|
||||||
AGMON - Remote Agent Monitor (AGMON715224918000001)
|
AGMON - Remote Agent Monitor (AGMON715224918000001)
|
||||||
|
HLvdcW - Hangup of customer call from agent screen (HLvdcW1475524272tluc)
|
||||||
|
CH123456 - Hangup of all non-agent channels in meetme session(CH1234614755246080)
|
||||||
|
|||||||
@@ -992,7 +992,8 @@ expiration_date DATE default '2099-12-31',
|
|||||||
na_call_url TEXT,
|
na_call_url TEXT,
|
||||||
local_call_time VARCHAR(10) NOT NULL DEFAULT 'campaign',
|
local_call_time VARCHAR(10) NOT NULL DEFAULT 'campaign',
|
||||||
web_form_address_three TEXT,
|
web_form_address_three TEXT,
|
||||||
status_group_id VARCHAR(20) default ''
|
status_group_id VARCHAR(20) default '',
|
||||||
|
user_new_lead_limit SMALLINT(5) default '-1'
|
||||||
) ENGINE=MyISAM;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
CREATE TABLE vicidial_statuses (
|
CREATE TABLE vicidial_statuses (
|
||||||
@@ -1670,7 +1671,8 @@ admin_screen_colors VARCHAR(20) default 'default',
|
|||||||
ofcom_uk_drop_calc ENUM('1','0') default '0',
|
ofcom_uk_drop_calc ENUM('1','0') default '0',
|
||||||
agent_screen_colors VARCHAR(20) default 'default',
|
agent_screen_colors VARCHAR(20) default 'default',
|
||||||
script_remove_js ENUM('1','0') default '1',
|
script_remove_js ENUM('1','0') default '1',
|
||||||
manual_auto_next ENUM('1','0') default '0'
|
manual_auto_next ENUM('1','0') default '0',
|
||||||
|
user_new_lead_limit ENUM('1','0') default '0'
|
||||||
) ENGINE=MyISAM;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
CREATE TABLE vicidial_campaigns_list_mix (
|
CREATE TABLE vicidial_campaigns_list_mix (
|
||||||
@@ -3535,6 +3537,14 @@ user_group VARCHAR(20) default '---ALL---',
|
|||||||
web_logo VARCHAR(100) default 'default_new'
|
web_logo VARCHAR(100) default 'default_new'
|
||||||
) ENGINE=MyISAM;
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
CREATE TABLE vicidial_user_list_new_lead (
|
||||||
|
user VARCHAR(20) NOT NULL,
|
||||||
|
list_id BIGINT(14) UNSIGNED default '999',
|
||||||
|
user_override SMALLINT(5) default '-1',
|
||||||
|
new_count MEDIUMINT(8) UNSIGNED default '0',
|
||||||
|
unique index userlistnew (user, list_id)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
|
ALTER TABLE vicidial_email_list MODIFY message text character set utf8;
|
||||||
|
|
||||||
@@ -3791,4 +3801,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 vdc_agent_api_active='1';
|
||||||
|
|
||||||
UPDATE system_settings SET db_schema_version='1468',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
UPDATE system_settings SET db_schema_version='1469',db_schema_update_date=NOW(),reload_timestamp=NOW();
|
||||||
|
|||||||
@@ -658,3 +658,17 @@ UPDATE system_settings SET db_schema_version='1467',db_schema_update_date=NOW()
|
|||||||
ALTER TABLE vicidial_campaigns MODIFY agent_display_fields VARCHAR(100) default '';
|
ALTER TABLE vicidial_campaigns MODIFY agent_display_fields VARCHAR(100) default '';
|
||||||
|
|
||||||
UPDATE system_settings SET db_schema_version='1468',db_schema_update_date=NOW() where db_schema_version < 1468;
|
UPDATE system_settings SET db_schema_version='1468',db_schema_update_date=NOW() where db_schema_version < 1468;
|
||||||
|
|
||||||
|
ALTER TABLE system_settings ADD user_new_lead_limit ENUM('1','0') default '0';
|
||||||
|
|
||||||
|
ALTER TABLE vicidial_lists ADD user_new_lead_limit SMALLINT(5) default '-1';
|
||||||
|
|
||||||
|
CREATE TABLE vicidial_user_list_new_lead (
|
||||||
|
user VARCHAR(20) NOT NULL,
|
||||||
|
list_id BIGINT(14) UNSIGNED default '999',
|
||||||
|
user_override SMALLINT(5) default '-1',
|
||||||
|
new_count MEDIUMINT(8) UNSIGNED default '0',
|
||||||
|
unique index userlistnew (user, list_id)
|
||||||
|
) ENGINE=MyISAM;
|
||||||
|
|
||||||
|
UPDATE system_settings SET db_schema_version='1469',db_schema_update_date=NOW() where db_schema_version < 1469;
|
||||||
|
|||||||
+74
-14
@@ -411,13 +411,14 @@
|
|||||||
# 160801-0717 - Added lists option to ALT dispo call url functions
|
# 160801-0717 - Added lists option to ALT dispo call url functions
|
||||||
# 160901-1714 - Added last_local_call_time sent to agent screen with lead info
|
# 160901-1714 - Added last_local_call_time sent to agent screen with lead info
|
||||||
# 160926-1053 - Fix for inbound call notes display
|
# 160926-1053 - Fix for inbound call notes display
|
||||||
|
# 161013-2226 - Added user_new_lead_limit option code
|
||||||
#
|
#
|
||||||
|
|
||||||
$version = '2.12-305';
|
$version = '2.12-306';
|
||||||
$build = '160926-1053';
|
$build = '161013-2226';
|
||||||
$php_script = 'vdc_db_query.php';
|
$php_script = 'vdc_db_query.php';
|
||||||
$mel=1; # Mysql Error Log enabled = 1
|
$mel=1; # Mysql Error Log enabled = 1
|
||||||
$mysql_log_count=654;
|
$mysql_log_count=658;
|
||||||
$one_mysql_log=0;
|
$one_mysql_log=0;
|
||||||
$DB=0;
|
$DB=0;
|
||||||
$VD_login=0;
|
$VD_login=0;
|
||||||
@@ -862,7 +863,7 @@ $sip_hangup_cause_dictionary = array(
|
|||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,agent_debug_logging,default_language,active_modules,allow_chats,default_phone_code FROM system_settings;";
|
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,qc_features_active,allow_emails,callback_time_24hour,enable_languages,language_method,agent_debug_logging,default_language,active_modules,allow_chats,default_phone_code,user_new_lead_limit FROM system_settings;";
|
||||||
$rslt=mysql_to_mysqli($stmt, $link);
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
if ($DB) {echo "$stmt\n";}
|
if ($DB) {echo "$stmt\n";}
|
||||||
@@ -888,6 +889,7 @@ if ($qm_conf_ct > 0)
|
|||||||
$active_modules = $row[15];
|
$active_modules = $row[15];
|
||||||
$allow_chats = $row[16];
|
$allow_chats = $row[16];
|
||||||
$default_phone_code = $row[17];
|
$default_phone_code = $row[17];
|
||||||
|
$SSuser_new_lead_limit = $row[18];
|
||||||
}
|
}
|
||||||
##### END SETTINGS LOOKUP #####
|
##### END SETTINGS LOOKUP #####
|
||||||
###########################################
|
###########################################
|
||||||
@@ -2273,7 +2275,7 @@ if ($ACTION == 'manDiaLnextCaLL')
|
|||||||
### figure out what the next lead that should be dialed is
|
### figure out what the next lead that should be dialed is
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
### BEGIN find the next lead to dial without looking in the hopper
|
### BEGIN find the next lead to dial without looking in the hopper (NO HOPPER DIALING)
|
||||||
##########################################################
|
##########################################################
|
||||||
# $DB=1;
|
# $DB=1;
|
||||||
|
|
||||||
@@ -2737,6 +2739,7 @@ if ($ACTION == 'manDiaLnextCaLL')
|
|||||||
|
|
||||||
#################################
|
#################################
|
||||||
# Camp List
|
# Camp List
|
||||||
|
$vulnl_SQL='';
|
||||||
$stmt="SELECT list_id FROM vicidial_lists where campaign_id='$campaign' and active='Y';";
|
$stmt="SELECT list_id FROM vicidial_lists where campaign_id='$campaign' and active='Y';";
|
||||||
$rslt_list=mysql_to_mysqli($stmt, $link);
|
$rslt_list=mysql_to_mysqli($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00603',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00603',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
@@ -2775,8 +2778,8 @@ if ($ACTION == 'manDiaLnextCaLL')
|
|||||||
$cur_list_id = $rowA[0];
|
$cur_list_id = $rowA[0];
|
||||||
$list_local_call_time = "";
|
$list_local_call_time = "";
|
||||||
|
|
||||||
# Pull the call times for the lists
|
# Pull the call times and user_new_lead_limit settings for the lists
|
||||||
$stmt="SELECT local_call_time,list_description FROM vicidial_lists where list_id='$cur_list_id';";
|
$stmt="SELECT local_call_time,list_description,user_new_lead_limit FROM vicidial_lists where list_id='$cur_list_id';";
|
||||||
$rslt=mysql_to_mysqli($stmt, $link);
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00604',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00604',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
$rslt_ct = mysqli_num_rows($rslt);
|
$rslt_ct = mysqli_num_rows($rslt);
|
||||||
@@ -2784,8 +2787,36 @@ if ($ACTION == 'manDiaLnextCaLL')
|
|||||||
{
|
{
|
||||||
#set Cur call_time
|
#set Cur call_time
|
||||||
$row=mysqli_fetch_row($rslt);
|
$row=mysqli_fetch_row($rslt);
|
||||||
$cur_call_time = $row[0];
|
$cur_call_time = $row[0];
|
||||||
$list_description = $row[1];
|
$list_description = $row[1];
|
||||||
|
$user_new_lead_limit = $row[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
# build NEW lead limit SQL, if that setting is enabled
|
||||||
|
if ($SSuser_new_lead_limit > 0)
|
||||||
|
{
|
||||||
|
$vulnl_user_override='-1';
|
||||||
|
$vulnl_new_count=0;
|
||||||
|
$stmt="SELECT user_override,new_count FROM vicidial_user_list_new_lead where user='$user' and list_id='$cur_list_id';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00655',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
$vulnlag_ct = mysqli_num_rows($rslt);
|
||||||
|
if ($vulnlag_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysqli_fetch_row($rslt);
|
||||||
|
$vulnl_user_override = $row[0];
|
||||||
|
$vulnl_new_count = $row[1];
|
||||||
|
}
|
||||||
|
if ($vulnl_user_override > -1)
|
||||||
|
{$user_new_lead_limit = $vulnl_user_override;}
|
||||||
|
if ( ($user_new_lead_limit > -1) and ($vulnl_new_count >= $user_new_lead_limit) )
|
||||||
|
{
|
||||||
|
$vulnl_SQL .= "and ( ( (list_id=$cur_list_id) and (status!='NEW') ) or (list_id!=$cur_list_id) )";
|
||||||
|
}
|
||||||
|
|
||||||
|
# $fp = fopen ("./DNNdebug_log.txt", "a");
|
||||||
|
# fwrite ($fp, "$NOW_TIME| |$k|$cur_list_id|$SSuser_new_lead_limit|$user_new_lead_limit|$vulnl_user_override|$vulnl_new_count|$user|$vulnl_SQL|$stmt|\n");
|
||||||
|
# fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
# check that call time exists
|
# check that call time exists
|
||||||
@@ -3336,19 +3367,19 @@ if ($ACTION == 'manDiaLnextCaLL')
|
|||||||
if (preg_match("/UP TIMEZONE/i",$lead_order)){$order_stmt = "order by gmt_offset_now desc, $last_order";}
|
if (preg_match("/UP TIMEZONE/i",$lead_order)){$order_stmt = "order by gmt_offset_now desc, $last_order";}
|
||||||
if (preg_match("/DOWN TIMEZONE/i",$lead_order)){$order_stmt = "order by gmt_offset_now, $last_order";}
|
if (preg_match("/DOWN TIMEZONE/i",$lead_order)){$order_stmt = "order by gmt_offset_now, $last_order";}
|
||||||
|
|
||||||
$stmt="UPDATE vicidial_list SET user='QUEUE$user' where called_since_last_reset='N' and ( (user NOT LIKE \"QUEUE%\") or (user is NULL) ) and status IN($Dsql) and ($list_id_sql) and ($all_gmtSQL) $CCLsql $DLTsql $fSQL $USERfSQL $adooSQL $order_stmt LIMIT 1;";
|
$stmt="UPDATE vicidial_list SET user='QUEUE$user' where called_since_last_reset='N' and ( (user NOT LIKE \"QUEUE%\") or (user is NULL) ) and status IN($Dsql) and ($list_id_sql) and ($all_gmtSQL) $CCLsql $DLTsql $fSQL $USERfSQL $adooSQL $vulnl_SQL $order_stmt LIMIT 1;";
|
||||||
if ($DB) {echo "$stmt\n";}
|
if ($DB) {echo "$stmt\n";}
|
||||||
$rslt=mysql_to_mysqli($stmt, $link);
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00242',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00242',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
$affected_rows = mysqli_affected_rows($link);
|
$affected_rows = mysqli_affected_rows($link);
|
||||||
|
|
||||||
# $fp = fopen ("./DNNdebug_log.txt", "a");
|
# $fp = fopen ("./DNNdebug_log.txt", "a");
|
||||||
# fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$agent_dialed_number|$user|M|$MqueryCID||$province|$affected_rows|$stmt|\n");
|
# fwrite ($fp, "$NOW_TIME|$campaign|$lead_id|$agent_dialed_number|$user|M|$MqueryCID||$province|$affected_rows|$stmt|\n");
|
||||||
# fclose($fp);
|
# fclose($fp);
|
||||||
|
|
||||||
if ($affected_rows > 0)
|
if ($affected_rows > 0)
|
||||||
{
|
{
|
||||||
$stmt="SELECT lead_id,list_id,gmt_offset_now,state,entry_list_id,vendor_lead_code FROM vicidial_list where user='QUEUE$user' and called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) and (modify_date > CONCAT(DATE_ADD(CURDATE(), INTERVAL -1 HOUR),' ',CURTIME()) ) $CCLsql $DLTsql $fSQL $USERfSQL $adooSQL order by modify_date desc LIMIT 1;";
|
$stmt="SELECT lead_id,list_id,gmt_offset_now,state,entry_list_id,vendor_lead_code,status FROM vicidial_list where user='QUEUE$user' and called_since_last_reset='N' and status IN($Dsql) and list_id IN($camp_lists) and ($all_gmtSQL) and (modify_date > CONCAT(DATE_ADD(CURDATE(), INTERVAL -1 HOUR),' ',CURTIME()) ) $CCLsql $DLTsql $fSQL $USERfSQL $adooSQL order by modify_date desc LIMIT 1;";
|
||||||
$rslt=mysql_to_mysqli($stmt, $link);
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00243',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00243',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
if ($DB) {echo "$stmt\n";}
|
if ($DB) {echo "$stmt\n";}
|
||||||
@@ -3362,11 +3393,40 @@ if ($ACTION == 'manDiaLnextCaLL')
|
|||||||
$state = $row[3];
|
$state = $row[3];
|
||||||
$entry_list_id = $row[4];
|
$entry_list_id = $row[4];
|
||||||
$vendor_lead_code = $row[5];
|
$vendor_lead_code = $row[5];
|
||||||
|
$old_status = $row[6];
|
||||||
|
|
||||||
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='QUEUE',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='MAIN',user='$user',priority='0',source='Q',vendor_lead_code=\"$vendor_lead_code\";";
|
$stmt = "INSERT INTO vicidial_hopper SET lead_id='$lead_id',campaign_id='$campaign',status='QUEUE',list_id='$list_id',gmt_offset_now='$gmt_offset_now',state='$state',alt_dial='MAIN',user='$user',priority='0',source='Q',vendor_lead_code=\"$vendor_lead_code\";";
|
||||||
if ($DB) {echo "$stmt\n";}
|
if ($DB) {echo "$stmt\n";}
|
||||||
$rslt=mysql_to_mysqli($stmt, $link);
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00244',$user,$server_ip,$session_name,$one_mysql_log);}
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00244',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
|
||||||
|
### BEGIN user_new_lead_limit logging section ###
|
||||||
|
if ( ($old_status == 'NEW') and ($SSuser_new_lead_limit > 0) )
|
||||||
|
{
|
||||||
|
$stmt="SELECT new_count FROM vicidial_user_list_new_lead WHERE list_id='$list_id' and user='$user';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00656',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$vulnl_ct = mysqli_num_rows($rslt);
|
||||||
|
if ($vulnl_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysqli_fetch_row($rslt);
|
||||||
|
$new_countUPDATE = ($row[0] + 1);
|
||||||
|
|
||||||
|
$stmt = "UPDATE vicidial_user_list_new_lead SET new_count='$new_countUPDATE' WHERE list_id='$list_id' and user='$user';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00657',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$stmt = "INSERT INTO vicidial_user_list_new_lead SET list_id='$list_id',user='$user',new_count='1';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00658',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
### END user_new_lead_limit logging section ###
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,6 +56,7 @@
|
|||||||
# 160121-2212 - Added report title header, default report format, cleaned up formatting
|
# 160121-2212 - Added report title header, default report format, cleaned up formatting
|
||||||
# 160503-2137 - Bug fix and inclusion of null sub_statuses in counts for "PAUSE CODE BREAKDOWN" section
|
# 160503-2137 - Bug fix and inclusion of null sub_statuses in counts for "PAUSE CODE BREAKDOWN" section
|
||||||
# 160714-2348 - Added and tested ChartJS features for more aesthetically appealing graphs
|
# 160714-2348 - Added and tested ChartJS features for more aesthetically appealing graphs
|
||||||
|
# 161013-2142 - Added option to display live agents only
|
||||||
#
|
#
|
||||||
|
|
||||||
$startMS = microtime();
|
$startMS = microtime();
|
||||||
@@ -90,6 +91,8 @@ if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];}
|
|||||||
elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];}
|
elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];}
|
||||||
if (isset($_GET["report_display_type"])) {$report_display_type=$_GET["report_display_type"];}
|
if (isset($_GET["report_display_type"])) {$report_display_type=$_GET["report_display_type"];}
|
||||||
elseif (isset($_POST["report_display_type"])) {$report_display_type=$_POST["report_display_type"];}
|
elseif (isset($_POST["report_display_type"])) {$report_display_type=$_POST["report_display_type"];}
|
||||||
|
if (isset($_GET["live_agents"])) {$live_agents=$_GET["live_agents"];}
|
||||||
|
elseif (isset($_POST["live_agents"])) {$live_agents=$_POST["live_agents"];}
|
||||||
if (isset($_GET["show_percentages"])) {$show_percentages=$_GET["show_percentages"];}
|
if (isset($_GET["show_percentages"])) {$show_percentages=$_GET["show_percentages"];}
|
||||||
elseif (isset($_POST["show_percentages"])) {$show_percentages=$_POST["show_percentages"];}
|
elseif (isset($_POST["show_percentages"])) {$show_percentages=$_POST["show_percentages"];}
|
||||||
if (isset($_GET["time_in_sec"])) {$time_in_sec=$_GET["time_in_sec"];}
|
if (isset($_GET["time_in_sec"])) {$time_in_sec=$_GET["time_in_sec"];}
|
||||||
@@ -460,7 +463,7 @@ else
|
|||||||
|
|
||||||
if ($DB) {$HTML_text.="$user_group_string|$user_group_ct|$user_groupQS|$i<BR>";}
|
if ($DB) {$HTML_text.="$user_group_string|$user_group_ct|$user_groupQS|$i<BR>";}
|
||||||
|
|
||||||
$LINKbase = "$PHP_SELF?query_date=$query_date&end_date=$end_date$groupQS$user_groupQS&shift=$shift&DB=$DB&show_percentages=$show_percentages&time_in_sec=$time_in_sec&search_archived_data=$search_archived_data&show_defunct_users=$show_defunct_users&breakdown_by_date=$breakdown_by_date&report_display_type=$report_display_type";
|
$LINKbase = "$PHP_SELF?query_date=$query_date&end_date=$end_date$groupQS$user_groupQS&shift=$shift&DB=$DB&show_percentages=$show_percentages&live_agents=$live_agents&time_in_sec=$time_in_sec&search_archived_data=$search_archived_data&show_defunct_users=$show_defunct_users&breakdown_by_date=$breakdown_by_date&report_display_type=$report_display_type";
|
||||||
|
|
||||||
$NWB = " <a href=\"javascript:openNewWindow('help.php?ADD=99999";
|
$NWB = " <a href=\"javascript:openNewWindow('help.php?ADD=99999";
|
||||||
$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>";
|
$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>";
|
||||||
@@ -572,6 +575,7 @@ while ($users_to_print > $o)
|
|||||||
}
|
}
|
||||||
$HTML_text.="</SELECT>\n";
|
$HTML_text.="</SELECT>\n";
|
||||||
$HTML_text.="</TD><TD VALIGN=TOP>";
|
$HTML_text.="</TD><TD VALIGN=TOP>";
|
||||||
|
$HTML_text.="<input type='checkbox' name='live_agents' value='checked' $live_agents>"._QXZ("Only live agents")."<BR>\n";
|
||||||
$HTML_text.="<input type='checkbox' name='show_percentages' value='checked' $show_percentages>"._QXZ("Show %s")."<BR>\n";
|
$HTML_text.="<input type='checkbox' name='show_percentages' value='checked' $show_percentages>"._QXZ("Show %s")."<BR>\n";
|
||||||
$HTML_text.="<input type='checkbox' name='time_in_sec' value='checked' $time_in_sec>"._QXZ("Time in seconds")."<BR>\n";
|
$HTML_text.="<input type='checkbox' name='time_in_sec' value='checked' $time_in_sec>"._QXZ("Time in seconds")."<BR>\n";
|
||||||
$HTML_text.="<input type='checkbox' name='breakdown_by_date' value='checked' $breakdown_by_date>"._QXZ("Show date breakdown")."<BR>\n";
|
$HTML_text.="<input type='checkbox' name='breakdown_by_date' value='checked' $breakdown_by_date>"._QXZ("Show date breakdown")."<BR>\n";
|
||||||
@@ -682,6 +686,19 @@ $usersARY[0]='';
|
|||||||
$user_namesARY[0]='';
|
$user_namesARY[0]='';
|
||||||
$k=0;
|
$k=0;
|
||||||
|
|
||||||
|
$live_agents_ary=array();
|
||||||
|
$live_user_SQL="";
|
||||||
|
$live_user_SQLvu="";
|
||||||
|
if ($live_agents) {
|
||||||
|
$active_stmt="SELECT user from vicidial_live_agents";
|
||||||
|
$active_rslt=mysql_to_mysqli($active_stmt, $link);
|
||||||
|
while($active_row=mysqli_fetch_row($active_rslt)) {
|
||||||
|
array_push($live_agents_ary, "$active_row[0]");
|
||||||
|
}
|
||||||
|
$live_user_SQL=" and user in ('".implode("','", $live_agents_ary)."') ";
|
||||||
|
$live_user_SQLvu=" and vicidial_users.user in ('".implode("','", $live_agents_ary)."') ";
|
||||||
|
}
|
||||||
|
|
||||||
$recent_UG_stmt="SELECT max(agent_log_id), user from ".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 $group_SQL $user_group_agent_log_SQL $user_agent_log_SQL group by user";
|
$recent_UG_stmt="SELECT max(agent_log_id), user from ".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 $group_SQL $user_group_agent_log_SQL $user_agent_log_SQL group by user";
|
||||||
if ($DB) {$HTML_text.="$recent_UG_stmt\n";}
|
if ($DB) {$HTML_text.="$recent_UG_stmt\n";}
|
||||||
$recent_UG_rslt=mysql_to_mysqli($recent_UG_stmt, $link);
|
$recent_UG_rslt=mysql_to_mysqli($recent_UG_stmt, $link);
|
||||||
@@ -712,11 +729,11 @@ $max_customeravg=1;
|
|||||||
|
|
||||||
if ($show_defunct_users=="checked")
|
if ($show_defunct_users=="checked")
|
||||||
{
|
{
|
||||||
$user_stmt="SELECT distinct '' as full_name, user from ".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' $group_SQL $user_agent_log_SQL order by user asc";
|
$user_stmt="SELECT distinct '' as full_name, user from ".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' $live_user_SQL $group_SQL $user_agent_log_SQL order by user asc";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$user_stmt="SELECT distinct full_name,vicidial_users.user,vicidial_users.user_group from vicidial_users,".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=".$agent_log_table.".user $group_SQL $user_group_SQL order by full_name asc";
|
$user_stmt="SELECT distinct full_name,vicidial_users.user,vicidial_users.user_group from vicidial_users,".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=".$agent_log_table.".user $live_user_SQLvu $group_SQL $user_group_SQL order by full_name asc";
|
||||||
}
|
}
|
||||||
if ($DB) {echo "$user_stmt\n";}
|
if ($DB) {echo "$user_stmt\n";}
|
||||||
$user_rslt=mysql_to_mysqli($user_stmt, $link);
|
$user_rslt=mysql_to_mysqli($user_stmt, $link);
|
||||||
@@ -765,11 +782,11 @@ $max_customeravg=1;
|
|||||||
|
|
||||||
if ($show_defunct_users=="checked")
|
if ($show_defunct_users=="checked")
|
||||||
{
|
{
|
||||||
$stat_stmt="SELECT distinct status from ".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 $group_SQL $user_agent_log_SQL $user_SQL order by status asc";
|
$stat_stmt="SELECT distinct status from ".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 $live_user_SQL $group_SQL $user_agent_log_SQL $user_SQL order by status asc";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$stat_stmt="SELECT distinct status from vicidial_users,".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=".$agent_log_table.".user and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 $group_SQL $user_group_SQL $user_SQL order by status asc";
|
$stat_stmt="SELECT distinct status from vicidial_users,".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=".$agent_log_table.".user and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 $live_user_SQLvu $group_SQL $user_group_SQL $user_SQL order by status asc";
|
||||||
}
|
}
|
||||||
$stat_rslt=mysql_to_mysqli($stat_stmt, $link);
|
$stat_rslt=mysql_to_mysqli($stat_stmt, $link);
|
||||||
if ($DB) {$HTML_text.="$stat_stmt\n";}
|
if ($DB) {$HTML_text.="$stat_stmt\n";}
|
||||||
@@ -781,11 +798,11 @@ while ($stat_row=mysqli_fetch_row($stat_rslt)) {
|
|||||||
|
|
||||||
if ($show_defunct_users=="checked")
|
if ($show_defunct_users=="checked")
|
||||||
{
|
{
|
||||||
$stmt="SELECT count(*) as calls,sum(talk_sec) as talk,'' as full_name,user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status,sum(dead_sec), '' as user_group from ".$agent_log_table.",date(event_time) as call_date where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 and status='$current_status' $group_SQL $user_agent_log_SQL $user_SQL group by user,full_name,user_group,status,call_date order by full_name,user,status desc limit 500000;";
|
$stmt="SELECT count(*) as calls,sum(talk_sec) as talk,'' as full_name,user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status,sum(dead_sec), '' as user_group from ".$agent_log_table.",date(event_time) as call_date where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 and status='$current_status' $live_user_SQL $group_SQL $user_agent_log_SQL $user_SQL group by user,full_name,user_group,status,call_date order by full_name,user,status desc limit 500000;";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$stmt="SELECT count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status,sum(dead_sec), vicidial_users.user_group,date(event_time) as call_date from vicidial_users,".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=".$agent_log_table.".user and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 and status='$current_status' $group_SQL $user_group_SQL $user_SQL group by user,full_name,user_group,status order by full_name,user,status desc limit 500000;";
|
$stmt="SELECT count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status,sum(dead_sec), vicidial_users.user_group,date(event_time) as call_date from vicidial_users,".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=".$agent_log_table.".user and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 and status='$current_status' $live_user_SQLvu $group_SQL $user_group_SQL $user_SQL group by user,full_name,user_group,status order by full_name,user,status desc limit 500000;";
|
||||||
}
|
}
|
||||||
$rslt=mysql_to_mysqli($stmt, $link);
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
if ($DB) {$HTML_text.="$stmt\n";}
|
if ($DB) {$HTML_text.="$stmt\n";}
|
||||||
@@ -1672,11 +1689,11 @@ while($ss_row=mysqli_fetch_row($sub_status_rslt)) {
|
|||||||
|
|
||||||
if ($show_defunct_users=="checked")
|
if ($show_defunct_users=="checked")
|
||||||
{
|
{
|
||||||
$stmt="SELECT '' as full_name,user,sum(pause_sec),sub_status,sum(wait_sec + talk_sec + dispo_sec), '' as user_group from ".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' $sub_status_clause and pause_sec<65000 $group_SQL $user_group_agent_log_SQL $user_SQL group by user,full_name,sub_status order by user,full_name,sub_status desc limit 100000;";
|
$stmt="SELECT '' as full_name,user,sum(pause_sec),sub_status,sum(wait_sec + talk_sec + dispo_sec), '' as user_group from ".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' $sub_status_clause and pause_sec<65000 $live_user_SQL $group_SQL $user_group_agent_log_SQL $user_SQL group by user,full_name,sub_status order by user,full_name,sub_status desc limit 100000;";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$stmt="SELECT full_name,vicidial_users.user,sum(pause_sec),sub_status,sum(wait_sec + talk_sec + dispo_sec), vicidial_users.user_group from vicidial_users,".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' $sub_status_clause and vicidial_users.user=".$agent_log_table.".user and pause_sec<65000 $group_SQL $user_group_SQL $user_SQL group by user,full_name,sub_status order by user,full_name,sub_status desc limit 100000;";
|
$stmt="SELECT full_name,vicidial_users.user,sum(pause_sec),sub_status,sum(wait_sec + talk_sec + dispo_sec), vicidial_users.user_group from vicidial_users,".$agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' $sub_status_clause and vicidial_users.user=".$agent_log_table.".user and pause_sec<65000 $live_user_SQLvu $group_SQL $user_group_SQL $user_SQL group by user,full_name,sub_status order by user,full_name,sub_status desc limit 100000;";
|
||||||
}
|
}
|
||||||
$rslt=mysql_to_mysqli($stmt, $link);
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
if ($DB) {$ASCII_text.="$stmt\n";}
|
if ($DB) {$ASCII_text.="$stmt\n";}
|
||||||
|
|||||||
+38
-8
File diff suppressed because one or more lines are too long
@@ -0,0 +1,639 @@
|
|||||||
|
<?php
|
||||||
|
# admin_user_list_new.php
|
||||||
|
#
|
||||||
|
# Copyright (C) 2016 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
|
#
|
||||||
|
# this screen will control the optional user list new limit override settings
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# changes:
|
||||||
|
# 161012-1327 - First Build
|
||||||
|
#
|
||||||
|
|
||||||
|
$admin_version = '2.12-1';
|
||||||
|
$build = '161012-1327';
|
||||||
|
|
||||||
|
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["user"])) {$user=$_GET["user"];}
|
||||||
|
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||||
|
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
|
||||||
|
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
|
||||||
|
if (isset($_GET["user_override"])) {$user_override=$_GET["user_override"];}
|
||||||
|
elseif (isset($_POST["user_override"])) {$user_override=$_POST["user_override"];}
|
||||||
|
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);
|
||||||
|
$user = preg_replace('/[^-_0-9a-zA-Z]/','',$user);
|
||||||
|
$list_id = preg_replace('/[^-_0-9a-zA-Z]/','',$list_id);
|
||||||
|
$user_override = preg_replace('/[^-0-9]/','',$user_override);
|
||||||
|
} # 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;
|
||||||
|
$US='_';
|
||||||
|
$NWB = " <a href=\"javascript:openNewWindow('help.php";
|
||||||
|
$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>";
|
||||||
|
|
||||||
|
$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_lists,user_level,modify_users,user_group from vicidial_users where user='$PHP_AUTH_USER';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$row=mysqli_fetch_row($rslt);
|
||||||
|
$LOGfullname = $row[0];
|
||||||
|
$LOGmodify_lists = $row[1];
|
||||||
|
$LOGuser_level = $row[2];
|
||||||
|
$LOGmodify_users = $row[3];
|
||||||
|
$LOGuser_group = $row[4];
|
||||||
|
|
||||||
|
if ( ($LOGmodify_lists < 1) or ($LOGmodify_users < 1) )
|
||||||
|
{
|
||||||
|
Header ("Content-type: text/html; charset=utf-8");
|
||||||
|
echo _QXZ("You do not have permissions to modify lists and users").": $LOGmodify_lists|$LOGmodify_users\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt="SELECT allowed_campaigns,allowed_reports,admin_viewable_groups,admin_viewable_call_times from vicidial_user_groups where user_group='$LOGuser_group';";
|
||||||
|
if ($DB) {echo "|$stmt|\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$row=mysqli_fetch_row($rslt);
|
||||||
|
$LOGallowed_campaigns = $row[0];
|
||||||
|
$LOGallowed_reports = $row[1];
|
||||||
|
$LOGadmin_viewable_groups = $row[2];
|
||||||
|
$LOGadmin_viewable_call_times = $row[3];
|
||||||
|
|
||||||
|
$LOGallowed_campaignsSQL='';
|
||||||
|
$whereLOGallowed_campaignsSQL='';
|
||||||
|
if ( (!preg_match('/\-ALL/i', $LOGallowed_campaigns)) )
|
||||||
|
{
|
||||||
|
$rawLOGallowed_campaignsSQL = preg_replace("/ -/",'',$LOGallowed_campaigns);
|
||||||
|
$rawLOGallowed_campaignsSQL = preg_replace("/ /","','",$rawLOGallowed_campaignsSQL);
|
||||||
|
$LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')";
|
||||||
|
$whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')";
|
||||||
|
}
|
||||||
|
$regexLOGallowed_campaigns = " $LOGallowed_campaigns ";
|
||||||
|
|
||||||
|
$LOGadmin_viewable_groupsSQL='';
|
||||||
|
$vuLOGadmin_viewable_groupsSQL='';
|
||||||
|
$whereLOGadmin_viewable_groupsSQL='';
|
||||||
|
if ( (!preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) and (strlen($LOGadmin_viewable_groups) > 3) )
|
||||||
|
{
|
||||||
|
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ -/",'',$LOGadmin_viewable_groups);
|
||||||
|
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL);
|
||||||
|
$LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||||
|
$whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||||
|
$vuLOGadmin_viewable_groupsSQL = "and vicidial_users.user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
##### BEGIN Set variables to make header show properly #####
|
||||||
|
$ADD = '311';
|
||||||
|
$SUB = '1';
|
||||||
|
$hh = 'lists';
|
||||||
|
$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='<b>';
|
||||||
|
$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($list_id) < 1)
|
||||||
|
{
|
||||||
|
echo _QXZ("ERROR: list not defined:");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if (strlen($user) < 1)
|
||||||
|
{
|
||||||
|
echo _QXZ("ERROR: user not defined:");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$ADD = '311';
|
||||||
|
$hh = 'lists';
|
||||||
|
$stmt_name="SELECT list_name from vicidial_lists where list_id='$list_id';";
|
||||||
|
$mod_link = "ADD=$ADD&list_id=";
|
||||||
|
$event_section = 'LISTS';
|
||||||
|
|
||||||
|
$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];
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
|
||||||
|
<title><?php echo _QXZ("ADMINISTRATION: User List New Lead Limits"); ?>
|
||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
require("admin_header.php");
|
||||||
|
|
||||||
|
|
||||||
|
if ($DB > 0)
|
||||||
|
{
|
||||||
|
echo "$DB,$action,$list_id,$user,$user_override,$active\n<BR>";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##### BEGIN USER LIST NEW ADD section
|
||||||
|
if ($action == "USER_LIST_NEW_ADD")
|
||||||
|
{
|
||||||
|
if ( (strlen($user)<1) or (strlen($list_id)<1) or (strlen($user_override)<1) )
|
||||||
|
{
|
||||||
|
echo _QXZ("ERROR: You must fill in all fields").": |$user|$list_id|$user_override|\n<BR>";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$stmt="INSERT INTO vicidial_user_list_new_lead SET list_id='$list_id',user_override='$user_override',user='$user';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$affected_rows = mysqli_affected_rows($link);
|
||||||
|
if ($DB > 0) {echo "$affected_rows|$stmt\n<BR>";}
|
||||||
|
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='$list_id', event_code='ADD USER LIST NEW ENTRY', event_sql=\"$SQL_log\", event_notes='$user|$list_id|$user_override';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($DB > 0) {echo "$list_id|$stmt\n<BR>";}
|
||||||
|
|
||||||
|
echo "<BR><b>$affected_rows "._QXZ("USER LIST NEW ENTRY ADDED")."</b><BR><BR>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{echo _QXZ("ERROR: Problem adding USER LIST NEW ENTRY").": $affected_rows|$stmt\n<BR>";}
|
||||||
|
$action='BLANK';
|
||||||
|
}
|
||||||
|
##### END USER LIST NEW NEW section
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
##### BEGIN USER LIST NEW control form
|
||||||
|
if ( ($list_id == '---ALL---') and ($user == '---ALL---') )
|
||||||
|
{
|
||||||
|
echo _QXZ("ERROR: you must select a list or user",0,'')."\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$bgcolor='bgcolor="#'. $SSstd_row2_background .'"';
|
||||||
|
echo "<TABLE><TR><TD>\n";
|
||||||
|
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
|
||||||
|
echo "<br>"._QXZ("User List New Limits Form");
|
||||||
|
echo "<center><TABLE width=$section_width cellspacing=3>\n";
|
||||||
|
echo "<tr><td align=center colspan=2>\n";
|
||||||
|
$FORM_list_id='';
|
||||||
|
$FORM_user='';
|
||||||
|
if ($list_id != '---ALL---')
|
||||||
|
{
|
||||||
|
$FORM_list_id = $list_id;
|
||||||
|
echo "<br><b>"._QXZ("User List New Limit Entries LIST",0,'').": <a href=\"./admin.php?$mod_link$list_id\">$list_id</a></b> $NWB#user_list_new_limits$NWE\n";
|
||||||
|
}
|
||||||
|
if ($user != '---ALL---')
|
||||||
|
{
|
||||||
|
$FORM_user = $user;
|
||||||
|
echo "<br><b>"._QXZ("User List New Limit Entries USER",0,'').": <a href=\"./admin.php?ADD=3&user=$user\">$user</a></b> $NWB#user_list_new_limits$NWE\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<form action=$PHP_SELF method=POST>\n";
|
||||||
|
echo "<input type=hidden name=DB value=\"$DB\">\n";
|
||||||
|
echo "<input type=hidden name=action value=USER_LIST_NEW_MODIFY>\n";
|
||||||
|
echo "<input type=hidden name=user value=\"$user\">\n";
|
||||||
|
echo "<input type=hidden name=list_id value=\"$list_id\">\n";
|
||||||
|
echo "<TABLE width=740 cellspacing=3>\n";
|
||||||
|
echo "<tr><td>#</td><td>"._QXZ("USER")."</td><td>"._QXZ("LIST")."</td><td>"._QXZ("ACTIVE")."</td><td>"._QXZ("CAMPAIGN")."</td><td>"._QXZ("NEW LIMIT")."</td><td>"._QXZ("TODAY")."</td></tr>\n";
|
||||||
|
|
||||||
|
$list_idSQL = "list_id='$list_id'";
|
||||||
|
if ($list_id == '---ALL---') {$list_idSQL = "list_id != 0";}
|
||||||
|
$userSQL = "user='$user'";
|
||||||
|
if ($user == '---ALL---') {$userSQL = "user!=''";}
|
||||||
|
###############################################################################
|
||||||
|
##### BEGIN run for one user, all lists #####
|
||||||
|
###############################################################################
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$changesLINK="admin.php?ADD=720000000000000&category=USERS&stage=$user";
|
||||||
|
|
||||||
|
$stmt="SELECT user,full_name,user_group from vicidial_users where $userSQL $LOGadmin_viewable_groupsSQL order by user limit 10000;";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$users_to_print = mysqli_num_rows($rslt);
|
||||||
|
if ($users_to_print > 0)
|
||||||
|
{
|
||||||
|
$rowx=mysqli_fetch_row($rslt);
|
||||||
|
$Ruser = $rowx[0];
|
||||||
|
$Rfull_name = $rowx[1];
|
||||||
|
$Ruser_group = $rowx[2];
|
||||||
|
|
||||||
|
$stmt="SELECT list_id,list_name,campaign_id,user_new_lead_limit,active from vicidial_lists where $list_idSQL $LOGallowed_campaignsSQL order by campaign_id,list_id limit 10000;";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$lists_to_print = mysqli_num_rows($rslt);
|
||||||
|
$o=0;
|
||||||
|
while ($lists_to_print > $o)
|
||||||
|
{
|
||||||
|
$rowx=mysqli_fetch_row($rslt);
|
||||||
|
$Rlist_id[$o] = $rowx[0];
|
||||||
|
$Rlist_name[$o] = $rowx[1];
|
||||||
|
$Rcampaign[$o] = $rowx[2];
|
||||||
|
$Ruser_new_lead_limit[$o] = $rowx[3];
|
||||||
|
$Ractive[$o] = $rowx[4];
|
||||||
|
|
||||||
|
$o++;
|
||||||
|
}
|
||||||
|
$rollingSQL_log='';
|
||||||
|
$vulnl_updates=0;
|
||||||
|
$vulnl_inserts=0;
|
||||||
|
$vulnl_nochng=0;
|
||||||
|
$o=0;
|
||||||
|
while ($lists_to_print > $o)
|
||||||
|
{
|
||||||
|
### BEGIN modification of vicidial_user_list_new_lead record ###
|
||||||
|
if ($action == "USER_LIST_NEW_MODIFY")
|
||||||
|
{
|
||||||
|
$Ruser_override='-1';
|
||||||
|
$vulnl_found=0;
|
||||||
|
$stmt="SELECT user_override from vicidial_user_list_new_lead where user='$Ruser' and list_id='$Rlist_id[$o]';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$entries_to_print = mysqli_num_rows($rslt);
|
||||||
|
if ($entries_to_print > 0)
|
||||||
|
{
|
||||||
|
$rowx=mysqli_fetch_row($rslt);
|
||||||
|
$Ruser_override = $rowx[0];
|
||||||
|
$vulnl_found++;;
|
||||||
|
}
|
||||||
|
if (isset($_GET["$Ruser$US$Rlist_id[$o]"])) {$Ruser_overrideNEW=$_GET["$Ruser$US$Rlist_id[$o]"];}
|
||||||
|
elseif (isset($_POST["$Ruser$US$Rlist_id[$o]"])) {$Ruser_overrideNEW=$_POST["$Ruser$US$Rlist_id[$o]"];}
|
||||||
|
if ( ($Ruser_overrideNEW == $Ruser_override) or (strlen($Ruser_overrideNEW) < 1) )
|
||||||
|
{
|
||||||
|
$vulnl_nochng++;
|
||||||
|
if ($DB) {echo "NO CHANGE: |$Ruser$US$Rlist_id[$o]|$Ruser_overrideNEW|$Ruser_override|\n";}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($vulnl_found > 0)
|
||||||
|
{
|
||||||
|
$stmt="UPDATE vicidial_user_list_new_lead SET user_override='$Ruser_overrideNEW' where list_id='$Rlist_id[$o]' and user='$Ruser';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$affected_rows = mysqli_affected_rows($link);
|
||||||
|
if ($DB > 0) {echo "$affected_rows|$stmt\n<BR>";}
|
||||||
|
if ($affected_rows > 0)
|
||||||
|
{
|
||||||
|
$rollingSQL_log .= "$stmt|";
|
||||||
|
$vulnl_updates++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{echo _QXZ("ERROR: Problem modifying USER LIST NEW LIMIT").": $affected_rows|$stmt\n<BR>";}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$stmt="INSERT INTO vicidial_user_list_new_lead SET list_id='$Rlist_id[$o]',user_override='$Ruser_overrideNEW',user='$Ruser';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$affected_rows = mysqli_affected_rows($link);
|
||||||
|
if ($DB > 0) {echo "$affected_rows|$stmt\n<BR>";}
|
||||||
|
if ($affected_rows > 0)
|
||||||
|
{
|
||||||
|
$rollingSQL_log .= "$stmt|";
|
||||||
|
$vulnl_inserts++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{echo _QXZ("ERROR: Problem modifying USER LIST NEW LIMIT").": $affected_rows|$stmt\n<BR>";}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
### END modification of vicidial_user_list_new_lead record ###
|
||||||
|
|
||||||
|
$Ruser_override='-1';
|
||||||
|
$Rnew_count=0;
|
||||||
|
$stmt="SELECT user_override,new_count from vicidial_user_list_new_lead where user='$Ruser' and list_id='$Rlist_id[$o]';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$entries_to_print = mysqli_num_rows($rslt);
|
||||||
|
if ($entries_to_print > 0)
|
||||||
|
{
|
||||||
|
$rowx=mysqli_fetch_row($rslt);
|
||||||
|
$Ruser_override = $rowx[0];
|
||||||
|
$Rnew_count = $rowx[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/1$|3$|5$|7$|9$/i', $o))
|
||||||
|
{$bgcolor='bgcolor="#'. $SSstd_row2_background .'"';}
|
||||||
|
else
|
||||||
|
{$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';}
|
||||||
|
|
||||||
|
$ct = ($o + 1);
|
||||||
|
echo "<tr $bgcolor>";
|
||||||
|
echo "<td><font size=1>$ct</td>";
|
||||||
|
echo "<td><font size=1><a href=\"admin.php?ADD=3&user=$Ruser\">$Ruser</a> - $Rfull_name</td>";
|
||||||
|
echo "<td><font size=1><a href=\"admin.php?ADD=311&list_id=$Rlist_id[$o]\">$Rlist_id[$o]</a> - $Rlist_name[$o]</td>";
|
||||||
|
echo "<td><font size=1>$Ractive[$o]</td>";
|
||||||
|
echo "<td><font size=1><a href=\"admin.php?ADD=34&campaign_id=$Rcampaign[$o]\">$Rcampaign[$o]</a></td>";
|
||||||
|
echo "<td><font size=1><input type=text size=4 maxlength=4 name=$Ruser$US$Rlist_id[$o] value=\"$Ruser_override\"></td>";
|
||||||
|
echo "<td><font size=1>$Rnew_count</td>";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
$o++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == "USER_LIST_NEW_MODIFY")
|
||||||
|
{
|
||||||
|
### LOG INSERTION Admin Log Table ###
|
||||||
|
$SQL_log = "$rollingSQL_log|";
|
||||||
|
$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='USERS', event_type='MODIFY', record_id='$user', event_code='MODIFY USER LIST NEW LIMIT ENTRIES', event_sql=\"$SQL_log\", event_notes='$user|$o|NOCHANGE: $vulnl_nochng|UPDATES: $vulnl_updates|INSERTS: $vulnl_inserts|';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($DB > 0) {echo "$user|$o|$stmt\n<BR>";}
|
||||||
|
|
||||||
|
echo "<BR><b>$o "._QXZ("USER LIST NEW LIMIT ENTRIES MODIFIED")." (ID: $user) $o</b><BR><BR>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
###############################################################################
|
||||||
|
##### END run for one user, all lists #####
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
##### BEGIN run for one list, all users #####
|
||||||
|
###############################################################################
|
||||||
|
if ($list_id != '---ALL---')
|
||||||
|
{
|
||||||
|
$changesLINK="admin.php?ADD=720000000000000&category=LISTS&stage=$list_id";
|
||||||
|
|
||||||
|
$stmt="SELECT list_id,list_name,campaign_id,user_new_lead_limit,active from vicidial_lists where $list_idSQL $LOGallowed_campaignsSQL order by campaign_id,list_id limit 10000;";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$lists_to_print = mysqli_num_rows($rslt);
|
||||||
|
if ($lists_to_print > 0)
|
||||||
|
{
|
||||||
|
$rowx=mysqli_fetch_row($rslt);
|
||||||
|
$Rlist_id = $rowx[0];
|
||||||
|
$Rlist_name = $rowx[1];
|
||||||
|
$Rcampaign = $rowx[2];
|
||||||
|
$Ruser_new_lead_limit = $rowx[3];
|
||||||
|
$Ractive = $rowx[4];
|
||||||
|
|
||||||
|
$stmt="SELECT user,full_name,user_group from vicidial_users where active='Y' and $userSQL $LOGadmin_viewable_groupsSQL order by user limit 10000;";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$users_to_print = mysqli_num_rows($rslt);
|
||||||
|
$o=0;
|
||||||
|
while ($users_to_print > $o)
|
||||||
|
{
|
||||||
|
$rowx=mysqli_fetch_row($rslt);
|
||||||
|
$Ruser[$o] = $rowx[0];
|
||||||
|
$Rfull_name[$o] = $rowx[1];
|
||||||
|
$Ruser_group[$o] = $rowx[2];
|
||||||
|
|
||||||
|
$o++;
|
||||||
|
}
|
||||||
|
$rollingSQL_log='';
|
||||||
|
$vulnl_updates=0;
|
||||||
|
$vulnl_inserts=0;
|
||||||
|
$vulnl_nochng=0;
|
||||||
|
$o=0;
|
||||||
|
while ($users_to_print > $o)
|
||||||
|
{
|
||||||
|
### BEGIN modification of vicidial_user_list_new_lead record ###
|
||||||
|
if ($action == "USER_LIST_NEW_MODIFY")
|
||||||
|
{
|
||||||
|
$Ruser_override='-1';
|
||||||
|
$vulnl_found=0;
|
||||||
|
$stmt="SELECT user_override from vicidial_user_list_new_lead where user='$Ruser[$o]' and list_id='$Rlist_id';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$entries_to_print = mysqli_num_rows($rslt);
|
||||||
|
if ($entries_to_print > 0)
|
||||||
|
{
|
||||||
|
$rowx=mysqli_fetch_row($rslt);
|
||||||
|
$Ruser_override = $rowx[0];
|
||||||
|
$vulnl_found++;;
|
||||||
|
}
|
||||||
|
if (isset($_GET["$Ruser[$o]$US$Rlist_id"])) {$Ruser_overrideNEW=$_GET["$Ruser[$o]$US$Rlist_id"];}
|
||||||
|
elseif (isset($_POST["$Ruser[$o]$US$Rlist_id"])) {$Ruser_overrideNEW=$_POST["$Ruser[$o]$US$Rlist_id"];}
|
||||||
|
if ( ($Ruser_overrideNEW == $Ruser_override) or (strlen($Ruser_overrideNEW) < 1) )
|
||||||
|
{
|
||||||
|
$vulnl_nochng++;
|
||||||
|
if ($DB) {echo "NO CHANGE: |$Ruser[$o]$US$Rlist_id|$Ruser_overrideNEW|$Ruser_override|\n";}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($vulnl_found > 0)
|
||||||
|
{
|
||||||
|
$stmt="UPDATE vicidial_user_list_new_lead SET user_override='$Ruser_overrideNEW' where list_id='$Rlist_id' and user='$Ruser[$o]';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$affected_rows = mysqli_affected_rows($link);
|
||||||
|
if ($DB > 0) {echo "$affected_rows|$stmt\n<BR>";}
|
||||||
|
if ($affected_rows > 0)
|
||||||
|
{
|
||||||
|
$rollingSQL_log .= "$stmt|";
|
||||||
|
$vulnl_updates++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{echo _QXZ("ERROR: Problem modifying USER LIST NEW LIMIT").": $affected_rows|$stmt\n<BR>";}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$stmt="INSERT INTO vicidial_user_list_new_lead SET list_id='$Rlist_id',user_override='$Ruser_overrideNEW',user='$Ruser[$o]';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$affected_rows = mysqli_affected_rows($link);
|
||||||
|
if ($DB > 0) {echo "$affected_rows|$stmt\n<BR>";}
|
||||||
|
if ($affected_rows > 0)
|
||||||
|
{
|
||||||
|
$rollingSQL_log .= "$stmt|";
|
||||||
|
$vulnl_inserts++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{echo _QXZ("ERROR: Problem modifying USER LIST NEW LIMIT").": $affected_rows|$stmt\n<BR>";}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
### END modification of vicidial_user_list_new_lead record ###
|
||||||
|
|
||||||
|
$Ruser_override='-1';
|
||||||
|
$Rnew_count=0;
|
||||||
|
$stmt="SELECT user_override,new_count from vicidial_user_list_new_lead where user='$Ruser[$o]' and list_id='$Rlist_id';";
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$entries_to_print = mysqli_num_rows($rslt);
|
||||||
|
if ($entries_to_print > 0)
|
||||||
|
{
|
||||||
|
$rowx=mysqli_fetch_row($rslt);
|
||||||
|
$Ruser_override = $rowx[0];
|
||||||
|
$Rnew_count = $rowx[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match('/1$|3$|5$|7$|9$/i', $o))
|
||||||
|
{$bgcolor='bgcolor="#'. $SSstd_row2_background .'"';}
|
||||||
|
else
|
||||||
|
{$bgcolor='bgcolor="#'. $SSstd_row1_background .'"';}
|
||||||
|
|
||||||
|
$ct = ($o + 1);
|
||||||
|
echo "<tr $bgcolor>";
|
||||||
|
echo "<td><font size=1>$ct</td>";
|
||||||
|
echo "<td><font size=1><a href=\"admin.php?ADD=3&user=$Ruser[$o]\">$Ruser[$o]</a> - $Rfull_name[$o]</td>";
|
||||||
|
echo "<td><font size=1><a href=\"admin.php?ADD=311&list_id=$Rlist_id\">$Rlist_id</a> - $Rlist_name</td>";
|
||||||
|
echo "<td><font size=1>$Ractive</td>";
|
||||||
|
echo "<td><font size=1><a href=\"admin.php?ADD=34&campaign_id=$Rcampaign\">$Rcampaign</a></td>";
|
||||||
|
echo "<td><font size=1><input type=text size=4 maxlength=4 name=$Ruser[$o]$US$Rlist_id value=\"$Ruser_override\"></td>";
|
||||||
|
echo "<td><font size=1>$Rnew_count</td>";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
$o++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == "USER_LIST_NEW_MODIFY")
|
||||||
|
{
|
||||||
|
### LOG INSERTION Admin Log Table ###
|
||||||
|
$SQL_log = "$rollingSQL_log|";
|
||||||
|
$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='LISTS', event_type='MODIFY', record_id='$list_id', event_code='MODIFY USER LIST NEW LIMIT ENTRIES', event_sql=\"$SQL_log\", event_notes='$list_id|$o|NOCHANGE: $vulnl_nochng|UPDATES: $vulnl_updates|INSERTS: $vulnl_inserts|';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($DB > 0) {echo "$user|$o|$stmt\n<BR>";}
|
||||||
|
|
||||||
|
echo "<BR><b>$o "._QXZ("USER LIST NEW LIMIT ENTRIES MODIFIED")." (ID: $list_id) $o</b><BR><BR>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
###############################################################################
|
||||||
|
##### END run for one list, all users #####
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
echo "<tr bgcolor=white>";
|
||||||
|
echo "<td colspan=7 align=center><input type=submit name=SUBMIT value='"._QXZ("SUBMIT")."'></td>";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
echo "</table></center><br>\n";
|
||||||
|
echo "</form>\n";
|
||||||
|
|
||||||
|
echo "</td></tr>\n";
|
||||||
|
|
||||||
|
echo "<TABLE width=700 cellspacing=3>\n";
|
||||||
|
echo "<tr $bgcolor>";
|
||||||
|
echo "</tr>\n";
|
||||||
|
echo "</table></center><br>\n";
|
||||||
|
|
||||||
|
echo "</TABLE>\n";
|
||||||
|
|
||||||
|
|
||||||
|
if ( ($LOGuser_level >= 9) and ( (preg_match("/Administration Change Log/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) )
|
||||||
|
{
|
||||||
|
echo "<br><br><font face=\"Arial,Helvetica\"><a href=\"$changesLINK\">"._QXZ("Click here to see Admin changes to this record")."</font>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</center>\n";
|
||||||
|
echo "</TD></TR></TABLE>\n";
|
||||||
|
### END USER LIST NEW control form
|
||||||
|
|
||||||
|
|
||||||
|
$ENDtime = date("U");
|
||||||
|
$RUNtime = ($ENDtime - $STARTtime);
|
||||||
|
echo "\n\n\n<br><br><br>\n<font size=1> "._QXZ("runtime").": $RUNtime "._QXZ("seconds")." "._QXZ("Version").": $admin_version "._QXZ("Build").": $build</font>";
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -95,6 +95,7 @@
|
|||||||
# 160731-2053 - Added POSTx description for recording filenames
|
# 160731-2053 - Added POSTx description for recording filenames
|
||||||
# 160809-1351 - Added customer_chat_screen_colors and customer_chat_survey_link/text entries
|
# 160809-1351 - Added customer_chat_screen_colors and customer_chat_survey_link/text entries
|
||||||
# 160915-0954 - Added ---READONLY--- option for field labels
|
# 160915-0954 - Added ---READONLY--- option for field labels
|
||||||
|
# 160926-1351 - Added user_new_lead_limit entries
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
@@ -2097,6 +2098,11 @@ if ($SSqc_features_active > 0)
|
|||||||
<BR>
|
<BR>
|
||||||
<B><?php echo _QXZ("Xfer-Conf Number Override"); ?> -</B><?php echo _QXZ("These five fields allow for you to override the Transfer Conference number presets when the lead is from this list. Default is blank."); ?>
|
<B><?php echo _QXZ("Xfer-Conf Number Override"); ?> -</B><?php echo _QXZ("These five fields allow for you to override the Transfer Conference number presets when the lead is from this list. Default is blank."); ?>
|
||||||
|
|
||||||
|
<BR>
|
||||||
|
<A NAME="lists-user_new_lead_limit">
|
||||||
|
<BR>
|
||||||
|
<B><?php echo _QXZ("User New Lead Limit"); ?> -</B><?php echo _QXZ("This setting will limit the number of new leads any user can dial in this list per day. This feature will only work properly if the campaign is set to either the MANUAL or INBOUND_MAN Dial Method and No Hopper dialing is enabled. Default is -1 for disabled."); ?>
|
||||||
|
|
||||||
<BR>
|
<BR>
|
||||||
<A NAME="lists-inventory_report">
|
<A NAME="lists-inventory_report">
|
||||||
<BR>
|
<BR>
|
||||||
@@ -5001,6 +5007,11 @@ FR_SPAC 00 00 00 00 00 - <?php echo _QXZ("France space separated phone number");
|
|||||||
<BR>
|
<BR>
|
||||||
<B><?php echo _QXZ("Max FILL Calls per Second"); ?> -</B><?php echo _QXZ("This setting determines the maximum number of calls that can be placed by the auto-FILL outbound auto-dialing script on for all servers, per second. Must be from 1 to 200. Default is 40."); ?>
|
<B><?php echo _QXZ("Max FILL Calls per Second"); ?> -</B><?php echo _QXZ("This setting determines the maximum number of calls that can be placed by the auto-FILL outbound auto-dialing script on for all servers, per second. Must be from 1 to 200. Default is 40."); ?>
|
||||||
|
|
||||||
|
<BR>
|
||||||
|
<A NAME="settings-user_new_lead_limit">
|
||||||
|
<BR>
|
||||||
|
<B><?php echo _QXZ("New Leads Per List Limit"); ?> -</B><?php echo _QXZ("This setting enables the new lead limits per list to be set on the list modify page and the user list new lead limit page. This feature will only work properly if the campaign is set to either the MANUAL or INBOUND_MAN Dial Method and No Hopper dialing is enabled. Default is 0 for disabled."); ?>
|
||||||
|
|
||||||
<BR>
|
<BR>
|
||||||
<A NAME="settings-allow_custom_dialplan">
|
<A NAME="settings-allow_custom_dialplan">
|
||||||
<BR>
|
<BR>
|
||||||
@@ -6234,6 +6245,14 @@ if ($SSqc_features_active > 0)
|
|||||||
<?php echo _QXZ("This page allows you to define Am Message Wildcards that will check lead data from the defined lead fields for matches in the defined order specified on this page. For example, if you add a wildcard with the word -vacation- tied to the vendor_lead_code field, and the lead being played a message has -vacation- in that field, then it will hear the message defined in that AM Message Wildcard record. If you want to delete a wildcard, it must first be set to not active, then you can click on the DELETE link below the SUBMIT button for that wildcard entry."); ?>
|
<?php echo _QXZ("This page allows you to define Am Message Wildcards that will check lead data from the defined lead fields for matches in the defined order specified on this page. For example, if you add a wildcard with the word -vacation- tied to the vendor_lead_code field, and the lead being played a message has -vacation- in that field, then it will hear the message defined in that AM Message Wildcard record. If you want to delete a wildcard, it must first be set to not active, then you can click on the DELETE link below the SUBMIT button for that wildcard entry."); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<BR><BR><BR><BR>
|
||||||
|
<A NAME="user_list_new_limits">
|
||||||
|
<B><FONT SIZE=3><?php echo _QXZ("User List New Lead Limits"); ?></FONT></B><BR><BR>
|
||||||
|
|
||||||
|
<?php echo _QXZ("If the system setting for New Leads Per List Limit is enabled, then this page allows for the setting of per-user per-list new lead limit overrides to those List limits. This feature will only work properly if the campaign is set to either the MANUAL or INBOUND_MAN Dial Method and No Hopper dialing is enabled."); ?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<BR><BR><BR><BR>
|
<BR><BR><BR><BR>
|
||||||
|
|
||||||
<A NAME="custom_reports_admin">
|
<A NAME="custom_reports_admin">
|
||||||
|
|||||||
@@ -0,0 +1,584 @@
|
|||||||
|
<?php
|
||||||
|
# list_merge.php - merge smaller lists into a larger one. Part of Admin Utilities.
|
||||||
|
#
|
||||||
|
# Copyright (C) 2016 Matt Florell,Joseph Johnson <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
|
#
|
||||||
|
# CHANGES
|
||||||
|
# 161004-2240 - Initial Build
|
||||||
|
#
|
||||||
|
|
||||||
|
$version = '2.12-1';
|
||||||
|
$build = '161004-2240';
|
||||||
|
|
||||||
|
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'];
|
||||||
|
$ip = getenv("REMOTE_ADDR");
|
||||||
|
$SQLdate = date("Y-m-d H:i:s");
|
||||||
|
|
||||||
|
$DB=0;
|
||||||
|
$submit = "";
|
||||||
|
$confirm = "";
|
||||||
|
$available_lists = "";
|
||||||
|
$start_dest_list_id = "";
|
||||||
|
$num_leads = "";
|
||||||
|
|
||||||
|
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||||
|
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||||
|
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
|
||||||
|
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
|
||||||
|
if (isset($_GET["confirm"])) {$confirm=$_GET["confirm"];}
|
||||||
|
elseif (isset($_POST["confirm"])) {$confirm=$_POST["confirm"];}
|
||||||
|
if (isset($_GET["available_lists"])) {$available_lists=$_GET["available_lists"];}
|
||||||
|
elseif (isset($_POST["available_lists"])) {$available_lists=$_POST["available_lists"];}
|
||||||
|
if (isset($_GET["start_dest_list_id"])) {$start_dest_list_id=$_GET["start_dest_list_id"];}
|
||||||
|
elseif (isset($_POST["start_dest_list_id"])) {$start_dest_list_id=$_POST["start_dest_list_id"];}
|
||||||
|
if (isset($_GET["num_leads"])) {$num_leads=$_GET["num_leads"];}
|
||||||
|
elseif (isset($_POST["num_leads"])) {$num_leads=$_POST["num_leads"];}
|
||||||
|
if (isset($_GET["destination_list_id"])) {$destination_list_id=$_GET["destination_list_id"];}
|
||||||
|
elseif (isset($_POST["destination_list_id"])) {$destination_list_id=$_POST["destination_list_id"];}
|
||||||
|
if (isset($_GET["new_list_id"])) {$new_list_id=$_GET["new_list_id"];}
|
||||||
|
elseif (isset($_POST["new_list_id"])) {$new_list_id=$_POST["new_list_id"];}
|
||||||
|
if (isset($_GET["new_list_name"])) {$new_list_name=$_GET["new_list_name"];}
|
||||||
|
elseif (isset($_POST["new_list_name"])) {$new_list_name=$_POST["new_list_name"];}
|
||||||
|
if (isset($_GET["new_list_description"])) {$new_list_description=$_GET["new_list_description"];}
|
||||||
|
elseif (isset($_POST["new_list_description"])) {$new_list_description=$_POST["new_list_description"];}
|
||||||
|
if (isset($_GET["active"])) {$active=$_GET["active"];}
|
||||||
|
elseif (isset($_POST["active"])) {$active=$_POST["active"];}
|
||||||
|
if (isset($_GET["campaign_id"])) {$campaign_id=$_GET["campaign_id"];}
|
||||||
|
elseif (isset($_POST["campaign_id"])) {$campaign_id=$_POST["campaign_id"];}
|
||||||
|
if (isset($_GET["retain_original_list"])) {$retain_original_list=$_GET["retain_original_list"];}
|
||||||
|
elseif (isset($_POST["retain_original_list"])) {$retain_original_list=$_POST["retain_original_list"];}
|
||||||
|
if (isset($_GET["create_new_list"])) {$create_new_list=$_GET["create_new_list"];}
|
||||||
|
elseif (isset($_POST["create_new_list"])) {$create_new_list=$_POST["create_new_list"];}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$DB = preg_replace('/[^0-9]/','',$DB);
|
||||||
|
$retain_original_list = preg_replace('/[^NY]/i','',$retain_original_list);
|
||||||
|
$submit = preg_replace('/[^-_0-9a-zA-Z]/','',$submit);
|
||||||
|
$confirm = preg_replace('/[^-_0-9a-zA-Z]/','',$confirm);
|
||||||
|
$available_lists = preg_replace('/[^0-9\|]/','',$available_lists);
|
||||||
|
$start_dest_list_id = preg_replace('/[^0-9]/','',$start_dest_list_id);
|
||||||
|
$destination_list_id = preg_replace('/[^0-9]/','',$destination_list_id);
|
||||||
|
$new_list_id = preg_replace('/[^0-9]/','',$new_list_id);
|
||||||
|
$new_list_name = preg_replace('/[^- \.\,\_0-9a-zA-Z]/','',$new_list_name);
|
||||||
|
$new_list_description = preg_replace('/[^- \.\,\_0-9a-zA-Z]/','',$new_list_description);
|
||||||
|
$num_leads = preg_replace('/[^0-9]/','',$num_leads);
|
||||||
|
|
||||||
|
|
||||||
|
#############################################
|
||||||
|
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||||
|
$sys_settings_stmt = "SELECT use_non_latin,outbound_autodial_active,sounds_central_control_active,enable_languages,language_method,active_modules,admin_screen_colors FROM system_settings;";
|
||||||
|
$sys_settings_rslt=mysql_to_mysqli($sys_settings_stmt, $link);
|
||||||
|
if ($DB) {echo "$sys_settings_stmt\n";}
|
||||||
|
$num_rows = mysqli_num_rows($sys_settings_rslt);
|
||||||
|
if ($num_rows > 0)
|
||||||
|
{
|
||||||
|
$sys_settings_row=mysqli_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];
|
||||||
|
$SSenable_languages = $sys_settings_row[3];
|
||||||
|
$SSlanguage_method = $sys_settings_row[4];
|
||||||
|
$SSactive_modules = $sys_settings_row[5];
|
||||||
|
$SSadmin_screen_colors = $sys_settings_row[6];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# there is something really weird if there are no system settings
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
##### 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);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$PHP_AUTH_PW = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_PW);
|
||||||
|
$PHP_AUTH_USER = preg_replace("/'|\"|\\\\|;/","",$PHP_AUTH_USER);
|
||||||
|
}
|
||||||
|
$list_id_override = preg_replace('/[^0-9]/','',$list_id_override);
|
||||||
|
|
||||||
|
$stmt="SELECT selected_language,modify_lists 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# valid user
|
||||||
|
$rights_stmt = "SELECT user_level, user_group, load_leads, modify_leads, modify_lists from vicidial_users where user='$PHP_AUTH_USER';";
|
||||||
|
if ($DB) {echo "|$stmt|\n";}
|
||||||
|
$rights_rslt=mysql_to_mysqli($rights_stmt, $link);
|
||||||
|
$rights_row=mysqli_fetch_row($rights_rslt);
|
||||||
|
$user_level = $rights_row[0];
|
||||||
|
$user_group = $rights_row[1];
|
||||||
|
$load_leads = $rights_row[2];
|
||||||
|
$modify_leads = $rights_row[3];
|
||||||
|
$modify_lists = $rights_row[4];
|
||||||
|
|
||||||
|
# check their permissions
|
||||||
|
if ( $user_level < 9 )
|
||||||
|
{
|
||||||
|
header ("Content-type: text/html; charset=utf-8");
|
||||||
|
echo _QXZ("You need to be a level 9 user to use this tool");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ( $load_leads < 1 )
|
||||||
|
{
|
||||||
|
header ("Content-type: text/html; charset=utf-8");
|
||||||
|
echo _QXZ("You do not have permissions to load leads");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ( $modify_leads < 1 )
|
||||||
|
{
|
||||||
|
header ("Content-type: text/html; charset=utf-8");
|
||||||
|
echo _QXZ("You do not have permissions to modify leads");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
if ( $modify_lists < 1 )
|
||||||
|
{
|
||||||
|
header ("Content-type: text/html; charset=utf-8");
|
||||||
|
echo _QXZ("You do not have permissions to modify lists");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<html>\n";
|
||||||
|
echo "<head>\n";
|
||||||
|
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"vicidial_stylesheet.css\" />";
|
||||||
|
echo "<script language=\"JavaScript\" src=\"functions.js\"></script>\n";
|
||||||
|
echo "<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>\n";
|
||||||
|
echo "<!-- "._QXZ("VERSION").": <?php echo $version ?> "._QXZ("BUILD").": <?php echo $build ?> -->\n";
|
||||||
|
echo "<title>"._QXZ("ADMINISTRATION: List Merge Tool")."</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='';
|
||||||
|
$SSadmin_color = '#FFFF99';
|
||||||
|
$admin_font = 'BLACK';
|
||||||
|
$SSadmin_color = '#E6E6E6';
|
||||||
|
$subcamp_color = '#C6C6C6';
|
||||||
|
$NWB = " <a href=\"javascript:openNewWindow('help.php";
|
||||||
|
$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>";
|
||||||
|
|
||||||
|
$SSmenu_background='015B91';
|
||||||
|
$SSframe_background='D9E6FE';
|
||||||
|
$SSstd_row1_background='9BB9FB';
|
||||||
|
$SSstd_row2_background='F0F5FE';
|
||||||
|
$SSstd_row3_background='8EBCFD';
|
||||||
|
$SSstd_row2_background='B6D3FC';
|
||||||
|
$SSstd_row5_background='A3C3D6';
|
||||||
|
$SSalt_row1_background='BDFFBD';
|
||||||
|
$SSalt_row2_background='99FF99';
|
||||||
|
$SSalt_row3_background='CCFFCC';
|
||||||
|
$SSweb_logo='default_old';
|
||||||
|
|
||||||
|
if ($SSadmin_screen_colors != 'default')
|
||||||
|
{
|
||||||
|
$stmt = "SELECT menu_background,frame_background,std_row1_background,std_row2_background,std_row3_background,std_row4_background,std_row5_background,alt_row1_background,alt_row2_background,alt_row3_background,web_logo FROM vicidial_screen_colors where colors_id='$SSadmin_screen_colors';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$colors_ct = mysqli_num_rows($rslt);
|
||||||
|
if ($colors_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysqli_fetch_row($rslt);
|
||||||
|
$SSmenu_background = $row[0];
|
||||||
|
$SSframe_background = $row[1];
|
||||||
|
$SSadmin_color = $row[1];
|
||||||
|
$SSstd_row1_background = $row[2];
|
||||||
|
$SSstd_row2_background = $row[3];
|
||||||
|
$SSstd_row3_background = $row[4];
|
||||||
|
$SSstd_row2_background = $row[5];
|
||||||
|
$SSstd_row5_background = $row[6];
|
||||||
|
$SSalt_row1_background = $row[7];
|
||||||
|
$SSalt_row2_background = $row[8];
|
||||||
|
$SSalt_row3_background = $row[9];
|
||||||
|
$SSweb_logo = $row[10];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$Mhead_color = $SSstd_row5_background;
|
||||||
|
$Mmain_bgcolor = $SSmenu_background;
|
||||||
|
$Mhead_color = $SSstd_row5_background;
|
||||||
|
##### END Set variables to make header show properly #####
|
||||||
|
|
||||||
|
require("admin_header.php");
|
||||||
|
|
||||||
|
echo "<table width=$page_width bgcolor='$SSadmin_color' cellpadding=2 cellspacing=0>\n";
|
||||||
|
echo "<tr bgcolor='$SSadmin_color'>\n";
|
||||||
|
echo "<td align=left>\n";
|
||||||
|
echo "<font face='ARIAL,HELVETICA' size=2>\n";
|
||||||
|
echo "<b>"._QXZ("List Merge Tool")."</b>\n";
|
||||||
|
echo "</font>\n";
|
||||||
|
echo "</td>\n";
|
||||||
|
echo "<td align=right><font face='ARIAL,HELVETICA' size=2><b> </td>\n";
|
||||||
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
|
echo "<tr bgcolor='#$SSframe_background'><td align=left colspan=2><font face='ARIAL,HELVETICA' color=black size=3> \n";
|
||||||
|
|
||||||
|
if ($DB>0)
|
||||||
|
{
|
||||||
|
echo "DB: $DB<br>\n";
|
||||||
|
echo "submit: $submit<br>\n";
|
||||||
|
echo "confirm: $confirm<br>\n";
|
||||||
|
echo "available_lists: $available_lists<br>\n";
|
||||||
|
echo "start_dest_list_id: $start_dest_list_id<br>\n";
|
||||||
|
echo "num_leads: $num_leads<br>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# figure out which campaigns this user is allowed to work on
|
||||||
|
# moved here from below because campaign list is needed multiple times
|
||||||
|
$allowed_campaigns_stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$user_group';";
|
||||||
|
if ($DB) { echo "|$allowed_campaigns_stmt|\n"; }
|
||||||
|
$rslt = mysql_to_mysqli($allowed_campaigns_stmt, $link);
|
||||||
|
$allowed_campaigns_row = mysqli_fetch_row($rslt);
|
||||||
|
$allowed_campaigns = $allowed_campaigns_row[0];
|
||||||
|
if ($DB) { echo "|$allowed_campaigns|\n"; }
|
||||||
|
$allowed_campaigns_sql = "";
|
||||||
|
if ( preg_match("/ALL\-CAMPAIGNS/i",$allowed_campaigns) )
|
||||||
|
{
|
||||||
|
if ($DB) { echo "|Processing All Campaigns|\n"; }
|
||||||
|
$campaign_id_stmt = "SELECT campaign_id FROM vicidial_campaigns;";
|
||||||
|
$campaign_id_rslt = mysql_to_mysqli($campaign_id_stmt, $link);
|
||||||
|
$campaign_id_num_rows = mysqli_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 = mysqli_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'";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# confirmation page
|
||||||
|
if ($submit == "submit" )
|
||||||
|
{
|
||||||
|
|
||||||
|
if(count($available_lists)<1) {
|
||||||
|
echo "<p>"._QXZ("No list ids to merge given.")."</p>\n";
|
||||||
|
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($new_list_id) {
|
||||||
|
# Check if "new" list is actually new
|
||||||
|
$list_stmt="select list_id, list_name, list_description, campaign_id, active FROM vicidial_lists where list_id = '$new_list_id';";
|
||||||
|
$list_rslt=mysql_to_mysqli($list_stmt, $link);
|
||||||
|
$list_row = mysqli_fetch_row($list_rslt);
|
||||||
|
$list_rows = mysqli_num_rows($list_rslt);
|
||||||
|
# If the new list ID already exists, get the existing information, not the new one.
|
||||||
|
if ($list_rows>0) {
|
||||||
|
$new_list_name=$list_row[1];
|
||||||
|
$new_list_description=$list_row[2];
|
||||||
|
$campaign_id=$list_row[3];
|
||||||
|
$active=$list_row[4];
|
||||||
|
|
||||||
|
if (!preg_match("/ $campaign_id /", $allowed_campaigns)) {
|
||||||
|
echo "<p>"._QXZ("Cannot move leads - access is denied to the specified list ID $new_list_id.")."</p>\n";
|
||||||
|
echo "<p><a href='$PHP_SELF?new_list_id=$new_list_id&destination_list_id=$destination_list_id&new_campaign_id=$new_campaign_id&new_list_name=".urlencode($new_list_name)."&new_list_description=".urlencode($new_list_description)."&active=$active&retain_original_list=$retain_original_list&available_lists[]=".implode("&available_lists[]=", $available_lists)."'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!$new_list_name || !$campaign_id) {
|
||||||
|
echo "<p>"._QXZ("Cannot move leads - list specified is new and missing information.")."</p>\n";
|
||||||
|
echo "<p><a href='$PHP_SELF?new_list_id=$new_list_id&destination_list_id=$destination_list_id&new_campaign_id=$new_campaign_id&new_list_name=".urlencode($new_list_name)."&new_list_description=".urlencode($new_list_description)."&active=$active&retain_original_list=$retain_original_list&available_lists[]=".implode("&available_lists[]=", $available_lists)."'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$create_new_list=1;
|
||||||
|
}
|
||||||
|
$destination_list_id=$new_list_id;
|
||||||
|
} else if ($destination_list_id) {
|
||||||
|
# make sure the original list id is valid
|
||||||
|
$id_chk_stmt = "SELECT list_id, list_name, list_description, campaign_id, active FROM vicidial_lists where list_id = '$destination_list_id';";
|
||||||
|
if ($DB) { echo "|$id_chk_stmt|\n"; }
|
||||||
|
$id_chk_rslt = mysql_to_mysqli($id_chk_stmt, $link);
|
||||||
|
$id_chk_rows = mysqli_num_rows($id_chk_rslt);
|
||||||
|
if ( $id_chk_rows < 1 )
|
||||||
|
{
|
||||||
|
echo "<p>$destination_list_id "._QXZ("is not a valid list id in the system.")."</p>\n";
|
||||||
|
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
|
echo "</body>\n</html>\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
echo "<p>"._QXZ("No valid destination list id given.")."</p>\n";
|
||||||
|
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get the number of leads in the available_lists
|
||||||
|
$orig_count_stmt = "SELECT count(*) FROM vicidial_list where list_id in ('".implode("','", $available_lists)."');";
|
||||||
|
if ($DB) { echo "|$orig_count_stmt|\n"; }
|
||||||
|
$orig_count_rslt = mysql_to_mysqli($orig_count_stmt, $link);
|
||||||
|
$orig_count_row = mysqli_fetch_row($orig_count_rslt);
|
||||||
|
$orig_count = $orig_count_row[0];
|
||||||
|
|
||||||
|
$num_lists = ceil( $orig_count / $num_leads );
|
||||||
|
|
||||||
|
|
||||||
|
echo ""._QXZ("You are about to merge list(s) <UL><LI>%1s</UL><BR>into list ID %2s.<BR><BR><B>TOTAL LEADS TO BE MOVED: %3s",0,'',implode("<LI>", $available_lists),$destination_list_id,$orig_count)."\n";
|
||||||
|
|
||||||
|
if ($orig_count>=400000) {
|
||||||
|
echo "<BR><BR><redalert>*** WARNING: Lists should not have more than 400,000 records in them!!! ***</redalert><BR><BR>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<center><form action=$PHP_SELF method=POST>\n";
|
||||||
|
echo "<input type=hidden name=available_lists value='".implode("|", $available_lists)."'>\n";
|
||||||
|
echo "<input type=hidden name=orig_count value='$orig_count'>\n";
|
||||||
|
echo "<input type=hidden name=destination_list_id value='$destination_list_id'>\n";
|
||||||
|
echo "<input type=hidden name=new_list_id value='$new_list_id'>\n";
|
||||||
|
echo "<input type=hidden name=new_list_name value='$new_list_name'>\n";
|
||||||
|
echo "<input type=hidden name=new_list_description value='$new_list_description'>\n";
|
||||||
|
echo "<input type=hidden name=campaign_id value='$campaign_id'>\n";
|
||||||
|
echo "<input type=hidden name=active value='$active'>\n";
|
||||||
|
echo "<input type=hidden name=create_new_list value='$create_new_list'>\n";
|
||||||
|
echo "<input type=hidden name=retain_original_list value='$retain_original_list'>\n";
|
||||||
|
|
||||||
|
# keep debug active
|
||||||
|
echo "<input type=hidden name=DB value='$DB'>\n";
|
||||||
|
|
||||||
|
echo "<input type=submit name='confirm' class='red_btn' value='CONFIRM'>\n";
|
||||||
|
echo "</form>\n";
|
||||||
|
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p></center>\n";
|
||||||
|
echo "</body>\n</html>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
# actually do the merge
|
||||||
|
if ($confirm == "CONFIRM")
|
||||||
|
{
|
||||||
|
$available_lists_array=explode("|", $available_lists);
|
||||||
|
# Get the number of leads in the available_lists
|
||||||
|
$orig_count_stmt = "SELECT count(*) FROM vicidial_list where list_id in ('".implode("', '", $available_lists_array)."');";
|
||||||
|
if ($DB) { echo "|$orig_count_stmt|\n"; }
|
||||||
|
$orig_count_rslt = mysql_to_mysqli($orig_count_stmt, $link);
|
||||||
|
$orig_count_row = mysqli_fetch_row($orig_count_rslt);
|
||||||
|
$orig_count = $orig_count_row[0];
|
||||||
|
|
||||||
|
if ($create_new_list)
|
||||||
|
{
|
||||||
|
$list_create_stmt = "INSERT INTO vicidial_lists (list_id, list_name, campaign_id, active, list_description) VALUES ('$new_list_id', '$new_list_name', '$campaign_id', '$active', '$new_list_description');";
|
||||||
|
$list_create_rslt=mysql_to_mysqli($list_create_stmt, $link);
|
||||||
|
$new_list_count = mysqli_affected_rows($link);
|
||||||
|
if ($DB) {echo "|$list_create_stmt|\n";}
|
||||||
|
$SQL_log = preg_replace('/;/', '', $list_create_stmt);
|
||||||
|
$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='$new_list_id', event_code='ADMIN ADD LIST', event_sql=\"$SQL_log\", event_notes='$new_list_count LIST CREATED';";
|
||||||
|
if ($DB) {echo "|$admin_log_stmt|\n";}
|
||||||
|
$admin_log_rslt=mysql_to_mysqli($admin_log_stmt, $link);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ($retain_original_list)
|
||||||
|
{
|
||||||
|
$upd_stmt="update vicidial_list set entry_list_id=list_id where list_id in ('".implode("', '", $available_lists_array)."');";
|
||||||
|
$upd_rslt=mysql_to_mysqli($upd_stmt, $link);
|
||||||
|
$update_lead_count = mysqli_affected_rows($link);
|
||||||
|
$SQL_log = preg_replace('/;/', '', $upd_stmt);
|
||||||
|
$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='$destination_list_id', event_code='ADMIN UPDATE LEADS', event_sql=\"$SQL_log\", event_notes='$update_lead_count LEADS UPDATED';";
|
||||||
|
$admin_log_rslt=mysql_to_mysqli($admin_log_stmt, $link);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
# move the leads to the new list from the old list
|
||||||
|
$move_lead_stmt = "UPDATE vicidial_list SET list_id = '$destination_list_id' WHERE list_id in ('".implode("', '", $available_lists_array)."');";
|
||||||
|
if ($DB) { echo "|$move_lead_stmt|\n"; }
|
||||||
|
$move_lead_rslt = mysql_to_mysqli($move_lead_stmt, $link);
|
||||||
|
$move_lead_count = mysqli_affected_rows($link);
|
||||||
|
|
||||||
|
# insert a record into the admin change log for the mvoe into new list
|
||||||
|
$SQL_log = "$move_lead_stmt";
|
||||||
|
$SQL_log = preg_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='$destination_list_id', event_code='ADMIN LIST MERGE', event_sql=\"$SQL_log\", event_notes='$move_lead_count LEADS MOVED';";
|
||||||
|
if ($DB) {echo "|$admin_log_stmt|\n";}
|
||||||
|
$admin_log_rslt=mysql_to_mysqli($admin_log_stmt, $link);
|
||||||
|
|
||||||
|
# reset the PHP max execution so this script does not exit prematurely
|
||||||
|
set_time_limit( 120 );
|
||||||
|
|
||||||
|
echo "<p>"._QXZ("List(s)")." ".implode(", ", $available_lists_array)." "._QXZ("was merged into list")." $destination_list_id "._QXZ("with")." $move_lead_count "._QXZ("lead(s) moved.")."</p>";
|
||||||
|
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# main page display
|
||||||
|
if (($submit != "submit" ) && ($confirm != "CONFIRM"))
|
||||||
|
{
|
||||||
|
# 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_to_mysqli($lists_stmt, $link);
|
||||||
|
$num_rows = mysqli_num_rows($lists_rslt);
|
||||||
|
$allowed_lists_count = 0;
|
||||||
|
while ( $allowed_lists_count < $num_rows )
|
||||||
|
{
|
||||||
|
$lists_row = mysqli_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_to_mysqli($lead_count_stmt, $link);
|
||||||
|
$lead_count_row = mysqli_fetch_row($lead_count_rslt);
|
||||||
|
$lead_count = $lead_count_row[0];
|
||||||
|
|
||||||
|
$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++;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "<p>"._QXZ("This is the list merge tool. It will only work on inactive lists. It will merge an existing list into several new lists with the same options as the original list. This includes copying the customer fields from the original.")."</p>";
|
||||||
|
echo "<form action=$PHP_SELF method=POST>\n";
|
||||||
|
echo "<center><table width=$section_width cellspacing=3>\n";
|
||||||
|
|
||||||
|
echo "<tr bgcolor=#$SSmenu_background><td colspan=2 align=center><font color=white><b>"._QXZ("List Merge")."</b></font></td></tr>\n";
|
||||||
|
|
||||||
|
# Available Lists
|
||||||
|
echo "<tr bgcolor=#$SSstd_row2_background><td align=right>"._QXZ("Available Lists")."</td><td align=left>\n";
|
||||||
|
echo "<select size=".($num_rows<10 ? $num_rows : 10)." name=available_lists[] id='available_lists' multiple onClick='PopulateMergeMenu()'>\n";
|
||||||
|
echo "<option value=''>-- SELECT LISTS BELOW --</option>\n";
|
||||||
|
$i = 0;
|
||||||
|
while ( $i < $allowed_lists_count )
|
||||||
|
{
|
||||||
|
if (in_array($list_ary[$i], $available_lists)) {$x="selected";} else {$x="";}
|
||||||
|
echo "<option value='$list_ary[$i]' $x>$list_ary[$i] - $list_name_ary[$i] ($list_lead_count_ary[$i] "._QXZ("leads").")</option>\n";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</select></td></tr>\n";
|
||||||
|
|
||||||
|
# Destination List ID
|
||||||
|
echo "<tr bgcolor=#$SSstd_row2_background><td align=right>"._QXZ("List to merge into:")."</td><td align=left>\n";
|
||||||
|
echo "<select name='destination_list_id' id='destination_list_id' size='1'>\n";
|
||||||
|
echo "<option value=''>ALTERNATE LIST (enter below)</option>\n";
|
||||||
|
echo "</select>\n";
|
||||||
|
# echo " <input type=button value='CLEAR' onClick='PopulateMergeMenu(1)'>";
|
||||||
|
#echo " <input type='checkbox' name='retain_original_list' id='retain_original_list' value='Y' ".($retain_original_list ? "checked" : "")."><font size='1'>Retain original list ID (stored in entry_list_id column)</font>";
|
||||||
|
echo "<font size='1'>(Lists selected above will automatically populate here)</font></td></tr>\n";
|
||||||
|
|
||||||
|
# Destination List ID
|
||||||
|
echo "<tr bgcolor=#$SSmenu_background><td colspan=2 align=center><font color=white><b>"._QXZ("Alternate list information - only required if 'ALTERNATE LIST' is selected above")."</b></font></td></tr>\n";
|
||||||
|
echo "<tr bgcolor=#$SSstd_row2_background><td align=right>"._QXZ("Alternate list ID:")."</td><td align=left>\n";
|
||||||
|
echo "<input type='text' name='new_list_id' id='new_list_id' size='19' maxlength='19' value='".$new_list_id."'> (digits only)\n";
|
||||||
|
echo "</td></tr>\n";
|
||||||
|
|
||||||
|
echo "<tr bgcolor=#$SSstd_row1_background><td colspan=2 align=center><b>"._QXZ("Below fields are required ONLY if \"Alternate list ID\" is filled out and not an already-existing list")."</b></td></tr>\n";
|
||||||
|
echo "<tr bgcolor=#$SSstd_row1_background><td align=right>"._QXZ("List Name").": </td><td align=left><input type=text name='new_list_name' size=30 maxlength=30 value='".$new_list_name."'>$NWB#lists-list_name$NWE</td></tr>\n";
|
||||||
|
echo "<tr bgcolor=#$SSstd_row1_background><td align=right>"._QXZ("List Description").": </td><td align=left><input type=text name='new_list_description' size=30 maxlength=255 value='".$new_list_description."'>$NWB#lists-list_description$NWE</td></tr>\n";
|
||||||
|
echo "<tr bgcolor=#$SSstd_row1_background><td align=right>"._QXZ("Campaign").": </td><td align=left><select size=1 name='campaign_id'>\n";
|
||||||
|
|
||||||
|
$stmt="SELECT campaign_id,campaign_name from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
$campaigns_to_print = mysqli_num_rows($rslt);
|
||||||
|
$campaigns_list='';
|
||||||
|
|
||||||
|
$o=0;
|
||||||
|
while ($campaigns_to_print > $o)
|
||||||
|
{
|
||||||
|
$rowx=mysqli_fetch_row($rslt);
|
||||||
|
$campaigns_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";
|
||||||
|
$o++;
|
||||||
|
}
|
||||||
|
echo "$campaigns_list";
|
||||||
|
echo "<option SELECTED>$campaign_id</option>\n";
|
||||||
|
echo "</select>$NWB#lists-campaign_id$NWE</td></tr>\n";
|
||||||
|
echo "<tr bgcolor=#$SSstd_row1_background><td align=right>"._QXZ("Active").": </td><td align=left><select size=1 name='active'><option value='Y'>"._QXZ("Y")."</option><option SELECTED>N</option></select>$NWB#lists-active$NWE</td></tr>\n";
|
||||||
|
|
||||||
|
# keep debug active
|
||||||
|
echo "<input type=hidden name=DB value='$DB'>\n";
|
||||||
|
|
||||||
|
# Submit
|
||||||
|
echo "<tr bgcolor=#$SSstd_row2_background><td colspan=2 align=center><input type=submit name=submit value=submit></td></tr>\n";
|
||||||
|
echo "</table></center>\n";
|
||||||
|
echo "</form>\n";
|
||||||
|
|
||||||
|
# pad the bottom
|
||||||
|
echo "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />\n";
|
||||||
|
# echo "<script type=\"text/javascript\">\$(window).load(function(){ if (window.attachEvent) {window.attachEvent('onload', PopulateMergeMenu());} else if (window.addEventListener) {PopulateMergeMenu();} else {PopulateMergeMenu();}});</script>";
|
||||||
|
echo "<script language='Javascript'>PopulateMergeMenu();</script>";
|
||||||
|
|
||||||
|
echo "</body></html>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</td></tr></table>\n";
|
||||||
|
?>
|
||||||
+122
-80
@@ -1,17 +1,18 @@
|
|||||||
<?php
|
<?php
|
||||||
# list_split.php - split one big list into smaller lists. Part of Admin Utilities.
|
# list_split.php - split one big list into smaller lists. Part of Admin Utilities.
|
||||||
#
|
#
|
||||||
# Copyright (C) 2015 Matt Florell,Michael Cargile <vicidial@gmail.com> LICENSE: AGPLv2
|
# Copyright (C) 2016 Matt Florell,Michael Cargile <vicidial@gmail.com> LICENSE: AGPLv2
|
||||||
#
|
#
|
||||||
# CHANGES
|
# CHANGES
|
||||||
# 140916-1215 - Initial Build
|
# 140916-1215 - Initial Build
|
||||||
# 141114-1330 - formatting changes, code cleanup
|
# 141114-1330 - formatting changes, code cleanup
|
||||||
# 141229-1822 - Added code for on-the-fly language translations display
|
# 141229-1822 - Added code for on-the-fly language translations display
|
||||||
# 150808-2042 - Added compatibility for custom fields data option
|
# 150808-2042 - Added compatibility for custom fields data option
|
||||||
|
# 161014-0842 - Added screen colors
|
||||||
#
|
#
|
||||||
|
|
||||||
$version = '2.12-4';
|
$version = '2.12-5';
|
||||||
$build = '150808-2042';
|
$build = '161014-0842';
|
||||||
|
|
||||||
require("dbconnect_mysqli.php");
|
require("dbconnect_mysqli.php");
|
||||||
require("functions.php");
|
require("functions.php");
|
||||||
@@ -52,7 +53,7 @@ $num_leads = preg_replace('/[^0-9]/','',$num_leads);
|
|||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||||
$sys_settings_stmt = "SELECT use_non_latin,outbound_autodial_active,sounds_central_control_active,enable_languages,language_method,active_modules FROM system_settings;";
|
$sys_settings_stmt = "SELECT use_non_latin,outbound_autodial_active,sounds_central_control_active,enable_languages,language_method,active_modules,admin_screen_colors FROM system_settings;";
|
||||||
$sys_settings_rslt=mysql_to_mysqli($sys_settings_stmt, $link);
|
$sys_settings_rslt=mysql_to_mysqli($sys_settings_stmt, $link);
|
||||||
if ($DB) {echo "$sys_settings_stmt\n";}
|
if ($DB) {echo "$sys_settings_stmt\n";}
|
||||||
$num_rows = mysqli_num_rows($sys_settings_rslt);
|
$num_rows = mysqli_num_rows($sys_settings_rslt);
|
||||||
@@ -65,6 +66,7 @@ if ($num_rows > 0)
|
|||||||
$SSenable_languages = $sys_settings_row[3];
|
$SSenable_languages = $sys_settings_row[3];
|
||||||
$SSlanguage_method = $sys_settings_row[4];
|
$SSlanguage_method = $sys_settings_row[4];
|
||||||
$SSactive_modules = $sys_settings_row[5];
|
$SSactive_modules = $sys_settings_row[5];
|
||||||
|
$SSadmin_screen_colors = $sys_settings_row[6];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -177,16 +179,56 @@ $subheader_font_size='2';
|
|||||||
$subcamp_font_size='2';
|
$subcamp_font_size='2';
|
||||||
$header_selected_bold='<b>';
|
$header_selected_bold='<b>';
|
||||||
$header_nonselected_bold='';
|
$header_nonselected_bold='';
|
||||||
$admin_color = '#FFFF99';
|
$SSadmin_color = '#FFFF99';
|
||||||
$admin_font = 'BLACK';
|
$admin_font = 'BLACK';
|
||||||
$admin_color = '#E6E6E6';
|
$SSadmin_color = '#E6E6E6';
|
||||||
$subcamp_color = '#C6C6C6';
|
$subcamp_color = '#C6C6C6';
|
||||||
|
|
||||||
|
$SSmenu_background='015B91';
|
||||||
|
$SSframe_background='D9E6FE';
|
||||||
|
$SSstd_row1_background='9BB9FB';
|
||||||
|
$SSstd_row2_background='F0F5FE';
|
||||||
|
$SSstd_row3_background='8EBCFD';
|
||||||
|
$SSstd_row4_background='B6D3FC';
|
||||||
|
$SSstd_row5_background='A3C3D6';
|
||||||
|
$SSalt_row1_background='BDFFBD';
|
||||||
|
$SSalt_row2_background='99FF99';
|
||||||
|
$SSalt_row3_background='CCFFCC';
|
||||||
|
$SSweb_logo='default_old';
|
||||||
|
|
||||||
|
if ($SSadmin_screen_colors != 'default')
|
||||||
|
{
|
||||||
|
$stmt = "SELECT menu_background,frame_background,std_row1_background,std_row2_background,std_row3_background,std_row4_background,std_row5_background,alt_row1_background,alt_row2_background,alt_row3_background,web_logo FROM vicidial_screen_colors where colors_id='$SSadmin_screen_colors';";
|
||||||
|
$rslt=mysql_to_mysqli($stmt, $link);
|
||||||
|
if ($DB) {echo "$stmt\n";}
|
||||||
|
$colors_ct = mysqli_num_rows($rslt);
|
||||||
|
if ($colors_ct > 0)
|
||||||
|
{
|
||||||
|
$row=mysqli_fetch_row($rslt);
|
||||||
|
$SSmenu_background = $row[0];
|
||||||
|
$SSframe_background = $row[1];
|
||||||
|
$SSadmin_color = $row[1];
|
||||||
|
$SSstd_row1_background = $row[2];
|
||||||
|
$SSstd_row2_background = $row[3];
|
||||||
|
$SSstd_row3_background = $row[4];
|
||||||
|
$SSstd_row4_background = $row[5];
|
||||||
|
$SSstd_row5_background = $row[6];
|
||||||
|
$SSalt_row1_background = $row[7];
|
||||||
|
$SSalt_row2_background = $row[8];
|
||||||
|
$SSalt_row3_background = $row[9];
|
||||||
|
$SSweb_logo = $row[10];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$Mhead_color = $SSstd_row5_background;
|
||||||
|
$Mmain_bgcolor = $SSmenu_background;
|
||||||
|
$Mhead_color = $SSstd_row5_background;
|
||||||
##### END Set variables to make header show properly #####
|
##### END Set variables to make header show properly #####
|
||||||
|
|
||||||
require("admin_header.php");
|
require("admin_header.php");
|
||||||
|
|
||||||
echo "<table width=$page_width bgcolor=#E6E6E6 cellpadding=2 cellspacing=0>\n";
|
echo "<table width=$page_width bgcolor='$SSadmin_color' cellpadding=2 cellspacing=0>\n";
|
||||||
echo "<tr bgcolor='#E6E6E6'>\n";
|
echo "<tr bgcolor='$SSadmin_color'>\n";
|
||||||
echo "<td align=left>\n";
|
echo "<td align=left>\n";
|
||||||
echo "<font face='ARIAL,HELVETICA' size=2>\n";
|
echo "<font face='ARIAL,HELVETICA' size=2>\n";
|
||||||
echo "<b>"._QXZ("List Split Tool")."</b>\n";
|
echo "<b>"._QXZ("List Split Tool")."</b>\n";
|
||||||
@@ -196,7 +238,7 @@ echo "<td align=right><font face='ARIAL,HELVETICA' size=2><b> </td>\n";
|
|||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
|
||||||
|
|
||||||
echo "<tr bgcolor='#F0F5FE'><td align=left colspan=2><font face='ARIAL,HELVETICA' color=black size=3> \n";
|
echo "<tr bgcolor='#$SSframe_background'><td align=left colspan=2><font face='ARIAL,HELVETICA' color=black size=3> \n";
|
||||||
|
|
||||||
if ($DB>0)
|
if ($DB>0)
|
||||||
{
|
{
|
||||||
@@ -220,7 +262,7 @@ if ($submit == "submit" )
|
|||||||
{
|
{
|
||||||
echo "<p>$orig_list "._QXZ("is not a valid list id in the system.")."</p>\n";
|
echo "<p>$orig_list "._QXZ("is not a valid list id in the system.")."</p>\n";
|
||||||
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
echo "</body>\n</html>\n";
|
echo "</body>\n</html>\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +278,7 @@ if ($submit == "submit" )
|
|||||||
{
|
{
|
||||||
echo "<p>"._QXZ("The Start Destination List must be greater than or equal to")." $max_list_id. "._QXZ("This is to ensure that new lists will not interfere with the existing ones.")."</p>\n";
|
echo "<p>"._QXZ("The Start Destination List must be greater than or equal to")." $max_list_id. "._QXZ("This is to ensure that new lists will not interfere with the existing ones.")."</p>\n";
|
||||||
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
echo "</body>\n</html>\n";
|
echo "</body>\n</html>\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +287,7 @@ if ($submit == "submit" )
|
|||||||
{
|
{
|
||||||
echo "<p>"._QXZ("Number of Leads Per List must be a numeric value.")."</p>\n";
|
echo "<p>"._QXZ("Number of Leads Per List must be a numeric value.")."</p>\n";
|
||||||
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
echo "</body>\n</html>\n";
|
echo "</body>\n</html>\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,10 +305,10 @@ if ($submit == "submit" )
|
|||||||
echo "<center><form action=$PHP_SELF method=POST>\n";
|
echo "<center><form action=$PHP_SELF method=POST>\n";
|
||||||
echo "<input type=hidden name=orig_list value='$orig_list'>\n";
|
echo "<input type=hidden name=orig_list value='$orig_list'>\n";
|
||||||
echo "<input type=hidden name=num_leads value='$num_leads'>\n";
|
echo "<input type=hidden name=num_leads value='$num_leads'>\n";
|
||||||
echo "<input type=hidden name=start_dest_list_id value='$start_dest_list_id'>\n";
|
echo "<input type=hidden name=start_dest_list_id value='$start_dest_list_id'>\n";
|
||||||
|
|
||||||
# keep debug active
|
# keep debug active
|
||||||
echo "<input type=hidden name=DB value='$DB'>\n";
|
echo "<input type=hidden name=DB value='$DB'>\n";
|
||||||
|
|
||||||
echo "<input type=submit name=confirm value=confirm>\n";
|
echo "<input type=submit name=confirm value=confirm>\n";
|
||||||
echo "</form></center>\n";
|
echo "</form></center>\n";
|
||||||
@@ -287,15 +329,15 @@ if ($confirm == "confirm")
|
|||||||
{
|
{
|
||||||
echo "<p>$orig_list "._QXZ("is not a valid list id in the system.")."</p>\n";
|
echo "<p>$orig_list "._QXZ("is not a valid list id in the system.")."</p>\n";
|
||||||
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
echo "</body>\n</html>\n";
|
echo "</body>\n</html>\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
# find out if the original list has any custom fields
|
# find out if the original list has any custom fields
|
||||||
$cf_chk_stmt = "SELECT COUNT(1) FROM vicidial_lists_fields where list_id = $orig_list;";
|
$cf_chk_stmt = "SELECT COUNT(1) FROM vicidial_lists_fields where list_id = $orig_list;";
|
||||||
if ($DB) { echo "|$cf_chk_stmt|\n"; }
|
if ($DB) { echo "|$cf_chk_stmt|\n"; }
|
||||||
$cf_chk_rslt = mysql_to_mysqli($cf_chk_stmt, $link);
|
$cf_chk_rslt = mysql_to_mysqli($cf_chk_stmt, $link);
|
||||||
$cf_chk_row = mysqli_fetch_row($cf_chk_rslt);
|
$cf_chk_row = mysqli_fetch_row($cf_chk_rslt);
|
||||||
$cf_chk_count = $cf_chk_row[0];
|
$cf_chk_count = $cf_chk_row[0];
|
||||||
|
|
||||||
# figure out the highest list id in the system
|
# figure out the highest list id in the system
|
||||||
@@ -310,7 +352,7 @@ if ($confirm == "confirm")
|
|||||||
{
|
{
|
||||||
echo "<p>"._QXZ("The Start Destination List must be greater than or equal to")." $max_list_id. "._QXZ("This is to ensure that new lists will not interfere with the existing ones.")."</p>\n";
|
echo "<p>"._QXZ("The Start Destination List must be greater than or equal to")." $max_list_id. "._QXZ("This is to ensure that new lists will not interfere with the existing ones.")."</p>\n";
|
||||||
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
echo "</body>\n</html>\n";
|
echo "</body>\n</html>\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,7 +361,7 @@ if ($confirm == "confirm")
|
|||||||
{
|
{
|
||||||
echo "<p>"._QXZ("Number of Leads Per List must be a numeric value.")."</p>\n";
|
echo "<p>"._QXZ("Number of Leads Per List must be a numeric value.")."</p>\n";
|
||||||
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
echo "</body>\n</html>\n";
|
echo "</body>\n</html>\n";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,16 +405,16 @@ if ($confirm == "confirm")
|
|||||||
|
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$new_list_id = $start_dest_list_id;
|
$new_list_id = $start_dest_list_id;
|
||||||
$new_lists = "";
|
$new_lists = "";
|
||||||
|
|
||||||
$all_sql = "";
|
$all_sql = "";
|
||||||
|
|
||||||
while ( $i < $num_lists ) {
|
while ( $i < $num_lists ) {
|
||||||
# create the new list
|
# create the new list
|
||||||
$list_create_stmt = "INSERT INTO vicidial_lists ( list_id, list_name, campaign_id, active, list_description, list_changedate, list_lastcalldate, reset_time, agent_script_override, campaign_cid_override, am_message_exten_override, drop_inbound_group_override, xferconf_a_number, xferconf_b_number, xferconf_c_number, xferconf_d_number, xferconf_e_number, web_form_address, web_form_address_two, time_zone_setting, inventory_report, expiration_date ) VALUES ( '$new_list_id', '$list_name split $i', '$campaign_id', '$active', '$list_description', '$list_changedate', '$list_lastcalldate', '$reset_time', '$agent_script_override', '$campaign_cid_override', '$am_message_exten_override', '$drop_inbound_group_override', '$xferconf_a_number', '$xferconf_b_number', '$xferconf_c_number', '$xferconf_d_number', '$xferconf_e_number', '$web_form_address', '$web_form_address_two', '$time_zone_setting', '$inventory_report', '$expiration_date' );";
|
$list_create_stmt = "INSERT INTO vicidial_lists ( list_id, list_name, campaign_id, active, list_description, list_changedate, list_lastcalldate, reset_time, agent_script_override, campaign_cid_override, am_message_exten_override, drop_inbound_group_override, xferconf_a_number, xferconf_b_number, xferconf_c_number, xferconf_d_number, xferconf_e_number, web_form_address, web_form_address_two, time_zone_setting, inventory_report, expiration_date ) VALUES ( '$new_list_id', '$list_name split $i', '$campaign_id', '$active', '$list_description', '$list_changedate', '$list_lastcalldate', '$reset_time', '$agent_script_override', '$campaign_cid_override', '$am_message_exten_override', '$drop_inbound_group_override', '$xferconf_a_number', '$xferconf_b_number', '$xferconf_c_number', '$xferconf_d_number', '$xferconf_e_number', '$web_form_address', '$web_form_address_two', '$time_zone_setting', '$inventory_report', '$expiration_date' );";
|
||||||
if ($DB) {echo "|$list_create_stmt|\n";}
|
if ($DB) {echo "|$list_create_stmt|\n";}
|
||||||
$list_create_rslt=mysql_to_mysqli($list_create_stmt, $link);
|
$list_create_rslt=mysql_to_mysqli($list_create_stmt, $link);
|
||||||
|
|
||||||
$all_sql .= "$list_create_stmt|";
|
$all_sql .= "$list_create_stmt|";
|
||||||
|
|
||||||
# insert a record into the admin change log for the new list creation
|
# insert a record into the admin change log for the new list creation
|
||||||
@@ -382,44 +424,44 @@ if ($confirm == "confirm")
|
|||||||
$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='$new_list_id', event_code='ADMIN LIST SPLIT', event_sql=\"$SQL_log\", event_notes='NEW LIST CREATION';";
|
$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='$new_list_id', event_code='ADMIN LIST SPLIT', event_sql=\"$SQL_log\", event_notes='NEW LIST CREATION';";
|
||||||
if ($DB) {echo "|$admin_log_stmt|\n";}
|
if ($DB) {echo "|$admin_log_stmt|\n";}
|
||||||
$admin_log_rslt=mysql_to_mysqli($admin_log_stmt, $link);
|
$admin_log_rslt=mysql_to_mysqli($admin_log_stmt, $link);
|
||||||
|
|
||||||
# copy the custom fields if there are any
|
# copy the custom fields if there are any
|
||||||
if ( $cf_chk_count > 0 )
|
if ( $cf_chk_count > 0 )
|
||||||
{
|
{
|
||||||
$admin_lists_custom = 'admin_lists_custom.php';
|
$admin_lists_custom = 'admin_lists_custom.php';
|
||||||
if (preg_match("/cf_encrypt/",$SSactive_modules))
|
if (preg_match("/cf_encrypt/",$SSactive_modules))
|
||||||
{$admin_lists_custom = 'admin_lists_custom_encrypt.php';}
|
{$admin_lists_custom = 'admin_lists_custom_encrypt.php';}
|
||||||
|
|
||||||
$url = "http" . (isset($_SERVER['HTTPS']) ? 's' : '') . "://$_SERVER[HTTP_HOST]/vicidial/" . $admin_lists_custom . "?action=COPY_FIELDS_SUBMIT&list_id=$new_list_id&source_list_id=$orig_list©_option=APPEND";
|
$url = "http" . (isset($_SERVER['HTTPS']) ? 's' : '') . "://$_SERVER[HTTP_HOST]/vicidial/" . $admin_lists_custom . "?action=COPY_FIELDS_SUBMIT&list_id=$new_list_id&source_list_id=$orig_list©_option=APPEND";
|
||||||
|
|
||||||
# use cURL to call the copy custom fields code
|
# use cURL to call the copy custom fields code
|
||||||
$curl = curl_init();
|
$curl = curl_init();
|
||||||
|
|
||||||
# Set some options - we are passing in a useragent too here
|
# Set some options - we are passing in a useragent too here
|
||||||
curl_setopt_array($curl, array(
|
curl_setopt_array($curl, array(
|
||||||
CURLOPT_RETURNTRANSFER => 1,
|
CURLOPT_RETURNTRANSFER => 1,
|
||||||
CURLOPT_URL => $url,
|
CURLOPT_URL => $url,
|
||||||
CURLOPT_USERPWD => "$PHP_AUTH_USER:$PHP_AUTH_PW",
|
CURLOPT_USERPWD => "$PHP_AUTH_USER:$PHP_AUTH_PW",
|
||||||
CURLOPT_USERAGENT => 'list_split.php'
|
CURLOPT_USERAGENT => 'list_split.php'
|
||||||
));
|
));
|
||||||
|
|
||||||
# Send the request & save response to $resp
|
# Send the request & save response to $resp
|
||||||
$resp = curl_exec($curl);
|
$resp = curl_exec($curl);
|
||||||
|
|
||||||
# Close request to clear up some resources
|
# Close request to clear up some resources
|
||||||
curl_close($curl);
|
curl_close($curl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($DB) { echo "|$resp|\n"; }
|
if ($DB) { echo "|$resp|\n"; }
|
||||||
|
|
||||||
|
|
||||||
# move the leads to the new list from the old list
|
# move the leads to the new list from the old list
|
||||||
$move_lead_stmt = "UPDATE vicidial_list SET list_id = '$new_list_id' WHERE list_id = '$orig_list' limit $num_leads;";
|
$move_lead_stmt = "UPDATE vicidial_list SET list_id = '$new_list_id' WHERE list_id = '$orig_list' limit $num_leads;";
|
||||||
if ($DB) { echo "|$move_lead_stmt|\n"; }
|
if ($DB) { echo "|$move_lead_stmt|\n"; }
|
||||||
$move_lead_rslt = mysql_to_mysqli($move_lead_stmt, $link);
|
$move_lead_rslt = mysql_to_mysqli($move_lead_stmt, $link);
|
||||||
$move_lead_count = mysqli_affected_rows($link);
|
$move_lead_count = mysqli_affected_rows($link);
|
||||||
|
|
||||||
$all_sql .= "$move_lead_stmt|";
|
$all_sql .= "$move_lead_stmt|";
|
||||||
|
|
||||||
# insert a record into the admin change log for the mvoe into new list
|
# insert a record into the admin change log for the mvoe into new list
|
||||||
$SQL_log = "$move_lead_stmt|";
|
$SQL_log = "$move_lead_stmt|";
|
||||||
@@ -433,22 +475,22 @@ if ($confirm == "confirm")
|
|||||||
$new_lists .= "$new_list_id ";
|
$new_lists .= "$new_list_id ";
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
$new_list_id++;
|
$new_list_id++;
|
||||||
|
|
||||||
# reset the PHP max execution so this script does not exit prematurely
|
# reset the PHP max execution so this script does not exit prematurely
|
||||||
set_time_limit( 120 );
|
set_time_limit( 120 );
|
||||||
}
|
}
|
||||||
|
|
||||||
# insert a record into the admin change log for the split into orig list
|
# insert a record into the admin change log for the split into orig list
|
||||||
$SQL_log = "$all_sql|";
|
$SQL_log = "$all_sql|";
|
||||||
$SQL_log = preg_replace('/;/', '', $SQL_log);
|
$SQL_log = preg_replace('/;/', '', $SQL_log);
|
||||||
$SQL_log = addslashes($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='$orig_list', event_code='ADMIN LIST SPLIT', event_sql=\"$SQL_log\", event_notes='List $orig_list split into list ids $new_lists';";
|
$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='$orig_list', event_code='ADMIN LIST SPLIT', event_sql=\"$SQL_log\", event_notes='List $orig_list split into list ids $new_lists';";
|
||||||
if ($DB) {echo "|$admin_log_stmt|\n";}
|
if ($DB) {echo "|$admin_log_stmt|\n";}
|
||||||
$admin_log_rslt=mysql_to_mysqli($admin_log_stmt, $link);
|
$admin_log_rslt=mysql_to_mysqli($admin_log_stmt, $link);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo "<p>"._QXZ("List")." $orig_list "._QXZ("was split into lists")." $new_lists "._QXZ("with")." $num_leads "._QXZ("leads placed into each new list.")."</p>";
|
echo "<p>"._QXZ("List")." $orig_list "._QXZ("was split into lists")." $new_lists "._QXZ("with")." $num_leads "._QXZ("leads placed into each new list.")."</p>";
|
||||||
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
echo "<p><a href='$PHP_SELF'>"._QXZ("Click here to start over.")."</a></p>\n";
|
||||||
}
|
}
|
||||||
@@ -546,10 +588,10 @@ if (($submit != "submit" ) && ($confirm != "confirm"))
|
|||||||
echo "<form action=$PHP_SELF method=POST>\n";
|
echo "<form action=$PHP_SELF method=POST>\n";
|
||||||
echo "<center><table width=$section_width cellspacing=3>\n";
|
echo "<center><table width=$section_width cellspacing=3>\n";
|
||||||
|
|
||||||
echo "<tr bgcolor=#015B91><td colspan=2 align=center><font color=white><b>"._QXZ("List Split")."</b></font></td></tr>\n";
|
echo "<tr bgcolor=#$SSmenu_background><td colspan=2 align=center><font color=white><b>"._QXZ("List Split")."</b></font></td></tr>\n";
|
||||||
|
|
||||||
# Orginal Lists
|
# Orginal Lists
|
||||||
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Original List")."</td><td align=left>\n";
|
echo "<tr bgcolor=#$SSstd_row4_background><td align=right>"._QXZ("Original List")."</td><td align=left>\n";
|
||||||
echo "<select size=1 name=orig_list>\n";
|
echo "<select size=1 name=orig_list>\n";
|
||||||
echo "<option value='-'>"._QXZ("Select A List")."</option>\n";
|
echo "<option value='-'>"._QXZ("Select A List")."</option>\n";
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@@ -562,11 +604,11 @@ if (($submit != "submit" ) && ($confirm != "confirm"))
|
|||||||
echo "</select></td></tr>\n";
|
echo "</select></td></tr>\n";
|
||||||
|
|
||||||
# Start Destination List ID
|
# Start Destination List ID
|
||||||
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Start Destination List")."</td><td align=left>\n";
|
echo "<tr bgcolor=#$SSstd_row4_background><td align=right>"._QXZ("Start Destination List")."</td><td align=left>\n";
|
||||||
echo "<input type='text' name='start_dest_list_id' value='$max_list_id'> ("._QXZ("must be")." >= $max_list_id)</td></tr>\n";
|
echo "<input type='text' name='start_dest_list_id' value='$max_list_id'> ("._QXZ("must be")." >= $max_list_id)</td></tr>\n";
|
||||||
|
|
||||||
# Number of leads per list
|
# Number of leads per list
|
||||||
echo "<tr bgcolor=#B6D3FC><td align=right>"._QXZ("Number of Leads Per List")."</td><td align=left>\n";
|
echo "<tr bgcolor=#$SSstd_row4_background><td align=right>"._QXZ("Number of Leads Per List")."</td><td align=left>\n";
|
||||||
echo "<select size=1 name=num_leads>\n";
|
echo "<select size=1 name=num_leads>\n";
|
||||||
echo "<option value='10000'>10000</option>\n";
|
echo "<option value='10000'>10000</option>\n";
|
||||||
echo "<option value='20000'>20000</option>\n";
|
echo "<option value='20000'>20000</option>\n";
|
||||||
@@ -578,12 +620,12 @@ if (($submit != "submit" ) && ($confirm != "confirm"))
|
|||||||
echo "<option value='100'>100</option>\n";
|
echo "<option value='100'>100</option>\n";
|
||||||
echo "<option value='10'>10</option>\n";
|
echo "<option value='10'>10</option>\n";
|
||||||
echo "</select></td></tr>\n";
|
echo "</select></td></tr>\n";
|
||||||
|
|
||||||
# keep debug active
|
# keep debug active
|
||||||
echo "<input type=hidden name=DB value='$DB'>\n";
|
echo "<input type=hidden name=DB value='$DB'>\n";
|
||||||
|
|
||||||
# Submit
|
# Submit
|
||||||
echo "<tr bgcolor=#B6D3FC><td colspan=2 align=center><input type=submit name=submit value=submit></td></tr>\n";
|
echo "<tr bgcolor=#$SSstd_row4_background><td colspan=2 align=center><input type=submit name=submit value=submit></td></tr>\n";
|
||||||
echo "</table></center>\n";
|
echo "</table></center>\n";
|
||||||
echo "</form>\n";
|
echo "</form>\n";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user