update of Spanish and Italian language builds

git-svn-id: svn://192.168.202.10@1541 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2010-10-28 02:44:41 +00:00
parent f3a4652fd5
commit d30a2666e3
88 changed files with 22514 additions and 6552 deletions
@@ -202,6 +202,8 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
$Aagent_log_id='';
$Acallerid='';
$DEADcustomer=0;
$Astatus='';
$Acampaign_id='';
### see if the agent has a record in the vicidial_live_agents table
$stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
+24 -6
View File
@@ -96,12 +96,16 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
$last_rank = $o;
$select_SQL = preg_replace("/.$/",'',$select_SQL);
##### BEGIN grab the data from custom table for the lead_id
$stmt="SELECT $select_SQL FROM custom_$list_id where lead_id='$lead_id' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05005',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$list_lead_ct = mysql_num_rows($rslt);
$list_lead_ct=0;
if (strlen($select_SQL)>0)
{
##### BEGIN grab the data from custom table for the lead_id
$stmt="SELECT $select_SQL FROM custom_$list_id where lead_id='$lead_id' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05005',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$list_lead_ct = mysql_num_rows($rslt);
}
if ($list_lead_ct > 0)
{
$row=mysql_fetch_row($rslt);
@@ -457,6 +461,20 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
$CFoutput = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$CFoutput);
$CFoutput = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$CFoutput);
$CFoutput = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$CFoutput);
$CFoutput = eregi_replace('--A--preset_number_a--B--',"$preset_number_a",$CFoutput);
$CFoutput = eregi_replace('--A--preset_number_b--B--',"$preset_number_b",$CFoutput);
$CFoutput = eregi_replace('--A--preset_number_c--B--',"$preset_number_c",$CFoutput);
$CFoutput = eregi_replace('--A--preset_number_d--B--',"$preset_number_d",$CFoutput);
$CFoutput = eregi_replace('--A--preset_number_e--B--',"$preset_number_e",$CFoutput);
$CFoutput = eregi_replace('--A--preset_dtmf_a--B--',"$preset_dtmf_a",$CFoutput);
$CFoutput = eregi_replace('--A--preset_dtmf_b--B--',"$preset_dtmf_b",$CFoutput);
$CFoutput = eregi_replace('--A--did_id--B--',"$did_id",$CFoutput);
$CFoutput = eregi_replace('--A--did_extension--B--',"$did_extension",$CFoutput);
$CFoutput = eregi_replace('--A--did_pattern--B--',"$did_pattern",$CFoutput);
$CFoutput = eregi_replace('--A--did_description--B--',"$did_description",$CFoutput);
$CFoutput = eregi_replace('--A--closecallid--B--',"$closecallid",$CFoutput);
$CFoutput = eregi_replace('--A--xfercallid--B--',"$xfercallid",$CFoutput);
$CFoutput = eregi_replace('--A--agent_log_id--B--',"$agent_log_id",$CFoutput);
# custom fields replacement
$o=0;
+183 -9
View File
@@ -42,6 +42,7 @@
# - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...)
# - $nodeletevdac - ('0','1')
# - $alertCID - ('0','1')
# - $preset_name = ('TESTING PRESET',...)
#
# CHANGELOG:
# 50401-1002 - First build of script, Hangup function only
@@ -98,12 +99,15 @@
# 100327-0846 - Fix for list_id override answering machine message
# 100423-2304 - Added alertCID
# 100527-1014 - Added SysCIDdtmfOriginate function
# 100813-0833 - Added preset_name variable and logging
# 101004-1345 - Added Ivr park functions
# 101024-1638 - Added park_log logging for parked calls
#
$version = '2.4-49';
$build = '100527-1014';
$version = '2.4-52';
$build = '101024-1638';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=85;
$mysql_log_count=97;
$one_mysql_log=0;
require("dbconnect.php");
@@ -191,6 +195,9 @@ if (isset($_GET["nodeletevdac"])) {$nodeletevdac=$_GET["nodeletevdac"];}
elseif (isset($_POST["nodeletevdac"])) {$nodeletevdac=$_POST["nodeletevdac"];}
if (isset($_GET["alertCID"])) {$alertCID=$_GET["alertCID"];}
elseif (isset($_POST["alertCID"])) {$alertCID=$_POST["alertCID"];}
if (isset($_GET["preset_name"])) {$preset_name=$_GET["preset_name"];}
elseif (isset($_POST["preset_name"])) {$preset_name=$_POST["preset_name"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@@ -303,7 +310,7 @@ if ($ACTION=="SysCIDdtmfOriginate")
$stmt="UPDATE vicidial_live_agents SET external_dtmf='' where user='$user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02092',$user,$server_ip,$session_name,$one_mysql_log);}
$ACTION="SysCIDOriginate";
}
@@ -442,10 +449,34 @@ if ($ACTION=="Originate")
if ($agent_dialed_number > 0)
{
$stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$exten','$channel','0','$outbound_cid','$RAWaccount')";
if (strlen($lead_id)<1) {$lead_id='0';}
$customer_hungup='';
if ( ($stage > 0) and (preg_match("/3WAY/",$agent_dialed_type)) )
{$customer_hungup = 'BEFORE_CALL';}
$stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id,preset_name,campaign_id,customer_hungup) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$exten','$channel','$lead_id','$outbound_cid','$RAWaccount','$preset_name','$campaign','$customer_hungup')";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00192',$user,$server_ip,$session_name,$one_mysql_log);}
if (strlen($preset_name) > 0)
{
$stmt = "SELECT count(*) from vicidial_xfer_stats where campaign_id='$campaign' and preset_name='$preset_name';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02093',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt = "UPDATE vicidial_xfer_stats SET xfer_count=(xfer_count+1) where campaign_id='$campaign' and preset_name='$preset_name';";
}
else
{
$stmt = "INSERT INTO vicidial_xfer_stats SET campaign_id='$campaign',preset_name='$preset_name',xfer_count='1';";
}
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02094',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
}
}
@@ -754,6 +785,32 @@ if ($ACTION=="RedirectVD")
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02024',$user,$server_ip,$session_name,$one_mysql_log);}
}
if (strlen($preset_name) > 0)
{
$stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,preset_name,campaign_id) values('$user','$NOW_TIME','BLIND_XFER','$server_ip','$exten','$channel','$lead_id','$preset_name','$campaign')";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02095',$user,$server_ip,$session_name,$one_mysql_log);}
$stmt = "SELECT count(*) from vicidial_xfer_stats where campaign_id='$campaign' and preset_name='$preset_name';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02096',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt = "UPDATE vicidial_xfer_stats SET xfer_count=(xfer_count+1) where campaign_id='$campaign' and preset_name='$preset_name';";
}
else
{
$stmt = "INSERT INTO vicidial_xfer_stats SET campaign_id='$campaign',preset_name='$preset_name',xfer_count='1';";
}
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02097',$user,$server_ip,$session_name,$one_mysql_log);}
}
$ACTION="Redirect";
}
}
@@ -782,6 +839,11 @@ if ($ACTION=="RedirectToPark")
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02025',$user,$server_ip,$session_name,$one_mysql_log);}
$ACTION="Redirect";
$stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='PARKINGED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
# $fp = fopen ("./vicidial_debug.txt", "a");
# fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n");
# fclose($fp);
@@ -790,7 +852,7 @@ if ($ACTION=="RedirectToPark")
$stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02086',$user,$server_ip,$session_name,$one_mysql_log);}
}
if ($ACTION=="RedirectFromPark")
@@ -814,14 +876,126 @@ if ($ACTION=="RedirectFromPark")
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02026',$user,$server_ip,$session_name,$one_mysql_log);}
$ACTION="Redirect";
$parked_sec=0;
$stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$VAC_pl_ct = mysql_num_rows($rslt);
if ($VAC_pl_ct > 0)
{
$row=mysql_fetch_row($rslt);
$parked_sec = ($StarTtime - $row[0]);
$stmt = "UPDATE park_log SET status='GRABBED',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
$stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02087',$user,$server_ip,$session_name,$one_mysql_log);}
}
if ($ACTION=="RedirectToParkIVR")
{
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) )
{
$channel_live=0;
echo "Una de estas variables No es válido:\n";
echo "Channel $channel debe ser mayor de 2 caracteres\n";
echo "queryCID $queryCID debe ser mayor de 14 caracteres\n";
echo "exten $exten debe ser fijado\n";
echo "extenName $extenName debe ser fijado\n";
echo "ext_context $ext_context debe ser fijado\n";
echo "ext_priority $ext_priority debe ser fijado\n";
echo "parkedby $parkedby debe ser fijado\n";
echo "\nRedirectToPark Action no enviado\n";
}
else
{
if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;}
$stmt = "INSERT INTO parked_channels values('$channel','$server_ip','$CalLCID','$extenName','$parkedby','$NOW_TIME');";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02025',$user,$server_ip,$session_name,$one_mysql_log);}
$ACTION="Redirect";
$stmt = "UPDATE vicidial_auto_calls SET extension='PARKING_IVR' where callerid='$CalLCID' limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02088',$user,$server_ip,$session_name,$one_mysql_log);}
$stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='IVRPARKINGED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
# $fp = fopen ("./vicidial_debug.txt", "a");
# fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n");
# fclose($fp);
}
$stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02089',$user,$server_ip,$session_name,$one_mysql_log);}
}
if ($ACTION=="RedirectFromParkIVR")
{
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) )
{
$channel_live=0;
echo "Una de estas variables No es válido:\n";
echo "Channel $channel debe ser mayor de 2 caracteres\n";
echo "queryCID $queryCID debe ser mayor de 14 caracteres\n";
echo "exten $exten debe ser fijado\n";
echo "ext_context $ext_context debe ser fijado\n";
echo "ext_priority $ext_priority debe ser fijado\n";
echo "\nRedirectFromPark Action no enviado\n";
}
else
{
if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;}
$stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02026',$user,$server_ip,$session_name,$one_mysql_log);}
$ACTION="Redirect";
$stmt = "UPDATE vicidial_auto_calls SET extension='' where callerid='$CalLCID' limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02090',$user,$server_ip,$session_name,$one_mysql_log);}
$parked_sec=0;
$stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$VAC_pl_ct = mysql_num_rows($rslt);
if ($VAC_pl_ct > 0)
{
$row=mysql_fetch_row($rslt);
$parked_sec = ($StarTtime - $row[0]);
$stmt = "UPDATE park_log SET status='GRABBEDIVR',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
$stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02091',$user,$server_ip,$session_name,$one_mysql_log);}
}
if ($ACTION=="RedirectName")
{
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) )
@@ -1135,7 +1309,7 @@ if ($ACTION=="RedirectXtraNeW")
if ($WeBRooTWritablE > 0)
{
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|$session_id|\n");
fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|$session_id|\n");
fclose($fp);
}
}
@@ -1680,7 +1854,7 @@ exit;
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
{
$NOW_TIME = date("Y-m-d H:i:s");
# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);
# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02001',$user,$server_ip,$session_name,$one_mysql_log);
$errno=''; $error='';
if ( ($mel > 0) or ($one_mysql_log > 0) )
{
+356 -36
View File
@@ -12,7 +12,7 @@
# - $pass
# optional variables:
# - $format - ('text','debug')
# - $ACTION - ('regCLOSER','regTERRITORY','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCaLL','manDiaLlogCALL','userLOGout','updateDISPO','updateLEAD','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl','AGENTSview','CALLSINQUEUEview','CALLSINQUEUEgrab','DiaLableLeaDsCounT','UpdateFields','CALLLOGview','LEADINFOview')
# - $ACTION - ('regCLOSER','regTERRITORY','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCaLL','manDiaLlogCALL','userLOGout','updateDISPO','updateLEAD','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl','AGENTSview','CALLSINQUEUEview','CALLSINQUEUEgrab','DiaLableLeaDsCounT','UpdateFields','CALLLOGview','LEADINFOview','customer_3way_hangup_process')
# - $stage - ('start','finish','lookup','new')
# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -')
# - $conf_exten - ('8600011',...)
@@ -88,6 +88,7 @@
# - $alt_num_status - ('0','1')
# - $DiaL_SecondS - ('0','1','2',...)
# - $date - ('2010-02-19')
# - $custom_field_names - ('|start_date|finish_date|favorite_color|')
#
# CHANGELOG:
# 50629-1044 - First build of script
@@ -250,13 +251,21 @@
# 100624-1401 - Fix for dispo call url bug related to dialed number and label
# 100625-0915 - Fix for auto-dial bug for presets and timer actions
# 100712-1447 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
# 100803-0822 - Added CAMPLISTS_ALL for manual_dial_filter(issue #369
# 100803-0822 - Added CAMPLISTS_ALL for manual_dial_filter(issue #369)
# 100823-1612 - Added DID variables on inbound calls
# 100902-1348 - Added closecallid and xfercallid variables
# 100903-0041 - Changed lead_id max length to 10 digits
# 100908-1102 - Added customer_3way_hangup_process function
# 100916-2144 - Added custom list names export with lead data
# 100927-1618 - Added ability to use custom fields in web form and dispo_call_url
# 101001-1451 - Added full name display to Call Log functionality
# 101022-1243 - Fixed missing variables from start and dispo call urls
#
$version = '2.4-158';
$build = '100803-0822';
$version = '2.4-166';
$build = '101022-1243';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=333;
$mysql_log_count=345;
$one_mysql_log=0;
require("dbconnect.php");
@@ -438,6 +447,8 @@ if (isset($_GET["DiaL_SecondS"])) {$DiaL_SecondS=$_GET["DiaL_SecondS"];}
elseif (isset($_POST["DiaL_SecondS"])) {$DiaL_SecondS=$_POST["DiaL_SecondS"];}
if (isset($_GET["date"])) {$date=$_GET["date"];}
elseif (isset($_POST["date"])) {$date=$_POST["date"];}
if (isset($_GET["custom_field_names"])) {$FORMcustom_field_names=$_GET["custom_field_names"];}
elseif (isset($_POST["custom_field_names"])) {$FORMcustom_field_names=$_POST["custom_field_names"];}
header ("Content-type: text/html; charset=utf-8");
@@ -453,7 +464,7 @@ $ENTRYdate = date("YmdHis");
$MT[0]='';
$agents='@agents';
$US='_';
while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);}
##### Hangup Cause Dictionary #####
$hangup_cause_dictionary = array(
@@ -1772,6 +1783,7 @@ if ($ACTION == 'manDiaLnextCaLL')
$rank = trim("$row[32]");
$owner = trim("$row[33]");
$entry_list_id = trim("$row[34]");
if ($entry_list_id < 100) {$entry_list_id = $list_id;}
}
$called_count++;
@@ -1791,8 +1803,8 @@ if ($ACTION == 'manDiaLnextCaLL')
if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) )
{
# generate callerID for unique identifier in xfer_log file
$PADlead_id = sprintf("%09s", $lead_id);
while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);}
$PADlead_id = sprintf("%010s", $lead_id);
while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);}
# Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL
$MqueryCID = "M$CIDdate$PADlead_id";
@@ -1917,8 +1929,8 @@ if ($ACTION == 'manDiaLnextCaLL')
}
if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';}
$PADlead_id = sprintf("%09s", $lead_id);
while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);}
$PADlead_id = sprintf("%010s", $lead_id);
while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);}
### check for extension append in campaign
$use_eac=0;
@@ -2152,6 +2164,50 @@ if ($ACTION == 'manDiaLnextCaLL')
if (strlen($row[4]) > 0)
{$VDCL_xferconf_e_number = $row[4];}
}
$custom_field_names='|';
$custom_field_names_SQL='';
$custom_field_values='----------';
$custom_field_types='|';
### find the names of all custom fields, if any
$stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00334',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$cffn_ct = mysql_num_rows($rslt);
$d=0;
while ($cffn_ct > $d)
{
$row=mysql_fetch_row($rslt);
$custom_field_names .= "$row[0]|";
$custom_field_names_SQL .= "$row[0],";
$custom_field_types .= "$row[1]|";
$custom_field_values .= "----------";
$d++;
}
if ($cffn_ct > 0)
{
$custom_field_names_SQL = eregi_replace(".$","",$custom_field_names_SQL);
### find the values of the named custom fields
$stmt = "SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00335',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$cffv_ct = mysql_num_rows($rslt);
if ($cffv_ct > 0)
{
$custom_field_values='----------';
$row=mysql_fetch_row($rslt);
$d=0;
while ($cffn_ct > $d)
{
$custom_field_values .= "$row[$d]----------";
$d++;
}
$custom_field_values = preg_replace("/\n/"," ",$custom_field_values);
$custom_field_values = preg_replace("/\r/","",$custom_field_values);
}
}
}
@@ -2203,6 +2259,9 @@ if ($ACTION == 'manDiaLnextCaLL')
$LeaD_InfO .= $VDCL_xferconf_d_number . "\n";
$LeaD_InfO .= $VDCL_xferconf_e_number . "\n";
$LeaD_InfO .= $entry_list_id . "\n";
$LeaD_InfO .= $custom_field_names . "\n";
$LeaD_InfO .= $custom_field_values . "\n";
$LeaD_InfO .= $custom_field_types . "\n";
echo $LeaD_InfO;
}
@@ -2410,8 +2469,8 @@ if ($ACTION == 'manDiaLonly')
{$CCID = "$temp_CID"; $CCID_on++;}
}
$PADlead_id = sprintf("%09s", $lead_id);
while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);}
$PADlead_id = sprintf("%010s", $lead_id);
while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);}
# Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL
$MqueryCID = "M$CIDdate$PADlead_id";
@@ -2751,9 +2810,12 @@ if ($stage == "start")
{
if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) )
{
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|VL_LOG_0|$uniqueid|$lead_id|$user|$list_id|$campaign|$start_epoch|$phone_number|$agent_log_id|\n");
fclose($fp);
if ($WeBRooTWritablE > 0)
{
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|VL_LOG_0|$uniqueid|$lead_id|$user|$list_id|$campaign|$start_epoch|$phone_number|$agent_log_id|\n");
fclose($fp);
}
echo "REGISTRO NO ENTRADO\n";
echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign No es válido\n";
@@ -3709,7 +3771,9 @@ if ($stage == "end")
{
if (strlen($hangup_channels[$loop_count])>5)
{
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','CH12346$StarTtime$loop_count','Channel: $hangup_channels[$loop_count]','','','','','','','','','');";
$variable = "Variable: ctuserserverconfleadphone=$loop_count$US$user$US$server_ip$US$conf_exten$US$lead_id$US$phone_number";
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','CH12346$StarTtime$loop_count','Channel: $hangup_channels[$loop_count]','$variable','','','','','','','','');";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00096',$user,$server_ip,$session_name,$one_mysql_log);}
@@ -3772,9 +3836,12 @@ if ($stage == "end")
if (!ereg('.',$VDvicidial_id))
{$vidSQL = ",vicidial_id='$VDvicidial_id'";}
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|INBND_LOG_3|$uniqueid|$lead_id|$user|$inOUT|$VLA_inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$vicidial_id|$start_epoch|$recording_id|\n");
fclose($fp);
if ($WeBRooTWritablE > 0)
{
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|INBND_LOG_3|$uniqueid|$lead_id|$user|$inOUT|$VLA_inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$vicidial_id|$start_epoch|$recording_id|\n");
fclose($fp);
}
}
}
$length_in_sec = ($StarTtime - $start_time);
@@ -3913,6 +3980,8 @@ if ($ACTION == 'VDADcheckINCOMING')
$alt_phone_note='';
$alt_phone_active='';
$alt_phone_count='';
$INclosecallid='';
$INxfercallid='';
if ( (strlen($campaign)<1) || (strlen($server_ip)<1) )
{
@@ -4018,6 +4087,7 @@ if ($ACTION == 'VDADcheckINCOMING')
$rank = trim("$row[32]");
$owner = trim("$row[33]");
$entry_list_id = trim("$row[34]");
if ($entry_list_id < 100) {$entry_list_id = $list_id;}
}
##### if lead is a callback, grab the callback comments
@@ -4140,7 +4210,7 @@ if ($ACTION == 'VDADcheckINCOMING')
else
{
$call_type = 'IN';
$stmt = "SELECT campaign_id from vicidial_closer_log where lead_id = '$lead_id' order by call_date desc limit 1;";
$stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where lead_id = '$lead_id' order by call_date desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00183',$user,$server_ip,$session_name,$one_mysql_log);}
@@ -4148,13 +4218,15 @@ if ($ACTION == 'VDADcheckINCOMING')
if ($VDCL_mvac_ct > 0)
{
$row=mysql_fetch_row($rslt);
$VDADchannel_group =$row[0];
$VDADchannel_group = $row[0];
$INclosecallid = $row[1];
$INxfercallid = $row[2];
}
}
if ($WeBRooTWritablE > 0)
{
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|$VDADchannel_group|$call_type|$dialed_number|$dialed_label\n");
fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|$VDADchannel_group|$call_type|$dialed_number|$dialed_label|$INclosecallid|$INxfercallid|\n");
fclose($fp);
}
}
@@ -4230,7 +4302,7 @@ if ($ACTION == 'VDADcheckINCOMING')
}
}
echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|X|X|||||$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number||||$VDCL_timer_action_destination|\n|\n";
echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|X|X|||||$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number||||$VDCL_timer_action_destination||||||\n|\n";
if (ereg('X',$dialed_label))
{
@@ -4267,6 +4339,21 @@ if ($ACTION == 'VDADcheckINCOMING')
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00117',$user,$server_ip,$session_name,$one_mysql_log);}
if (strlen($closecallid)<1)
{
$stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='$lead_id' and user='$user' and list_id='$list_id' order by call_date desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00336',$user,$server_ip,$session_name,$one_mysql_log);}
$VDCL_mvac_ct = mysql_num_rows($rslt);
if ($VDCL_mvac_ct > 0)
{
$row=mysql_fetch_row($rslt);
$INclosecallid = $row[0];
$INxfercallid = $row[1];
}
}
$stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
@@ -4506,9 +4593,38 @@ if ($ACTION == 'VDADcheckINCOMING')
}
}
$DID_id='';
$DID_extension='';
$DID_pattern='';
$DID_description='';
$stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='$uniqueid' order by call_date desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00337',$user,$server_ip,$session_name,$one_mysql_log);}
$VDIDL_ct = mysql_num_rows($rslt);
if ($VDIDL_ct > 0)
{
$row=mysql_fetch_row($rslt);
$DID_id = $row[0];
$DID_extension = $row[1];
$stmt = "SELECT did_pattern,did_description from vicidial_inbound_dids where did_id='$DID_id' limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00338',$user,$server_ip,$session_name,$one_mysql_log);}
$VDIDL_ct = mysql_num_rows($rslt);
if ($VDIDL_ct > 0)
{
$row=mysql_fetch_row($rslt);
$DID_pattern = $row[0];
$DID_description = $row[1];
}
}
### if web form is set then send en to vicidial.php for override of WEB_FORM address
if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|\n";}
else {echo "X|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|\n";}
if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|$DID_id|$DID_extension|$DID_pattern|$DID_description|$INclosecallid|$INxfercallid|\n";}
else {echo "X|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|$DID_id|$DID_extension|$DID_pattern|$DID_description|$INclosecallid|$INxfercallid|\n";}
$stmt = "SELECT full_name from vicidial_users where user='$tsr';";
if ($DB) {echo "$stmt\n";}
@@ -4550,6 +4666,51 @@ if ($ACTION == 'VDADcheckINCOMING')
}
}
$custom_field_names='|';
$custom_field_names_SQL='';
$custom_field_values='----------';
$custom_field_types='|';
### find the names of all custom fields, if any
$stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00339',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$cffn_ct = mysql_num_rows($rslt);
$d=0;
while ($cffn_ct > $d)
{
$row=mysql_fetch_row($rslt);
$custom_field_names .= "$row[0]|";
$custom_field_names_SQL .= "$row[0],";
$custom_field_types .= "$row[1]|";
$custom_field_values .= "----------";
$d++;
}
if ($cffn_ct > 0)
{
$custom_field_names_SQL = eregi_replace(".$","",$custom_field_names_SQL);
### find the values of the named custom fields
$stmt = "SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00340',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$cffv_ct = mysql_num_rows($rslt);
if ($cffv_ct > 0)
{
$custom_field_values='----------';
$row=mysql_fetch_row($rslt);
$d=0;
while ($cffn_ct > $d)
{
$custom_field_values .= "$row[$d]----------";
$d++;
}
$custom_field_values = preg_replace("/\n/"," ",$custom_field_values);
$custom_field_values = preg_replace("/\r/","",$custom_field_values);
}
}
$comments = eregi_replace("\r",'',$comments);
$comments = eregi_replace("\n",'!N',$comments);
@@ -4597,6 +4758,9 @@ if ($ACTION == 'VDADcheckINCOMING')
$LeaD_InfO .= $owner . "\n";
$LeaD_InfO .= $script_recording_delay . "\n";
$LeaD_InfO .= $entry_list_id . "\n";
$LeaD_InfO .= $custom_field_names . "\n";
$LeaD_InfO .= $custom_field_values . "\n";
$LeaD_InfO .= $custom_field_types . "\n";
echo $LeaD_InfO;
@@ -4703,8 +4867,8 @@ if ($ACTION == 'VDADcheckINCOMING')
$VDCL_start_call_url = eregi_replace('--A--phone_pass--B--',urlencode(trim($phone_pass)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--fronter--B--',urlencode(trim($fronter)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--closer--B--',urlencode(trim($closer)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--group--B--',urlencode(trim($group)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--channel_group--B--',urlencode(trim($channel_group)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--group--B--',urlencode(trim($VDADchannel_group)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--channel_group--B--',urlencode(trim($VDADchannel_group)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--SQLdate--B--',urlencode(trim($SQLdate)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--epoch--B--',urlencode(trim($epoch)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--uniqueid--B--',urlencode(trim($uniqueid)),$VDCL_start_call_url);
@@ -4731,6 +4895,44 @@ if ($ACTION == 'VDADcheckINCOMING')
$VDCL_start_call_url = eregi_replace('--A--user_custom_five--B--',urlencode(trim($user_custom_five)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--talk_time--B--',"0",$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--talk_time_min--B--',"0",$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--entry_list_id--B--',urlencode(trim($entry_list_id)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--did_id--B--',urlencode(trim($DID_id)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--did_extension--B--',urlencode(trim($DID_extension)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--did_pattern--B--',urlencode(trim($DID_pattern)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--did_description--B--',urlencode(trim($DID_description)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--closecallid--B--',urlencode(trim($INclosecallid)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--xfercallid--B--',urlencode(trim($INxfercallid)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--agent_log_id--B--',urlencode(trim($agent_log_id)),$VDCL_start_call_url);
if (strlen($custom_field_names)>2)
{
$custom_field_names = preg_replace("/^\||\|$/",'',$custom_field_names);
$custom_field_names = preg_replace("/\|/",",",$custom_field_names);
$custom_field_names_ARY = explode(',',$custom_field_names);
$custom_field_names_ct = count($custom_field_names_ARY);
$custom_field_names_SQL = $custom_field_names;
##### BEGIN grab the data from custom table for the lead_id
$stmt="SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00344',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$list_lead_ct = mysql_num_rows($rslt);
if ($list_lead_ct > 0)
{
$row=mysql_fetch_row($rslt);
$o=0;
while ($custom_field_names_ct > $o)
{
$form_field_value = trim("$row[$o]");
$field_name_id = $custom_field_names_ARY[$o];
$field_name_tag = "--A--" . $field_name_id . "--B--";
$VDCL_start_call_url = eregi_replace("$field_name_tag","$form_field_value",$VDCL_start_call_url);
$o++;
}
}
}
if ($DB > 0) {echo "$VDCL_start_call_url<BR>\n";}
$SCUfile = file("$VDCL_start_call_url");
if ($DB > 0) {echo "$SCUfile[0]<BR>\n";}
@@ -5219,8 +5421,8 @@ if ($ACTION == 'updateDISPO')
{$VLphone_code = "$phone_code";}
}
$PADlead_id = sprintf("%09s", $lead_id);
while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);}
$PADlead_id = sprintf("%010s", $lead_id);
while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);}
$FAKEcall_id = "$StarTtime.$PADlead_id";
$stmt = "INSERT INTO vicidial_log set uniqueid='$FAKEcall_id',lead_id='$lead_id',list_id='$VLlist_id',campaign_id='$campaign',call_date='$NOW_TIME',start_epoch='$StarTtime',end_epoch='$StarTtime',length_in_sec='0',status='$dispo_choice',phone_code='$VLphone_code',phone_number='$VLphone_number',user='$user',comments='MANUAL',processed='N',user_group='$user_group',term_reason='AGENT',alt_dial='$VLalt';";
if ($DB) {echo "$stmt\n";}
@@ -5285,7 +5487,7 @@ if ($ACTION == 'updateDISPO')
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00146',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');";
$stmt="INSERT IGNORE INTO vicidial_dnc (phone_number) values('$row[0]');";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00147',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -5298,7 +5500,7 @@ if ($ACTION == 'updateDISPO')
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00148',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$stmt="INSERT INTO vicidial_campaign_dnc (phone_number,campaign_id) values('$row[0]','$campaign');";
$stmt="INSERT IGNORE INTO vicidial_campaign_dnc (phone_number,campaign_id) values('$row[0]','$campaign');";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00149',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -6019,7 +6221,7 @@ if ($ACTION == 'updateDISPO')
$stmt = "SELECT phone_number,alt_dial from vicidial_log where uniqueid='$uniqueid';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00341',$user,$server_ip,$session_name,$one_mysql_log);}
$vl_dialed_ct = mysql_num_rows($rslt);
if ($vl_dialed_ct > 0)
{
@@ -6030,7 +6232,56 @@ if ($ACTION == 'updateDISPO')
}
}
if (eregi('--A--did_',$dispo_call_url))
{
$DID_id='';
$DID_extension='';
$DID_pattern='';
$DID_description='';
$stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='$uniqueid' order by call_date desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$VDIDL_ct = mysql_num_rows($rslt);
if ($VDIDL_ct > 0)
{
$row=mysql_fetch_row($rslt);
$DID_id = $row[0];
$DID_extension = $row[1];
$stmt = "SELECT did_pattern,did_description from vicidial_inbound_dids where did_id='$DID_id' limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$VDIDL_ct = mysql_num_rows($rslt);
if ($VDIDL_ct > 0)
{
$row=mysql_fetch_row($rslt);
$DID_pattern = $row[0];
$DID_description = $row[1];
}
}
}
if ((eregi('callid--B--',$dispo_call_url)) or (eregi('group--B--',$dispo_call_url)))
{
$INclosecallid='';
$INxfercallid='';
$VDADchannel_group=$campaign;
$stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where uniqueid='$uniqueid' and user='$user' order by call_date desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$VDCL_mvac_ct = mysql_num_rows($rslt);
if ($VDCL_mvac_ct > 0)
{
$row=mysql_fetch_row($rslt);
$VDADchannel_group = $row[0];
$INclosecallid = $row[1];
$INxfercallid = $row[2];
}
}
##### grab the data from vicidial_list for the lead_id
$stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='$lead_id' LIMIT 1;";
@@ -6107,9 +6358,9 @@ if ($ACTION == 'updateDISPO')
$dispo_call_url = eregi_replace('--A--original_phone_login--B--',"$original_phone_login",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--phone_pass--B--',"$phone_pass",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--fronter--B--',"$fronter",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--closer--B--',"$closer",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--group--B--',"$group",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--channel_group--B--',"$channel_group",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--closer--B--',"$user",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--group--B--',"$VDADchannel_group",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--channel_group--B--',"$VDADchannel_group",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--SQLdate--B--',"$SQLdate",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--epoch--B--',"$epoch",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--uniqueid--B--',"$uniqueid",$dispo_call_url);
@@ -6139,6 +6390,43 @@ if ($ACTION == 'updateDISPO')
$dispo_call_url = eregi_replace('--A--talk_time_ms--B--',"$talk_time_ms",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--talk_time_min--B--',"$talk_time_min",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--agent_log_id--B--',"$CALL_agent_log_id",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--entry_list_id--B--',"$entry_list_id",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--did_id--B--',urlencode(trim($DID_id)),$dispo_call_url);
$dispo_call_url = eregi_replace('--A--did_extension--B--',urlencode(trim($DID_extension)),$dispo_call_url);
$dispo_call_url = eregi_replace('--A--did_pattern--B--',urlencode(trim($DID_pattern)),$dispo_call_url);
$dispo_call_url = eregi_replace('--A--did_description--B--',urlencode(trim($DID_description)),$dispo_call_url);
$dispo_call_url = eregi_replace('--A--closecallid--B--',urlencode(trim($INclosecallid)),$dispo_call_url);
$dispo_call_url = eregi_replace('--A--xfercallid--B--',urlencode(trim($INxfercallid)),$dispo_call_url);
if (strlen($FORMcustom_field_names)>2)
{
$custom_field_names = preg_replace("/^\||\|$/",'',$FORMcustom_field_names);
$custom_field_names = preg_replace("/\|/",",",$custom_field_names);
$custom_field_names_ARY = explode(',',$custom_field_names);
$custom_field_names_ct = count($custom_field_names_ARY);
$custom_field_names_SQL = $custom_field_names;
##### BEGIN grab the data from custom table for the lead_id
$stmt="SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00345',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$list_lead_ct = mysql_num_rows($rslt);
if ($list_lead_ct > 0)
{
$row=mysql_fetch_row($rslt);
$o=0;
while ($custom_field_names_ct > $o)
{
$form_field_value = trim("$row[$o]");
$field_name_id = $custom_field_names_ARY[$o];
$field_name_tag = "--A--" . $field_name_id . "--B--";
$dispo_call_url = eregi_replace("$field_name_tag","$form_field_value",$dispo_call_url);
$o++;
}
}
}
if ($DB > 0) {echo "$dispo_call_url<BR>\n";}
$SCUfile = file("$dispo_call_url");
if ($DB > 0) {echo "$SCUfile[0]<BR>\n";}
@@ -7135,6 +7423,7 @@ if ($ACTION == 'CALLLOGview')
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; LENGTH &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; ESTADO &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; PHONE &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; FULL NAME &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; CAMPAIGN &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; IN/OUT &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; ALT &nbsp; </font></TD>";
@@ -7167,6 +7456,13 @@ if ($ACTION == 'CALLLOGview')
$ALLalt_dial[$g] = $row[9];
$ALLin_out[$g] = "OUT-AUTO";
if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";}
$stmtA="SELECT first_name,last_name FROM vicidial_list WHERE lead_id='$ALLlead_id[$g]';";
$rsltA=mysql_query($stmtA, $link);
$rowA=mysql_fetch_row($rsltA);
$Allfirst_name[$g] = $rowA[0];
$Alllast_name[$g] = $rowA[1];
$g++;
$u++;
}
@@ -7193,6 +7489,13 @@ if ($ACTION == 'CALLLOGview')
$ALLhangup_reason[$g] = $row[8];
$ALLalt_dial[$g] = "MAIN";
$ALLin_out[$g] = "IN";
$stmtA="SELECT first_name,last_name FROM vicidial_list WHERE lead_id='$ALLlead_id[$g]';";
$rsltA=mysql_query($stmtA, $link);
$rowA=mysql_fetch_row($rsltA);
$Allfirst_name[$g] = $rowA[0];
$Alllast_name[$g] = $rowA[1];
$g++;
$u++;
}
@@ -7220,6 +7523,7 @@ if ($ACTION == 'CALLLOGview')
echo "<td align=right><font size=2> $ALLlength_in_sec[$i]</td>\n";
echo "<td align=right><font size=2> $ALLstatus[$i]</td>\n";
echo "<td align=right><font size=2> $ALLphone_code[$i] $ALLphone_number[$i] </td>\n";
echo "<td align=right><font size=2> $Allfirst_name[$i] $Alllast_name[$i] </td>\n";
echo "<td align=right><font size=2> $ALLcampaign_id[$i] </td>\n";
echo "<td align=right><font size=2> $ALLin_out[$i] </td>\n";
echo "<td align=right><font size=2> $ALLalt_dial[$i] </td>\n";
@@ -7488,6 +7792,22 @@ if ($ACTION == 'CalLBacKCounT')
################################################################################
### customer_3way_hangup_process - send the count of the USERONLY callbacks for an agent
################################################################################
if ($ACTION == 'customer_3way_hangup_process')
{
$stmt="UPDATE user_call_log SET customer_hungup='$status',customer_hungup_seconds='$stage' where lead_id='$lead_id' and user='$user' and call_type LIKE \"%3WAY%\" order by user_call_log_id desc limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00342',$user,$server_ip,$session_name,$one_mysql_log);}
echo "DONE: $stage|$lead_id|$status";
}
################################################################################
### DiaLableLeaDsCounT - send the count of the dialable leads in this campaign
################################################################################
@@ -7516,7 +7836,7 @@ if ($ACTION == 'Clear_API_Field')
$stmt="UPDATE vicidial_live_agents SET $comments='' where user='$user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00343',$user,$server_ip,$session_name,$one_mysql_log);}
echo "DONE: $comments";
}
@@ -11,10 +11,11 @@
# 100630-1119 - First build of script
# 100703-1124 - Added submit_button,admin_submit fields, which will log to admin log
# 100712-2322 - Added code to log vicidial_list.entry_list_id field if data altered
# 100916-1749 - Added non-lead variable parsing
#
$version = '2.4-3';
$build = '100712-2322';
$version = '2.4-4';
$build = '100916-1749';
require("dbconnect.php");
require("functions.php");
@@ -43,10 +44,108 @@ if (isset($_GET["admin_submit"])) {$admin_submit=$_GET["admin_submit"];}
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
if (isset($_GET["closer"])) {$closer=$_GET["closer"];}
elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
if (isset($_GET["preset_number_a"])) {$preset_number_a=$_GET["preset_number_a"];}
elseif (isset($_POST["preset_number_a"])) {$preset_number_a=$_POST["preset_number_a"];}
if (isset($_GET["preset_number_b"])) {$preset_number_b=$_GET["preset_number_b"];}
elseif (isset($_POST["preset_number_b"])) {$preset_number_b=$_POST["preset_number_b"];}
if (isset($_GET["preset_number_c"])) {$preset_number_c=$_GET["preset_number_c"];}
elseif (isset($_POST["preset_number_c"])) {$preset_number_c=$_POST["preset_number_c"];}
if (isset($_GET["preset_number_d"])) {$preset_number_d=$_GET["preset_number_d"];}
elseif (isset($_POST["preset_number_d"])) {$preset_number_d=$_POST["preset_number_d"];}
if (isset($_GET["preset_number_e"])) {$preset_number_e=$_GET["preset_number_e"];}
elseif (isset($_POST["preset_number_e"])) {$preset_number_e=$_POST["preset_number_e"];}
if (isset($_GET["preset_number_f"])) {$preset_number_f=$_GET["preset_number_f"];}
elseif (isset($_POST["preset_number_f"])) {$preset_number_f=$_POST["preset_number_f"];}
if (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];}
elseif (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];}
if (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];}
elseif (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];}
if (isset($_GET["did_id"])) {$did_id=$_GET["did_id"];}
elseif (isset($_POST["did_id"])) {$did_id=$_POST["did_id"];}
if (isset($_GET["did_extension"])) {$did_extension=$_GET["did_extension"];}
elseif (isset($_POST["did_extension"])) {$did_extension=$_POST["did_extension"];}
if (isset($_GET["did_pattern"])) {$did_pattern=$_GET["did_pattern"];}
elseif (isset($_POST["did_pattern"])) {$did_pattern=$_POST["did_pattern"];}
if (isset($_GET["did_description"])) {$did_description=$_GET["did_description"];}
elseif (isset($_POST["did_description"])) {$did_description=$_POST["did_description"];}
if (isset($_GET["closecallid"])) {$closecallid=$_GET["closecallid"];}
elseif (isset($_POST["closecallid"])) {$closecallid=$_POST["closecallid"];}
if (isset($_GET["xfercallid"])) {$xfercallid=$_GET["xfercallid"];}
elseif (isset($_POST["xfercallid"])) {$xfercallid=$_POST["xfercallid"];}
if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];}
elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
if ($stage=='WELCOME')
{echo "FORM"; exit;}
$txt = '.txt';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
@@ -328,7 +427,7 @@ else
echo " </script>\n";
echo " <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "</head>\n";
echo '<BODY BGCOLOR="#' . $bgcolor . '" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>';
echo "<BODY BGCOLOR=\"#" . $bgcolor . "\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"parent.document.getElementById('FORM_LOADED').value='1';\">";
echo "\n";
echo "<form action=./vdc_form_display.php method=POST name=form_custom_fields id=form_custom_fields>\n";
echo "<input type=hidden name=lead_id id=lead_id value=\"$lead_id\">\n";
@@ -12,10 +12,12 @@
# 91211-1103 - Added user_custom_... variables
# 100116-0702 - Added preset variables
# 100127-1611 - Added ignore_list_script_override option
# 100823-1644 - Added DID variables
# 100902-1344 - Added closecallid, xfercallid, agent_log_id variables
#
$version = '2.2.0-6';
$build = '100127-1611';
$version = '2.4-8';
$build = '100902-1344';
require("dbconnect.php");
@@ -161,10 +163,29 @@ if (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];}
elseif (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];}
if (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];}
elseif (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];}
if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
if (isset($_GET["did_id"])) {$did_id=$_GET["did_id"];}
elseif (isset($_POST["did_id"])) {$did_id=$_POST["did_id"];}
if (isset($_GET["did_extension"])) {$did_extension=$_GET["did_extension"];}
elseif (isset($_POST["did_extension"])) {$did_extension=$_POST["did_extension"];}
if (isset($_GET["did_pattern"])) {$did_pattern=$_GET["did_pattern"];}
elseif (isset($_POST["did_pattern"])) {$did_pattern=$_POST["did_pattern"];}
if (isset($_GET["did_description"])) {$did_description=$_GET["did_description"];}
elseif (isset($_POST["did_description"])) {$did_description=$_POST["did_description"];}
if (isset($_GET["closecallid"])) {$closecallid=$_GET["closecallid"];}
elseif (isset($_POST["closecallid"])) {$closecallid=$_POST["closecallid"];}
if (isset($_GET["xfercallid"])) {$xfercallid=$_GET["xfercallid"];}
elseif (isset($_POST["xfercallid"])) {$xfercallid=$_POST["xfercallid"];}
if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];}
elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];}
if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
if (isset($_GET["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_GET["CF_uses_custom_fields"];}
elseif (isset($_POST["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_POST["CF_uses_custom_fields"];}
if (isset($_GET["entry_list_id"])) {$entry_list_id=$_GET["entry_list_id"];}
elseif (isset($_POST["entry_list_id"])) {$entry_list_id=$_POST["entry_list_id"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@@ -363,6 +384,10 @@ if (eregi("iframe src",$script_text))
$preset_number_f = eregi_replace(' ','+',$preset_number_f);
$preset_dtmf_a = eregi_replace(' ','+',$preset_dtmf_a);
$preset_dtmf_b = eregi_replace(' ','+',$preset_dtmf_b);
$did_id = eregi_replace(' ','+',$did_id);
$did_extension = eregi_replace(' ','+',$did_extension);
$did_pattern = eregi_replace(' ','+',$did_pattern);
$did_description = eregi_replace(' ','+',$did_description);
}
$script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text);
@@ -438,6 +463,36 @@ $script_text = eregi_replace('--A--preset_number_e--B--',"$preset_number_e",$scr
$script_text = eregi_replace('--A--preset_number_f--B--',"$preset_number_f",$script_text);
$script_text = eregi_replace('--A--preset_dtmf_a--B--',"$preset_dtmf_a",$script_text);
$script_text = eregi_replace('--A--preset_dtmf_b--B--',"$preset_dtmf_b",$script_text);
$script_text = eregi_replace('--A--did_id--B--',"$did_id",$script_text);
$script_text = eregi_replace('--A--did_extension--B--',"$did_extension",$script_text);
$script_text = eregi_replace('--A--did_pattern--B--',"$did_pattern",$script_text);
$script_text = eregi_replace('--A--did_description--B--',"$did_description",$script_text);
$script_text = eregi_replace('--A--closecallid--B--',"$closecallid",$script_text);
$script_text = eregi_replace('--A--xfercallid--B--',"$xfercallid",$script_text);
$script_text = eregi_replace('--A--agent_log_id--B--',"$agent_log_id",$script_text);
$script_text = eregi_replace('--A--entry_list_id--B--',"$entry_list_id",$script_text);
if ($CF_uses_custom_fields=='Y')
{
### find the names of all custom fields, if any
$stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$cffn_ct = mysql_num_rows($rslt);
$d=0;
while ($cffn_ct > $d)
{
$row=mysql_fetch_row($rslt);
$field_name_id = $row[0];
$field_name_tag = "--A--" . $field_name_id . "--B--";
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
$script_text = eregi_replace("$field_name_tag","$form_field_value",$script_text);
if ($DB) {echo "$d|$field_name_id|$field_name_tag|$form_field_value|<br>\n";}
$d++;
}
}
$script_text = eregi_replace("\n","<BR>",$script_text);
$script_text = stripslashes($script_text);
File diff suppressed because it is too large Load Diff
@@ -202,6 +202,8 @@ echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>
$Aagent_log_id='';
$Acallerid='';
$DEADcustomer=0;
$Astatus='';
$Acampaign_id='';
### see if the agent has a record in the vicidial_live_agents table
$stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
+24 -6
View File
@@ -96,12 +96,16 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
$last_rank = $o;
$select_SQL = preg_replace("/.$/",'',$select_SQL);
##### BEGIN grab the data from custom table for the lead_id
$stmt="SELECT $select_SQL FROM custom_$list_id where lead_id='$lead_id' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05005',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$list_lead_ct = mysql_num_rows($rslt);
$list_lead_ct=0;
if (strlen($select_SQL)>0)
{
##### BEGIN grab the data from custom table for the lead_id
$stmt="SELECT $select_SQL FROM custom_$list_id where lead_id='$lead_id' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'05005',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$list_lead_ct = mysql_num_rows($rslt);
}
if ($list_lead_ct > 0)
{
$row=mysql_fetch_row($rslt);
@@ -457,6 +461,20 @@ function custom_list_fields_values($lead_id,$list_id,$uniqueid,$user)
$CFoutput = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$CFoutput);
$CFoutput = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$CFoutput);
$CFoutput = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$CFoutput);
$CFoutput = eregi_replace('--A--preset_number_a--B--',"$preset_number_a",$CFoutput);
$CFoutput = eregi_replace('--A--preset_number_b--B--',"$preset_number_b",$CFoutput);
$CFoutput = eregi_replace('--A--preset_number_c--B--',"$preset_number_c",$CFoutput);
$CFoutput = eregi_replace('--A--preset_number_d--B--',"$preset_number_d",$CFoutput);
$CFoutput = eregi_replace('--A--preset_number_e--B--',"$preset_number_e",$CFoutput);
$CFoutput = eregi_replace('--A--preset_dtmf_a--B--',"$preset_dtmf_a",$CFoutput);
$CFoutput = eregi_replace('--A--preset_dtmf_b--B--',"$preset_dtmf_b",$CFoutput);
$CFoutput = eregi_replace('--A--did_id--B--',"$did_id",$CFoutput);
$CFoutput = eregi_replace('--A--did_extension--B--',"$did_extension",$CFoutput);
$CFoutput = eregi_replace('--A--did_pattern--B--',"$did_pattern",$CFoutput);
$CFoutput = eregi_replace('--A--did_description--B--',"$did_description",$CFoutput);
$CFoutput = eregi_replace('--A--closecallid--B--',"$closecallid",$CFoutput);
$CFoutput = eregi_replace('--A--xfercallid--B--',"$xfercallid",$CFoutput);
$CFoutput = eregi_replace('--A--agent_log_id--B--',"$agent_log_id",$CFoutput);
# custom fields replacement
$o=0;
+183 -9
View File
@@ -42,6 +42,7 @@
# - $agent_dialed_type - ('MANUAL_OVERRIDE','MANUAL_DIALNOW','MANUAL_PREVIEW',...)
# - $nodeletevdac - ('0','1')
# - $alertCID - ('0','1')
# - $preset_name = ('TESTING PRESET',...)
#
# CHANGELOG:
# 50401-1002 - First build of script, Hangup function only
@@ -98,12 +99,15 @@
# 100327-0846 - Fix for list_id override answering machine message
# 100423-2304 - Added alertCID
# 100527-1014 - Added SysCIDdtmfOriginate function
# 100813-0833 - Added preset_name variable and logging
# 101004-1345 - Added Ivr park functions
# 101024-1638 - Added park_log logging for parked calls
#
$version = '2.4-49';
$build = '100527-1014';
$version = '2.4-52';
$build = '101024-1638';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=85;
$mysql_log_count=97;
$one_mysql_log=0;
require("dbconnect.php");
@@ -191,6 +195,9 @@ if (isset($_GET["nodeletevdac"])) {$nodeletevdac=$_GET["nodeletevdac"];}
elseif (isset($_POST["nodeletevdac"])) {$nodeletevdac=$_POST["nodeletevdac"];}
if (isset($_GET["alertCID"])) {$alertCID=$_GET["alertCID"];}
elseif (isset($_POST["alertCID"])) {$alertCID=$_POST["alertCID"];}
if (isset($_GET["preset_name"])) {$preset_name=$_GET["preset_name"];}
elseif (isset($_POST["preset_name"])) {$preset_name=$_POST["preset_name"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@@ -303,7 +310,7 @@ if ($ACTION=="SysCIDdtmfOriginate")
$stmt="UPDATE vicidial_live_agents SET external_dtmf='' where user='$user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02092',$user,$server_ip,$session_name,$one_mysql_log);}
$ACTION="SysCIDOriginate";
}
@@ -442,10 +449,34 @@ if ($ACTION=="Originate")
if ($agent_dialed_number > 0)
{
$stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$exten','$channel','0','$outbound_cid','$RAWaccount')";
if (strlen($lead_id)<1) {$lead_id='0';}
$customer_hungup='';
if ( ($stage > 0) and (preg_match("/3WAY/",$agent_dialed_type)) )
{$customer_hungup = 'BEFORE_CALL';}
$stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,callerid,group_alias_id,preset_name,campaign_id,customer_hungup) values('$user','$NOW_TIME','$agent_dialed_type','$server_ip','$exten','$channel','$lead_id','$outbound_cid','$RAWaccount','$preset_name','$campaign','$customer_hungup')";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00192',$user,$server_ip,$session_name,$one_mysql_log);}
if (strlen($preset_name) > 0)
{
$stmt = "SELECT count(*) from vicidial_xfer_stats where campaign_id='$campaign' and preset_name='$preset_name';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02093',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt = "UPDATE vicidial_xfer_stats SET xfer_count=(xfer_count+1) where campaign_id='$campaign' and preset_name='$preset_name';";
}
else
{
$stmt = "INSERT INTO vicidial_xfer_stats SET campaign_id='$campaign',preset_name='$preset_name',xfer_count='1';";
}
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02094',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
}
}
@@ -754,6 +785,32 @@ if ($ACTION=="RedirectVD")
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02024',$user,$server_ip,$session_name,$one_mysql_log);}
}
if (strlen($preset_name) > 0)
{
$stmt = "INSERT INTO user_call_log (user,call_date,call_type,server_ip,phone_number,number_dialed,lead_id,preset_name,campaign_id) values('$user','$NOW_TIME','BLIND_XFER','$server_ip','$exten','$channel','$lead_id','$preset_name','$campaign')";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02095',$user,$server_ip,$session_name,$one_mysql_log);}
$stmt = "SELECT count(*) from vicidial_xfer_stats where campaign_id='$campaign' and preset_name='$preset_name';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02096',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
if ($row[0] > 0)
{
$stmt = "UPDATE vicidial_xfer_stats SET xfer_count=(xfer_count+1) where campaign_id='$campaign' and preset_name='$preset_name';";
}
else
{
$stmt = "INSERT INTO vicidial_xfer_stats SET campaign_id='$campaign',preset_name='$preset_name',xfer_count='1';";
}
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02097',$user,$server_ip,$session_name,$one_mysql_log);}
}
$ACTION="Redirect";
}
}
@@ -782,6 +839,11 @@ if ($ACTION=="RedirectToPark")
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02025',$user,$server_ip,$session_name,$one_mysql_log);}
$ACTION="Redirect";
$stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='ATTESAED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
# $fp = fopen ("./vicidial_debug.txt", "a");
# fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n");
# fclose($fp);
@@ -790,7 +852,7 @@ if ($ACTION=="RedirectToPark")
$stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02086',$user,$server_ip,$session_name,$one_mysql_log);}
}
if ($ACTION=="RedirectFromPark")
@@ -814,14 +876,126 @@ if ($ACTION=="RedirectFromPark")
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02026',$user,$server_ip,$session_name,$one_mysql_log);}
$ACTION="Redirect";
$parked_sec=0;
$stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$VAC_pl_ct = mysql_num_rows($rslt);
if ($VAC_pl_ct > 0)
{
$row=mysql_fetch_row($rslt);
$parked_sec = ($StarTtime - $row[0]);
$stmt = "UPDATE park_log SET status='GRABBED',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
$stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02087',$user,$server_ip,$session_name,$one_mysql_log);}
}
if ($ACTION=="RedirectToParkIVR")
{
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) or (strlen($parkedby)<1) )
{
$channel_live=0;
echo "Una di queste variabili non è valido:\n";
echo "Channel $channel deve avere più di 2 caratteri\n";
echo "queryCID $queryCID deve avere più di 14 caratteri\n";
echo "exten $exten deve essere impostato\n";
echo "extenName $extenName deve essere impostato\n";
echo "ext_context $ext_context deve essere impostato\n";
echo "ext_priority $ext_priority deve essere impostato\n";
echo "parkedby $parkedby deve essere impostato\n";
echo "\nRedirectToPark Action non inviato\n";
}
else
{
if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;}
$stmt = "INSERT INTO parked_channels values('$channel','$server_ip','$CalLCID','$extenName','$parkedby','$NOW_TIME');";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02025',$user,$server_ip,$session_name,$one_mysql_log);}
$ACTION="Redirect";
$stmt = "UPDATE vicidial_auto_calls SET extension='ATTESA_IVR' where callerid='$CalLCID' limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02088',$user,$server_ip,$session_name,$one_mysql_log);}
$stmt = "INSERT INTO park_log SET uniqueid='$uniqueid',status='IVRATTESAED',channel='$channel',channel_group='$campaign',server_ip='$server_ip',parked_time='$NOW_TIME',parked_sec=0,extension='$CalLCID',user='$user',lead_id='$lead_id';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
# $fp = fopen ("./vicidial_debug.txt", "a");
# fwrite ($fp, "$NOW_TIME|MS_LOG_0|$queryCID|$stmt|\n");
# fclose($fp);
}
$stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02089',$user,$server_ip,$session_name,$one_mysql_log);}
}
if ($ACTION=="RedirectFromParkIVR")
{
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($exten)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) )
{
$channel_live=0;
echo "Una di queste variabili non è valido:\n";
echo "Channel $channel deve avere più di 2 caratteri\n";
echo "queryCID $queryCID deve avere più di 14 caratteri\n";
echo "exten $exten deve essere impostato\n";
echo "ext_context $ext_context deve essere impostato\n";
echo "ext_priority $ext_priority deve essere impostato\n";
echo "\nRedirectFromPark Action non inviato\n";
}
else
{
if (strlen($call_server_ip)>6) {$server_ip = $call_server_ip;}
$stmt = "DELETE FROM parked_channels where server_ip='$server_ip' and channel='$channel';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02026',$user,$server_ip,$session_name,$one_mysql_log);}
$ACTION="Redirect";
$stmt = "UPDATE vicidial_auto_calls SET extension='' where callerid='$CalLCID' limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02090',$user,$server_ip,$session_name,$one_mysql_log);}
$parked_sec=0;
$stmt = "SELECT UNIX_TIMESTAMP(parked_time) FROM park_log where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' and (parked_sec < 1 or grab_time is NULL) order by parked_time desc limit 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$VAC_pl_ct = mysql_num_rows($rslt);
if ($VAC_pl_ct > 0)
{
$row=mysql_fetch_row($rslt);
$parked_sec = ($StarTtime - $row[0]);
$stmt = "UPDATE park_log SET status='GRABBEDIVR',grab_time='$NOW_TIME',parked_sec='$parked_sec' where uniqueid='$uniqueid' and server_ip='$server_ip' and extension='$CalLCID' order by parked_time desc limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02XXX',$user,$server_ip,$session_name,$one_mysql_log);}
}
}
$stmt="UPDATE vicidial_live_agents SET external_park='' where user='$user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02091',$user,$server_ip,$session_name,$one_mysql_log);}
}
if ($ACTION=="RedirectName")
{
if ( (strlen($channel)<3) or (strlen($queryCID)<15) or (strlen($extenName)<1) or (strlen($ext_context)<1) or (strlen($ext_priority)<1) )
@@ -1135,7 +1309,7 @@ if ($ACTION=="RedirectXtraNeW")
if ($WeBRooTWritablE > 0)
{
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|$session_id|\n");
fwrite ($fp, "$NOW_TIME|RDX|$filename|$user|$campaign|$channel|$extrachannel|$queryCID|$exten|$ext_context|ext_priority|$session_id|\n");
fclose($fp);
}
}
@@ -1680,7 +1854,7 @@ exit;
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
{
$NOW_TIME = date("Y-m-d H:i:s");
# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);
# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'02001',$user,$server_ip,$session_name,$one_mysql_log);
$errno=''; $error='';
if ( ($mel > 0) or ($one_mysql_log > 0) )
{
+356 -36
View File
@@ -12,7 +12,7 @@
# - $pass
# optional variables:
# - $format - ('text','debug')
# - $ACTION - ('regCLOSER','regTERRITORY','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCaLL','manDiaLlogCALL','userLOGout','updateDISPO','updateLEAD','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl','AGENTSview','CALLSINQUEUEview','CALLSINQUEUEgrab','DiaLableLeaDsCounT','UpdateFields','CALLLOGview','LEADINFOview')
# - $ACTION - ('regCLOSER','regTERRITORY','manDiaLnextCALL','manDiaLskip','manDiaLonly','manDiaLlookCaLL','manDiaLlogCALL','userLOGout','updateDISPO','updateLEAD','VDADpause','VDADready','VDADcheckINCOMING','UpdatEFavoritEs','CalLBacKLisT','CalLBacKCounT','PauseCodeSubmit','LogiNCamPaigns','alt_phone_change','AlertControl','AGENTSview','CALLSINQUEUEview','CALLSINQUEUEgrab','DiaLableLeaDsCounT','UpdateFields','CALLLOGview','LEADINFOview','customer_3way_hangup_process')
# - $stage - ('start','finish','lookup','new')
# - $closer_choice - ('CL_TESTCAMP_L CL_OUT123_L -')
# - $conf_exten - ('8600011',...)
@@ -88,6 +88,7 @@
# - $alt_num_status - ('0','1')
# - $DiaL_SecondS - ('0','1','2',...)
# - $date - ('2010-02-19')
# - $custom_field_names - ('|start_date|finish_date|favorite_color|')
#
# CHANGELOG:
# 50629-1044 - First build of script
@@ -250,13 +251,21 @@
# 100624-1401 - Fix for dispo call url bug related to dialed number and label
# 100625-0915 - Fix for auto-dial bug for presets and timer actions
# 100712-1447 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
# 100803-0822 - Added CAMPLISTS_ALL for manual_dial_filter(issue #369
# 100803-0822 - Added CAMPLISTS_ALL for manual_dial_filter(issue #369)
# 100823-1612 - Added DID variables on inbound calls
# 100902-1348 - Added closecallid and xfercallid variables
# 100903-0041 - Changed lead_id max length to 10 digits
# 100908-1102 - Added customer_3way_hangup_process function
# 100916-2144 - Added custom list names export with lead data
# 100927-1618 - Added ability to use custom fields in web form and dispo_call_url
# 101001-1451 - Added full name display to Call Log functionality
# 101022-1243 - Fixed missing variables from start and dispo call urls
#
$version = '2.4-158';
$build = '100803-0822';
$version = '2.4-166';
$build = '101022-1243';
$mel=1; # Mysql Error Log enabled = 1
$mysql_log_count=333;
$mysql_log_count=345;
$one_mysql_log=0;
require("dbconnect.php");
@@ -438,6 +447,8 @@ if (isset($_GET["DiaL_SecondS"])) {$DiaL_SecondS=$_GET["DiaL_SecondS"];}
elseif (isset($_POST["DiaL_SecondS"])) {$DiaL_SecondS=$_POST["DiaL_SecondS"];}
if (isset($_GET["date"])) {$date=$_GET["date"];}
elseif (isset($_POST["date"])) {$date=$_POST["date"];}
if (isset($_GET["custom_field_names"])) {$FORMcustom_field_names=$_GET["custom_field_names"];}
elseif (isset($_POST["custom_field_names"])) {$FORMcustom_field_names=$_POST["custom_field_names"];}
header ("Content-type: text/html; charset=utf-8");
@@ -453,7 +464,7 @@ $ENTRYdate = date("YmdHis");
$MT[0]='';
$agents='@agents';
$US='_';
while (strlen($CIDdate) > 9) {$CIDdate = substr("$CIDdate", 1);}
##### Hangup Cause Dictionary #####
$hangup_cause_dictionary = array(
@@ -1772,6 +1783,7 @@ if ($ACTION == 'manDiaLnextCaLL')
$rank = trim("$row[32]");
$owner = trim("$row[33]");
$entry_list_id = trim("$row[34]");
if ($entry_list_id < 100) {$entry_list_id = $list_id;}
}
$called_count++;
@@ -1791,8 +1803,8 @@ if ($ACTION == 'manDiaLnextCaLL')
if ( ($WeBRooTWritablE > 0) and ($enable_agc_xfer_log > 0) )
{
# generate callerID for unique identifier in xfer_log file
$PADlead_id = sprintf("%09s", $lead_id);
while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);}
$PADlead_id = sprintf("%010s", $lead_id);
while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);}
# Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL
$MqueryCID = "M$CIDdate$PADlead_id";
@@ -1917,8 +1929,8 @@ if ($ACTION == 'manDiaLnextCaLL')
}
if (eregi("x",$dial_prefix)) {$Local_out_prefix = '';}
$PADlead_id = sprintf("%09s", $lead_id);
while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);}
$PADlead_id = sprintf("%010s", $lead_id);
while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);}
### check for extension append in campaign
$use_eac=0;
@@ -2152,6 +2164,50 @@ if ($ACTION == 'manDiaLnextCaLL')
if (strlen($row[4]) > 0)
{$VDCL_xferconf_e_number = $row[4];}
}
$custom_field_names='|';
$custom_field_names_SQL='';
$custom_field_values='----------';
$custom_field_types='|';
### find the names of all custom fields, if any
$stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00334',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$cffn_ct = mysql_num_rows($rslt);
$d=0;
while ($cffn_ct > $d)
{
$row=mysql_fetch_row($rslt);
$custom_field_names .= "$row[0]|";
$custom_field_names_SQL .= "$row[0],";
$custom_field_types .= "$row[1]|";
$custom_field_values .= "----------";
$d++;
}
if ($cffn_ct > 0)
{
$custom_field_names_SQL = eregi_replace(".$","",$custom_field_names_SQL);
### find the values of the named custom fields
$stmt = "SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00335',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$cffv_ct = mysql_num_rows($rslt);
if ($cffv_ct > 0)
{
$custom_field_values='----------';
$row=mysql_fetch_row($rslt);
$d=0;
while ($cffn_ct > $d)
{
$custom_field_values .= "$row[$d]----------";
$d++;
}
$custom_field_values = preg_replace("/\n/"," ",$custom_field_values);
$custom_field_values = preg_replace("/\r/","",$custom_field_values);
}
}
}
@@ -2203,6 +2259,9 @@ if ($ACTION == 'manDiaLnextCaLL')
$LeaD_InfO .= $VDCL_xferconf_d_number . "\n";
$LeaD_InfO .= $VDCL_xferconf_e_number . "\n";
$LeaD_InfO .= $entry_list_id . "\n";
$LeaD_InfO .= $custom_field_names . "\n";
$LeaD_InfO .= $custom_field_values . "\n";
$LeaD_InfO .= $custom_field_types . "\n";
echo $LeaD_InfO;
}
@@ -2410,8 +2469,8 @@ if ($ACTION == 'manDiaLonly')
{$CCID = "$temp_CID"; $CCID_on++;}
}
$PADlead_id = sprintf("%09s", $lead_id);
while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);}
$PADlead_id = sprintf("%010s", $lead_id);
while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);}
# Create unique calleridname to track the call: MmmddhhmmssLLLLLLLLL
$MqueryCID = "M$CIDdate$PADlead_id";
@@ -2751,9 +2810,12 @@ if ($stage == "start")
{
if ( (strlen($uniqueid)<1) || (strlen($lead_id)<1) || (strlen($list_id)<1) || (strlen($phone_number)<1) || (strlen($campaign)<1) )
{
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|VL_LOG_0|$uniqueid|$lead_id|$user|$list_id|$campaign|$start_epoch|$phone_number|$agent_log_id|\n");
fclose($fp);
if ($WeBRooTWritablE > 0)
{
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|VL_LOG_0|$uniqueid|$lead_id|$user|$list_id|$campaign|$start_epoch|$phone_number|$agent_log_id|\n");
fclose($fp);
}
echo "LOG NON INSERITO\n";
echo "uniqueid $uniqueid or lead_id: $lead_id or list_id: $list_id or phone_number: $phone_number or campaign: $campaign non è valido\n";
@@ -3709,7 +3771,9 @@ if ($stage == "end")
{
if (strlen($hangup_channels[$loop_count])>5)
{
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','CH12346$StarTtime$loop_count','Channel: $hangup_channels[$loop_count]','','','','','','','','','');";
$variable = "Variable: ctuserserverconfleadphone=$loop_count$US$user$US$server_ip$US$conf_exten$US$lead_id$US$phone_number";
$stmt="INSERT INTO vicidial_manager values('','','$NOW_TIME','NEW','N','$server_ip','','Hangup','CH12346$StarTtime$loop_count','Channel: $hangup_channels[$loop_count]','$variable','','','','','','','','');";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00096',$user,$server_ip,$session_name,$one_mysql_log);}
@@ -3772,9 +3836,12 @@ if ($stage == "end")
if (!ereg('.',$VDvicidial_id))
{$vidSQL = ",vicidial_id='$VDvicidial_id'";}
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|INBND_LOG_3|$uniqueid|$lead_id|$user|$inOUT|$VLA_inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$vicidial_id|$start_epoch|$recording_id|\n");
fclose($fp);
if ($WeBRooTWritablE > 0)
{
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|INBND_LOG_3|$uniqueid|$lead_id|$user|$inOUT|$VLA_inOUT|$length_in_sec|$VDterm_reason|$VDvicidial_id|$vicidial_id|$start_epoch|$recording_id|\n");
fclose($fp);
}
}
}
$length_in_sec = ($StarTtime - $start_time);
@@ -3913,6 +3980,8 @@ if ($ACTION == 'VDADcheckINCOMING')
$alt_phone_note='';
$alt_phone_active='';
$alt_phone_count='';
$INclosecallid='';
$INxfercallid='';
if ( (strlen($campaign)<1) || (strlen($server_ip)<1) )
{
@@ -4018,6 +4087,7 @@ if ($ACTION == 'VDADcheckINCOMING')
$rank = trim("$row[32]");
$owner = trim("$row[33]");
$entry_list_id = trim("$row[34]");
if ($entry_list_id < 100) {$entry_list_id = $list_id;}
}
##### if lead is a callback, grab the callback comments
@@ -4140,7 +4210,7 @@ if ($ACTION == 'VDADcheckINCOMING')
else
{
$call_type = 'IN';
$stmt = "SELECT campaign_id from vicidial_closer_log where lead_id = '$lead_id' order by call_date desc limit 1;";
$stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where lead_id = '$lead_id' order by call_date desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00183',$user,$server_ip,$session_name,$one_mysql_log);}
@@ -4148,13 +4218,15 @@ if ($ACTION == 'VDADcheckINCOMING')
if ($VDCL_mvac_ct > 0)
{
$row=mysql_fetch_row($rslt);
$VDADchannel_group =$row[0];
$VDADchannel_group = $row[0];
$INclosecallid = $row[1];
$INxfercallid = $row[2];
}
}
if ($WeBRooTWritablE > 0)
{
$fp = fopen ("./vicidial_debug.txt", "a");
fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|$VDADchannel_group|$call_type|$dialed_number|$dialed_label\n");
fwrite ($fp, "$NOW_TIME|INBND|$callerid|$user|$user_group|$list_id|$lead_id|$phone_number|$uniqueid|$VDADchannel_group|$call_type|$dialed_number|$dialed_label|$INclosecallid|$INxfercallid|\n");
fclose($fp);
}
}
@@ -4230,7 +4302,7 @@ if ($ACTION == 'VDADcheckINCOMING')
}
}
echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|X|X|||||$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number||||$VDCL_timer_action_destination|\n|\n";
echo "|||||$VDCL_campaign_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|X|X|||||$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number||||$VDCL_timer_action_destination||||||\n|\n";
if (ereg('X',$dialed_label))
{
@@ -4267,6 +4339,21 @@ if ($ACTION == 'VDADcheckINCOMING')
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00117',$user,$server_ip,$session_name,$one_mysql_log);}
if (strlen($closecallid)<1)
{
$stmt = "SELECT closecallid,xfercallid from vicidial_closer_log where lead_id='$lead_id' and user='$user' and list_id='$list_id' order by call_date desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00336',$user,$server_ip,$session_name,$one_mysql_log);}
$VDCL_mvac_ct = mysql_num_rows($rslt);
if ($VDCL_mvac_ct > 0)
{
$row=mysql_fetch_row($rslt);
$INclosecallid = $row[0];
$INxfercallid = $row[1];
}
}
$stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
@@ -4506,9 +4593,38 @@ if ($ACTION == 'VDADcheckINCOMING')
}
}
$DID_id='';
$DID_extension='';
$DID_pattern='';
$DID_description='';
$stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='$uniqueid' order by call_date desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00337',$user,$server_ip,$session_name,$one_mysql_log);}
$VDIDL_ct = mysql_num_rows($rslt);
if ($VDIDL_ct > 0)
{
$row=mysql_fetch_row($rslt);
$DID_id = $row[0];
$DID_extension = $row[1];
$stmt = "SELECT did_pattern,did_description from vicidial_inbound_dids where did_id='$DID_id' limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00338',$user,$server_ip,$session_name,$one_mysql_log);}
$VDIDL_ct = mysql_num_rows($rslt);
if ($VDIDL_ct > 0)
{
$row=mysql_fetch_row($rslt);
$DID_pattern = $row[0];
$DID_description = $row[1];
}
}
### if web form is set then send su to vicidial.php for override of WEB_FORM address
if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|\n";}
else {echo "X|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|\n";}
if ( (strlen($VDCL_group_web)>5) or (strlen($VDCL_group_name)>0) ) {echo "$VDCL_group_web|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|$DID_id|$DID_extension|$DID_pattern|$DID_description|$INclosecallid|$INxfercallid|\n";}
else {echo "X|$VDCL_group_name|$VDCL_group_color|$VDCL_fronter_display|$VDADchannel_group|$VDCL_ingroup_script|$VDCL_get_call_launch|$VDCL_xferconf_a_dtmf|$VDCL_xferconf_a_number|$VDCL_xferconf_b_dtmf|$VDCL_xferconf_b_number|$VDCL_default_xfer_group|$VDCL_ingroup_recording_override|$VDCL_ingroup_rec_filename|$VDCL_default_group_alias|$VDCL_caller_id_number|$VDCL_group_web_vars|$VDCL_group_web_two|$VDCL_timer_action|$VDCL_timer_action_message|$VDCL_timer_action_seconds|$VDCL_xferconf_c_number|$VDCL_xferconf_d_number|$VDCL_xferconf_e_number|$VDCL_uniqueid_status_display|$custom_call_id|$VDCL_uniqueid_status_prefix|$VDCL_timer_action_destination|$DID_id|$DID_extension|$DID_pattern|$DID_description|$INclosecallid|$INxfercallid|\n";}
$stmt = "SELECT full_name from vicidial_users where user='$tsr';";
if ($DB) {echo "$stmt\n";}
@@ -4550,6 +4666,51 @@ if ($ACTION == 'VDADcheckINCOMING')
}
}
$custom_field_names='|';
$custom_field_names_SQL='';
$custom_field_values='----------';
$custom_field_types='|';
### find the names of all custom fields, if any
$stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00339',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$cffn_ct = mysql_num_rows($rslt);
$d=0;
while ($cffn_ct > $d)
{
$row=mysql_fetch_row($rslt);
$custom_field_names .= "$row[0]|";
$custom_field_names_SQL .= "$row[0],";
$custom_field_types .= "$row[1]|";
$custom_field_values .= "----------";
$d++;
}
if ($cffn_ct > 0)
{
$custom_field_names_SQL = eregi_replace(".$","",$custom_field_names_SQL);
### find the values of the named custom fields
$stmt = "SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00340',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$cffv_ct = mysql_num_rows($rslt);
if ($cffv_ct > 0)
{
$custom_field_values='----------';
$row=mysql_fetch_row($rslt);
$d=0;
while ($cffn_ct > $d)
{
$custom_field_values .= "$row[$d]----------";
$d++;
}
$custom_field_values = preg_replace("/\n/"," ",$custom_field_values);
$custom_field_values = preg_replace("/\r/","",$custom_field_values);
}
}
$comments = eregi_replace("\r",'',$comments);
$comments = eregi_replace("\n",'!N',$comments);
@@ -4597,6 +4758,9 @@ if ($ACTION == 'VDADcheckINCOMING')
$LeaD_InfO .= $owner . "\n";
$LeaD_InfO .= $script_recording_delay . "\n";
$LeaD_InfO .= $entry_list_id . "\n";
$LeaD_InfO .= $custom_field_names . "\n";
$LeaD_InfO .= $custom_field_values . "\n";
$LeaD_InfO .= $custom_field_types . "\n";
echo $LeaD_InfO;
@@ -4703,8 +4867,8 @@ if ($ACTION == 'VDADcheckINCOMING')
$VDCL_start_call_url = eregi_replace('--A--phone_pass--B--',urlencode(trim($phone_pass)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--fronter--B--',urlencode(trim($fronter)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--closer--B--',urlencode(trim($closer)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--group--B--',urlencode(trim($group)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--channel_group--B--',urlencode(trim($channel_group)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--group--B--',urlencode(trim($VDADchannel_group)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--channel_group--B--',urlencode(trim($VDADchannel_group)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--SQLdate--B--',urlencode(trim($SQLdate)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--epoch--B--',urlencode(trim($epoch)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--uniqueid--B--',urlencode(trim($uniqueid)),$VDCL_start_call_url);
@@ -4731,6 +4895,44 @@ if ($ACTION == 'VDADcheckINCOMING')
$VDCL_start_call_url = eregi_replace('--A--user_custom_five--B--',urlencode(trim($user_custom_five)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--talk_time--B--',"0",$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--talk_time_min--B--',"0",$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--entry_list_id--B--',urlencode(trim($entry_list_id)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--did_id--B--',urlencode(trim($DID_id)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--did_extension--B--',urlencode(trim($DID_extension)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--did_pattern--B--',urlencode(trim($DID_pattern)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--did_description--B--',urlencode(trim($DID_description)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--closecallid--B--',urlencode(trim($INclosecallid)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--xfercallid--B--',urlencode(trim($INxfercallid)),$VDCL_start_call_url);
$VDCL_start_call_url = eregi_replace('--A--agent_log_id--B--',urlencode(trim($agent_log_id)),$VDCL_start_call_url);
if (strlen($custom_field_names)>2)
{
$custom_field_names = preg_replace("/^\||\|$/",'',$custom_field_names);
$custom_field_names = preg_replace("/\|/",",",$custom_field_names);
$custom_field_names_ARY = explode(',',$custom_field_names);
$custom_field_names_ct = count($custom_field_names_ARY);
$custom_field_names_SQL = $custom_field_names;
##### BEGIN grab the data from custom table for the lead_id
$stmt="SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00344',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$list_lead_ct = mysql_num_rows($rslt);
if ($list_lead_ct > 0)
{
$row=mysql_fetch_row($rslt);
$o=0;
while ($custom_field_names_ct > $o)
{
$form_field_value = trim("$row[$o]");
$field_name_id = $custom_field_names_ARY[$o];
$field_name_tag = "--A--" . $field_name_id . "--B--";
$VDCL_start_call_url = eregi_replace("$field_name_tag","$form_field_value",$VDCL_start_call_url);
$o++;
}
}
}
if ($DB > 0) {echo "$VDCL_start_call_url<BR>\n";}
$SCUfile = file("$VDCL_start_call_url");
if ($DB > 0) {echo "$SCUfile[0]<BR>\n";}
@@ -5219,8 +5421,8 @@ if ($ACTION == 'updateDISPO')
{$VLphone_code = "$phone_code";}
}
$PADlead_id = sprintf("%09s", $lead_id);
while (strlen($PADlead_id) > 9) {$PADlead_id = substr("$PADlead_id", 0, -1);}
$PADlead_id = sprintf("%010s", $lead_id);
while (strlen($PADlead_id) > 10) {$PADlead_id = substr("$PADlead_id", 1);}
$FAKEcall_id = "$StarTtime.$PADlead_id";
$stmt = "INSERT INTO vicidial_log set uniqueid='$FAKEcall_id',lead_id='$lead_id',list_id='$VLlist_id',campaign_id='$campaign',call_date='$NOW_TIME',start_epoch='$StarTtime',end_epoch='$StarTtime',length_in_sec='0',status='$dispo_choice',phone_code='$VLphone_code',phone_number='$VLphone_number',user='$user',comments='MANUAL',processed='N',user_group='$user_group',term_reason='AGENT',alt_dial='$VLalt';";
if ($DB) {echo "$stmt\n";}
@@ -5285,7 +5487,7 @@ if ($ACTION == 'updateDISPO')
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00146',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$stmt="INSERT INTO vicidial_dnc (phone_number) values('$row[0]');";
$stmt="INSERT IGNORE INTO vicidial_dnc (phone_number) values('$row[0]');";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00147',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -5298,7 +5500,7 @@ if ($ACTION == 'updateDISPO')
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00148',$user,$server_ip,$session_name,$one_mysql_log);}
$row=mysql_fetch_row($rslt);
$stmt="INSERT INTO vicidial_campaign_dnc (phone_number,campaign_id) values('$row[0]','$campaign');";
$stmt="INSERT IGNORE INTO vicidial_campaign_dnc (phone_number,campaign_id) values('$row[0]','$campaign');";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00149',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
@@ -6019,7 +6221,7 @@ if ($ACTION == 'updateDISPO')
$stmt = "SELECT phone_number,alt_dial from vicidial_log where uniqueid='$uniqueid';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00341',$user,$server_ip,$session_name,$one_mysql_log);}
$vl_dialed_ct = mysql_num_rows($rslt);
if ($vl_dialed_ct > 0)
{
@@ -6030,7 +6232,56 @@ if ($ACTION == 'updateDISPO')
}
}
if (eregi('--A--did_',$dispo_call_url))
{
$DID_id='';
$DID_extension='';
$DID_pattern='';
$DID_description='';
$stmt = "SELECT did_id,extension from vicidial_did_log where uniqueid='$uniqueid' order by call_date desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$VDIDL_ct = mysql_num_rows($rslt);
if ($VDIDL_ct > 0)
{
$row=mysql_fetch_row($rslt);
$DID_id = $row[0];
$DID_extension = $row[1];
$stmt = "SELECT did_pattern,did_description from vicidial_inbound_dids where did_id='$DID_id' limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$VDIDL_ct = mysql_num_rows($rslt);
if ($VDIDL_ct > 0)
{
$row=mysql_fetch_row($rslt);
$DID_pattern = $row[0];
$DID_description = $row[1];
}
}
}
if ((eregi('callid--B--',$dispo_call_url)) or (eregi('group--B--',$dispo_call_url)))
{
$INclosecallid='';
$INxfercallid='';
$VDADchannel_group=$campaign;
$stmt = "SELECT campaign_id,closecallid,xfercallid from vicidial_closer_log where uniqueid='$uniqueid' and user='$user' order by call_date desc limit 1;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
$VDCL_mvac_ct = mysql_num_rows($rslt);
if ($VDCL_mvac_ct > 0)
{
$row=mysql_fetch_row($rslt);
$VDADchannel_group = $row[0];
$INclosecallid = $row[1];
$INxfercallid = $row[2];
}
}
##### grab the data from vicidial_list for the lead_id
$stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id FROM vicidial_list where lead_id='$lead_id' LIMIT 1;";
@@ -6107,9 +6358,9 @@ if ($ACTION == 'updateDISPO')
$dispo_call_url = eregi_replace('--A--original_phone_login--B--',"$original_phone_login",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--phone_pass--B--',"$phone_pass",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--fronter--B--',"$fronter",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--closer--B--',"$closer",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--group--B--',"$group",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--channel_group--B--',"$channel_group",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--closer--B--',"$user",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--group--B--',"$VDADchannel_group",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--channel_group--B--',"$VDADchannel_group",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--SQLdate--B--',"$SQLdate",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--epoch--B--',"$epoch",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--uniqueid--B--',"$uniqueid",$dispo_call_url);
@@ -6139,6 +6390,43 @@ if ($ACTION == 'updateDISPO')
$dispo_call_url = eregi_replace('--A--talk_time_ms--B--',"$talk_time_ms",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--talk_time_min--B--',"$talk_time_min",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--agent_log_id--B--',"$CALL_agent_log_id",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--entry_list_id--B--',"$entry_list_id",$dispo_call_url);
$dispo_call_url = eregi_replace('--A--did_id--B--',urlencode(trim($DID_id)),$dispo_call_url);
$dispo_call_url = eregi_replace('--A--did_extension--B--',urlencode(trim($DID_extension)),$dispo_call_url);
$dispo_call_url = eregi_replace('--A--did_pattern--B--',urlencode(trim($DID_pattern)),$dispo_call_url);
$dispo_call_url = eregi_replace('--A--did_description--B--',urlencode(trim($DID_description)),$dispo_call_url);
$dispo_call_url = eregi_replace('--A--closecallid--B--',urlencode(trim($INclosecallid)),$dispo_call_url);
$dispo_call_url = eregi_replace('--A--xfercallid--B--',urlencode(trim($INxfercallid)),$dispo_call_url);
if (strlen($FORMcustom_field_names)>2)
{
$custom_field_names = preg_replace("/^\||\|$/",'',$FORMcustom_field_names);
$custom_field_names = preg_replace("/\|/",",",$custom_field_names);
$custom_field_names_ARY = explode(',',$custom_field_names);
$custom_field_names_ct = count($custom_field_names_ARY);
$custom_field_names_SQL = $custom_field_names;
##### BEGIN grab the data from custom table for the lead_id
$stmt="SELECT $custom_field_names_SQL FROM custom_$entry_list_id where lead_id='$lead_id' LIMIT 1;";
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00345',$user,$server_ip,$session_name,$one_mysql_log);}
if ($DB) {echo "$stmt\n";}
$list_lead_ct = mysql_num_rows($rslt);
if ($list_lead_ct > 0)
{
$row=mysql_fetch_row($rslt);
$o=0;
while ($custom_field_names_ct > $o)
{
$form_field_value = trim("$row[$o]");
$field_name_id = $custom_field_names_ARY[$o];
$field_name_tag = "--A--" . $field_name_id . "--B--";
$dispo_call_url = eregi_replace("$field_name_tag","$form_field_value",$dispo_call_url);
$o++;
}
}
}
if ($DB > 0) {echo "$dispo_call_url<BR>\n";}
$SCUfile = file("$dispo_call_url");
if ($DB > 0) {echo "$SCUfile[0]<BR>\n";}
@@ -7135,6 +7423,7 @@ if ($ACTION == 'CALLLOGview')
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; LENGTH &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; STATO &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; PHONE &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; FULL NAME &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; CAMPAIGN &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; IN/OUT &nbsp; </font></TD>";
echo "<TD BGCOLOR=\"#CCCCCC\"><font style=\"font-size:11px;font-family:sans-serif;\"><B> &nbsp; ALT &nbsp; </font></TD>";
@@ -7167,6 +7456,13 @@ if ($ACTION == 'CALLLOGview')
$ALLalt_dial[$g] = $row[9];
$ALLin_out[$g] = "OUT-AUTO";
if ($row[10] == 'MANUAL') {$ALLin_out[$g] = "OUT-MANUAL";}
$stmtA="SELECT first_name,last_name FROM vicidial_list WHERE lead_id='$ALLlead_id[$g]';";
$rsltA=mysql_query($stmtA, $link);
$rowA=mysql_fetch_row($rsltA);
$Allfirst_name[$g] = $rowA[0];
$Alllast_name[$g] = $rowA[1];
$g++;
$u++;
}
@@ -7193,6 +7489,13 @@ if ($ACTION == 'CALLLOGview')
$ALLhangup_reason[$g] = $row[8];
$ALLalt_dial[$g] = "MAIN";
$ALLin_out[$g] = "IN";
$stmtA="SELECT first_name,last_name FROM vicidial_list WHERE lead_id='$ALLlead_id[$g]';";
$rsltA=mysql_query($stmtA, $link);
$rowA=mysql_fetch_row($rsltA);
$Allfirst_name[$g] = $rowA[0];
$Alllast_name[$g] = $rowA[1];
$g++;
$u++;
}
@@ -7220,6 +7523,7 @@ if ($ACTION == 'CALLLOGview')
echo "<td align=right><font size=2> $ALLlength_in_sec[$i]</td>\n";
echo "<td align=right><font size=2> $ALLstatus[$i]</td>\n";
echo "<td align=right><font size=2> $ALLphone_code[$i] $ALLphone_number[$i] </td>\n";
echo "<td align=right><font size=2> $Allfirst_name[$i] $Alllast_name[$i] </td>\n";
echo "<td align=right><font size=2> $ALLcampaign_id[$i] </td>\n";
echo "<td align=right><font size=2> $ALLin_out[$i] </td>\n";
echo "<td align=right><font size=2> $ALLalt_dial[$i] </td>\n";
@@ -7488,6 +7792,22 @@ if ($ACTION == 'CalLBacKCounT')
################################################################################
### customer_3way_hangup_process - send the count of the USERONLY callbacks for an agent
################################################################################
if ($ACTION == 'customer_3way_hangup_process')
{
$stmt="UPDATE user_call_log SET customer_hungup='$status',customer_hungup_seconds='$stage' where lead_id='$lead_id' and user='$user' and call_type LIKE \"%3WAY%\" order by user_call_log_id desc limit 1;";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00342',$user,$server_ip,$session_name,$one_mysql_log);}
echo "DONE: $stage|$lead_id|$status";
}
################################################################################
### DiaLableLeaDsCounT - send the count of the dialable leads in this campaign
################################################################################
@@ -7516,7 +7836,7 @@ if ($ACTION == 'Clear_API_Field')
$stmt="UPDATE vicidial_live_agents SET $comments='' where user='$user';";
if ($format=='debug') {echo "\n<!-- $stmt -->";}
$rslt=mysql_query($stmt, $link);
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);}
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00343',$user,$server_ip,$session_name,$one_mysql_log);}
echo "DONE: $comments";
}
@@ -11,10 +11,11 @@
# 100630-1119 - First build of script
# 100703-1124 - Added submit_button,admin_submit fields, which will log to admin log
# 100712-2322 - Added code to log vicidial_list.entry_list_id field if data altered
# 100916-1749 - Added non-lead variable parsing
#
$version = '2.4-3';
$build = '100712-2322';
$version = '2.4-4';
$build = '100916-1749';
require("dbconnect.php");
require("functions.php");
@@ -43,10 +44,108 @@ if (isset($_GET["admin_submit"])) {$admin_submit=$_GET["admin_submit"];}
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
if (isset($_GET["closer"])) {$closer=$_GET["closer"];}
elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];}
if (isset($_GET["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
if (isset($_GET["preset_number_a"])) {$preset_number_a=$_GET["preset_number_a"];}
elseif (isset($_POST["preset_number_a"])) {$preset_number_a=$_POST["preset_number_a"];}
if (isset($_GET["preset_number_b"])) {$preset_number_b=$_GET["preset_number_b"];}
elseif (isset($_POST["preset_number_b"])) {$preset_number_b=$_POST["preset_number_b"];}
if (isset($_GET["preset_number_c"])) {$preset_number_c=$_GET["preset_number_c"];}
elseif (isset($_POST["preset_number_c"])) {$preset_number_c=$_POST["preset_number_c"];}
if (isset($_GET["preset_number_d"])) {$preset_number_d=$_GET["preset_number_d"];}
elseif (isset($_POST["preset_number_d"])) {$preset_number_d=$_POST["preset_number_d"];}
if (isset($_GET["preset_number_e"])) {$preset_number_e=$_GET["preset_number_e"];}
elseif (isset($_POST["preset_number_e"])) {$preset_number_e=$_POST["preset_number_e"];}
if (isset($_GET["preset_number_f"])) {$preset_number_f=$_GET["preset_number_f"];}
elseif (isset($_POST["preset_number_f"])) {$preset_number_f=$_POST["preset_number_f"];}
if (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];}
elseif (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];}
if (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];}
elseif (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];}
if (isset($_GET["did_id"])) {$did_id=$_GET["did_id"];}
elseif (isset($_POST["did_id"])) {$did_id=$_POST["did_id"];}
if (isset($_GET["did_extension"])) {$did_extension=$_GET["did_extension"];}
elseif (isset($_POST["did_extension"])) {$did_extension=$_POST["did_extension"];}
if (isset($_GET["did_pattern"])) {$did_pattern=$_GET["did_pattern"];}
elseif (isset($_POST["did_pattern"])) {$did_pattern=$_POST["did_pattern"];}
if (isset($_GET["did_description"])) {$did_description=$_GET["did_description"];}
elseif (isset($_POST["did_description"])) {$did_description=$_POST["did_description"];}
if (isset($_GET["closecallid"])) {$closecallid=$_GET["closecallid"];}
elseif (isset($_POST["closecallid"])) {$closecallid=$_POST["closecallid"];}
if (isset($_GET["xfercallid"])) {$xfercallid=$_GET["xfercallid"];}
elseif (isset($_POST["xfercallid"])) {$xfercallid=$_POST["xfercallid"];}
if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];}
elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
header ("Pragma: no-cache"); // HTTP/1.0
if ($stage=='WELCOME')
{echo "FORM"; exit;}
$txt = '.txt';
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
@@ -328,7 +427,7 @@ else
echo " </script>\n";
echo " <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "</head>\n";
echo '<BODY BGCOLOR="#' . $bgcolor . '" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>';
echo "<BODY BGCOLOR=\"#" . $bgcolor . "\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"parent.document.getElementById('FORM_LOADED').value='1';\">";
echo "\n";
echo "<form action=./vdc_form_display.php method=POST name=form_custom_fields id=form_custom_fields>\n";
echo "<input type=hidden name=lead_id id=lead_id value=\"$lead_id\">\n";
@@ -12,10 +12,12 @@
# 91211-1103 - Added user_custom_... variables
# 100116-0702 - Added preset variables
# 100127-1611 - Added ignore_list_script_override option
# 100823-1644 - Added DID variables
# 100902-1344 - Added closecallid, xfercallid, agent_log_id variables
#
$version = '2.2.0-6';
$build = '100127-1611';
$version = '2.4-8';
$build = '100902-1344';
require("dbconnect.php");
@@ -161,10 +163,29 @@ if (isset($_GET["preset_dtmf_a"])) {$preset_dtmf_a=$_GET["preset_dtmf_a"];}
elseif (isset($_POST["preset_dtmf_a"])) {$preset_dtmf_a=$_POST["preset_dtmf_a"];}
if (isset($_GET["preset_dtmf_b"])) {$preset_dtmf_b=$_GET["preset_dtmf_b"];}
elseif (isset($_POST["preset_dtmf_b"])) {$preset_dtmf_b=$_POST["preset_dtmf_b"];}
if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
if (isset($_GET["did_id"])) {$did_id=$_GET["did_id"];}
elseif (isset($_POST["did_id"])) {$did_id=$_POST["did_id"];}
if (isset($_GET["did_extension"])) {$did_extension=$_GET["did_extension"];}
elseif (isset($_POST["did_extension"])) {$did_extension=$_POST["did_extension"];}
if (isset($_GET["did_pattern"])) {$did_pattern=$_GET["did_pattern"];}
elseif (isset($_POST["did_pattern"])) {$did_pattern=$_POST["did_pattern"];}
if (isset($_GET["did_description"])) {$did_description=$_GET["did_description"];}
elseif (isset($_POST["did_description"])) {$did_description=$_POST["did_description"];}
if (isset($_GET["closecallid"])) {$closecallid=$_GET["closecallid"];}
elseif (isset($_POST["closecallid"])) {$closecallid=$_POST["closecallid"];}
if (isset($_GET["xfercallid"])) {$xfercallid=$_GET["xfercallid"];}
elseif (isset($_POST["xfercallid"])) {$xfercallid=$_POST["xfercallid"];}
if (isset($_GET["agent_log_id"])) {$agent_log_id=$_GET["agent_log_id"];}
elseif (isset($_POST["agent_log_id"])) {$agent_log_id=$_POST["agent_log_id"];}
if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
if (isset($_GET["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_GET["CF_uses_custom_fields"];}
elseif (isset($_POST["CF_uses_custom_fields"])) {$CF_uses_custom_fields=$_POST["CF_uses_custom_fields"];}
if (isset($_GET["entry_list_id"])) {$entry_list_id=$_GET["entry_list_id"];}
elseif (isset($_POST["entry_list_id"])) {$entry_list_id=$_POST["entry_list_id"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@@ -363,6 +384,10 @@ if (eregi("iframe src",$script_text))
$preset_number_f = eregi_replace(' ','+',$preset_number_f);
$preset_dtmf_a = eregi_replace(' ','+',$preset_dtmf_a);
$preset_dtmf_b = eregi_replace(' ','+',$preset_dtmf_b);
$did_id = eregi_replace(' ','+',$did_id);
$did_extension = eregi_replace(' ','+',$did_extension);
$did_pattern = eregi_replace(' ','+',$did_pattern);
$did_description = eregi_replace(' ','+',$did_description);
}
$script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text);
@@ -438,6 +463,36 @@ $script_text = eregi_replace('--A--preset_number_e--B--',"$preset_number_e",$scr
$script_text = eregi_replace('--A--preset_number_f--B--',"$preset_number_f",$script_text);
$script_text = eregi_replace('--A--preset_dtmf_a--B--',"$preset_dtmf_a",$script_text);
$script_text = eregi_replace('--A--preset_dtmf_b--B--',"$preset_dtmf_b",$script_text);
$script_text = eregi_replace('--A--did_id--B--',"$did_id",$script_text);
$script_text = eregi_replace('--A--did_extension--B--',"$did_extension",$script_text);
$script_text = eregi_replace('--A--did_pattern--B--',"$did_pattern",$script_text);
$script_text = eregi_replace('--A--did_description--B--',"$did_description",$script_text);
$script_text = eregi_replace('--A--closecallid--B--',"$closecallid",$script_text);
$script_text = eregi_replace('--A--xfercallid--B--',"$xfercallid",$script_text);
$script_text = eregi_replace('--A--agent_log_id--B--',"$agent_log_id",$script_text);
$script_text = eregi_replace('--A--entry_list_id--B--',"$entry_list_id",$script_text);
if ($CF_uses_custom_fields=='Y')
{
### find the names of all custom fields, if any
$stmt = "SELECT field_label,field_type FROM vicidial_lists_fields where list_id='$entry_list_id' and field_type NOT IN('SCRIPT','DISPLAY') and field_label NOT IN('vendor_lead_code','source_id','list_id','gmt_offset_now','called_since_last_reset','phone_code','phone_number','title','first_name','middle_initial','last_name','address1','address2','address3','city','state','province','postal_code','country_code','gender','date_of_birth','alt_phone','email','security_phrase','comments','called_count','last_local_call_time','rank','owner');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$cffn_ct = mysql_num_rows($rslt);
$d=0;
while ($cffn_ct > $d)
{
$row=mysql_fetch_row($rslt);
$field_name_id = $row[0];
$field_name_tag = "--A--" . $field_name_id . "--B--";
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
$script_text = eregi_replace("$field_name_tag","$form_field_value",$script_text);
if ($DB) {echo "$d|$field_name_id|$field_name_tag|$form_field_value|<br>\n";}
$d++;
}
}
$script_text = eregi_replace("\n","<BR>",$script_text);
$script_text = stripslashes($script_text);
File diff suppressed because it is too large Load Diff
@@ -14,6 +14,9 @@
# 90801-0923 - Added in-group name to pulldown
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -39,9 +42,12 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
if (strlen($shift)<2) {$shift='ALL';}
$report_name = 'Inbound Service Level Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -49,17 +55,34 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';";
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
@@ -69,6 +92,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -106,7 +150,7 @@ echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Inbound Service Level Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -979,7 +1023,7 @@ echo "+-------------+-------+-----------------------------------------+ +------+
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\nRun Time: $RUNtime seconds\n";
echo "\nRun Time: $RUNtime seconds|$db_source\n";
}
@@ -27,6 +27,10 @@
# 100206-1454 - Fixed TMR(service level) calculation
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100709-1809 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100913-1634 - Added DID option to select by DIDs instead of In-groups
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -47,6 +51,8 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];}
elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];}
if (isset($_GET["DID"])) {$DID=$_GET["DID"];}
elseif (isset($_POST["DID"])) {$DID=$_POST["DID"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
@@ -56,9 +62,12 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$MT[0]='0';
if (strlen($shift)<2) {$shift='ALL';}
$report_name = 'Inbound Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -66,10 +75,23 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
@@ -82,13 +104,18 @@ if ($gmt_conf_ct > 0)
$epoch_offset = (($local_gmt + $dst) * 3600);
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
@@ -98,6 +125,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -105,7 +153,9 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select group_id,group_name from vicidial_inbound_groups order by group_id;";
$stmt="select group_id,group_name,8 from vicidial_inbound_groups order by group_id;";
if ($DID=='Y')
{$stmt="select did_pattern,did_description,did_id from vicidial_inbound_dids order by did_pattern;";}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
@@ -118,6 +168,7 @@ while ($i < $groups_to_print)
$row=mysql_fetch_row($rslt);
$LISTgroups[$i] = $row[0];
$LISTgroup_names[$i] = $row[1];
$LISTgroup_ids[$i] = $row[2];
$i++;
}
@@ -175,7 +226,7 @@ echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Inbound Stats</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -195,6 +246,7 @@ if ($DB > 0)
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET name=vicidial_report id=vicidial_report>\n";
echo "<TABLE Border=0><TR><TD VALIGN=TOP>\n";
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
echo "<INPUT TYPE=HIDDEN NAME=DID VALUE=\"$DID\">\n";
echo "Rango de Fecha:<BR>\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">";
@@ -227,7 +279,10 @@ o_cal.a_tpl.yearscroll = false;
<?php
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "Grupos De entrada: \n";
if ($DID=='Y')
{echo "Inbound DIDs: \n";}
else
{echo "Grupos De entrada: \n";}
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "<SELECT SIZE=5 NAME=group[] multiple>\n";
$o=0;
@@ -242,9 +297,12 @@ while ($groups_to_print > $o)
echo "</SELECT>\n";
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ";
echo "<a href=\"./admin.php?ADD=3111&group_id=$group[0]\">MODIFICAR</a> | ";
if ($DID!='Y')
{
echo "<a href=\"./admin.php?ADD=3111&group_id=$group[0]\">MODIFICAR</a> | ";
echo "<a href=\"./AST_IVRstats.php?query_date=$query_date&end_date=$end_date&shift=$shift$groupQS\">IVR REPORT</a> | \n";
}
echo "<a href=\"./admin.php?ADD=999999\">INFORMES</a> | ";
echo "<a href=\"./AST_IVRstats.php?query_date=$query_date&end_date=$end_date&shift=$shift$groupQS\">IVR REPORT</a> \n";
echo "</FONT>\n";
echo "</TD></TR>\n";
@@ -274,10 +332,13 @@ echo "<PRE><FONT SIZE=2>\n\n";
if ($groups_to_print < 1)
{
echo "\n\n";
echo "POR FAVOR SELECCIONE UN GRUPO EN EL PÁRRAFO ANTERIOR Y FECHA DE RANGO y haga clic en Enviar\n";
}
{
echo "\n\n";
if ($DID=='Y')
{echo "PLEASE SELECT A DID AND DATE RANGE ABOVE AND CLICK ENVIAR\n";}
else
{echo "POR FAVOR SELECCIONE UN GRUPO EN EL PÁRRAFO ANTERIOR Y FECHA DE RANGO y haga clic en Enviar\n";}
}
else
{
@@ -310,30 +371,111 @@ echo "Inbound Call Stats: $group_string $NOW_TIME\n";
if ($DID=='Y')
{
$stmt="select did_id from vicidial_inbound_dids where did_pattern IN($group_SQL);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$dids_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $dids_to_print)
{
$row=mysql_fetch_row($rslt);
$did_id[$i] = $row[0];
$did_SQL .= "'$row[0]',";
$i++;
}
$did_SQL = eregi_replace(",$",'',$did_SQL);
if (strlen($did_SQL)<3) {$did_SQL="''";}
$stmt="select uniqueid from vicidial_did_log where did_id IN($did_SQL);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$unids_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $unids_to_print)
{
$row=mysql_fetch_row($rslt);
$unid_SQL .= "'$row[0]',";
$i++;
}
$unid_SQL = eregi_replace(",$",'',$unid_SQL);
if (strlen($unid_SQL)<3) {$unid_SQL="''";}
if ($DB > 0)
{echo "|$did_SQL|$unid_SQL|\n";}
}
if ($group_ct > 1)
{
echo "\n";
echo "---------- MULTI-GROUP BREAKDOWN:\n";
echo "+----------------------+---------+---------+---------+---------+\n";
echo "| IN-GROUP | CALLS | DROPS | DROP % | IVR |\n";
echo "+----------------------+---------+---------+---------+---------+\n";
if ($DID=='Y')
{
echo "+----------------------+---------+---------+---------+---------+\n";
echo "| DID | CALLS | DROPS | DROP % | IVR |\n";
echo "+----------------------+---------+---------+---------+---------+\n";
}
else
{
echo "+----------------------+---------+---------+---------+---------+\n";
echo "| IN-GROUP | CALLS | DROPS | DROP % | IVR |\n";
echo "+----------------------+---------+---------+---------+---------+\n";
}
$i=0;
while($i < $group_ct)
{
$did_id[$i]='0';
$DIDunid_SQL='';
$stmt="select did_id from vicidial_inbound_dids where did_pattern='$group[$i]';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$Sdids_to_print = mysql_num_rows($rslt);
if ($Sdids_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$did_id[$i] = $row[0];
}
$stmt="select uniqueid from vicidial_did_log where did_id='$did_id[$i]';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$DIDunids_to_print = mysql_num_rows($rslt);
$k=0;
while ($k < $DIDunids_to_print)
{
$row=mysql_fetch_row($rslt);
$DIDunid_SQL .= "'$row[0]',";
$k++;
}
$DIDunid_SQL = eregi_replace(",$",'',$DIDunid_SQL);
if (strlen($DIDunid_SQL)<3) {$DIDunid_SQL="''";}
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]';";
if ($DID=='Y')
{
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($DIDunid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a='$group[$i]' and comment_b='START';";
if ($DID=='Y')
{
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and uniqueid IN($DIDunid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rowx=mysql_fetch_row($rslt);
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);";
if ($DID=='Y')
{
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null) and uniqueid IN($DIDunid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rowy=mysql_fetch_row($rslt);
@@ -364,17 +506,30 @@ echo "\n";
echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
echo "---------- TOTALS\n";
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL);";
if ($DID=='Y')
{
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND');";
if ($DID=='Y')
{
$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND') and uniqueid IN($unid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rowy=mysql_fetch_row($rslt);
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) and comment_b='START';";
if ($DID=='Y')
{
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and uniqueid IN($unid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rowx=mysql_fetch_row($rslt);
@@ -419,6 +574,10 @@ echo "\n";
echo "---------- DROPS\n";
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);";
if ($DID=='Y')
{
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null) and uniqueid IN($unid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -458,41 +617,47 @@ echo "Average hold time for DROP Calls: $average_hold_seconds second
if (strlen($group_SQL)>3)
{
$stmt = "SELECT answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two from vicidial_inbound_groups where group_id IN($group_SQL) order by answer_sec_pct_rt_stat_one desc limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$Sanswer_sec_pct_rt_stat_one = $row[0];
$Sanswer_sec_pct_rt_stat_two = $row[1];
$stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_one and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$answer_sec_pct_rt_stat_one = $row[0];
$stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_two and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$answer_sec_pct_rt_stat_two = $row[0];
if ( ($RESPUESTAEDcalls > 0) and ($answer_sec_pct_rt_stat_one > 0) and ($answer_sec_pct_rt_stat_two > 0) )
if ($DID!='Y')
{
$PCTanswer_sec_pct_rt_stat_one = (($answer_sec_pct_rt_stat_one / $RESPUESTAEDcalls) * 100);
$PCTanswer_sec_pct_rt_stat_one = round($PCTanswer_sec_pct_rt_stat_one, 0);
#$PCTanswer_sec_pct_rt_stat_one = sprintf("%10s", $PCTanswer_sec_pct_rt_stat_one);
$PCTanswer_sec_pct_rt_stat_two = (($answer_sec_pct_rt_stat_two / $RESPUESTAEDcalls) * 100);
$PCTanswer_sec_pct_rt_stat_two = round($PCTanswer_sec_pct_rt_stat_two, 0);
#$PCTanswer_sec_pct_rt_stat_two = sprintf("%10s", $PCTanswer_sec_pct_rt_stat_two);
$stmt = "SELECT answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two from vicidial_inbound_groups where group_id IN($group_SQL) order by answer_sec_pct_rt_stat_one desc limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$Sanswer_sec_pct_rt_stat_one = $row[0];
$Sanswer_sec_pct_rt_stat_two = $row[1];
$stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_one and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$answer_sec_pct_rt_stat_one = $row[0];
$stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_two and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$answer_sec_pct_rt_stat_two = $row[0];
if ( ($RESPUESTAEDcalls > 0) and ($answer_sec_pct_rt_stat_one > 0) and ($answer_sec_pct_rt_stat_two > 0) )
{
$PCTanswer_sec_pct_rt_stat_one = (($answer_sec_pct_rt_stat_one / $RESPUESTAEDcalls) * 100);
$PCTanswer_sec_pct_rt_stat_one = round($PCTanswer_sec_pct_rt_stat_one, 0);
#$PCTanswer_sec_pct_rt_stat_one = sprintf("%10s", $PCTanswer_sec_pct_rt_stat_one);
$PCTanswer_sec_pct_rt_stat_two = (($answer_sec_pct_rt_stat_two / $RESPUESTAEDcalls) * 100);
$PCTanswer_sec_pct_rt_stat_two = round($PCTanswer_sec_pct_rt_stat_two, 0);
#$PCTanswer_sec_pct_rt_stat_two = sprintf("%10s", $PCTanswer_sec_pct_rt_stat_two);
}
}
}
echo "\n";
echo "---------- CUSTOM INDICATORS\n";
echo "GDE (Answered/Llamadas totales tomadas in to this In-Group): $RESPUESTAEDpercent%\n";
echo "ACR (Dropped/Answered): $DROP_RESPUESTAEDpercent%\n";
echo "TMR1 (Answered within $Sanswer_sec_pct_rt_stat_one seconds/Answered): $PCTanswer_sec_pct_rt_stat_one%\n";
echo "TMR2 (Answered within $Sanswer_sec_pct_rt_stat_two seconds/Answered): $PCTanswer_sec_pct_rt_stat_two%\n";
if ($DID!='Y')
{
echo "TMR1 (Answered within $Sanswer_sec_pct_rt_stat_one seconds/Answered): $PCTanswer_sec_pct_rt_stat_one%\n";
echo "TMR2 (Answered within $Sanswer_sec_pct_rt_stat_two seconds/Answered): $PCTanswer_sec_pct_rt_stat_two%\n";
}
# GET LIST OF ALL STATUSES and create SQL from human_answered statuses
@@ -538,6 +703,10 @@ echo "\n";
echo "---------- QUEUE STATS\n";
$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and (queue_seconds > 0);";
if ($DID=='Y')
{
$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and (queue_seconds > 0) and uniqueid IN($unid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -587,6 +756,10 @@ echo "| 0 5 10 15 20 25 30 35 40 45 50 55
echo "+-------------------------------------------------------------------------------------------+------------+\n";
$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_seconds;";
if ($DID=='Y')
{
$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_seconds;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$reasons_to_print = mysql_num_rows($rslt);
@@ -650,6 +823,10 @@ echo "| 0 5 10 15 20 25 30 35 40 45 50 55
echo "+-------------------------------------------------------------------------------------------+------------+\n";
$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') group by queue_seconds;";
if ($DID=='Y')
{
$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') group by queue_seconds;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$reasons_to_print = mysql_num_rows($rslt);
@@ -714,6 +891,10 @@ echo " | 0 5 10 15 20 25 30 35 40 45
echo "----------+-------------------------------------------------------------------------------------------+------------+\n";
$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND') group by queue_seconds;";
if ($DID=='Y')
{
$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND') group by queue_seconds;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$reasons_to_print = mysql_num_rows($rslt);
@@ -922,6 +1103,10 @@ echo "| HANGUP REASON | CALLS |\n";
echo "+----------------------+------------+\n";
$stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by term_reason;";
if ($DID=='Y')
{
$stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by term_reason;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$reasons_to_print = mysql_num_rows($rslt);
@@ -964,6 +1149,10 @@ echo "+--------+----------------------+----------------------+------------+-----
## get counts and time totals for all statuses in this campaign
$stmt="select count(*),status,sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by status;";
if ($DID=='Y')
{
$stmt="select count(*),status,sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by status;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$statuses_to_print = mysql_num_rows($rslt);
@@ -1095,6 +1284,10 @@ echo "| 1 2 3 4 5 6 7 8 9 10 15 20
echo "+-------------------------------------------------------------------------------------+------------+\n";
$stmt="select count(*),queue_position from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_position;";
if ($DID=='Y')
{
$stmt="select count(*),queue_position from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_position;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$positions_to_print = mysql_num_rows($rslt);
@@ -1159,6 +1352,10 @@ echo "| AGENTE | CALLS | TIME H:M:S |AVERAGE |\n";
echo "+--------------------------+------------+------------+--------+\n";
$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 0 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
if ($DID=='Y')
{
$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 0 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$users_to_print = mysql_num_rows($rslt);
@@ -1228,6 +1425,10 @@ echo "<FONT SIZE=0>\n";
######### 15-minute increment breakdowns of total calls and drops, then answered table
$BDansweredCALLS = 0;
$stmt="SELECT status,queue_seconds,UNIX_TIMESTAMP(call_date),call_date from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL);";
if ($DID=='Y')
{
$stmt="SELECT status,queue_seconds,UNIX_TIMESTAMP(call_date),call_date from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$calls_to_print = mysql_num_rows($rslt);
@@ -1524,7 +1725,7 @@ echo "+------+------------------------------------------------------------------
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\nRun Time: $RUNtime seconds\n";
echo "\nRun Time: $RUNtime seconds|$db_source\n";
}
@@ -9,6 +9,9 @@
# 90809-0216 - Added Exclude Outbound Drop Group option
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -52,9 +55,12 @@ $MT[0]='0';
if (strlen($shift)<2) {$shift='ALL';}
if (strlen($exclude_rollover)<2) {$exclude_rollover='NO';}
$report_name = 'Inbound Summary Hourly Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -62,10 +68,22 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
@@ -78,13 +96,19 @@ if ($gmt_conf_ct > 0)
$epoch_offset = (($local_gmt + $dst) * 3600);
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -93,6 +117,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -187,7 +232,7 @@ echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Inbound Summary Hourly Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
if ($bareformat < 1)
{
@@ -676,7 +721,7 @@ else
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\nRun Time: $RUNtime seconds\n";
echo "\n\nRun Time: $RUNtime seconds|$db_source\n";
}
@@ -13,6 +13,9 @@
# 91112-0719 - Added in-group names to select list
# 100214-1421 - Sort menu alphabetically
# 100301-1401 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -40,9 +43,12 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
if (strlen($shift)<2) {$shift='ALL';}
$report_name = 'Inbound IVR Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -50,17 +56,34 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';";
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
@@ -70,6 +93,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -85,6 +129,7 @@ $i=0;
$LISTgroups[$i]='CALLMENU';
$LISTgroups_names[$i]='IVR';
$i++;
$groups_to_print++;
$LISTgroups[$i]='XMLPULL';
$LISTgroups_names[$i]='Dynamic Application';
$i++;
@@ -197,7 +242,7 @@ $end_date_T = $end_dateARRAY[1];
<?php
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>IVR Stats Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -720,7 +765,7 @@ else
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\nRun Time: $RUNtime seconds\n";
echo "\nRun Time: $RUNtime seconds|$db_source\n";
}
@@ -9,6 +9,9 @@
# 091129-0017 - Added Sales-type and DNC-type tallies
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -50,9 +53,12 @@ $MT[0]='0';
if (strlen($shift)<2) {$shift='ALL';}
if (strlen($include_rollover)<2) {$include_rollover='NO';}
$report_name = 'Outbound Summary Interval Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -60,10 +66,22 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
@@ -91,6 +109,12 @@ if ($records_to_print > 0)
$auth++;
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -101,28 +125,31 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ($user_level < 9)
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$user_group';";
$rslt=mysql_query($stmt, $link);
$records_to_print = mysql_num_rows($rslt);
if ($records_to_print > 0)
{
$stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$user_group';";
$rslt=mysql_query($stmt, $link);
$records_to_print = mysql_num_rows($rslt);
if ($records_to_print > 0)
$row=mysql_fetch_row($rslt);
$LOGallowed_reports = $row[1];
if ( (!eregi("ALL-CAMPAIGNS",$row[0])) )
{
$row=mysql_fetch_row($rslt);
if ( (!eregi("ALL-CAMPAIGNS",$row[0])) )
{
$rawLOGallowed_campaignsSQL = eregi_replace(' -','',$row[0]);
$rawLOGallowed_campaignsSQL = eregi_replace(' ',"','",$rawLOGallowed_campaignsSQL);
$LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')";
$whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')";
}
$rawLOGallowed_campaignsSQL = eregi_replace(' -','',$row[0]);
$rawLOGallowed_campaignsSQL = eregi_replace(' ',"','",$rawLOGallowed_campaignsSQL);
$LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')";
$whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')";
}
else
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
echo "Campaigns Permissions Error: |$PHP_AUTH_USER|$user_group|\n";
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
}
else
{
echo "Campaigns Permissions Error: |$PHP_AUTH_USER|$user_group|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -163,10 +190,6 @@ $group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
$stmt="select campaign_name from vicidial_campaigns where campaign_id='$group[$i]' $LOGallowed_campaignsSQL;";
$rslt=mysql_query($stmt, $link);
$campaign_names_to_print = mysql_num_rows($rslt);
@@ -174,6 +197,9 @@ while($i < $group_ct)
{
$row=mysql_fetch_row($rslt);
$group_cname[$i] = $row[0];
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
}
if (eregi("YES",$include_rollover))
@@ -336,7 +362,7 @@ echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Outbound Summary Interval Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
if ($bareformat < 1)
{
@@ -1167,8 +1193,8 @@ else
$hTOTcalls_count = sprintf("%6s", $hTOTcalls_count);
$hTOTsystem_count = sprintf("%6s", $hTOTsystem_count);
$hTOTagent_count = sprintf("%6s", $hTOTagent_count);
$hTOTptp_count = sprintf("%6s", $hTOTrtp_count);
$hTOTrtp_count = sprintf("%6s", $hTOTptp_count);
$hTOTptp_count = sprintf("%6s", $hTOTptp_count);
$hTOTrtp_count = sprintf("%6s", $hTOTrtp_count);
if ( ($hTOTcalls_count < 1) or ($hTOTna_count < 1) )
{$hTOTna_percent=0;}
else
@@ -1268,7 +1294,7 @@ else
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\nRun Time: $RUNtime seconds\n";
echo "\n\nRun Time: $RUNtime seconds|$db_source\n";
}
@@ -26,6 +26,10 @@
# 100202-1034 - Added statuses to no-answer section
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100814-2307 - Added display of preset dials if presets are enabled in the campaign
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
header ("Content-type: text/html; charset=utf-8");
@@ -73,10 +77,12 @@ if (strlen($bottom_graph)<2) {$bottom_graph='NO';}
if (strlen($carrier_stats)<2) {$carrier_stats='NO';}
if (strlen($include_rollover)<2) {$include_rollover='NO';}
$report_name = 'Outbound Calling Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -84,10 +90,22 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
##### SERVER CARRIER LOGGING LOOKUP #####
$stmt = "SELECT count(*) FROM servers where carrier_logging_active='Y' and max_vicidial_trunks > 0;";
$rslt=mysql_query($stmt, $link);
@@ -99,13 +117,19 @@ if ($srv_conf_ct > 0)
$carrier_logging_active = $row[0];
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -114,6 +138,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -130,7 +175,18 @@ while($i < $group_ct)
$i++;
}
$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;";
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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 ";
$stmt="select campaign_id,campaign_name from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
@@ -140,7 +196,7 @@ while ($i < $campaigns_to_print)
$row=mysql_fetch_row($rslt);
$groups[$i] = $row[0];
$group_names[$i] = $row[1];
if (ereg("--ALL",$group_string) )
if (ereg("-ALL",$group_string) )
{$group[$i] = $groups[$i];}
$i++;
}
@@ -151,13 +207,16 @@ $group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
if ( (preg_match("/ $group[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) )
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
}
if (eregi("YES",$include_rollover))
{
$stmt="select drop_inbound_group from vicidial_campaigns where campaign_id='$group[$i]' and drop_inbound_group NOT LIKE \"%NONE%\" and drop_inbound_group is NOT NULL and drop_inbound_group != '';";
$stmt="select drop_inbound_group from vicidial_campaigns where campaign_id='$group[$i]' $LOGallowed_campaignsSQL and drop_inbound_group NOT LIKE \"%NONE%\" and drop_inbound_group is NOT NULL and drop_inbound_group != '';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$in_groups_to_print = mysql_num_rows($rslt);
@@ -174,9 +233,9 @@ while($i < $group_ct)
}
if (strlen($group_drop_SQL) < 2)
{$group_drop_SQL = "''";}
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) or (strlen($group_string) < 2) )
{
$group_SQL = "";
$group_SQL = "$LOGallowed_campaignsSQL";
$group_drop_SQL = "";
}
else
@@ -252,7 +311,7 @@ echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Outbound Stats</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -981,7 +1040,7 @@ else
if ( ($carrier_logging_active > 0) and ($carrier_stats == 'YES') )
{
##############################
######### STATUS CATEGORÍA STATS
######### CARRIER STATS
$OUToutput .= "\n";
$OUToutput .= "---------- CARRIER CALL STATUSES\n";
@@ -1016,6 +1075,55 @@ else
}
## find if any selected campaigns have presets enabled
$presets_enabled=0;
$stmt="select count(*) from vicidial_campaigns where enable_xfer_presets='ENABLED' $group_SQLand;";
$rslt=mysql_query($stmt, $link);
if ($DB) {$OUToutput .= "$stmt\n";}
$presets_enabled_count = mysql_num_rows($rslt);
if ($presets_enabled_count > 0)
{
$row=mysql_fetch_row($rslt);
$presets_enabled = $row[0];
}
if ($presets_enabled > 0)
{
##############################
######### PRESET DIAL STATS
$OUToutput .= "\n";
$OUToutput .= "---------- AGENTE PRESET DIALS\n";
$OUToutput .= "+------------------------------------------+------------+\n";
$OUToutput .= "| PRESET NAME | CALLS |\n";
$OUToutput .= "+------------------------------------------+------------+\n";
## get counts and time totals for all statuses in this campaign
$stmt="select preset_name,count(*) from user_call_log where call_date > \"$query_date_BEGIN\" and call_date < \"$query_date_END\" and preset_name!='' and preset_name is not NULL $group_SQLand group by preset_name order by preset_name;";
$rslt=mysql_query($stmt, $link);
if ($DB) {$OUToutput .= "$stmt\n";}
$carrierstatuses_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $carrierstatuses_to_print)
{
$row=mysql_fetch_row($rslt);
$TOTPREcalls = ($TOTPREcalls + $row[1]);
$PREstatus = sprintf("%-40s", $row[0]); while(strlen($PREstatus)>40) {$PREstatus = substr("$PREstatus", 0, -1);}
$PREcount = sprintf("%10s", $row[1]); while(strlen($PREcount)>10) {$PREcount = substr("$PREcount", 0, -1);}
$OUToutput .= "| $PREstatus | $PREcount |\n";
$i++;
}
$TOTPREcalls = sprintf("%10s", $TOTPREcalls); while(strlen($TOTPREcalls)>10) {$TOTPREcalls = substr("$TOTPREcalls", 0, -1);}
$OUToutput .= "+------------------------------------------+------------+\n";
$OUToutput .= "| TOTAL | $TOTPREcalls |\n";
$OUToutput .= "+------------------------------------------+------------+\n";
}
##############################
######### STATUS CATEGORÍA STATS
@@ -1446,7 +1554,7 @@ else
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\nRun Time: $RUNtime seconds\n";
echo "\nRun Time: $RUNtime seconds|$db_source\n";
}
@@ -19,12 +19,14 @@ require("dbconnect.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["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];}
elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];}
elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
@@ -77,10 +79,14 @@ while ($i < $campaigns_to_print)
<?php
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Lista De Hopper Report</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<TITLE>Lista De Hopper Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
require("admin_header.php");
echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
#echo "<INPUT TYPE=HIDDEN NAME=server_ip VALUE=\"$server_ip\">\n";
#echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">\n";
echo "<SELECT SIZE=1 NAME=group>\n";
$o=0;
while ($campaigns_to_print > $o)
@@ -164,4 +170,6 @@ else
?>
</PRE>
</TD></TR></TABLE>
</BODY></HTML>
@@ -11,6 +11,9 @@
# 90508-0644 - Changed to PHP long tags
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
@@ -42,9 +45,12 @@ if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];}
if (strlen($shift)<2) {$shift='ALL';}
$report_name = 'Single Agent Daily';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -52,20 +58,38 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -74,6 +98,38 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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 ";
$MT[0]='';
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -82,7 +138,16 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns;";
$i=0;
$group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$i++;
}
$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
@@ -91,6 +156,8 @@ while ($i < $campaigns_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
if (ereg("-ALL",$group_string) )
{$group[$i] = $groups[$i];}
$i++;
}
@@ -99,9 +166,12 @@ $group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
if ( (preg_match("/ $group[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) )
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
}
$i++;
}
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
@@ -164,7 +234,7 @@ if ($file_download < 1)
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Agent Situación días Report</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>Single Agent Daily</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<span style=\"position:absolute;left:0px;top:0px;z-index:20;\" id=admin_header>";
$short_header=1;
@@ -273,12 +343,12 @@ else
{
echo "LEAD STATS BREAKDOWN:\n";
echo "+------------+--------+--------+--------+$statusesHEAD\n";
echo "| <a href=\"$LINKbase\">DATE</a> | <a href=\"$LINKbase&stage=LEADS\">LEADS</a> | <a href=\"$LINKbase&stage=CI\">CIcalls</a>| <a href=\"$LINKbase&stage=DNCCI\">DNC/CI%</a>|$statusesHTML\n";
echo "| <a href=\"$LINKbase\">DATE</a> | <a href=\"$LINKbase&stage=LEADS\">CALLS</a> | <a href=\"$LINKbase&stage=CI\">CIcalls</a>| <a href=\"$LINKbase&stage=DNCCI\">DNC/CI%</a>|$statusesHTML\n";
echo "+------------+--------+--------+--------+$statusesHEAD\n";
}
else
{
$file_output .= "DATE,LEADS,CIcalls,DNC-CI%,$statusesFILE\n";
$file_output .= "DATE,CALLS,CIcalls,DNC-CI%,$statusesFILE\n";
}
### BEGIN loop through each user ###
@@ -596,7 +666,7 @@ else
echo "<a href=\"./admin.php?ADD=999999\">INFORMES</a> </FONT>\n";
echo "</TD></TR></TABLE>";
echo "</FORM>\n\n";
echo "</FORM>\n\n<BR>$db_source";
echo "</span>\n";
echo "<span style=\"position:absolute;left:3px;top:3px;z-index:18;\" id=agent_status_bars>\n";
@@ -23,6 +23,9 @@
# 100203-1131 - Added CUSTOMER time statistics
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -55,9 +58,12 @@ if (strlen($shift)<2) {$shift='ALL';}
$LINKbase = "$PHP_SELF?query_date=$query_date&end_date=$end_date&group=$group&user_group=$user_group&shift=$shift&DB=$DB";
$report_name = 'Agent Performance Detalle';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -65,20 +71,38 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -87,6 +111,38 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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 ";
$MT[0]='';
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -95,7 +151,17 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns order by campaign_id;";
$i=0;
$group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$i++;
}
$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
@@ -104,6 +170,8 @@ while ($i < $campaigns_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
if (ereg("-ALL",$group_string) )
{$group[$i] = $groups[$i];}
$i++;
}
$stmt="select user_group from vicidial_user_groups order by user_group;";
@@ -123,9 +191,12 @@ $group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
if ( (preg_match("/ $group[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) )
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
}
$i++;
}
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
@@ -174,7 +245,7 @@ echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Agent Performance Detalle</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -364,7 +435,7 @@ while ($i < $rows_to_print)
echo "CALL STATS BREAKDOWN: (Statistics related to handling of calls only)\n";
echo "+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n";
echo "| <a href=\"$LINKbase\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">LEADS</a> | <a href=\"$LINKbase&stage=TIME\">TIME</a> | PAUSE |PAUSAVG | WAIT |WAITAVG | TALK |TALKAVG | DISPO |DISPAVG | DEAD |DEADAVG | CUSTOMER |CUSTAVG |$statusesHTML\n";
echo "| <a href=\"$LINKbase\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">CALLS</a> | <a href=\"$LINKbase&stage=TIME\">TIME</a> | PAUSE |PAUSAVG | WAIT |WAITAVG | TALK |TALKAVG | DISPO |DISPAVG | DEAD |DEADAVG | CUSTOMER |CUSTAVG |$statusesHTML\n";
echo "+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n";
@@ -863,7 +934,7 @@ echo "+-----------------+----------+----------+----------+----------+ +$sub_sta
echo "| TOTALS AGENTS:$TOT_AGENTS |$TOTtotTOTAL_MS|$TOTtotNONPAUSE_MS|$TOTtotPAUSE_MS| |$SUMstatusesHTML\n";
echo "+----------------------------+----------+----------+----------+ +$sub_statusesHEAD\n";
echo "\n\n";
echo "\n\n<BR>$db_source";
}
@@ -12,6 +12,9 @@
# 100119-0935 - Fixed bug 291
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
@@ -43,9 +46,12 @@ if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];}
if (strlen($shift)<2) {$shift='ALL';}
$report_name = 'Agent Status Detalle';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -53,20 +59,38 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -75,6 +99,39 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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 ";
$MT[0]='';
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -83,7 +140,17 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns order by campaign_id;";
$i=0;
$group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$i++;
}
$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
@@ -92,6 +159,8 @@ while ($i < $campaigns_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
if (ereg("-ALL",$group_string) )
{$group[$i] = $groups[$i];}
$i++;
}
$stmt="select user_group from vicidial_user_groups order by user_group;";
@@ -111,9 +180,12 @@ $group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
if ( (preg_match("/ $group[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) )
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
}
$i++;
}
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
@@ -210,7 +282,7 @@ if ($file_download < 1)
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Agent Status Detalle Report</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<span style=\"position:absolute;left:0px;top:0px;z-index:20;\" id=admin_header>";
$short_header=1;
@@ -319,14 +391,14 @@ else
if ($file_download < 1)
{
echo "LEADS STATS BREAKDOWN:\n";
echo "CALLS STATS BREAKDOWN:\n";
echo "+-----------------+----------+--------+--------+--------+$statusesHEAD\n";
echo "| <a href=\"$LINKbase\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">LEADS</a> | <a href=\"$LINKbase&stage=CI\">CIcalls</a>| <a href=\"$LINKbase&stage=DNCCI\">DNC/CI%</a>|$statusesHTML\n";
echo "| <a href=\"$LINKbase\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">CALLS</a> | <a href=\"$LINKbase&stage=CI\">CIcalls</a>| <a href=\"$LINKbase&stage=DNCCI\">DNC/CI%</a>|$statusesHTML\n";
echo "+-----------------+----------+--------+--------+--------+$statusesHEAD\n";
}
else
{
$file_output .= "USER,ID,LEADS,CIcalls,DNC-CI%,$statusesFILE\n";
$file_output .= "USER,ID,CALLS,CIcalls,DNC-CI%,$statusesFILE\n";
}
@@ -338,7 +410,7 @@ else
{
$Suser=$usersARY[$m];
$Sfull_name=$user_namesARY[$m];
$Scalls=$calls[$m];
$Scalls=0;
$SstatusesHTML='';
$SstatusesFILE='';
$CIScount=0;
@@ -663,7 +735,7 @@ echo " <a href=\"./admin.php?ADD=999999\">INFORMES</a> </FONT>\n";
echo "</FONT>\n";
echo "</TD></TR></TABLE>";
echo "</FORM>\n\n";
echo "</FORM>\n\n<BR>$db_source";
echo "</span>\n";
echo "<span style=\"position:absolute;left:3px;top:3px;z-index:18;\" id=agent_status_bars>\n";
@@ -12,6 +12,9 @@
# 100203-1147 - Added CUSTOMER time statistics
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -44,9 +47,12 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
if (strlen($shift)<2) {$shift='ALL';}
if (strlen($stage)<2) {$stage='NAME';}
$report_name = 'Agent Time Detail';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -54,20 +60,38 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -76,6 +100,38 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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 ";
$MT[0]='';
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -84,7 +140,18 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns order by campaign_id;";
$i=0;
$group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$i++;
}
$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
@@ -93,8 +160,32 @@ while ($i < $campaigns_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
if (ereg("-ALL",$group_string) )
{$group[$i] = $groups[$i];}
$i++;
}
$i=0;
$group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
if ( (preg_match("/ $group[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) )
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
}
$i++;
}
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
{$group_SQL = "";}
else
{
$group_SQL = eregi_replace(",$",'',$group_SQL);
$group_SQL = "and campaign_id IN($group_SQL)";
}
$stmt="select user_group from vicidial_user_groups order by user_group;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
@@ -107,24 +198,6 @@ while ($i < $user_groups_to_print)
$i++;
}
$i=0;
$group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
$i++;
}
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
{$group_SQL = "";}
else
{
$group_SQL = eregi_replace(",$",'',$group_SQL);
$group_SQL = "and campaign_id IN($group_SQL)";
}
$i=0;
$user_group_string='|';
$user_group_ct = count($user_group);
@@ -183,7 +256,7 @@ if ($file_download < 1)
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Agent Time Detail</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<span style=\"position:absolute;left:0px;top:0px;z-index:20;\" id=admin_header>";
$short_header=1;
@@ -421,12 +494,12 @@ else
{
echo "AGENT TIME BREAKDOWN:\n";
echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
echo "| <a href=\"$LINKbase&stage=NAME\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">LEADS</a> | <a href=\"$LINKbase&stage=TCLOCK\">TIME CLOCK</a> | <a href=\"$LINKbase&stage=TIME\">AGENT TIME</a> | WAIT | TALK | DISPO | PAUSE | DEAD | CUSTOMER | |$sub_statusesHTML\n";
echo "| <a href=\"$LINKbase&stage=NAME\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">CALLS</a> | <a href=\"$LINKbase&stage=TCLOCK\">TIME CLOCK</a> | <a href=\"$LINKbase&stage=TIME\">AGENT TIME</a> | WAIT | TALK | DISPO | PAUSE | DEAD | CUSTOMER | |$sub_statusesHTML\n";
echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
}
else
{
$file_output .= "USER,ID,LEADS,TIME CLOCK,AGENT TIME,WAIT,TALK,DISPO,PAUSE,DEAD,CUSTOMER$sub_statusesFILE\n";
$file_output .= "USER,ID,CALLS,TIME CLOCK,AGENT TIME,WAIT,TALK,DISPO,PAUSE,DEAD,CUSTOMER$sub_statusesFILE\n";
}
##### END print the output to screen or put into file output variable
@@ -861,7 +934,7 @@ echo " <a href=\"./admin.php?ADD=999999\">REPORTS</a> </FONT>\n";
echo "</FONT>\n";
echo "</TD></TR></TABLE>";
echo "</FORM>\n\n";
echo "</FORM>\n\n<BR>$db_source";
############################################################################
##### END HTML form section
############################################################################
@@ -1,7 +1,7 @@
<?php
# AST_agent_time_sheet.php
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
#
@@ -11,27 +11,44 @@
# 90310-0745 - Added admin header
# 90508-0644 - Changed to PHP long tags
# 90524-2231 - Changed to use functions.php for seconds to HH:MM:SS conversion
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
require("functions.php");
$report_name = 'Usuario Hoja de tiempo';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,user_territories_active FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,user_territories_active FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$ss_conf_ct = mysql_num_rows($rslt);
if ($ss_conf_ct > 0)
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$SSoutbound_autodial_active = $row[1];
$user_territories_active = $row[2];
$non_latin = $row[0];
$SSoutbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
$user_territories_active = $row[4];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
@@ -51,14 +68,20 @@ $user=$agent;
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
@@ -66,6 +89,27 @@ $auth=$row[0];
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -86,7 +130,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;}
<?php
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Agent Hoja de tiempo";
echo "<TITLE>$report_name";
##### BEGIN Set variables to make header show properly #####
@@ -298,7 +342,7 @@ echo "<td align=right><font size=2> </td>\n";
echo "<td align=right colspan=2><font size=2><font size=2>TOTAL </td>\n";
echo "<td align=right><font size=2> $total_login_hours_minutes </td></tr>\n";
echo "</TABLE>\n";
echo "</TABLE><BR>$db_source\n";
@@ -8,6 +8,9 @@
# CHANGES
# 90602-2244 - First build
# 100301-1401 - Added popup date selector
# 100712-1324 - Added system setting slave server option and added user stats link dates
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
@@ -41,9 +44,12 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
if (strlen($shift)<2) {$shift='ALL';}
if (strlen($stage)<2) {$stage='ID';}
$report_name = 'User Timeclock Detail Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -51,20 +57,38 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -73,6 +97,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$MT[0]='';
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -145,6 +190,7 @@ if ( (ereg("--ALL--",$user_group_string) ) or ($user_group_ct < 1) )
{$user_group_SQL = "";}
else
{
$TCuser_group_SQL = $user_group_SQL;
$user_group_SQL = eregi_replace(",$",'',$user_group_SQL);
$user_group_SQL = "and vicidial_agent_log.user_group IN($user_group_SQL)";
$TCuser_group_SQL = eregi_replace(",$",'',$TCuser_group_SQL);
@@ -188,7 +234,7 @@ if ($file_download < 1)
<?php
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>User Time-Clock Detail</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<span style=\"position:absolute;left:0px;top:0px;z-index:20;\" id=admin_header>";
$short_header=1;
@@ -428,7 +474,7 @@ else
if ($file_download < 1)
{
$Toutput = "| $Sname[$m] | <a href=\"./user_stats.php?user=$RAWuser\">$Suser[$m]</a> | $Sgroup[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $TCdetail\n";
$Toutput = "| $Sname[$m] | <a href=\"./user_stats.php?user=$RAWuser&begin_date=$query_date_D&end_date=$end_date_D\">$Suser[$m]</a> | $Sgroup[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $TCdetail\n";
}
else
{
@@ -636,7 +682,7 @@ else
$o=0;
while ($user_groups_to_print > $o)
{
if (eregi("$user_groups[$o]\|",$user_group_string)) {echo "<option selected value=\"$user_groups[$o]\">$user_groups[$o]</option>\n";}
if (eregi("\|$user_groups[$o]\|",$user_group_string)) {echo "<option selected value=\"$user_groups[$o]\">$user_groups[$o]</option>\n";}
else {echo "<option value=\"$user_groups[$o]\">$user_groups[$o]</option>\n";}
$o++;
}
@@ -684,7 +730,7 @@ echo "</FORM>\n\n";
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "<font size=1 color=white>$RUNtime</font>\n";
echo "<font size=1 color=white>$RUNtime|$db_source</font>\n";
?>
@@ -13,6 +13,9 @@
# 90310-2151 - Added admin header
# 90508-0644 - Changed to PHP long tags
# 100214-1421 - Sort menu alphabetically
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -36,12 +39,47 @@ if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_servers='1';";
$report_name = 'Server Performance Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -50,6 +88,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
# path from root to where ploticus files will be stored
$PLOTroot = "vicidial/ploticus";
$DOCroot = "$WeBServeRRooT/$PLOTroot/";
@@ -88,7 +147,7 @@ while ($i < $servers_to_print)
<?php
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Server Performance Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -343,5 +402,6 @@ echo "<!-- /usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile -->";
?>
</TD></TR></TABLE>
<BR>
<?php echo "$db_source"; ?>
</BODY></HTML>
@@ -60,10 +60,19 @@
# 91204-1548 - Added ability to change agent in-groups and blended
# 100214-1127 - Added no-dialable-leads alert and in-groups stats option
# 100301-1229 - Added 3-WAY status for consultative transfer agents
# 100303-0930 - Added carrier stats display option
# 100424-0943 - Added realtime_block_user_info option
# 100709-1054 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100805-0704 - Fixed minor bug in campaigns restrictions
# 100815-0002 - Added optional display of preset dials if presets are enabled in the campaign
# 100912-0839 - Changed several stats to limit to 2 or 3 decimal spaces
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
# 101024-0832 - Added Agent time stats option and agents-in-dispo counter
#
$version = '2.2.0-51';
$build = '100301-1229';
$version = '2.4-60';
$build = '101024-0832';
header ("Content-type: text/html; charset=utf-8");
@@ -123,11 +132,19 @@ if (isset($_GET["monitor_active"])) {$monitor_active=$_GET["monitor_active"];
elseif (isset($_POST["monitor_active"])) {$monitor_active=$_POST["monitor_active"];}
if (isset($_GET["monitor_phone"])) {$monitor_phone=$_GET["monitor_phone"];}
elseif (isset($_POST["monitor_phone"])) {$monitor_phone=$_POST["monitor_phone"];}
if (isset($_GET["CARRIERstats"])) {$CARRIERstats=$_GET["CARRIERstats"];}
elseif (isset($_POST["CARRIERstats"])) {$CARRIERstats=$_POST["CARRIERstats"];}
if (isset($_GET["PRESETstats"])) {$PRESETstats=$_GET["PRESETstats"];}
elseif (isset($_POST["PRESETstats"])) {$PRESETstats=$_POST["PRESETstats"];}
if (isset($_GET["AGENTtimeSTATS"])) {$AGENTtimeSTATS=$_GET["AGENTtimeSTATS"];}
elseif (isset($_POST["AGENTtimeSTATS"])) {$AGENTtimeSTATS=$_POST["AGENTtimeSTATS"];}
$report_name = 'Tiempo Real Main Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -136,13 +153,24 @@ if ($qm_conf_ct > 0)
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
if (!isset($DB)) {$DB=0;}
if (!isset($RR)) {$RR=40;}
if (!isset($group)) {$group='';}
if (!isset($group)) {$group='ALL-ACTIVE';}
if (!isset($usergroup)) {$usergroup='';}
if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes
if (!isset($UidORname)) {$UidORname=1;} # 0=id, 1=name
@@ -155,13 +183,13 @@ if (!isset($PAUSEcodes)) {$PAUSEcodes='N';} # 0=no, 1=yes
if (!isset($with_inbound))
{
if ($outbound_autodial_active > 0)
{$with_inbound='N';} # N=no, Y=yes, O=only
{$with_inbound='Y';} # N=no, Y=yes, O=only
else
{$with_inbound='O';} # N=no, Y=yes, O=only
}
$ingroup_detail='';
if (strlen($group)>1) {$groups[0] = $group; $RR=40;}
if ( (strlen($group)>1) and (strlen($groups[0])<1) ) {$groups[0] = $group; $RR=40;}
else {$group = $groups[0];}
function get_server_load($windows = false)
@@ -216,8 +244,18 @@ $NOW_TIME = date("Y-m-d H:i:s");
$NOW_DAY = date("Y-m-d");
$NOW_HOUR = date("H:i:s");
$STARTtime = date("U");
$epochONEminuteAGO = ($STARTtime - 60);
$timeONEminuteAGO = date("Y-m-d H:i:s",$epochONEminuteAGO);
$epochFIVEminutesAGO = ($STARTtime - 300);
$timeFIVEminutesAGO = date("Y-m-d H:i:s",$epochFIVEminutesAGO);
$epochFIFTEENminutesAGO = ($STARTtime - 900);
$timeFIFTEENminutesAGO = date("Y-m-d H:i:s",$epochFIFTEENminutesAGO);
$epochONEhourAGO = ($STARTtime - 3600);
$timeONEhourAGO = date("Y-m-d H:i:s",$epochONEhourAGO);
$epochSIXhoursAGO = ($STARTtime - 21600);
$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO);
$epochTWENTYFOURhoursAGO = ($STARTtime - 86400);
$timeTWENTYFOURhoursAGO = date("Y-m-d H:i:s",$epochTWENTYFOURhoursAGO);
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
@@ -230,7 +268,13 @@ $rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
@@ -247,7 +291,41 @@ if ( (!isset($monitor_phone)) or (strlen($monitor_phone)<1) )
$monitor_phone = $row[0];
}
$stmt="select campaign_id,campaign_name from vicidial_campaigns where active='Y' order by campaign_id;";
$stmt="SELECT realtime_block_user_info,user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$realtime_block_user_info = $row[0];
$LOGuser_group = $row[1];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!preg_match("/ALL-/",$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 ";
$allactivecampaigns='';
$stmt="select campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
@@ -260,26 +338,32 @@ while ($i < $groups_to_print)
$row=mysql_fetch_row($rslt);
$LISTgroups[$i] =$row[0];
$LISTnames[$i] =$row[1];
$allactivecampaigns .= "'$LISTgroups[$i]',";
$i++;
}
$allactivecampaigns .= "''";
$i=0;
$group_string='|';
$group_ct = count($groups);
while($i < $group_ct)
{
$group_string .= "$groups[$i]|";
$group_SQL .= "'$groups[$i]',";
$groupQS .= "&groups[]=$groups[$i]";
if ( (preg_match("/ $groups[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/ALL-/",$LOGallowed_campaigns)) )
{
$group_string .= "$groups[$i]|";
$group_SQL .= "'$groups[$i]',";
$groupQS .= "&groups[]=$groups[$i]";
}
$i++;
}
$group_SQL = eregi_replace(",$",'',$group_SQL);
### if no campaigns selected, display all
if ($group_ct < 1)
if ( ($group_ct < 1) or (strlen($group_string) < 2) )
{
$groups[0] = 'ALL-ACTIVE';
$group_string = 'ALL-ACTIVE';
$group_string = '|ALL-ACTIVE|';
$group = 'ALL-ACTIVE';
$groupQS .= "&groups[]=ALL-ACTIVE";
}
@@ -294,9 +378,9 @@ if ( (ereg("--NONE--",$group_string) ) or ($group_ct < 1) )
elseif ( eregi('ALL-ACTIVE',$group_string) )
{
$all_active = 1;
$group_SQL = "''";
$group_SQLand = "";
$group_SQLwhere = "";
$group_SQL = $allactivecampaigns;
$group_SQLand = "and campaign_id IN($allactivecampaigns)";
$group_SQLwhere = "where campaign_id IN($allactivecampaigns)";
}
else
{
@@ -325,7 +409,7 @@ $NFB = '<b><font size=6 face="courier">';
$NFE = '</font></b>';
$F=''; $FG=''; $B=''; $BG='';
$select_list = "<TABLE WIDTH=200 CELLPADDING=5 BGCOLOR=\"#D9E6FE\"><TR><TD>Select Campañas: <BR>";
$select_list = "<TABLE WIDTH=700 CELLPADDING=5 BGCOLOR=\"#D9E6FE\"><TR><TD VALIGN=TOP>Select Campañas: <BR>";
$select_list .= "<SELECT SIZE=15 NAME=groups[] multiple>";
$o=0;
while ($groups_to_print > $o)
@@ -340,23 +424,10 @@ $select_list .= "</SELECT>";
$select_list .= "<BR><font size=1>(Para seleccionar más de 1 campaña, mantenga pulsada la tecla Ctrl y haga clic en)<font>";
$select_list .= "</TD><TD VALIGN=TOP ALIGN=CENTER>";
$select_list .= "<a href=\"#\" onclick=\"closeDiv(\'campaign_select_list\');\">Panel de Cierre</a><BR><BR>";
$select_list .= "<TABLE CELLPADDING=2 CELLSPACING=2 Border=0>";
if ($UGdisplay > 0)
{
$select_list .= "Select Grupo Del Usuario:<BR>";
$select_list .= "<SELECT SIZE=1 NAME=usergroup>";
$select_list .= "<option value=\"\">ALL GRUPOS DE USUARIO</option>";
$o=0;
while ($usergroups_to_print > $o)
{
if ($usergroups[$o] == $usergroup) {$select_list .= "<option selected value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
else {$select_list .= "<option value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
$o++;
}
$select_list .= "</SELECT><BR><BR>";
}
$select_list .= " &nbsp; Inbound: <SELECT SIZE=1 NAME=with_inbound>";
$select_list .= "<TR><TD align=right>";
$select_list .= "Inbound: </TD><TD align=left><SELECT SIZE=1 NAME=with_inbound>";
$select_list .= "<option value=\"N\"";
if ($with_inbound=='N') {$select_list .= " selected";}
$select_list .= ">No</option>";
@@ -366,9 +437,10 @@ $select_list .= ">Yes</option>";
$select_list .= "<option value=\"O\"";
if ($with_inbound=='O') {$select_list .= " selected";}
$select_list .= ">Only</option>";
$select_list .= "</SELECT><BR><BR>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= " &nbsp; Monitor: <SELECT SIZE=1 NAME=monitor_active>";
$select_list .= "<TR><TD align=right>";
$select_list .= "Monitor: </TD><TD align=left><SELECT SIZE=1 NAME=monitor_active>";
$select_list .= "<option value=\"\"";
if (strlen($monitor_active) < 2) {$select_list .= " selected";}
$select_list .= ">NONE</option>";
@@ -381,37 +453,101 @@ $select_list .= ">BARGE</option>";
#$select_list .= "<option value=\"HIJACK\"";
# if ($monitor_active=='HIJACK') {$select_list .= " selected";}
#$select_list .= ">HIJACK</option>";
$select_list .= "</SELECT><BR>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= "Phone: ";
$select_list .= "<TR><TD align=right>";
$select_list .= "Phone: </TD><TD align=left>";
$select_list .= "<INPUT type=text size=10 maxlength=20 NAME=monitor_phone VALUE=\"$monitor_phone\">";
$select_list .= "<BR><BR>";
$select_list .= "</TD></TR>";
$select_list .= "<TR><TD align=center COLSPAN=2> &nbsp; </TD></TR>";
$select_list .= " &nbsp; Dialable Leads Alert:<BR><SELECT SIZE=1 NAME=NOLEADSalert>";
if ($UGdisplay > 0)
{
$select_list .= "<TR><TD align=right>";
$select_list .= "Select Grupo Del Usuario: </TD><TD align=left>";
$select_list .= "<SELECT SIZE=1 NAME=usergroup>";
$select_list .= "<option value=\"\">ALL GRUPOS DE USUARIO</option>";
$o=0;
while ($usergroups_to_print > $o)
{
if ($usergroups[$o] == $usergroup) {$select_list .= "<option selected value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
else {$select_list .= "<option value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
$o++;
}
$select_list .= "</SELECT></TD></TR>";
}
$select_list .= "<TR><TD align=right>";
$select_list .= "Dialable Leads Alert: </TD><TD align=left><SELECT SIZE=1 NAME=NOLEADSalert>";
$select_list .= "<option value=\"\"";
if (strlen($NOLEADSalert) < 2) {$select_list .= " selected";}
$select_list .= ">NO</option>";
$select_list .= "<option value=\"YES\"";
if ($NOLEADSalert=='YES') {$select_list .= " selected";}
$select_list .= ">YES</option>";
$select_list .= "</SELECT><BR><BR>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= " &nbsp; Show Drop In-Group Row:<BR><SELECT SIZE=1 NAME=DROPINGROUPstats>";
$select_list .= "<TR><TD align=right>";
$select_list .= "Show Drop In-Group Row: </TD><TD align=left><SELECT SIZE=1 NAME=DROPINGROUPstats>";
$select_list .= "<option value=\"0\"";
if ($DROPINGROUPstats < 1) {$select_list .= " selected";}
$select_list .= ">NO</option>";
$select_list .= "<option value=\"1\"";
if ($DROPINGROUPstats=='1') {$select_list .= " selected";}
$select_list .= ">YES</option>";
$select_list .= "</SELECT><BR><BR>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= "<TR><TD align=right>";
$select_list .= "Show Carrier Stats: </TD><TD align=left><SELECT SIZE=1 NAME=CARRIERstats>";
$select_list .= "<option value=\"0\"";
if ($CARRIERstats < 1) {$select_list .= " selected";}
$select_list .= ">NO</option>";
$select_list .= "<option value=\"1\"";
if ($CARRIERstats=='1') {$select_list .= " selected";}
$select_list .= ">YES</option>";
$select_list .= "</SELECT></TD></TR>";
## find if any selected campaigns have presets enabled
$presets_enabled=0;
$stmt="select count(*) from vicidial_campaigns where enable_xfer_presets='ENABLED' $group_SQLand;";
$rslt=mysql_query($stmt, $link);
if ($DB) {$OUToutput .= "$stmt\n";}
$presets_enabled_count = mysql_num_rows($rslt);
if ($presets_enabled_count > 0)
{
$row=mysql_fetch_row($rslt);
$presets_enabled = $row[0];
}
if ($presets_enabled > 0)
{
$select_list .= "<TR><TD align=right>";
$select_list .= "Show Presets Stats: </TD><TD align=left><SELECT SIZE=1 NAME=PRESETstats>";
$select_list .= "<option value=\"0\"";
if ($PRESETstats < 1) {$select_list .= " selected";}
$select_list .= ">NO</option>";
$select_list .= "<option value=\"1\"";
if ($PRESETstats=='1') {$select_list .= " selected";}
$select_list .= ">YES</option>";
$select_list .= "</SELECT></TD></TR>";
}
$select_list .= "<TR><TD align=right>";
$select_list .= "Agent Time Stats: </TD><TD align=left><SELECT SIZE=1 NAME=AGENTtimeSTATS>";
$select_list .= "<option value=\"0\"";
if ($AGENTtimeSTATS < 1) {$select_list .= " selected";}
$select_list .= ">NO</option>";
$select_list .= "<option value=\"1\"";
if ($AGENTtimeSTATS=='1') {$select_list .= " selected";}
$select_list .= ">YES</option>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= "</TABLE><BR>";
$select_list .= "<INPUT type=submit NAME=ENVIAR VALUE=ENVIAR><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; ";
$select_list .= "</TD></TR>";
$select_list .= "<TR><TD ALIGN=CENTER>";
$select_list .= "<font size=1> &nbsp; </font>";
$select_list .= "</TD>";
$select_list .= "<TD NOWRAP>";
$select_list .= "<TD NOWRAP align=right>";
$select_list .= "<font size=1>VERSIÓN: $version &nbsp; CONSTRUCCION: $build</font>";
$select_list .= "</TD></TR></TABLE>";
@@ -707,8 +843,8 @@ $rslt=mysql_query($stmt, $link);
$campaign_allow_inbound = $row[0];
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"<META HTTP-EQUIV=Refresh CONTENT=\"$RR; URL=$PHP_SELF?RR=$RR&DB=$DB$groupQS&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">\n";
echo "<TITLE>Tiempo Real Report: $group</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo"<META HTTP-EQUIV=Refresh CONTENT=\"$RR; URL=$PHP_SELF?RR=$RR&DB=$DB$groupQS&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">\n";
echo "<TITLE>$report_name: $group</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -734,6 +870,9 @@ echo "<INPUT TYPE=HIDDEN NAME=PHONEdisplay VALUE=\"$PHONEdisplay\">\n";
echo "<INPUT TYPE=HIDDEN NAME=CUSTPHONEdisplay VALUE=\"$CUSTPHONEdisplay\">\n";
echo "<INPUT TYPE=HIDDEN NAME=DROPINGROUPstats VALUE=\"$DROPINGROUPstats\">\n";
echo "<INPUT TYPE=HIDDEN NAME=ALLINGROUPstats VALUE=\"$ALLINGROUPstats\">\n";
echo "<INPUT TYPE=HIDDEN NAME=CARRIERstats VALUE=\"$CARRIERstats\">\n";
echo "<INPUT TYPE=HIDDEN NAME=PRESETstats VALUE=\"$PRESETstats\">\n";
echo "<INPUT TYPE=HIDDEN NAME=AGENTtimeSTATS VALUE=\"$AGENTtimeSTATS\">\n";
echo "Tiempo Real Report &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo "<span style=\"position:absolute;left:160px;top:27px;z-index:19;\" id=campaign_select_list>\n";
echo "<TABLE WIDTH=250 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#D9E6FE\"><TR><TD ALIGN=CENTER>\n";
@@ -743,9 +882,9 @@ echo "</span>\n";
echo "<span style=\"position:absolute;left:10px;top:120px;z-index:18;\" id=agent_ingroup_display>\n";
echo " &nbsp; ";
echo "</span>\n";
echo "<a href=\"$PHP_SELF?RR=4000$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">STOP</a> | ";
echo "<a href=\"$PHP_SELF?RR=40$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">SLOW</a> | ";
echo "<a href=\"$PHP_SELF?RR=4$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">GO</a>";
echo "<a href=\"$PHP_SELF?RR=4000$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">STOP</a> | ";
echo "<a href=\"$PHP_SELF?RR=40$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">SLOW</a> | ";
echo "<a href=\"$PHP_SELF?RR=4$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">GO</a>";
if (eregi('ALL-ACTIVE',$group_string))
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"./admin.php?ADD=10\">MODIFICAR</a> | \n";
@@ -798,10 +937,9 @@ if ( ( ereg('Y',$with_inbound) or ereg('O',$with_inbound) ) and ($campaign_allow
}
$closer_campaignsSQL = preg_replace("/,$/","",$closer_campaignsSQL);
}
else
{
$closer_campaignsSQL = "''";
}
if (strlen($closer_campaignsSQL)<2)
{$closer_campaignsSQL="''";}
if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";}
@@ -936,6 +1074,7 @@ if ( ($DROPINGROUPstats > 0) and (!preg_match("/ALL-ACTIVE/",$group_string)) )
$dtp++;
}
$DIGcampaigns = preg_replace("/,$/",'',$DIGcampaigns);
if (strlen($DIGcampaigns) < 2) {$DIGcampaigns = "''";}
$stmtB="select sum(calls_today),sum(drops_today),sum(answers_today) from vicidial_campaign_stats where campaign_id IN($DIGcampaigns);";
if ($DB > 0) {echo "\n|$stmtB|\n";}
@@ -963,6 +1102,200 @@ if ( ($DROPINGROUPstats > 0) and (!preg_match("/ALL-ACTIVE/",$group_string)) )
}
##### CARRIER STATS TOTALS ###
$CARRIERstatsHTML='';
if ($CARRIERstats > 0)
{
$stmtB="select dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeTWENTYFOURhoursAGO\" group by dialstatus;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$car_to_print = mysql_num_rows($rslt);
$ctp=0;
while ($car_to_print > $ctp)
{
$row=mysql_fetch_row($rslt);
$TFhour_status[$ctp] = $row[0];
$TFhour_count[$ctp] = $row[1];
$dialstatuses .= "'$row[0]',";
$ctp++;
}
$dialstatuses = preg_replace("/,$/",'',$dialstatuses);
$CARRIERstatsHTML .= "<TR BGCOLOR=white><TD ALIGN=left COLSPAN=8>";
$CARRIERstatsHTML .= "<TABLE CELLPADDING=1 CELLSPACING=1 Border=0 BGCOLOR=white>";
$CARRIERstatsHTML .= "<TR BGCOLOR=\"#E6E6E6\">";
$CARRIERstatsHTML .= "<TD ALIGN=LEFT><font size=2><B>CARRIER STATS: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=LEFT><font size=2><B>&nbsp; HANGUP STATUS &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B>&nbsp; 24 HOURS &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B>&nbsp; 6 HOURS &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B>&nbsp; 1 HOUR &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B>&nbsp; 15 MIN &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B>&nbsp; 5 MIN &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B>&nbsp; 1 MIN &nbsp; </B></TD>";
$CARRIERstatsHTML .= "</TR>";
if (strlen($dialstatuses) > 1)
{
$stmtB="select dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeSIXhoursAGO\" group by dialstatus;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$scar_to_print = mysql_num_rows($rslt);
$print_sctp=0;
while ($scar_to_print > $print_sctp)
{
$row=mysql_fetch_row($rslt);
$print_ctp=0;
while ($print_ctp < $ctp)
{
if ($TFhour_status[$print_ctp] == $row[0])
{$SIXhour_count[$print_ctp] = $row[1];}
$print_ctp++;
}
$print_sctp++;
}
$stmtB="select dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeONEhourAGO\" group by dialstatus;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$scar_to_print = mysql_num_rows($rslt);
$print_sctp=0;
while ($scar_to_print > $print_sctp)
{
$row=mysql_fetch_row($rslt);
$print_ctp=0;
while ($print_ctp < $ctp)
{
if ($TFhour_status[$print_ctp] == $row[0])
{$ONEhour_count[$print_ctp] = $row[1];}
$print_ctp++;
}
$print_sctp++;
}
$stmtB="select dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeFIFTEENminutesAGO\" group by dialstatus;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$scar_to_print = mysql_num_rows($rslt);
$print_sctp=0;
while ($scar_to_print > $print_sctp)
{
$row=mysql_fetch_row($rslt);
$print_ctp=0;
while ($print_ctp < $ctp)
{
if ($TFhour_status[$print_ctp] == $row[0])
{$FTminute_count[$print_ctp] = $row[1];}
$print_ctp++;
}
$print_sctp++;
}
$stmtB="select dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeFIVEminutesAGO\" group by dialstatus;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$scar_to_print = mysql_num_rows($rslt);
$print_sctp=0;
while ($scar_to_print > $print_sctp)
{
$row=mysql_fetch_row($rslt);
$print_ctp=0;
while ($print_ctp < $ctp)
{
if ($TFhour_status[$print_ctp] == $row[0])
{$FIVEminute_count[$print_ctp] = $row[1];}
$print_ctp++;
}
$print_sctp++;
}
$stmtB="select dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeONEminuteAGO\" group by dialstatus;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$scar_to_print = mysql_num_rows($rslt);
$print_sctp=0;
while ($scar_to_print > $print_sctp)
{
$row=mysql_fetch_row($rslt);
$print_ctp=0;
while ($print_ctp < $ctp)
{
if ($TFhour_status[$print_ctp] == $row[0])
{$ONEminute_count[$print_ctp] = $row[1];}
$print_ctp++;
}
$print_sctp++;
}
$print_ctp=0;
while ($print_ctp < $ctp)
{
if (strlen($TFhour_count[$print_ctp])<1) {$TFhour_count[$print_ctp]=0;}
if (strlen($SIXhour_count[$print_ctp])<1) {$SIXhour_count[$print_ctp]=0;}
if (strlen($ONEhour_count[$print_ctp])<1) {$ONEhour_count[$print_ctp]=0;}
if (strlen($FTminute_count[$print_ctp])<1) {$FTminute_count[$print_ctp]=0;}
if (strlen($FIVEminute_count[$print_ctp])<1) {$FIVEminute_count[$print_ctp]=0;}
if (strlen($ONEminute_count[$print_ctp])<1) {$ONEminute_count[$print_ctp]=0;}
$CARRIERstatsHTML .= "<TR>";
$CARRIERstatsHTML .= "<TD BGCOLOR=white><font size=2>&nbsp;</TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=LEFT><font size=2>&nbsp; &nbsp; $TFhour_status[$print_ctp]</TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $TFhour_count[$print_ctp] </TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $SIXhour_count[$print_ctp] </TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $ONEhour_count[$print_ctp] </TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $FTminute_count[$print_ctp] </TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $FIVEminute_count[$print_ctp] </TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $ONEminute_count[$print_ctp] </TD>";
$CARRIERstatsHTML .= "</TR>";
$print_ctp++;
}
}
else
{
$CARRIERstatsHTML .= "<TR><TD BGCOLOR=white colspan=7><font size=2>no log entries</TD></TR>";
}
$CARRIERstatsHTML .= "</TABLE>";
$CARRIERstatsHTML .= "</TD></TR>";
}
##### PRESET STATS TOTALS ###
$PRESETstatsHTML='';
if ($PRESETstats > 0)
{
$PRESETstatsHTML .= "<TR BGCOLOR=white><TD ALIGN=left COLSPAN=8>";
$PRESETstatsHTML .= "<TABLE CELLPADDING=1 CELLSPACING=1 Border=0 BGCOLOR=white>";
$PRESETstatsHTML .= "<TR BGCOLOR=\"#E6E6E6\">";
$PRESETstatsHTML .= "<TD ALIGN=LEFT><font size=2><B> &nbsp; AGENTE DIAL PRESETS: &nbsp; </B></TD>";
$PRESETstatsHTML .= "<TD ALIGN=LEFT><font size=2><B> &nbsp; PRESET NAMES &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </B></TD>";
$PRESETstatsHTML .= "<TD ALIGN=LEFT><font size=2><B> &nbsp; CALLS &nbsp; </B></TD>";
$PRESETstatsHTML .= "</TR>";
$stmtB="select preset_name,xfer_count from vicidial_xfer_stats where preset_name!='' and preset_name is not NULL $group_SQLand order by preset_name;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$pre_to_print = mysql_num_rows($rslt);
$ctp=0;
while ($pre_to_print > $ctp)
{
$row=mysql_fetch_row($rslt);
$PRESETstatsHTML .= "<TR>";
$PRESETstatsHTML .= "<TD><font size=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </TD>";
$PRESETstatsHTML .= "<TD ALIGN=LEFT BGCOLOR=\"#E6E6E6\"><font size=2><B> &nbsp; $row[0] &nbsp; </B></TD>";
$PRESETstatsHTML .= "<TD ALIGN=RIGHT BGCOLOR=\"#E6E6E6\"><font size=2> &nbsp; $row[1] &nbsp; </TD>";
$PRESETstatsHTML .= "</TR>";
$ctp++;
}
if ($ctp < 1)
{
$PRESETstatsHTML .= "<TR><TD BGCOLOR=white colspan=2><font size=2>no log entries</TD></TR>";
}
$PRESETstatsHTML .= "</TABLE>";
$PRESETstatsHTML .= "</TD></TR>";
}
# http://server/vicidial/AST_timeonVDADall.php?&groups[]=ALL-ACTIVE&RR=4000&DB=0&adastats=&SIPmonitorLINK=&IAXmonitorLINK=&usergroup=&UGdisplay=1&UidORname=1&orderby=timeup&SERVdisplay=0&CALLSdisplay=1&PHONEdisplay=0&CUSTPHONEdisplay=0&with_inbound=Y&monitor_active=&monitor_phone=350a&ALLINGROUPstats=1&DROPINGROUPstats=0&NOLEADSalert=&CARRIERstats=1
##### INBOUND ONLY ###
if (ereg('O',$with_inbound))
{
@@ -974,10 +1307,8 @@ if (ereg('O',$with_inbound))
if (eregi('ALL-ACTIVE',$group_string))
{
$non_inboundSQL='';
if (ereg('N',$with_inbound))
{$non_inboundSQL = "where campaign_id NOT IN ($ALLcloser_campaignsSQL)";}
$stmtB="select sum(calls_today),sum(drops_today),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(hold_sec_stat_one),sum(hold_sec_stat_two),sum(hold_sec_answer_calls),sum(hold_sec_drop_calls),sum(hold_sec_queue_calls) from vicidial_campaign_stats $non_inboundSQL;";
$inboundSQL = "where campaign_id IN ($closer_campaignsSQL)";
$stmtB="select sum(calls_today),sum(drops_today),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(hold_sec_stat_one),sum(hold_sec_stat_two),sum(hold_sec_answer_calls),sum(hold_sec_drop_calls),sum(hold_sec_queue_calls) from vicidial_campaign_stats $inboundSQL;";
}
$stmtC="select agent_non_pause_sec from vicidial_campaign_stats $group_SQLwhere;";
@@ -1100,11 +1431,13 @@ else
{
$non_inboundSQL='';
if (ereg('N',$with_inbound))
{$non_inboundSQL = "where campaign_id NOT IN ($ALLcloser_campaignsSQL)";}
{$non_inboundSQL = "and campaign_id NOT IN($ALLcloser_campaignsSQL)";}
else
{$non_inboundSQL = "and campaign_id IN($group_SQL,$closer_campaignsSQL)";}
$multi_drop++;
$stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses),max(agent_pause_codes_active),max(list_order_mix) from vicidial_campaigns where active='Y';";
$stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses),max(agent_pause_codes_active),max(list_order_mix) from vicidial_campaigns where active='Y' $group_SQLand;";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats $non_inboundSQL;";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(agent_calls_today),sum(agent_wait_today),sum(agent_custtalk_today),sum(agent_acw_today),sum(agent_pause_today) from vicidial_campaign_stats where calls_today > -1 $non_inboundSQL;";
}
else
{
@@ -1117,13 +1450,13 @@ else
$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active,list_order_mix from vicidial_campaigns where campaign_id IN ($group_SQL,$closer_campaignsSQL);";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats where campaign_id IN ($group_SQL,$closer_campaignsSQL);";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(agent_calls_today),sum(agent_wait_today),sum(agent_custtalk_today),sum(agent_acw_today),sum(agent_pause_today) from vicidial_campaign_stats where campaign_id IN ($group_SQL,$closer_campaignsSQL);";
}
else
{
$stmt="select avg(auto_dial_level),max(dial_status_a),max(dial_status_b),max(dial_status_c),max(dial_status_d),max(dial_status_e),max(lead_order),max(lead_filter_id),max(hopper_level),max(dial_method),max(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),max(available_only_ratio_tally),max(adaptive_latest_server_time),max(local_call_time),max(dial_timeout),max(dial_statuses),max(agent_pause_codes_active),max(list_order_mix) from vicidial_campaigns where campaign_id IN($group_SQL);";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats where campaign_id IN($group_SQL);";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(agent_calls_today),sum(agent_wait_today),sum(agent_custtalk_today),sum(agent_acw_today),sum(agent_pause_today) from vicidial_campaign_stats where campaign_id IN($group_SQL);";
}
}
if ($DB > 0) {echo "\n|$stmt|$stmtB|\n";}
@@ -1187,6 +1520,11 @@ else
$VSCcat3tally = $row[13];
$VSCcat4 = $row[14];
$VSCcat4tally = $row[15];
$VSCagentcalls = $row[16];
$VSCagentwait = $row[17];
$VSCagentcust = $row[18];
$VSCagentacw = $row[19];
$VSCagentpause = $row[20];
if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) )
{
@@ -1207,7 +1545,7 @@ else
}
else
{
$stmt="select vcl_id from vicidial_campaigns_list_mix where status='ACTIVE' $groupSQLand limit 1;";
$stmt="select vcl_id from vicidial_campaigns_list_mix where status='ACTIVE' $group_SQLand limit 1;";
$rslt=mysql_query($stmt, $link);
$Lmix_to_print = mysql_num_rows($rslt);
if ($Lmix_to_print > 0)
@@ -1217,6 +1555,10 @@ else
$DIALorder = "Mezcla lista: $row[0]";
}
}
$DIALlev = sprintf("%01.3f", $DIALlev);
$agentsONEMIN = sprintf("%01.2f", $agentsONEMIN);
$diffONEMIN = sprintf("%01.2f", $diffONEMIN);
echo "<BR><table cellpadding=0 cellspacing=0><TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>DIAL NIVEL:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALlev&nbsp; &nbsp; </TD>";
@@ -1271,7 +1613,55 @@ else
echo "<TD ALIGN=RIGHT><font size=2><B>ORDER:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALorder &nbsp; &nbsp; </TD>";
echo "</TR>";
if ($AGENTtimeSTATS>0)
{
if ( ($VSCagentcalls > 0) and ($VSCagentpause > 0) )
{
$avgpauseTODAY = ($VSCagentpause / $VSCagentcalls);
$avgpauseTODAY = round($avgpauseTODAY, 0);
$avgpauseTODAY = sprintf("%01.0f", $avgpauseTODAY);
}
else
{$avgpauseTODAY=0;}
if ( ($VSCagentcalls > 0) and ($VSCagentwait > 0) )
{
$avgwaitTODAY = ($VSCagentwait / $VSCagentcalls);
$avgwaitTODAY = round($avgwaitTODAY, 0);
$avgwaitTODAY = sprintf("%01.0f", $avgwaitTODAY);
}
else
{$avgwaitTODAY=0;}
if ( ($VSCagentcalls > 0) and ($VSCagentcust > 0) )
{
$avgcustTODAY = ($VSCagentcust / $VSCagentcalls);
$avgcustTODAY = round($avgcustTODAY, 0);
$avgcustTODAY = sprintf("%01.0f", $avgcustTODAY);
}
else
{$avgcustTODAY=0;}
if ( ($VSCagentcalls > 0) and ($VSCagentacw > 0) )
{
$avgacwTODAY = ($VSCagentacw / $VSCagentcalls);
$avgacwTODAY = round($avgacwTODAY, 0);
$avgacwTODAY = sprintf("%01.0f", $avgacwTODAY);
}
else
{$avgacwTODAY=0;}
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>AGENTE AVG WAIT:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $avgwaitTODAY &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVG CUSTTIME:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $avgcustTODAY &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVG ACW:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $avgacwTODAY &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVG PAUSE:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $avgpauseTODAY &nbsp;</TD>";
echo "</TR>";
}
echo "$DROPINGROUPstatsHTML\n";
echo "$CARRIERstatsHTML\n";
echo "$PRESETstatsHTML\n";
}
echo "<TR>";
@@ -1292,60 +1682,60 @@ echo "$ingroup_detail";
if ($adastats<2)
{
echo "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=2&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>+ VIEW MORE</font></a>";
echo "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=2&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>+ VIEW MORE</font></a>";
}
else
{
echo "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=1&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>+ VIEW LESS</font></a>";
echo "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=1&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>+ VIEW LESS</font></a>";
}
if ($UGdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=0&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>PIEL GRUPO DE USUARIOS</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=0&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>PIEL GRUPO DE USUARIOS</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=1&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>VIEW GRUPO DE USUARIOS</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=1&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>VIEW GRUPO DE USUARIOS</font></a>";
}
if ($SERVdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=0&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>PIEL SERVIDOR INFO</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=0&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>PIEL SERVIDOR INFO</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=1&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>DEMOSTRACIÓN SERVIDOR INFO</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=1&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>DEMOSTRACIÓN SERVIDOR INFO</font></a>";
}
if ($CALLSdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=0&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>PIEL WAITING CALLS</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=0&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>PIEL WAITING CALLS</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=1&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>DEMOSTRACIÓN WAITING CALLS</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=1&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>DEMOSTRACIÓN WAITING CALLS</font></a>";
}
if ($ALLINGROUPstats>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=0&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>PIEL IN-GROUP STATS</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=0&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>PIEL IN-GROUP STATS</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=1&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>DEMOSTRACIÓN IN-GROUP STATS</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=1&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>DEMOSTRACIÓN IN-GROUP STATS</font></a>";
}
if ($PHONEdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=0&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>PIEL PHONES</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=0&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>PIEL PHONES</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=1&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>DEMOSTRACIÓN PHONES</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=1&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>DEMOSTRACIÓN PHONES</font></a>";
}
if ($CUSTPHONEdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=0&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>PIEL CUSTPHONES</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=0&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>PIEL CUSTPHONES</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=1&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>DEMOSTRACIÓN CUSTPHONES</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=1&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>DEMOSTRACIÓN CUSTPHONES</font></a>";
}
echo "</TD>";
echo "</TR>";
@@ -1390,6 +1780,20 @@ if ( ($with_inbound != 'O') and ($NOLEADSalert == 'YES') )
###################################################################################
if ($campaign_allow_inbound > 0)
{
if (eregi('ALL-ACTIVE',$group_string))
{
$stmt="select closer_campaigns from vicidial_campaigns where active='Y' $group_SQLand";
$rslt=mysql_query($stmt, $link);
$closer_campaigns="";
while ($row=mysql_fetch_row($rslt))
{
$closer_campaigns.="$row[0]";
}
$closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns);
$closer_campaigns = preg_replace("/ - /"," ",$closer_campaigns);
$closer_campaigns = preg_replace("/ /","','",$closer_campaigns);
$closer_campaignsSQL = "'$closer_campaigns'";
}
$stmtB="from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaignsSQL)) or (call_type IN('OUT','OUTBALANCE') $group_SQLand) ) order by queue_priority desc,campaign_id,call_time;";
}
else
@@ -1515,15 +1919,15 @@ if ($agentonlycount > 0)
{$agentonlyheader = 'AGENTONLY';}
$Cecho = '';
$Cecho .= "VICIDIAL: Calls Waiting $NOW_TIME\n";
$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+----------+\n";
$Cecho .= "| STATUS | CAMPAIGN | PHONE NUMBER | SERVER_IP | DIALTIME| CALL TYPE | PRIORIDAD | $agentonlyheader\n";
$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+----------+\n";
$Cecho .= "+--------+----------------------+--------------+-----------------+---------+------------+----------+\n";
$Cecho .= "| STATUS | CAMPAIGN | PHONE NUMBER | SERVER_IP | DIALTIME| CALL TYPE | PRIORIDAD | $agentonlyheader\n";
$Cecho .= "+--------+----------------------+--------------+-----------------+---------+------------+----------+\n";
$p=0;
while($p<$k)
{
$Cstatus = sprintf("%-6s", $CDstatus[$p]);
$Ccampaign_id = sprintf("%-12s", $CDcampaign_id[$p]);
$Ccampaign_id = sprintf("%-20s", $CDcampaign_id[$p]);
$Cphone_number = sprintf("%-12s", $CDphone_number[$p]);
$Cserver_ip = sprintf("%-15s", $CDserver_ip[$p]);
$Ccall_type = sprintf("%-10s", $CDcall_type[$p]);
@@ -1548,7 +1952,7 @@ while($p<$k)
$p++;
}
$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+----------+\n";
$Cecho .= "+--------+----------------------+--------------+-----------------+---------+------------+----------+\n";
if ($p<1)
{$Cecho='';}
@@ -1560,6 +1964,7 @@ if ($p<1)
$agent_incall=0;
$agent_ready=0;
$agent_paused=0;
$agent_dispo=0;
$agent_dead=0;
$agent_total=0;
@@ -1589,25 +1994,25 @@ $HTbegin = "|";
$HDstation = "----------------+";
$HTstation = " STATION |";
$HDphone = "-------------+";
$HTphone = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$phoneord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">PHONE</a> |";
$HTphone = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$phoneord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">PHONE</a> |";
$HDuser = "------------------------+";
$HTuser = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$userord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">USER</a> ";
$HTuser = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$userord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">USER</a> ";
if ($UidORname>0)
{
$HTuser .= "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=0&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">DEMOSTRACIÓN ID</a> ";
$HTuser .= "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=0&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">DEMOSTRACIÓN ID</a> ";
}
else
{
$HTuser .= "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=1&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">DEMOSTRACIÓN NAME</a>";
$HTuser .= "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=1&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">DEMOSTRACIÓN NAME</a>";
}
$HTuser .= " INFO |";
$HDusergroup = "--------------+";
$HTusergroup = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$groupord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">GRUPO DE USUARIOS</a> |";
$HTusergroup = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$groupord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">GRUPO DE USUARIOS</a> |";
$HDsessionid = "------------------+";
$HTsessionid = " SESSIONID |";
$HDbarge = "-------+";
@@ -1621,9 +2026,9 @@ $HTserver_ip = " SERVIDOR IP |";
$HDcall_server_ip = "-----------------+";
$HTcall_server_ip = " CALL SERVIDOR IP |";
$HDtime = "---------+";
$HTtime = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$timeord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">MM:SS</a> |";
$HTtime = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$timeord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">MM:SS</a> |";
$HDcampaign = "------------+";
$HTcampaign = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$campaignord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">CAMPAIGN</a> |";
$HTcampaign = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$campaignord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">CAMPAIGN</a> |";
$HDcalls = "-------+";
$HTcalls = " CALLS |";
$HDpause = '';
@@ -1672,9 +2077,16 @@ if ($SERVdisplay < 1)
}
$Aline = "$HDbegin$HDstation$HDphone$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDpause$HDcustphone$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign$HDcalls$HDigcall\n";
$Bline = "$HTbegin$HTstation$HTphone$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTpause$HTcustphone$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign$HTcalls$HTigcall\n";
if ($realtime_block_user_info > 0)
{
$Aline = "$HDbegin$HDusergroup$HDsessionid$HDbarge$HDstatus$HDpause$HDcustphone$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign$HDcalls$HDigcall\n";
$Bline = "$HTbegin$HTusergroup$HTsessionid$HTbarge$HTstatus$HTpause$HTcustphone$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign$HTcalls$HTigcall\n";
}
else
{
$Aline = "$HDbegin$HDstation$HDphone$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDpause$HDcustphone$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign$HDcalls$HDigcall\n";
$Bline = "$HTbegin$HTstation$HTphone$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTpause$HTcustphone$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign$HTcalls$HTigcall\n";
}
$Aecho .= "$Aline";
$Aecho .= "$Bline";
$Aecho .= "$Aline";
@@ -1698,7 +2110,7 @@ else
if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';}
}
if (eregi('ALL-ACTIVE',$group_string)) {$UgroupSQL = '';}
if ( (eregi('ALL-ACTIVE',$group_string)) and (strlen($group_SQL) < 3) ) {$UgroupSQL = '';}
else {$UgroupSQL = " and vicidial_live_agents.campaign_id IN($group_SQL)";}
if (strlen($usergroup)<1) {$usergroupSQL = '';}
else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";}
@@ -2000,7 +2412,7 @@ $calls_to_list = mysql_num_rows($rslt);
{$j++; continue;}
else
{
$agent_paused++; $agent_total++;
$agent_dispo++; $agent_total++;
$G=''; $EG='';
if ($call_time_S >= 10) {$G='<SPAN class="khaki"><B>'; $EG='</B></SPAN>';}
if ($call_time_S >= 60) {$G='<SPAN class="yellow"><B>'; $EG='</B></SPAN>';}
@@ -2088,14 +2500,20 @@ $calls_to_list = mysql_num_rows($rslt);
$agentcount++;
$Aecho .= "| $G$extension$EG |$phoneD<a href=\"./user_status.php?user=$Luser\" target=\"_blank\">$G$user$EG</a> <a href=\"javascript:ingroup_info('$Luser','$j');\">+</a> |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM $pausecode| $CP$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG |$INGRP\n";
if ($realtime_block_user_info > 0)
{
$Aecho .= "|$UGD $G$sessionid$EG$L$R | $G$status$EG $CM $pausecode| $CP$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG |$INGRP\n";
}
if ($realtime_block_user_info < 1)
{
$Aecho .= "| $G$extension$EG |$phoneD<a href=\"./user_status.php?user=$Luser\" target=\"_blank\">$G$user$EG</a> <a href=\"javascript:ingroup_info('$Luser','$j');\">+</a> |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM $pausecode| $CP$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG |$INGRP\n";
}
$j++;
}
$Aecho .= "$Aline";
$Aecho .= " $agentcount agents logged in on all servers\n";
$Aecho .= " Sistema de carga Average: $load_ave\n\n";
$Aecho .= " Sistema de carga Average: $load_ave &nbsp; $db_source\n\n";
# $Aecho .= " <SPAN class=\"orange\"><B> </SPAN> - Balanced call</B>\n";
$Aecho .= " <SPAN class=\"lightblue\"><B> </SPAN> - Agent waiting for call</B>\n";
@@ -2123,6 +2541,7 @@ $calls_to_list = mysql_num_rows($rslt);
echo "$NFB$B &nbsp;$agent_ready $BG$NFE agents waiting &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$agent_paused$NFE paused agents &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$agent_dead$NFE agentes muertos en las llamadas&nbsp; &nbsp; &nbsp; \n";
echo "$NFB$agent_dispo$NFE agents in dispo&nbsp; &nbsp; &nbsp; \n";
echo "<PRE><FONT SIZE=2>";
echo "";
@@ -1,7 +1,7 @@
<?php
# AST_timeonVDADallSUMMARY.php
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# Summary for all campaigns live real-time stats for the VICIDIAL Auto-Dialer all servers
#
@@ -16,6 +16,9 @@
# 80525-1040 - Added IVR status summary display for inbound calls
# 90310-2119 - Added admin header
# 90508-0644 - Changed to PHP long tags
# 100709-1806 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
header ("Content-type: text/html; charset=utf-8");
@@ -38,17 +41,52 @@ if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];}
if (!isset($RR)) {$gRRroup=4;}
$report_name = 'Tiempo Real Campaña Summary';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
@@ -56,10 +94,41 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
$stmt="select campaign_id from vicidial_campaigns where active='Y';";
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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')";
}
$stmt="select campaign_id from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if (!isset($DB)) {$DB=0;}
if ($DB) {echo "$stmt\n";}
@@ -107,7 +176,7 @@ if (!isset($RR)) {$RR=4;}
<?php
echo"<META HTTP-EQUIV=Refresh CONTENT=\"$RR; URL=$PHP_SELF?RR=$RR&DB=$DB&adastats=$adastats\">\n";
echo "<TITLE>Tiempo Real All Campañas Summary</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -446,10 +515,12 @@ echo "</TD>";
echo "</TR>";
echo "</TABLE>";
echo "</FORM>\n\n";
echo "</FORM>\n\n<BR>";
$k++;
}
echo "$db_source\n";
?>
</PRE>
</TD></TR></TABLE>
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
<?php
# admin_header.php - VICIDIAL administration header
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
@@ -18,6 +18,15 @@
# 90904-1534 - Added launch_moh_chooser
# 90916-2334 - Added Voicemail options
# 91223-1030 - Added VIDPROMPT options for in-group routing in Call Menus
# 100311-2210 - Added callcard_enabled Admin element
# 100428-1039 - Added custom fields display
# 100507-1339 - Added copy carrier submenu
# 100616-2350 - Added VIDPROMPT call menu options
# 100728-0904 - Changed Lead Loader link to the new 3rd gen lead loader
# 100802-2127 - Changed Admin to point to links page instead of Phones listings
# 100831-2255 - Added password strength checking function
# 100914-1311 - Removed other links for reports-only users
# 101022-1323 - Added IGU_selectall function
#
@@ -27,15 +36,23 @@ if($short_header)
?>
<TABLE CELLPADDING=0 CELLSPACING=0 BGCOLOR="#015B91"><TR>
<TD><IMG SRC="vicidial_admin_web_logo_small.gif" WIDTH=71 HEIGHT=22> &nbsp; </TD>
<?php if ($reports_only_user < 1) {
?>
<TD> &nbsp; <A HREF="admin.php" ALT="Usuarios"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Usuarios</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=10" ALT="Campañas"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Campañas</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=100" ALT="Listas"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Listas</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=1000000" ALT="Escrituras"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Escrituras</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=10000000" ALT="Filtros"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Filtros</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=1000" ALT="In-Groups"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>In-Groups</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=1000" ALT="Inbound"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Inbound</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=100000" ALT="Grupos De Usuario"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Grupos De Usuario</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=10000" ALT="Agentes Remotos"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Agentes Remotos</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=10000000000" ALT="Admin"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Admin</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=999998" ALT="Admin"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Admin</B></A> &nbsp; </TD>
<?php
}
else
{ ?>
<TD width=600> &nbsp; &nbsp; </TD>
<?php } ?>
<TD> &nbsp; <A HREF="admin.php?ADD=999999" ALT="Informes"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Informes</B></A> &nbsp; </TD>
</TR>
</TABLE>
@@ -319,34 +336,72 @@ if ( ( ($ADD==34) or ($ADD==31) or ($ADD==49) ) and ($SUB==29) and ($LOGmodify_c
<?php
}
?>
var weak = Image();
weak.src = "images/weak.png";
var medium = Image();
medium.src = "images/medium.png";
var strong = Image();
strong.src = "images/strong.png";
function openNewWindow(url) {
window.open (url,"",'width=620,height=300,scrollbars=yes,menubar=yes,address=yes');
}
function scriptInsertField() {
function pwdChanged(pwd_field_str, pwd_img_str)
{
var pwd_field = document.getElementById(pwd_field_str);
var pwd_img = document.getElementById(pwd_img_str);
var strong_regex = new RegExp( "^(?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])", "g" );
var medium_regex = new RegExp( "^(?=.{6,})(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9]))).*$", "g" );
if (strong_regex.test(pwd_field.value) )
{
if (pwd_img.src != strong.src)
{pwd_img.src = strong.src;}
}
else if (medium_regex.test( pwd_field.value) )
{
if (pwd_img.src != medium.src)
{pwd_img.src = medium.src;}
}
else
{
if (pwd_img.src != weak.src)
{pwd_img.src = weak.src;}
}
}
function openNewWindow(url)
{
window.open (url,"",'width=620,height=300,scrollbars=yes,menubar=yes,address=yes');
}
function scriptInsertField()
{
openField = '--A--';
closeField = '--B--';
var textBox = document.scriptForm.script_text;
var scriptIndex = document.getElementById("selectedField").selectedIndex;
var insValue = document.getElementById('selectedField').options[scriptIndex].value;
if (document.selection) {
//IE
textBox = document.scriptForm.script_text;
insValue = document.scriptForm.selectedField.options[document.scriptForm.selectedField.selectedIndex].text;
textBox.focus();
sel = document.selection.createRange();
sel.text = openField + insValue + closeField;
} else if (textBox.selectionStart || textBox.selectionStart == 0) {
//Mozilla
var startPos = textBox.selectionStart;
var endPos = textBox.selectionEnd;
textBox.value = textBox.value.substring(0, startPos)
+ openField + insValue + closeField
+ textBox.value.substring(endPos, textBox.value.length);
} else {
textBox.value += openField + insValue + closeField;
}
}
if (document.selection)
{
//IE
textBox = document.scriptForm.script_text;
insValue = document.scriptForm.selectedField.options[document.scriptForm.selectedField.selectedIndex].text;
textBox.focus();
sel = document.selection.createRange();
sel.text = openField + insValue + closeField;
}
else if (textBox.selectionStart || textBox.selectionStart == 0)
{
//Mozilla
var startPos = textBox.selectionStart;
var endPos = textBox.selectionEnd;
textBox.value = textBox.value.substring(0, startPos)
+ openField + insValue + closeField
+ textBox.value.substring(endPos, textBox.value.length);
}
else
{
textBox.value += openField + insValue + closeField;
}
}
<?php
@@ -519,6 +574,31 @@ if ( ($ADD==131111111) or ($ADD==331111111) or ($ADD==431111111) )
}
### Javascript for shift end-time calculation and display
if ( ($ADD==3111) or ($ADD==4111) or ($ADD==5111) )
{
?>
function IGU_selectall(temp_count,temp_fields)
{
var fields_array=temp_fields.split('|');
var inc=0;
while (temp_count >= inc)
{
if (fields_array[inc].length > 0)
{
document.getElementById(fields_array[inc]).checked=true;
// document.admin_form.fields_array[inc].checked=true;
}
inc++;
}
}
<?php
}
### select list contents generation for dynamic route displays in call menu and in-group screens
if ( ($ADD==3511) or ($ADD==2511) or ($ADD==2611) or ($ADD==4511) or ($ADD==5511) or ($ADD==3111) or ($ADD==2111) or ($ADD==2011) or ($ADD==4111) or ($ADD==5111) )
{
@@ -622,13 +702,17 @@ if ( ($ADD==3511) or ($ADD==2511) or ($ADD==2611) or ($ADD==4511) or ($ADD==5511
if (selected_route=='INGROUP')
{
if (value_context.length < 10)
{value_context = 'CID,LB,998,TESTCAMP,1';}
var value_context_split = value_context.split(",");
var IGhandle_method = value_context_split[0];
var IGsearch_method = value_context_split[1];
var IGlist_id = value_context_split[2];
var IGcampaign_id = value_context_split[3];
var IGphone_code = value_context_split[4];
{value_context = 'CID,LB,998,TESTCAMP,1,,,,';}
var value_context_split = value_context.split(",");
var IGhandle_method = value_context_split[0];
var IGsearch_method = value_context_split[1];
var IGlist_id = value_context_split[2];
var IGcampaign_id = value_context_split[3];
var IGphone_code = value_context_split[4];
var IGvid_enter_filename = value_context_split[5];
var IGvid_id_number_filename = value_context_split[6];
var IGvid_confirm_filename = value_context_split[7];
var IGvid_validate_digits = value_context_split[8];
if (route == selected_route)
{
@@ -642,12 +726,17 @@ if ( ($ADD==3511) or ($ADD==2511) or ($ADD==2611) or ($ADD==4511) or ($ADD==5511
new_content = new_content + '' + ingroup_list + "\n" + selected_value + '</select>';
new_content = new_content + ' &nbsp; Handle Method: <select size=1 name=IGhandle_method_' + option + ' id=IGhandle_method_' + option + '>';
new_content = new_content + '' + IGhandle_method_list + "\n" + '<option SELECTED>' + IGhandle_method + '</select>';
new_content = new_content + ' &nbsp; <a href="javascript:openNewWindow(\'admin.php?ADD=99999#vicidial_call_menu-ingroup_settings\')"><IMG SRC="help.gif" WIDTH=20 HEIGHT=20 Border=0 ALT="AYUDA" ALIGN=TOP></a>';
new_content = new_content + '<BR>Search Method: <select size=1 name=IGsearch_method_' + option + ' id=IGsearch_method_' + option + '>';
new_content = new_content + '' + IGsearch_method_list + "\n" + '<option SELECTED>' + IGsearch_method + '</select>';
new_content = new_content + ' &nbsp; ID De la Lista: <input type=text size=5 maxlength=14 name=IGlist_id_' + option + ' id=IGlist_id_' + option + ' value="' + IGlist_id + '">';
new_content = new_content + '<BR>ID De la Campaña: <select size=1 name=IGcampaign_id_' + option + ' id=IGcampaign_id_' + option + '>';
new_content = new_content + '' + IGcampaign_id_list + "\n" + '<option SELECTED>' + IGcampaign_id + '</select>';
new_content = new_content + ' &nbsp; Phone Code: <input type=text size=5 maxlength=14 name=IGphone_code_' + option + ' id=IGphone_code_' + option + ' value="' + IGphone_code + '">';
new_content = new_content + "<BR> &nbsp; VID Enter Filename: <input type=text name=IGvid_enter_filename_" + option + " id=IGvid_enter_filename_" + option + " size=40 maxlength=255 value=\"" + IGvid_enter_filename + "\"> <a href=\"javascript:launch_chooser('IGvid_enter_filename_" + option + "','date'," + chooser_height + ");\">audio chooser</a>";
new_content = new_content + "<BR> &nbsp; VID ID Number Filename: <input type=text name=IGvid_id_number_filename_" + option + " id=IGvid_id_number_filename_" + option + " size=40 maxlength=255 value=\"" + IGvid_id_number_filename + "\"> <a href=\"javascript:launch_chooser('IGvid_id_number_filename_" + option + "','date'," + chooser_height + ");\">audio chooser</a>";
new_content = new_content + "<BR> &nbsp; VID Confirm Filename: <input type=text name=IGvid_confirm_filename_" + option + " id=IGvid_confirm_filename_" + option + " size=40 maxlength=255 value=\"" + IGvid_confirm_filename + "\"> <a href=\"javascript:launch_chooser('IGvid_confirm_filename_" + option + "','date'," + chooser_height + ");\">audio chooser</a>";
new_content = new_content + ' &nbsp; VID Digits: <input type=text size=3 maxlength=3 name=IGvid_validate_digits_' + option + ' id=IGvid_validate_digits_' + option + ' value="' + IGvid_validate_digits + '">';
}
if (selected_route=='DID')
{
@@ -782,14 +871,18 @@ if ( ($ADD==3111) or ($ADD==2111) or ($ADD==2011) or ($ADD==4111) or ($ADD==5111
if (selected_route=='INGROUP')
{
if ( (route != selected_route) || (value.length < 10) )
{value = 'SALESLINE,CID,LB,998,TESTCAMP,1';}
{value = 'SALESLINE,CID,LB,998,TESTCAMP,1,,,,';}
var value_split = value.split(",");
var IGgroup_id = value_split[0];
var IGhandle_method = value_split[1];
var IGsearch_method = value_split[2];
var IGlist_id = value_split[3];
var IGcampaign_id = value_split[4];
var IGphone_code = value_split[5];
var IGgroup_id = value_split[0];
var IGhandle_method = value_split[1];
var IGsearch_method = value_split[2];
var IGlist_id = value_split[3];
var IGcampaign_id = value_split[4];
var IGphone_code = value_split[5];
var IGvid_enter_filename = value_split[6];
var IGvid_id_number_filename = value_split[7];
var IGvid_confirm_filename = value_split[8];
var IGvid_validate_digits = value_split[9];
if (route == selected_route)
{
@@ -807,6 +900,11 @@ if ( ($ADD==3111) or ($ADD==2111) or ($ADD==2011) or ($ADD==4111) or ($ADD==5111
new_content = new_content + '<BR>ID De la Campaña: <select size=1 name=IGcampaign_id_' + option + ' id=IGcampaign_id_' + option + '>';
new_content = new_content + '' + IGcampaign_id_list + "\n" + '<option SELECTED>' + IGcampaign_id + '</select>';
new_content = new_content + ' &nbsp; Phone Code: <input type=text size=5 maxlength=14 name=IGphone_code_' + option + ' id=IGphone_code_' + option + ' value="' + IGphone_code + '">';
// new_content = new_content + "<BR> &nbsp; VID Enter Filename: <input type=text name=IGvid_enter_filename_" + option + " id=IGvid_enter_filename_" + option + " size=40 maxlength=255 value=\"" + IGvid_enter_filename + "\"> <a href=\"javascript:launch_chooser('IGvid_enter_filename_" + option + "','date'," + chooser_height + ");\">audio chooser</a>";
// new_content = new_content + "<BR> &nbsp; VID ID Number Filename: <input type=text name=IGvid_id_number_filename_" + option + " id=IGvid_id_number_filename_" + option + " size=40 maxlength=255 value=\"" + IGvid_id_number_filename + "\"> <a href=\"javascript:launch_chooser('IGvid_id_number_filename_" + option + "','date'," + chooser_height + ");\">audio chooser</a>";
// new_content = new_content + "<BR> &nbsp; VID Confirm Filename: <input type=text name=IGvid_confirm_filename_" + option + " id=IGvid_confirm_filename_" + option + " size=40 maxlength=255 value=\"" + IGvid_confirm_filename + "\"> <a href=\"javascript:launch_chooser('IGvid_confirm_filename_" + option + "','date'," + chooser_height + ");\">audio chooser</a>";
// new_content = new_content + ' &nbsp; VID Digits: <input type=text size=3 maxlength=3 name=IGvid_validate_digits_' + option + ' id=IGvid_validate_digits_' + option + ' value="' + IGvid_validate_digits + '">';
}
if (selected_route=='DID')
{
@@ -896,11 +994,13 @@ echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<!-- ILPV -->\n";
echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP NOWRAP><a href=\"../vicidial_en/admin.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">English <img src=\"../agc/images/en.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP BGCOLOR=\"#CCFFCC\" NOWRAP><a href=\"../vicidial_es/admin.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">Español <img src=\"../agc/images/es.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";
$stmt="SELECT admin_home_url,enable_tts_integration from system_settings;";
$stmt="SELECT admin_home_url,enable_tts_integration,callcard_enabled,custom_fields_enabled from system_settings;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$admin_home_url_LU = $row[0];
$admin_home_url_LU = $row[0];
$SSenable_tts_integration = $row[1];
$SScallcard_enabled = $row[2];
$SScustom_fields_enabled = $row[3];
?>
<CENTER>
@@ -911,6 +1011,8 @@ $SSenable_tts_integration = $row[1];
<IMG SRC="./vicidial_admin_web_logo.gif" WIDTH=170 HEIGHT=45 ALT="VICIDIAL logo">
<B><FONT FACE="ARIAL,HELVETICA" COLOR=white>ADMINISTRATION</FONT></B><BR>
<TABLE CELLPADDING=2 CELLSPACING=0 BGCOLOR=#015B91 WIDTH=160>
<?php if ($reports_only_user < 1) {
?>
<!-- USUARIOS NAVIGATION -->
<TR WIDTH=160><TD <?php echo $users_hh ?> WIDTH=160>
<a href="<?php echo $ADMIN ?>?ADD=0"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $users_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $users_bold ?>Usuarios</a>
@@ -966,6 +1068,8 @@ $SSenable_tts_integration = $row[1];
else {$pause_sh=''; $pause_fc='BLACK';}
if ($sh=='listmix') {$listmix_sh="bgcolor=\"$subcamp_color\""; $listmix_fc="$subcamp_font";}
else {$listmix_sh=''; $listmix_fc='BLACK';}
if ($sh=='preset') {$preset_sh="bgcolor=\"$subcamp_color\""; $preset_fc="$subcamp_font";}
else {$preset_sh=''; $preset_fc='BLACK';}
?>
<TR BGCOLOR=<?php echo $campaigns_color ?>>
@@ -989,6 +1093,8 @@ $SSenable_tts_integration = $row[1];
?>
</TR><TR BGCOLOR=<?php echo $campaigns_color ?>>
<TD ALIGN=LEFT <?php echo $pause_sh ?>> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=37"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $pause_fc ?> SIZE=<?php echo $subcamp_font_size ?>>Pausa Códigos</a></TD>
</TR><TR BGCOLOR=<?php echo $campaigns_color ?>>
<TD ALIGN=LEFT <?php echo $preset_sh ?>> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=301"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $preset_fc ?> SIZE=<?php echo $subcamp_font_size ?>>Presets</a></TD>
<?php }
?>
<!-- LISTAS NAVIGATION -->
@@ -998,22 +1104,35 @@ $SSenable_tts_integration = $row[1];
?>
<TR><TD ALIGN=LEFT <?php echo $lists_hh ?>><a href="<?php echo $ADMIN ?>?ADD=100"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $lists_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $lists_bold ?>Listas</a></TD></TR>
<?php
if (strlen($lists_hh) > 1) {
if ($LOGdelete_from_dnc > 0) {$DNClink = 'Añadir-Supr Número de DNC';}
else {$DNClink = 'Add Number To DNC';}
if (strlen($lists_hh) > 1)
{
if ($LOGdelete_from_dnc > 0) {$DNClink = 'Add-BorrarDNC Number';}
else {$DNClink = 'Add DNC Number';}
?>
<TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=100"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Demuestre Las Listas </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Agregue Una Nueva Lista </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="admin_search_lead.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Búsqueda Para Un Plomo </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=121"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo $DNClink ?> </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="./new_listloader_superL.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Nuevos Plomos De la Carga </a>
</TD></TR>
<?php }
<TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=100"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Demuestre Las Listas </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Agregue Una Nueva Lista </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="admin_search_lead.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Búsqueda Para Un Plomo </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=121"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo $DNClink ?> </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="./admin_listloader_third_gen.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Nuevos Plomos De la Carga </a>
<?php
if ($SScustom_fields_enabled > 0)
{
?>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="./admin_lists_custom.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> List Custom Fields </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="./admin_lists_custom.php?action=COPY_FIELDS_FORM"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> CopiarCustom Fields </a>
<?php
}
?>
</TD></TR>
<?php
}
}
?>
<!-- ESCRITURAS NAVIGATION -->
@@ -1051,11 +1170,13 @@ $SSenable_tts_integration = $row[1];
?>
<!-- INGROUPS NAVIGATION -->
<TR><TD <?php echo $ingroups_hh ?>>
<a href="<?php echo $ADMIN ?>?ADD=1000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $ingroups_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $ingroups_bold ?> En-Grupos </a>
<a href="<?php echo $ADMIN ?>?ADD=1000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $ingroups_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $ingroups_bold ?> Inbound </a>
</TD></TR>
<?php
if (strlen($ingroups_hh) > 1)
{
{
if ($LOGdelete_from_dnc > 0) {$FPGlink = 'Add-BorrarFPG Number';}
else {$FPGlink = 'Add FPG Number';}
?>
<TR BGCOLOR=<?php echo $ingroups_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=1000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Demuestre A En-Grupos </a>
@@ -1074,7 +1195,13 @@ $SSenable_tts_integration = $row[1];
</TD></TR><TR BGCOLOR=<?php echo $ingroups_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=1511"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Añadir un nuevo menú de llamadas </a>
</TD></TR><TR BGCOLOR=<?php echo $ingroups_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=1611"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Copia de llamadas Menú </a>
<a href="<?php echo $ADMIN ?>?ADD=1611"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Copia de llamadas Menú </a><HR>
</TD></TR><TR BGCOLOR=<?php echo $ingroups_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=1700"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Filter Phone Groups </a>
</TD></TR><TR BGCOLOR=<?php echo $ingroups_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=1711"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Add Filter Phone Group </a>
</TD></TR><TR BGCOLOR=<?php echo $ingroups_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=171"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo $FPGlink ?> </a>
</TD></TR>
<?php }
?>
@@ -1109,12 +1236,16 @@ $SSenable_tts_integration = $row[1];
<a href="<?php echo $ADMIN ?>?ADD=10000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Demuestre Los Agentes Alejados </a>
</TR><TR BGCOLOR=<?php echo $remoteagent_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=11111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Agregue Los Agentes Alejados Nuevos </a>
</TR><TR BGCOLOR=<?php echo $remoteagent_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=12000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Show Extension Groups </a>
</TR><TR BGCOLOR=<?php echo $remoteagent_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=12111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Add Extension Group </a>
</TD></TR>
<?php }
?>
<!-- ADMIN NAVIGATION -->
<TR><TD <?php echo $admin_hh ?>>
<a href="<?php echo $ADMIN ?>?ADD=10000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $admin_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $admin_bold ?> Admin </a>
<a href="<?php echo $ADMIN ?>?ADD=999998"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $admin_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $admin_bold ?> Admin </a>
</TD></TR>
<?php
if (strlen($admin_hh) > 1)
@@ -1145,6 +1276,8 @@ $SSenable_tts_integration = $row[1];
else {$vm_sh=''; $vm_fc='BLACK';}
if ($sh=='tts') {$tts_sh="bgcolor=\"$tts_color\""; $tts_fc="$tts_font";}
else {$tts_sh=''; $tts_fc='BLACK';}
if ($sh=='cc') {$cc_sh="bgcolor=\"$cc_color\""; $cc_fc="$cc_font";}
else {$cc_sh=''; $cc_fc='BLACK';}
?>
<TR BGCOLOR=<?php echo $admin_color ?>>
@@ -1185,8 +1318,16 @@ $SSenable_tts_integration = $row[1];
<a href="<?php echo $ADMIN ?>?ADD=150000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $tts_fc ?> SIZE=<?php echo $header_font_size ?>> Text To Speech </a></TD>
</TR>
<?php }
if ($SScallcard_enabled > 0)
{ ?>
<TR BGCOLOR=<?php echo $admin_color ?>><TD ALIGN=LEFT <?php echo $cc_sh ?>> &nbsp;
<a href="callcard_admin.php"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $cc_fc ?> SIZE=<?php echo $header_font_size ?>> CallCard Admin </a></TD>
</TR>
<?php }
}
}
?>
<!-- INFORMES NAVIGATION -->
<TR><TD <?php echo $reports_hh ?>>
@@ -1245,12 +1386,16 @@ $SSenable_tts_integration = $row[1];
<?php }
if ( (strlen($carriers_sh) > 1) and (strlen($admin_hh) > 1) ) {
?>
<TR BGCOLOR=<?php echo $carriers_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=140000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Show Transportistas </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=141111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Add A New Carrier </a></TD></TR>
<TR BGCOLOR=<?php echo $carriers_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=140000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Show Transportistas </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=141111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Add A New Carrier </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=140111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> CopiarA Carrier </a></TD></TR>
<?php }
if ( (strlen($tts_sh) > 1) and (strlen($admin_hh) > 1) ) {
?>
<TR BGCOLOR=<?php echo $tts_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=150000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Mostrar las entradas TTS </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=151111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Agregar una nueva entrada TTS </a></TD></TR>
<?php }
if ( (strlen($cc_sh) > 1) and (strlen($admin_hh) > 1) ) {
?>
<TR BGCOLOR=<?php echo $cc_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="callcard_admin.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> CallCard Summary </a> &nbsp; | &nbsp; <a href="callcard_admin.php?action=CALLCARD_RUNS"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Runs </a> &nbsp; | &nbsp; <a href="callcard_admin.php?action=CALLCARD_BATCHES"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Batches </a> &nbsp; | &nbsp; <a href="callcard_admin.php?action=SEARCH"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> CallCard Search </a> &nbsp; | &nbsp; <a href="callcard_report_export.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> CallCard Log Export </a> &nbsp; | &nbsp; <a href="callcard_admin.php?action=GENERATE"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> CallCard Generate New Numbers </a></TD></TR>
<?php }
if ( (strlen($moh_sh) > 1) and (strlen($admin_hh) > 1) ) {
?>
<TR BGCOLOR=<?php echo $moh_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=160000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Mostrar las entradas del Ministerio de Salud </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=161111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Agregar una nueva entrada del Ministerio de Salud </a></TD></TR>
@@ -1,5 +1,5 @@
<?php
# admin_modify_lead.php
# admin_modify_lead.php version 2.4
#
# ViciDial database administration modify lead in vicidial_list
# admin_modify_lead.php
@@ -8,7 +8,7 @@
# just needs to enter the leadID and then they can view and modify the
# information in the record for that lead
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
#
@@ -33,6 +33,12 @@
# 90708-1549 - Added phone number dialed to outbound log
# 90721-1246 - Added rank and owner as vicidial_list fields
# 90917-2355 - Added extended alt phone entries
# 100405-1333 - Changed to show logs of non-found leads
# 100618-0148 - Added Middle name modify and fixes statuses list
# 100622-0945 - Added field labels
# 100703-1122 - Added custom fields display/edit
# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
# 100924-1431 - Added Called Count display
#
require("dbconnect.php");
@@ -48,8 +54,12 @@ if (isset($_GET["old_phone"])) {$old_phone=$_GET["old_phone"];}
elseif (isset($_POST["old_phone"])) {$old_phone=$_POST["old_phone"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["title"])) {$title=$_GET["title"];}
elseif (isset($_POST["title"])) {$title=$_POST["title"];}
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
@@ -131,8 +141,8 @@ if (isset($_GET["modify_agent_logs"])) {$modify_agent_logs=$_GET["modify_agent
if (isset($_GET["add_closer_record"])) {$add_closer_record=$_GET["add_closer_record"];}
elseif (isset($_POST["add_closer_record"])) {$add_closer_record=$_POST["add_closer_record"];}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW);
$STARTtime = date("U");
$TODAY = date("Y-m-d");
@@ -140,26 +150,34 @@ $NOW_TIME = date("Y-m-d H:i:s");
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
$i=0;
while ($i < $qm_conf_ct)
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$i++;
$non_latin = $row[0];
$custom_fields_enabled = $row[1];
}
##### END SETTINGS LOOKUP #####
###########################################
if ($non_latin < 1)
{
$PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW);
$old_phone = ereg_replace("[^0-9]","",$old_phone);
$phone_number = ereg_replace("[^0-9]","",$phone_number);
$alt_phone = ereg_replace("[^0-9]","",$alt_phone);
} # end of non_latin
else
{
$PHP_AUTH_USER = ereg_replace("'|\"|\\\\|;","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("'|\"|\\\\|;","",$PHP_AUTH_PW);
}
if (strlen($phone_number)<6) {$phone_number=$old_phone;}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';";
@@ -210,6 +228,50 @@ else
}
}
$label_title = 'Title';
$label_first_name = 'First';
$label_middle_initial = 'MI';
$label_last_name = 'Last';
$label_address1 = 'Address1';
$label_address2 = 'Address2';
$label_address3 = 'Address3';
$label_city = 'Ciudad';
$label_state = 'State';
$label_province = 'Provincia';
$label_postal_code = 'Código Postal';
$label_vendor_lead_code = 'Vendor ID';
$label_gender = 'Sexo';
$label_phone_number = 'Phone';
$label_phone_code = 'DialCode';
$label_alt_phone = 'Alt. Phone';
$label_security_phrase = 'Show';
$label_email = 'Email';
$label_comments = 'Comentarios';
### find any custom field labels
$stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if (strlen($row[0])>0) {$label_title = $row[0];}
if (strlen($row[1])>0) {$label_first_name = $row[1];}
if (strlen($row[2])>0) {$label_middle_initial = $row[2];}
if (strlen($row[3])>0) {$label_last_name = $row[3];}
if (strlen($row[4])>0) {$label_address1 = $row[4];}
if (strlen($row[5])>0) {$label_address2 = $row[5];}
if (strlen($row[6])>0) {$label_address3 = $row[6];}
if (strlen($row[7])>0) {$label_city = $row[7];}
if (strlen($row[8])>0) {$label_state = $row[8];}
if (strlen($row[9])>0) {$label_province = $row[9];}
if (strlen($row[10])>0) {$label_postal_code = $row[10];}
if (strlen($row[11])>0) {$label_vendor_lead_code = $row[11];}
if (strlen($row[12])>0) {$label_gender = $row[12];}
if (strlen($row[13])>0) {$label_phone_number = $row[13];}
if (strlen($row[14])>0) {$label_phone_code = $row[14];}
if (strlen($row[15])>0) {$label_alt_phone = $row[15];}
if (strlen($row[16])>0) {$label_security_phrase = $row[16];}
if (strlen($row[17])>0) {$label_email = $row[17];}
if (strlen($row[18])>0) {$label_comments = $row[18];}
?>
<html>
<head>
@@ -224,7 +286,7 @@ echo "<a href=\"./admin.php?ADD=100\">ADMINISTRATION</a>: Registro del Lead modi
if ($end_call > 0)
{
### update the lead record in the vicidial_list table
$stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',phone_number='$phone_number',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "',rank='" . mysql_real_escape_string($rank) . "',owner='" . mysql_real_escape_string($owner) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',title='" . mysql_real_escape_string($title) . "',first_name='" . mysql_real_escape_string($first_name) . "',middle_initial='" . mysql_real_escape_string($middle_initial) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',phone_number='$phone_number',phone_code='$phone_code',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "',rank='" . mysql_real_escape_string($rank) . "',owner='" . mysql_real_escape_string($owner) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
@@ -366,271 +428,6 @@ else
$alts_output .= "<td align=left><font size=2> $row[4] </td></tr>\n";
}
##### grab vicidial_log records #####
$stmt="select uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,user_group,term_reason,alt_dial from vicidial_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid desc limit 500;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
$u=0;
$call_log = '';
$log_campaign = '';
while ($logs_to_print > $u)
{
$row=mysql_fetch_row($rslt);
if (strlen($log_campaign)<1) {$log_campaign = $row[3];}
if (eregi("1$|3$|5$|7$|9$", $u))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$u++;
$call_log .= "<tr $bgcolor>";
$call_log .= "<td><font size=1>$u</td>";
$call_log .= "<td><font size=2>$row[4]</td>";
$call_log .= "<td align=left><font size=2> $row[7]</td>\n";
$call_log .= "<td align=left><font size=2> $row[8]</td>\n";
$call_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[11]\" target=\"_blank\">$row[11]</A> </td>\n";
$call_log .= "<td align=right><font size=2> $row[3] </td>\n";
$call_log .= "<td align=right><font size=2> $row[2] </td>\n";
$call_log .= "<td align=right><font size=2> $row[1] </td>\n";
$call_log .= "<td align=right><font size=2> $row[15] </td>\n";
$call_log .= "<td align=right><font size=2>&nbsp; $row[10] </td></tr>\n";
$campaign_id = $row[3];
}
##### grab vicidial_agent_log records #####
$stmt="select agent_log_id,user,server_ip,event_time,lead_id,campaign_id,pause_epoch,pause_sec,wait_epoch,wait_sec,talk_epoch,talk_sec,dispo_epoch,dispo_sec,status,user_group,comments,sub_status from vicidial_agent_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 500;";
$rslt=mysql_query($stmt, $link);
$Alogs_to_print = mysql_num_rows($rslt);
$y=0;
$agent_log = '';
$Alog_campaign = '';
while ($Alogs_to_print > $y)
{
$row=mysql_fetch_row($rslt);
if (strlen($Alog_campaign)<1) {$Alog_campaign = $row[5];}
if (eregi("1$|3$|5$|7$|9$", $y))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$y++;
$agent_log .= "<tr $bgcolor>";
$agent_log .= "<td><font size=1>$y</td>";
$agent_log .= "<td><font size=2>$row[3]</td>";
$agent_log .= "<td align=left><font size=2> $row[5]</td>\n";
$agent_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[1]\" target=\"_blank\">$row[1]</A> </td>\n";
$agent_log .= "<td align=right><font size=2> $row[7]</td>\n";
$agent_log .= "<td align=right><font size=2> $row[9] </td>\n";
$agent_log .= "<td align=right><font size=2> $row[11] </td>\n";
$agent_log .= "<td align=right><font size=2> $row[13] </td>\n";
$agent_log .= "<td align=right><font size=2> &nbsp; $row[14] </td>\n";
$agent_log .= "<td align=right><font size=2> &nbsp; $row[15] </td>\n";
$agent_log .= "<td align=right><font size=2> &nbsp; $row[17] </td></tr>\n";
$campaign_id = $row[5];
}
##### grab vicidial_closer_log records #####
$stmt="select closecallid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,queue_seconds,user_group,xfercallid,term_reason,uniqueid,agent_only from vicidial_closer_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by closecallid desc limit 500;";
$rslt=mysql_query($stmt, $link);
$Clogs_to_print = mysql_num_rows($rslt);
$y=0;
$closer_log = '';
$Clog_campaign = '';
while ($Clogs_to_print > $y)
{
$row=mysql_fetch_row($rslt);
if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];}
if (eregi("1$|3$|5$|7$|9$", $y))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$y++;
$closer_log .= "<tr $bgcolor>";
$closer_log .= "<td><font size=1>$y</td>";
$closer_log .= "<td><font size=2>$row[4]</td>";
$closer_log .= "<td align=left><font size=2> $row[7]</td>\n";
$closer_log .= "<td align=left><font size=2> $row[8]</td>\n";
$closer_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[11]\" target=\"_blank\">$row[11]</A> </td>\n";
$closer_log .= "<td align=right><font size=2> $row[3] </td>\n";
$closer_log .= "<td align=right><font size=2> $row[2] </td>\n";
$closer_log .= "<td align=right><font size=2> $row[1] </td>\n";
$closer_log .= "<td align=right><font size=2> &nbsp; $row[14] </td>\n";
$closer_log .= "<td align=right><font size=2> &nbsp; $row[17] </td></tr>\n";
$campaign_id = $row[3];
}
##### grab vicidial_list data for lead #####
$stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$lead_id = "$row[0]";
$dispo = "$row[3]";
$tsr = "$row[4]";
$vendor_id = "$row[5]";
$list_id = "$row[7]";
$gmt_offset_now = "$row[8]";
$phone_code = "$row[10]";
$phone_number = "$row[11]";
$title = "$row[12]";
$first_name = "$row[13]";
$middle_initial = "$row[14]";
$last_name = "$row[15]";
$address1 = "$row[16]";
$address2 = "$row[17]";
$address3 = "$row[18]";
$city = "$row[19]";
$state = "$row[20]";
$province = "$row[21]";
$postal_code = "$row[22]";
$country_code = "$row[23]";
$gender = "$row[24]";
$date_of_birth = "$row[25]";
$alt_phone = "$row[26]";
$email = "$row[27]";
$security = "$row[28]";
$comments = "$row[29]";
$called_count = "$row[30]";
$last_local_call_time = "$row[31]";
$rank = "$row[32]";
$owner = "$row[33]";
echo "<br>Información de la llamada: $first_name $last_name - $phone_number<br><br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=end_call value=1>\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=dispo value=\"$dispo\">\n";
echo "<input type=hidden name=list_id value=\"$list_id\">\n";
echo "<input type=hidden name=campaign_id value=\"$campaign_id\">\n";
echo "<input type=hidden name=phone_code value=\"$phone_code\">\n";
echo "<input type=hidden name=old_phone value=\"$phone_number\">\n";
echo "<input type=hidden name=server_ip value=\"$server_ip\">\n";
echo "<input type=hidden name=extension value=\"$extension\">\n";
echo "<input type=hidden name=channel value=\"$channel\">\n";
echo "<input type=hidden name=call_began value=\"$call_began\">\n";
echo "<input type=hidden name=parked_time value=\"$parked_time\">\n";
echo "<table cellpadding=1 cellspacing=0>\n";
echo "<tr><td colspan=2>Vendor ID: $vendor_id &nbsp; &nbsp; Lead ID: $lead_id</td></tr>\n";
echo "<tr><td colspan=2>Fronter: <A HREF=\"user_stats.php?user=$tsr\">$tsr</A> &nbsp; &nbsp; ID De la Lista: $list_id</td></tr>\n";
echo "<tr><td align=right>Nombre: </td><td align=left><input type=text name=first_name size=15 maxlength=30 value=\"$first_name\"> &nbsp; \n";
echo " Apellidos: <input type=text name=last_name size=15 maxlength=30 value=\"$last_name\"> </td></tr>\n";
echo "<tr><td align=right>Dirección 1 : </td><td align=left><input type=text name=address1 size=30 maxlength=30 value=\"$address1\"></td></tr>\n";
echo "<tr><td align=right>Dirección 2 : </td><td align=left><input type=text name=address2 size=30 maxlength=30 value=\"$address2\"></td></tr>\n";
echo "<tr><td align=right>Dirección 3 : </td><td align=left><input type=text name=address3 size=30 maxlength=30 value=\"$address3\"></td></tr>\n";
echo "<tr><td align=right>Ciudad : </td><td align=left><input type=text name=city size=30 maxlength=30 value=\"$city\"></td></tr>\n";
echo "<tr><td align=right>Estado: </td><td align=left><input type=text name=state size=2 maxlength=2 value=\"$state\"> &nbsp; \n";
echo " Código Postal: <input type=text name=postal_code size=10 maxlength=10 value=\"$postal_code\"> </td></tr>\n";
echo "<tr><td align=right>Provincia: </td><td align=left><input type=text name=province size=30 maxlength=30 value=\"$province\"></td></tr>\n";
echo "<tr><td align=right>País : </td><td align=left><input type=text name=country_code size=3 maxlength=3 value=\"$country_code\"></td></tr>\n";
echo "<tr><td align=right>Main Phone : </td><td align=left><input type=text name=phone_number size=20 maxlength=20 value=\"$phone_number\"></td></tr>\n";
echo "<tr><td align=right>Alt Phone : </td><td align=left><input type=text name=alt_phone size=20 maxlength=20 value=\"$alt_phone\"></td></tr>\n";
echo "<tr><td align=right>Email : </td><td align=left><input type=text name=email size=30 maxlength=50 value=\"$email\"></td></tr>\n";
echo "<tr><td align=right>Seguridad: </td><td align=left><input type=text name=security size=30 maxlength=100 value=\"$security\"></td></tr>\n";
echo "<tr><td align=right>Rank : </td><td align=left><input type=text name=rank size=7 maxlength=5 value=\"$rank\"></td></tr>\n";
echo "<tr><td align=right>Owner : </td><td align=left><input type=text name=owner size=22 maxlength=20 value=\"$owner\"></td></tr>\n";
echo "<tr><td align=right>Comentarios : </td><td align=left><TEXTAREA name=comments ROWS=3 COLS=65>$comments</TEXTAREA></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Disposición: </td><td align=left><select size=1 name=status>\n";
$stmt="SELECT status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable from vicidial_statuses where selectable='Y' order by status";
$rslt=mysql_query($stmt, $link);
$statuses_to_print = mysql_num_rows($rslt);
$statuses_list='';
$o=0;
$DS=0;
while ($statuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
if ( (strlen($dispo) == strlen($rowx[0])) and (eregi($dispo,$rowx[0])) )
{$statuses_list .= "<option SELECTED value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; $DS++;}
else
{$statuses_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";}
$o++;
}
$stmt="SELECT status,status_name,selectable,campaign_id,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable from vicidial_campaign_statuses where selectable='Y' and campaign_id='$log_campaign' order by status";
$rslt=mysql_query($stmt, $link);
$CAMPstatuses_to_print = mysql_num_rows($rslt);
$o=0;
while ($CAMPstatuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
if ( (strlen($dispo) == strlen($rowx[0])) and (eregi($dispo,$rowx[0])) )
{$statuses_list .= "<option SELECTED value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; $DS++;}
else
{$statuses_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";}
$o++;
}
if ($DS < 1) {$statuses_list .= "<option SELECTED value=\"$dispo\">$dispo</option>\n";}
echo "$statuses_list";
echo "</select> <i>(with $log_campaign statuses)</i></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modificarvicidial log </td><td align=left><input type=checkbox name=modify_logs value=\"1\" CHECKED></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modificaragent log </td><td align=left><input type=checkbox name=modify_agent_logs value=\"1\" CHECKED></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modificarcloser log </td><td align=left><input type=checkbox name=modify_closer_logs value=\"1\"></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Add closer log record </td><td align=left><input type=checkbox name=add_closer_record value=\"1\"></td></tr>\n";
echo "<tr><td colspan=2 align=center><input type=submit name=submit value=\"ENVIAR\"></td></tr>\n";
echo "</table></form>\n";
echo "<BR><BR><BR>\n";
if ( ($dispo == 'CALLBK') or ($dispo == 'CBHOLD') )
{
### find any vicidial_callback records for this lead
$stmt="select callback_id,lead_id,list_id,campaign_id,status,entry_time,callback_time,modify_date,user,recipient,comments,user_group from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$CB_to_print = mysql_num_rows($rslt);
$rowx=mysql_fetch_row($rslt);
if ($CB_to_print>0)
{
if ($rowx[9] == 'USERONLY')
{
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeUSERtoANY value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "<input type=submit name=submit value=\"CHANGE TO ANYONE CALLBACK\"></form><BR>\n";
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeUSERtoUSER value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "New Callback Owner UsuarioID: <input type=text name=CBuser size=8 maxlength=10 value=\"$rowx[8]\"> \n";
echo "<input type=submit name=submit value=\"CHANGE USERONLY CALLBACK USER\"></form><BR>\n";
}
else
{
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeANYtoUSER value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "New Callback Owner UsuarioID: <input type=text name=CBuser size=8 maxlength=10 value=\"$rowx[8]\"> \n";
echo "<input type=submit name=submit value=\"CHANGE TO USERONLY CALLBACK\"></form><BR>\n";
}
}
else
{
echo "<BR>No Callback records found<BR>\n";
}
}
}
else
{
@@ -638,6 +435,288 @@ else
# echo "<a href=\"$PHP_SELF\">Close this window</a>\n<BR><BR>\n";
}
##### grab vicidial_log records #####
$stmt="select uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,user_group,term_reason,alt_dial from vicidial_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid desc limit 500;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
$u=0;
$call_log = '';
$log_campaign = '';
while ($logs_to_print > $u)
{
$row=mysql_fetch_row($rslt);
if (strlen($log_campaign)<1) {$log_campaign = $row[3];}
if (eregi("1$|3$|5$|7$|9$", $u))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$u++;
$call_log .= "<tr $bgcolor>";
$call_log .= "<td><font size=1>$u</td>";
$call_log .= "<td><font size=2>$row[4]</td>";
$call_log .= "<td align=left><font size=2> $row[7]</td>\n";
$call_log .= "<td align=left><font size=2> $row[8]</td>\n";
$call_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[11]\" target=\"_blank\">$row[11]</A> </td>\n";
$call_log .= "<td align=right><font size=2> $row[3] </td>\n";
$call_log .= "<td align=right><font size=2> $row[2] </td>\n";
$call_log .= "<td align=right><font size=2> $row[1] </td>\n";
$call_log .= "<td align=right><font size=2> $row[15] </td>\n";
$call_log .= "<td align=right><font size=2>&nbsp; $row[10] </td></tr>\n";
$campaign_id = $row[3];
}
##### grab vicidial_agent_log records #####
$stmt="select agent_log_id,user,server_ip,event_time,lead_id,campaign_id,pause_epoch,pause_sec,wait_epoch,wait_sec,talk_epoch,talk_sec,dispo_epoch,dispo_sec,status,user_group,comments,sub_status from vicidial_agent_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 500;";
$rslt=mysql_query($stmt, $link);
$Alogs_to_print = mysql_num_rows($rslt);
$y=0;
$agent_log = '';
$Alog_campaign = '';
while ($Alogs_to_print > $y)
{
$row=mysql_fetch_row($rslt);
if (strlen($Alog_campaign)<1) {$Alog_campaign = $row[5];}
if (eregi("1$|3$|5$|7$|9$", $y))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$y++;
$agent_log .= "<tr $bgcolor>";
$agent_log .= "<td><font size=1>$y</td>";
$agent_log .= "<td><font size=2>$row[3]</td>";
$agent_log .= "<td align=left><font size=2> $row[5]</td>\n";
$agent_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[1]\" target=\"_blank\">$row[1]</A> </td>\n";
$agent_log .= "<td align=right><font size=2> $row[7]</td>\n";
$agent_log .= "<td align=right><font size=2> $row[9] </td>\n";
$agent_log .= "<td align=right><font size=2> $row[11] </td>\n";
$agent_log .= "<td align=right><font size=2> $row[13] </td>\n";
$agent_log .= "<td align=right><font size=2> &nbsp; $row[14] </td>\n";
$agent_log .= "<td align=right><font size=2> &nbsp; $row[15] </td>\n";
$agent_log .= "<td align=right><font size=2> &nbsp; $row[17] </td></tr>\n";
$campaign_id = $row[5];
}
##### grab vicidial_closer_log records #####
$stmt="select closecallid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,queue_seconds,user_group,xfercallid,term_reason,uniqueid,agent_only from vicidial_closer_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by closecallid desc limit 500;";
$rslt=mysql_query($stmt, $link);
$Clogs_to_print = mysql_num_rows($rslt);
$y=0;
$closer_log = '';
$Clog_campaign = '';
while ($Clogs_to_print > $y)
{
$row=mysql_fetch_row($rslt);
if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];}
if (eregi("1$|3$|5$|7$|9$", $y))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$y++;
$closer_log .= "<tr $bgcolor>";
$closer_log .= "<td><font size=1>$y</td>";
$closer_log .= "<td><font size=2>$row[4]</td>";
$closer_log .= "<td align=left><font size=2> $row[7]</td>\n";
$closer_log .= "<td align=left><font size=2> $row[8]</td>\n";
$closer_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[11]\" target=\"_blank\">$row[11]</A> </td>\n";
$closer_log .= "<td align=right><font size=2> $row[3] </td>\n";
$closer_log .= "<td align=right><font size=2> $row[2] </td>\n";
$closer_log .= "<td align=right><font size=2> $row[1] </td>\n";
$closer_log .= "<td align=right><font size=2> &nbsp; $row[14] </td>\n";
$closer_log .= "<td align=right><font size=2> &nbsp; $row[17] </td></tr>\n";
$campaign_id = $row[3];
}
##### grab vicidial_list data for lead #####
$stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
if (strlen($row[0]) > 0)
{$lead_id = $row[0];}
$dispo = $row[3];
$tsr = $row[4];
$vendor_id = $row[5];
$list_id = $row[7];
$gmt_offset_now = $row[8];
$phone_code = $row[10];
$phone_number = $row[11];
$title = $row[12];
$first_name = $row[13];
$middle_initial = $row[14];
$last_name = $row[15];
$address1 = $row[16];
$address2 = $row[17];
$address3 = $row[18];
$city = $row[19];
$state = $row[20];
$province = $row[21];
$postal_code = $row[22];
$country_code = $row[23];
$gender = $row[24];
$date_of_birth = $row[25];
$alt_phone = $row[26];
$email = $row[27];
$security = $row[28];
$comments = $row[29];
$called_count = $row[30];
$last_local_call_time = $row[31];
$rank = $row[32];
$owner = $row[33];
$entry_list_id = $row[34];
echo "<br>Información de la llamada: $first_name $last_name - $phone_number<br><br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=end_call value=1>\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=dispo value=\"$dispo\">\n";
echo "<input type=hidden name=list_id value=\"$list_id\">\n";
echo "<input type=hidden name=campaign_id value=\"$campaign_id\">\n";
echo "<input type=hidden name=old_phone value=\"$phone_number\">\n";
echo "<input type=hidden name=server_ip value=\"$server_ip\">\n";
echo "<input type=hidden name=extension value=\"$extension\">\n";
echo "<input type=hidden name=channel value=\"$channel\">\n";
echo "<input type=hidden name=call_began value=\"$call_began\">\n";
echo "<input type=hidden name=parked_time value=\"$parked_time\">\n";
echo "<table cellpadding=1 cellspacing=0>\n";
echo "<tr><td colspan=2>$label_vendor_lead_code: $vendor_id &nbsp; &nbsp; Lead ID: $lead_id</td></tr>\n";
echo "<tr><td colspan=2>Fronter: <A HREF=\"user_stats.php?user=$tsr\">$tsr</A> &nbsp; &nbsp; ID De la Lista: $list_id &nbsp; &nbsp; Called Count: $called_count</td></tr>\n";
echo "<tr><td align=right>$label_title: </td><td align=left><input type=text name=title size=4 maxlength=4 value=\"$title\"> &nbsp; \n";
echo "$label_first_name: <input type=text name=first_name size=15 maxlength=30 value=\"$first_name\"> </td></tr>\n";
echo "<tr><td align=right>$label_middle_initial: </td><td align=left><input type=text name=middle_initial size=4 maxlength=1 value=\"$middle_initial\"> &nbsp; \n";
echo " $label_last_name: <input type=text name=last_name size=15 maxlength=30 value=\"$last_name\"> </td></tr>\n";
echo "<tr><td align=right>$label_address1 : </td><td align=left><input type=text name=address1 size=30 maxlength=30 value=\"$address1\"></td></tr>\n";
echo "<tr><td align=right>$label_address2 : </td><td align=left><input type=text name=address2 size=30 maxlength=30 value=\"$address2\"></td></tr>\n";
echo "<tr><td align=right>$label_address3 : </td><td align=left><input type=text name=address3 size=30 maxlength=30 value=\"$address3\"></td></tr>\n";
echo "<tr><td align=right>$label_city : </td><td align=left><input type=text name=city size=30 maxlength=30 value=\"$city\"></td></tr>\n";
echo "<tr><td align=right>$label_state: </td><td align=left><input type=text name=state size=2 maxlength=2 value=\"$state\"> &nbsp; \n";
echo " $label_postal_code: <input type=text name=postal_code size=10 maxlength=10 value=\"$postal_code\"> </td></tr>\n";
echo "<tr><td align=right>$label_province : </td><td align=left><input type=text name=province size=30 maxlength=30 value=\"$province\"></td></tr>\n";
echo "<tr><td align=right>País : </td><td align=left><input type=text name=country_code size=3 maxlength=3 value=\"$country_code\"></td></tr>\n";
echo "<tr><td align=right>$label_phone_number : </td><td align=left><input type=text name=phone_number size=20 maxlength=20 value=\"$phone_number\"></td></tr>\n";
echo "<tr><td align=right>$label_phone_code : </td><td align=left><input type=text name=phone_code size=10 maxlength=10 value=\"$phone_code\"></td></tr>\n";
echo "<tr><td align=right>$label_alt_phone : </td><td align=left><input type=text name=alt_phone size=20 maxlength=20 value=\"$alt_phone\"></td></tr>\n";
echo "<tr><td align=right>$label_email : </td><td align=left><input type=text name=email size=30 maxlength=50 value=\"$email\"></td></tr>\n";
echo "<tr><td align=right>$label_security_phrase : </td><td align=left><input type=text name=security size=30 maxlength=100 value=\"$security\"></td></tr>\n";
echo "<tr><td align=right>Rank : </td><td align=left><input type=text name=rank size=7 maxlength=5 value=\"$rank\"></td></tr>\n";
echo "<tr><td align=right>Owner : </td><td align=left><input type=text name=owner size=22 maxlength=20 value=\"$owner\"></td></tr>\n";
echo "<tr><td align=right>$label_comments : </td><td align=left><TEXTAREA name=comments ROWS=3 COLS=65>$comments</TEXTAREA></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Disposición: </td><td align=left><select size=1 name=status>\n";
$list_campaign='';
$stmt="SELECT campaign_id from vicidial_lists where list_id='$list_id'";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$Cstatuses_to_print = mysql_num_rows($rslt);
if ($Cstatuses_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$list_campaign = $row[0];
}
$stmt="SELECT status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable from vicidial_statuses where selectable='Y' order by status";
$rslt=mysql_query($stmt, $link);
$statuses_to_print = mysql_num_rows($rslt);
$statuses_list='';
$o=0;
$DS=0;
while ($statuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
if ( (strlen($dispo) == strlen($rowx[0])) and (eregi($dispo,$rowx[0])) )
{$statuses_list .= "<option SELECTED value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; $DS++;}
else
{$statuses_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";}
$o++;
}
$stmt="SELECT status,status_name,selectable,campaign_id,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable from vicidial_campaign_statuses where selectable='Y' and campaign_id='$list_campaign' order by status";
$rslt=mysql_query($stmt, $link);
$CAMPstatuses_to_print = mysql_num_rows($rslt);
$o=0;
while ($CAMPstatuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
if ( (strlen($dispo) == strlen($rowx[0])) and (eregi($dispo,$rowx[0])) )
{$statuses_list .= "<option SELECTED value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; $DS++;}
else
{$statuses_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";}
$o++;
}
if ($DS < 1) {$statuses_list .= "<option SELECTED value=\"$dispo\">$dispo</option>\n";}
echo "$statuses_list";
echo "</select> <i>(with $list_campaign statuses)</i></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modificarvicidial log </td><td align=left><input type=checkbox name=modify_logs value=\"1\" CHECKED></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modificaragent log </td><td align=left><input type=checkbox name=modify_agent_logs value=\"1\" CHECKED></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modificarcloser log </td><td align=left><input type=checkbox name=modify_closer_logs value=\"1\"></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Add closer log record </td><td align=left><input type=checkbox name=add_closer_record value=\"1\"></td></tr>\n";
echo "<tr><td colspan=2 align=center><input type=submit name=submit value=\"ENVIAR\"></td></tr>\n";
echo "</table></form>\n";
echo "<BR><BR><BR>\n";
if ( ($dispo == 'CALLBK') or ($dispo == 'CBHOLD') )
{
### find any vicidial_callback records for this lead
$stmt="select callback_id,lead_id,list_id,campaign_id,status,entry_time,callback_time,modify_date,user,recipient,comments,user_group from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$CB_to_print = mysql_num_rows($rslt);
$rowx=mysql_fetch_row($rslt);
if ($CB_to_print>0)
{
if ($rowx[9] == 'USERONLY')
{
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeUSERtoANY value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "<input type=submit name=submit value=\"CHANGE TO ANYONE CALLBACK\"></form><BR>\n";
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeUSERtoUSER value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "New Callback Owner UsuarioID: <input type=text name=CBuser size=8 maxlength=10 value=\"$rowx[8]\"> \n";
echo "<input type=submit name=submit value=\"CHANGE USERONLY CALLBACK USER\"></form><BR>\n";
}
else
{
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeANYtoUSER value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "New Callback Owner UsuarioID: <input type=text name=CBuser size=8 maxlength=10 value=\"$rowx[8]\"> \n";
echo "<input type=submit name=submit value=\"CHANGE TO USERONLY CALLBACK\"></form><BR>\n";
}
}
else
{
echo "<BR>No Callback records found<BR>\n";
}
}
echo "<br><br>\n";
@@ -656,6 +735,37 @@ else
echo "<BR><BR>\n";
}
### iframe for custom fields display/editing
if ($custom_fields_enabled > 0)
{
$CLlist_id = $list_id;
if (strlen($entry_list_id) > 2)
{$CLlist_id = $entry_list_id;}
$stmt="DEMOSTRACIÓN TABLAS LIKE \"custom_$CLlist_id\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmt="SELECT count(*) from custom_$CLlist_id where lead_id='$lead_id';";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$fieldscount_to_print = mysql_num_rows($rslt);
if ($fieldscount_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$custom_records_count = $rowx[0];
echo "<B>CUSTOM FIELDS FOR THIS LEAD:</B><BR>\n";
echo "<iframe src=\"../agc/vdc_form_display.php?lead_id=$lead_id&list_id=$CLlist_id&stage=DISPLAY&submit_button=YES&user=$PHP_AUTH_USER&pass=$PHP_AUTH_PW&bgcolor=E6E6E6\" style=\"background-color:transparent;\" scrolling=\"auto\" frameborder=\"2\" allowtransparency=\"true\" id=\"vcFormIFrame\" name=\"vcFormIFrame\" width=\"740\" height=\"300\" STYLE=\"z-index:18\"> </iframe>\n";
echo "<BR><BR>";
}
}
}
echo "<B>LLAMADAS A ESTE LEAD:</B>\n";
echo "<TABLE width=750 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2>LENGTH</td><td align=left><font size=2> STATUS</td><td align=left><font size=2> TSR</td><td align=right><font size=2> CAMPAÑA</td><td align=right><font size=2> LIST</td><td align=right><font size=2> LEAD</td><td align=right><font size=2> HANGUP REASON</td><td align=right><font size=2> PHONE</td></tr>\n";
@@ -692,6 +802,7 @@ else
$stmt="select recording_id,channel,server_ip,extension,start_time,start_epoch,end_time,end_epoch,length_in_sec,length_in_min,filename,location,lead_id,user,vicidial_id from recording_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by recording_id desc limit 500;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
if ($DB) {echo "$logs_to_print|$stmt|\n";}
$u=0;
while ($logs_to_print > $u)
@@ -731,7 +842,7 @@ else
{$locat = substr($location,0,27); $locat = "$locat...";}
else
{$locat = $location;}
if (eregi("http",$location))
if ( (eregi("ftp",$location)) or (eregi("http",$location)) )
{$location = "<a href=\"$location\">$locat</a>";}
else
{$location = $locat;}
@@ -750,7 +861,21 @@ else
}
echo "</TABLE></center>\n";
echo "</TABLE><BR><BR>\n";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 9 and modify_leads='1';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$admin_display=$row[0];
if ($admin_display > 0)
{
echo "<a href=\"./admin.php?ADD=720000000000000&stage=$lead_id&category=LEADS\">Click here to see Lead Modificarchanges to this lead</a>\n";
}
echo "</center>\n";
}
@@ -1,5 +1,5 @@
<?php
# admin_search_lead.php
# admin_search_lead.php version 2.4
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
@@ -22,6 +22,8 @@
# 90917-2307 - Added alternate phone number searching option
# 90921-0713 - Removed SELECT STAR
# 100224-1621 - Added first/last name search and changed format of the page
# 100405-1331 - Added log search ability
# 100622-0928 - Added field labels
#
require("dbconnect.php");
@@ -39,6 +41,10 @@ if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["log_phone"])) {$log_phone=$_GET["log_phone"];}
elseif (isset($_POST["log_phone"])) {$log_phone=$_POST["log_phone"];}
if (isset($_GET["log_lead_id"])) {$log_lead_id=$_GET["log_lead_id"];}
elseif (isset($_POST["log_lead_id"])) {$log_lead_id=$_POST["log_lead_id"];}
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];}
@@ -141,13 +147,58 @@ $subcamp_color = '#C6C6C6';
require("admin_header.php");
$label_title = 'Title';
$label_first_name = 'First';
$label_middle_initial = 'MI';
$label_last_name = 'Last';
$label_address1 = 'Address1';
$label_address2 = 'Address2';
$label_address3 = 'Address3';
$label_city = 'Ciudad';
$label_state = 'State';
$label_province = 'Provincia';
$label_postal_code = 'Código Postal';
$label_vendor_lead_code = 'Vendor ID';
$label_gender = 'Sexo';
$label_phone_number = 'Phone';
$label_phone_code = 'DialCode';
$label_alt_phone = 'Alt. Phone';
$label_security_phrase = 'Show';
$label_email = 'Email';
$label_comments = 'Comentarios';
### find any custom field labels
$stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if (strlen($row[0])>0) {$label_title = $row[0];}
if (strlen($row[1])>0) {$label_first_name = $row[1];}
if (strlen($row[2])>0) {$label_middle_initial = $row[2];}
if (strlen($row[3])>0) {$label_last_name = $row[3];}
if (strlen($row[4])>0) {$label_address1 = $row[4];}
if (strlen($row[5])>0) {$label_address2 = $row[5];}
if (strlen($row[6])>0) {$label_address3 = $row[6];}
if (strlen($row[7])>0) {$label_city = $row[7];}
if (strlen($row[8])>0) {$label_state = $row[8];}
if (strlen($row[9])>0) {$label_province = $row[9];}
if (strlen($row[10])>0) {$label_postal_code = $row[10];}
if (strlen($row[11])>0) {$label_vendor_lead_code = $row[11];}
if (strlen($row[12])>0) {$label_gender = $row[12];}
if (strlen($row[13])>0) {$label_phone_number = $row[13];}
if (strlen($row[14])>0) {$label_phone_code = $row[14];}
if (strlen($row[15])>0) {$label_alt_phone = $row[15];}
if (strlen($row[16])>0) {$label_security_phrase = $row[16];}
if (strlen($row[17])>0) {$label_email = $row[17];}
if (strlen($row[18])>0) {$label_comments = $row[18];}
echo " Lead search: $vendor_id $phone $lead_id $status $list_id $user\n";
echo date("l F j, Y G:i:s A");
echo "<BR>\n";
if ( (!$vendor_id) and (!$phone) and (!$lead_id) and ( (strlen($status)<1) and (strlen($list_id)<1) and (strlen($user)<1) ) and ( (strlen($first_name)<1) and (strlen($last_name)<1) ))
if ( (!$vendor_id) and (!$phone) and (!$lead_id) and (!$log_phone) and (!$log_lead_id) and ( (strlen($status)<1) and (strlen($list_id)<1) and (strlen($user)<1) ) and ( (strlen($first_name)<1) and (strlen($last_name)<1) ))
{
### Lead search
echo "<br><center>\n";
echo "<form method=post name=search action=\"$PHP_SELF\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
@@ -156,16 +207,16 @@ if ( (!$vendor_id) and (!$phone) and (!$lead_id) and ( (strlen($status)<1) and
echo "<TD colspan=3 align=center><b>Buscar Lead Opcións:</TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>Vendor ID(código del vendedor del Lead): &nbsp; </TD><TD ALIGN=left><input type=text name=vendor_id size=10 maxlength=10></TD>";
echo "<TD ALIGN=right>$label_vendor_lead_code(código del vendedor del Lead): &nbsp; </TD><TD ALIGN=left><input type=text name=vendor_id size=10 maxlength=10></TD>";
echo "<TD><input type=submit name=submit value=ENVIAR></TD>\n";
echo "</TR><TR>";
echo "<TD colspan=3 align=center> &nbsp; </TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>Home Número De Teléfono: &nbsp; </TD><TD ALIGN=left><input type=text name=phone size=14 maxlength=18></TD>";
echo "<TD ALIGN=right>$label_phone_number: &nbsp; </TD><TD ALIGN=left><input type=text name=phone size=14 maxlength=18></TD>";
echo "<TD rowspan=2><input type=submit name=submit value=ENVIAR></TD>\n";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>Alt phone search: &nbsp; </TD><TD ALIGN=left><select size=1 name=alt_phone_search><option>No</option><option>Yes</option><option SELECTED>$alt_phone_search</option></select></TD>";
echo "<TD ALIGN=right>$label_alt_phone search: &nbsp; </TD><TD ALIGN=left><select size=1 name=alt_phone_search><option>No</option><option>Yes</option><option SELECTED>$alt_phone_search</option></select></TD>";
echo "</TR><TR>";
echo "<TD colspan=3 align=center> &nbsp; </TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
@@ -186,12 +237,33 @@ if ( (!$vendor_id) and (!$phone) and (!$lead_id) and ( (strlen($status)<1) and
echo "<TD colspan=3 align=center> &nbsp; </TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>Nombre: &nbsp; </TD><TD ALIGN=left><input type=text name=first_name size=15 maxlength=30></TD>";
echo "<TD ALIGN=right>$label_first_name: &nbsp; </TD><TD ALIGN=left><input type=text name=first_name size=15 maxlength=30></TD>";
echo "<TD rowspan=2><input type=submit name=submit value=ENVIAR></TD>\n";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>Apellidos: &nbsp; </TD><TD ALIGN=left><input type=text name=last_name size=15 maxlength=30></TD>";
echo "<TD ALIGN=right>$label_last_name: &nbsp; </TD><TD ALIGN=left><input type=text name=last_name size=15 maxlength=30></TD>";
echo "</TR>";
### Log search
echo "<br><center>\n";
echo "<TD colspan=3 align=center> &nbsp; </TD>";
echo "</TR><TR>";
echo "<TD colspan=3 align=center><b>Log Search Opcións:</TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>Lead ID: &nbsp; </TD><TD ALIGN=left><input type=text name=log_lead_id size=10 maxlength=10></TD>";
echo "<TD><input type=submit name=submit value=ENVIAR></TD>\n";
echo "</TR><TR>";
echo "<TD colspan=3 align=center> &nbsp; </TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>$label_phone_number Dialed: &nbsp; </TD><TD ALIGN=left><input type=text name=log_phone size=18 maxlength=18></TD>";
echo "<TD><input type=submit name=submit value=ENVIAR></TD>\n";
echo "</TR><TR>";
echo "<TD colspan=3 align=center> &nbsp; </TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "</TABLE>\n";
echo "</form>\n</center>\n";
echo "</body></html>\n";
@@ -200,6 +272,189 @@ if ( (!$vendor_id) and (!$phone) and (!$lead_id) and ( (strlen($status)<1) and
else
{
##### BEGIN Log search #####
if ( (strlen($log_lead_id)>0) or (strlen($log_phone)>0) )
{
if (strlen($log_lead_id)>0)
{
$stmtA="SELECT lead_id,phone_number,campaign_id,call_date,status,user,list_id,length_in_sec,alt_dial from vicidial_log where lead_id='" . mysql_real_escape_string($log_lead_id) . "'";
$stmtB="SELECT lead_id,phone_number,campaign_id,call_date,status,user,list_id,length_in_sec from vicidial_closer_log where lead_id='" . mysql_real_escape_string($log_lead_id) . "'";
}
if (strlen($log_phone)>0)
{
$stmtA="SELECT lead_id,phone_number,campaign_id,call_date,status,user,list_id,length_in_sec,alt_dial from vicidial_log where phone_number='" . mysql_real_escape_string($log_phone) . "'";
$stmtB="SELECT lead_id,phone_number,campaign_id,call_date,status,user,list_id,length_in_sec from vicidial_closer_log where phone_number='" . mysql_real_escape_string($log_phone) . "'";
$stmtC="SELECT extension,caller_id_number,did_id,call_date from vicidial_did_log where caller_id_number='" . mysql_real_escape_string($log_phone) . "'";
}
$rslt=mysql_query("$stmtA", $link);
$results_to_print = mysql_num_rows($rslt);
if ( ($results_to_print < 1) and ($results_to_printX < 1) )
{
echo "\n<br><br><center>\n";
echo "<b>There are no outbound calls matching your search criteria</b><br><br>\n";
echo "</center>\n";
}
else
{
echo "<BR><b>SALIENTE LOG RESULTS: $results_to_print</b><BR>\n";
echo "<TABLE BGCOLOR=WHITE CELLPADDING=1 CELLSPACING=0 WIDTH=770>\n";
echo "<TR BGCOLOR=BLACK>\n";
echo "<TD ALIGN=LEFT VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>#</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>LEAD ID</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>PHONE</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>CAMPAIGN</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>CALL FECHA</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>ESTADO</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>USER</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>ID DE LA LISTA</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>LENGTH</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>DIAL</B></FONT></TD>\n";
echo "</TR>\n";
$o=0;
while ($results_to_print > $o)
{
$row=mysql_fetch_row($rslt);
$o++;
$search_lead = $row[0];
if (eregi("1$|3$|5$|7$|9$", $o))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
echo "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$o</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><a href=\"admin_modify_lead.php?lead_id=$row[0]\" target=\"_blank\">$row[0]</a></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[1]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[2]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[3]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[4]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[5]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[6]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[7]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[8]</FONT></TD>\n";
echo "</TR>\n";
}
echo "</TABLE>\n";
}
$rslt=mysql_query("$stmtB", $link);
$results_to_print = mysql_num_rows($rslt);
if ( ($results_to_print < 1) and ($results_to_printX < 1) )
{
echo "\n<br><br><center>\n";
echo "<b>There are no inbound calls matching your search criteria</b><br><br>\n";
echo "</center>\n";
}
else
{
echo "<BR><b>Entrantes LOG RESULTS: $results_to_print</b><BR>\n";
echo "<TABLE BGCOLOR=WHITE CELLPADDING=1 CELLSPACING=0 WIDTH=770>\n";
echo "<TR BGCOLOR=BLACK>\n";
echo "<TD ALIGN=LEFT VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>#</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>LEAD ID</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>PHONE</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>INGROUP</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>CALL FECHA</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>ESTADO</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>USER</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>ID DE LA LISTA</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>LENGTH</B> &nbsp;</FONT></TD>\n";
echo "</TR>\n";
$o=0;
while ($results_to_print > $o)
{
$row=mysql_fetch_row($rslt);
$o++;
$search_lead = $row[0];
if (eregi("1$|3$|5$|7$|9$", $o))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
echo "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$o</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><a href=\"admin_modify_lead.php?lead_id=$row[0]\" target=\"_blank\">$row[0]</a></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[1]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[2]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[3]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[4]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[5]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[6]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[7]</FONT></TD>\n";
echo "</TR>\n";
}
echo "</TABLE>\n";
}
if (strlen($stmtC) > 10)
{
$rslt=mysql_query("$stmtC", $link);
$results_to_print = mysql_num_rows($rslt);
if ( ($results_to_print < 1) and ($results_to_printX < 1) )
{
echo "\n<br><br><center>\n";
echo "<b>There are no inbound did calls matching your search criteria</b><br><br>\n";
echo "</center>\n";
}
else
{
echo "<BR><b>Entrantes DID LOG RESULTS: $results_to_print</b><BR>\n";
echo "<TABLE BGCOLOR=WHITE CELLPADDING=1 CELLSPACING=0 WIDTH=770>\n";
echo "<TR BGCOLOR=BLACK>\n";
echo "<TD ALIGN=LEFT VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>#</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>DID</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>PHONE</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>DID ID</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>CALL FECHA</B> &nbsp;</FONT></TD>\n";
echo "</TR>\n";
$o=0;
while ($results_to_print > $o)
{
$row=mysql_fetch_row($rslt);
$o++;
$search_lead = $row[0];
if (eregi("1$|3$|5$|7$|9$", $o))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
echo "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$o</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[0]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[1]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[2]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[3]</FONT></TD>\n";
echo "</TR>\n";
}
echo "</TABLE>\n";
}
}
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|";
$SQL_log = ereg_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='LEADS', event_type='SEARCH', record_id='$search_lead', event_code='ADMIN SEARCH LEAD', event_sql=\"$SQL_log\", event_notes='';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n<a href=\"$PHP_SELF\">NUEVA BÚSQUEDA</a>";
echo "\n\n\n<br><br><br>\nScript runtime: $RUNtime seconds";
echo "\n\n\n</body></html>";
exit;
}
##### END Log search #####
##### BEGIN Lead search #####
if ($vendor_id)
{
$stmt="SELECT $vicidial_list_fields from vicidial_list where vendor_lead_code='" . mysql_real_escape_string($vendor_id) . "'";
@@ -365,6 +620,7 @@ else
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
}
##### END Lead search #####
@@ -1,17 +1,18 @@
<?php
# audio_store.php
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# Central Audio Storage script
#
# CHANGES
# 90511-1325 - First build
# 90618-0640 - Fix for users going through proxy or tunnel
# 100401-1037 - remove spaces and special characters from filenames, admin log uploads
#
$version = '2.2.0-2';
$build = '90618-0640';
$version = '2.2.0-3';
$build = '100401-1037';
$MT[0]='';
@@ -191,8 +192,12 @@ if ($action == "LIST")
# curl 'http://10.0.0.4/vicidial/audio_store.php?action=AUTOUPLOAD' -F "audiofile=@/var/lib/asterisk/sounds/beep.gsm"
if ($action == "AUTOUPLOAD")
{
if ($audiofile)
if ($audiofile)
{
$AF_path = preg_replace("/ /",'\ ',$AF_path);
$AF_path = preg_replace("/@/",'\@',$AF_path);
$audiofile_name = preg_replace("/ /",'',$audiofile_name);
$audiofile_name = preg_replace("/@/",'',$audiofile_name);
copy($AF_path, "$WeBServeRRooT/$sounds_web_directory/$audiofile_name");
chmod("$WeBServeRRooT/$sounds_web_directory/$audiofile_name", 0766);
@@ -277,6 +282,10 @@ if ($action == "MANUALUPLOAD")
{
if ($audiofile)
{
$AF_path = preg_replace("/ /",'\ ',$AF_path);
$AF_path = preg_replace("/@/",'\@',$AF_path);
$audiofile_name = preg_replace("/ /",'',$audiofile_name);
$audiofile_name = preg_replace("/@/",'',$audiofile_name);
copy($AF_path, "$WeBServeRRooT/$sounds_web_directory/$audiofile_name");
chmod("$WeBServeRRooT/$sounds_web_directory/$audiofile_name", 0766);
@@ -284,6 +293,14 @@ if ($action == "MANUALUPLOAD")
$stmt="UPDATE servers SET sounds_update='Y';";
$rslt=mysql_query($stmt, $link);
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|";
$SQL_log = ereg_replace(';','',$SQL_log);
$SQL_log = addslashes($SQL_log);
$stmt="INSERT INTO vicidial_admin_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$ip', event_section='AUDIOSTORE', event_type='LOAD', record_id='manualupload', event_code='$audiofile_name " . filesize("$WeBServeRRooT/$sounds_web_directory/$audiofile_name") . "', event_sql=\"$SQL_log\", event_notes='$audiofile_name $AF_path $AF_orig';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
}
else
{
@@ -309,8 +326,18 @@ if ($action == "MANUALUPLOAD")
<tr><td align=left><font size=1> &nbsp; </font></td><td align=right><font size=1>Audio Store- &nbsp; &nbsp; VERSION: <?php echo $version ?> &nbsp; &nbsp; BUILD: <?php echo $build ?> &nbsp; &nbsp; </td></tr>
</table>
<BR><BR>
<CENTER><B>We STRONGLY recommend uploading only 16bit 8k PCM WAV audio files(.wav)
<BR><BR>
<a href="javascript:launch_chooser('sample_prompt','date',30);">audio file list</a></CENTER>
<CENTER><B>We STRONGLY recommend uploading only 16bit Mono 8k PCM WAV audio files(.wav)</B>
<BR><BR><font size=1>All spaces will be stripped from uploaded audio file names</font><BR><BR>
<B><a href="javascript:launch_chooser('sample_prompt','date',30);">audio file list</a></CENTER>
<?php
echo "<BR><BR><BR><BR><BR><BR>\n";
echo "</B></B><br><br><a href=\"admin.php?ADD=720000000000000&category=AUDIOSTORE&stage=manualupload\">Click here to see a log of the uploads to the audio store</FONT>\n";
?>
</TD></TR></TABLE>
@@ -17,6 +17,14 @@
# 100119-1039 - Filtered comments for \n newlines
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100507-1413 - Added headers for export
# 100702-1332 - Added custom fields option
# 100712-1324 - Added system setting slave server option
# 100713-0101 - Added recordings fields option (for filename, recording ID and URL)
# 100713-1050 - Fixed minor custom fields issue
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
# Allow level 7 users to view this report
#
require("dbconnect.php");
@@ -42,6 +50,12 @@ if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["run_export"])) {$run_export=$_GET["run_export"];}
elseif (isset($_POST["run_export"])) {$run_export=$_POST["run_export"];}
if (isset($_GET["header_row"])) {$header_row=$_GET["header_row"];}
elseif (isset($_POST["header_row"])) {$header_row=$_POST["header_row"];}
if (isset($_GET["rec_fields"])) {$rec_fields=$_GET["rec_fields"];}
elseif (isset($_POST["rec_fields"])) {$rec_fields=$_POST["rec_fields"];}
if (isset($_GET["custom_fields"])) {$custom_fields=$_GET["custom_fields"];}
elseif (isset($_POST["custom_fields"])) {$custom_fields=$_POST["custom_fields"];}
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
@@ -49,30 +63,52 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
if (strlen($shift)<2) {$shift='ALL';}
$report_name = 'Export Calls Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
$custom_fields_enabled = $row[4];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and export_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and export_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
# Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -81,6 +117,38 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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 ";
##### START RUN THE EXPORT AND OUTPUT FLAT DATA FILE #####
if ($run_export > 0)
@@ -110,8 +178,11 @@ if ($run_export > 0)
$i=0;
while($i < $campaign_ct)
{
$campaign_string .= "$campaign[$i]|";
$campaign_SQL .= "'$campaign[$i]',";
if ( (preg_match("/ $campaign[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) )
{
$campaign_string .= "$campaign[$i]|";
$campaign_SQL .= "'$campaign[$i]',";
}
$i++;
}
if ( (ereg("--NONE--",$campaign_string) ) or ($campaign_ct < 1) )
@@ -218,7 +289,7 @@ if ($run_export > 0)
$k=0;
if ($RUNcampaign > 0)
{
$stmt = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id from vicidial_users vu,vicidial_log vl,vicidial_list vi where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;";
$stmt = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id from vicidial_users vu,vicidial_log vl,vicidial_list vi where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$outbound_to_print = mysql_num_rows($rslt);
@@ -236,8 +307,11 @@ if ($run_export > 0)
$row[29] = preg_replace("/\n|\r/",'!N',$row[29]);
$export_status[$k] = $row[2];
$export_list_id[$k] = $row[8];
$export_status[$k] = $row[2];
$export_list_id[$k] = $row[8];
$export_lead_id[$k] = $row[35];
$export_vicidial_id[$k] = $row[36];
$export_entry_list_id[$k] = $row[37];
$export_rows[$k] = "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]\t$row[34]\t$row[35]\t";
$i++;
$k++;
@@ -248,7 +322,7 @@ if ($run_export > 0)
if ($RUNgroup > 0)
{
$stmtA = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.queue_seconds,vi.rank,vi.owner,vi.lead_id from vicidial_users vu,vicidial_closer_log vl,vicidial_list vi where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $group_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;";
$stmtA = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.queue_seconds,vi.rank,vi.owner,vi.lead_id,vl.closecallid,vi.entry_list_id from vicidial_users vu,vicidial_closer_log vl,vicidial_list vi where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $group_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;";
$rslt=mysql_query($stmtA, $link);
if ($DB) {echo "$stmt\n";}
$inbound_to_print = mysql_num_rows($rslt);
@@ -266,8 +340,11 @@ if ($run_export > 0)
$row[29] = preg_replace("/\n|\r/",'!N',$row[29]);
$export_status[$k] = $row[2];
$export_list_id[$k] = $row[8];
$export_status[$k] = $row[2];
$export_list_id[$k] = $row[8];
$export_lead_id[$k] = $row[35];
$export_vicidial_id[$k] = $row[36];
$export_entry_list_id[$k] = $row[37];
$export_rows[$k] = "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]\t$row[34]\t$row[35]\t";
$i++;
$k++;
@@ -299,9 +376,28 @@ if ($run_export > 0)
ob_clean();
flush();
if ($header_row=='YES')
{
$CFheader = '';
$RFheader = '';
if ( ($custom_fields_enabled > 0) and ($custom_fields=='YES') )
{$CFheader = "\tcustom_fields";}
if ($rec_fields=='ID')
{$RFheader = "\trecording_id";}
if ($rec_fields=='FILENAME')
{$RFheader = "\trecording_filename";}
if ($rec_fields=='LOCATION')
{$RFheader = "\trecording_location";}
if ($rec_fields=='ALL')
{$RFheader = "\trecording_id\trecording_filename\trecording_location";}
echo "call_date\tphone_number\tstatus\tuser\tfull_name\tcampaign_id\tvendor_lead_code\tsource_id\tlist_id\tgmt_offset_now\tphone_code\tphone_number\ttitle\tfirst_name\tmiddle_initial\tlast_name\taddress1\taddress2\taddress3\tcity\tstate\tprovince\tpostal_code\tcountry_code\tgender\tdate_of_birth\talt_phone\temail\tsecurity_phrase\tcomments\tlength_in_sec\tuser_group\talt_dial\trank\towner\tlead_id\tlist_name\tlist_description\tstatus_name$RFheader$CFheader\r\n";
}
$i=0;
while ($k > $i)
{
$custom_data='';
$ex_list_name='';
$ex_list_description='';
$stmt = "SELECT list_name,list_description FROM vicidial_lists where list_id='$export_list_id[$i]';";
@@ -338,7 +434,85 @@ if ($run_export > 0)
}
}
echo "$export_rows[$i]$ex_list_name\t$ex_list_description\t$ex_status_name\r\n";
$rec_data='';
if ( ($rec_fields=='ID') or ($rec_fields=='FILENAME') or ($rec_fields=='LOCATION') or ($rec_fields=='ALL') )
{
$rec_id='';
$rec_filename='';
$rec_location='';
$stmt = "SELECT recording_id,filename,location from recording_log where vicidial_id='$export_vicidial_id[$i]' order by recording_id desc LIMIT 10;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$recordings_ct = mysql_num_rows($rslt);
$u=0;
while ($recordings_ct > $u)
{
$row=mysql_fetch_row($rslt);
$rec_id .= "$row[0]|";
$rec_filename .= "$row[1]|";
$rec_location .= "$row[2]|";
$u++;
}
$rec_id = preg_replace("/.$/",'',$rec_id);
$rec_filename = preg_replace("/.$/",'',$rec_filename);
$rec_location = preg_replace("/.$/",'',$rec_location);
if ($rec_fields=='ID')
{$rec_data = "\t$rec_id";}
if ($rec_fields=='FILENAME')
{$rec_data = "\t$rec_filename";}
if ($rec_fields=='LOCATION')
{$rec_data = "\t$rec_location";}
if ($rec_fields=='ALL')
{$rec_data = "\t$rec_id\t$rec_filename\t$rec_location";}
}
if ( ($custom_fields_enabled > 0) and ($custom_fields=='YES') )
{
$CF_list_id = $export_list_id[$i];
if ($export_entry_list_id[$i] > 99)
{$CF_list_id = $export_entry_list_id[$i];}
$stmt="SHOW TABLES LIKE \"custom_$CF_list_id\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmt = "describe custom_$CF_list_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$columns_ct = mysql_num_rows($rslt);
$u=0;
while ($columns_ct > $u)
{
$row=mysql_fetch_row($rslt);
$column = $row[0];
$u++;
}
if ($columns_ct > 1)
{
$stmt = "SELECT * from custom_$CF_list_id where lead_id='$export_lead_id[$i]' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$customfield_ct = mysql_num_rows($rslt);
if ($customfield_ct > 0)
{
$row=mysql_fetch_row($rslt);
$t=1;
while ($columns_ct > $t)
{
$custom_data .= "\t$row[$t]";
$t++;
}
}
}
$custom_data = preg_replace("/\r\n/",'!N',$custom_data);
$custom_data = preg_replace("/\n/",'!N',$custom_data);
}
}
echo "$export_rows[$i]$ex_list_name\t$ex_list_description\t$ex_status_name$rec_data$custom_data\r\n";
$i++;
}
}
@@ -360,7 +534,7 @@ else
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns order by campaign_id;";
$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
@@ -405,7 +579,7 @@ else
$i++;
}
$stmt="select list_id from vicidial_lists order by list_id;";
$stmt="select list_id from vicidial_lists $whereLOGallowed_campaignsSQL order by list_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$lists_to_print = mysql_num_rows($rslt);
@@ -435,7 +609,7 @@ else
$i++;
}
$stmt="select distinct status from vicidial_campaign_statuses order by status;";
$stmt="select distinct status from vicidial_campaign_statuses $whereLOGallowed_campaignsSQL order by status;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$Cstatuses_to_print = mysql_num_rows($rslt);
@@ -455,7 +629,7 @@ else
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>ADMINISTRATION: Export Calls Report";
echo "<TITLE>ADMINISTRATION: $report_name";
##### BEGIN Set variables to make header show properly #####
$ADD = '100';
@@ -518,6 +692,30 @@ else
</script>
<?php
echo "<BR><BR>\n";
echo "Header Row:<BR>\n";
echo "<select size=1 name=header_row><option selected>YES</option><option>NO</option></select>\n";
echo "<BR><BR>\n";
echo "Recording Fields:<BR>\n";
echo "<select size=1 name=rec_fields>";
echo "<option>ID</option>";
echo "<option>FILENAME</option>";
echo "<option>LOCATION</option>";
echo "<option>ALL</option>";
echo "<option selected>NONE</option>";
echo "</select>\n";
if ($custom_fields_enabled > 0)
{
echo "<BR><BR>\n";
echo "Custom Fields:<BR>\n";
echo "<select size=1 name=custom_fields><option>YES</option><option selected>NO</option></select>\n";
}
echo "</TD><TD ALIGN=LEFT VALIGN=TOP ROWSPAN=2>\n";
echo "<font class=\"select_bold\"><B>Campaigns:</B></font><BR><CENTER>\n";
echo "<SELECT SIZE=15 NAME=campaign[] multiple>\n";
@@ -1,50 +1,63 @@
<?php
#
# dbconnect.php version 2.2.0
# dbconnect.php version 2.4
#
# database connection settings and some global web settings
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 100712-1430 - Added slave server option for connection
#
if ( file_exists("/etc/astguiclient.conf") )
{
$DBCagc = file("/etc/astguiclient.conf");
foreach ($DBCagc as $DBCline)
{
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
if (ereg("^PATHlogs", $DBCline))
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
if (ereg("^PATHweb", $DBCline))
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
if (ereg("^VARserver_ip", $DBCline))
{$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);}
if (ereg("^VARDB_server", $DBCline))
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
if (ereg("^VARDB_database", $DBCline))
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
if (ereg("^VARDB_user", $DBCline))
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
if (ereg("^VARDB_pass", $DBCline))
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
if (ereg("^VARDB_port", $DBCline))
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
$DBCagc = file("/etc/astguiclient.conf");
foreach ($DBCagc as $DBCline)
{
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
if (ereg("^PATHlogs", $DBCline))
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
if (ereg("^PATHweb", $DBCline))
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
if (ereg("^VARserver_ip", $DBCline))
{$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);}
if (ereg("^VARDB_server", $DBCline))
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
if (ereg("^VARDB_database", $DBCline))
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
if (ereg("^VARDB_user", $DBCline))
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
if (ereg("^VARDB_pass", $DBCline))
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
if (ereg("^VARDB_custom_user", $DBCline))
{$VARDB_custom_user = $DBCline; $VARDB_custom_user = preg_replace("/.*=/","",$VARDB_custom_user);}
if (ereg("^VARDB_custom_pass", $DBCline))
{$VARDB_custom_pass = $DBCline; $VARDB_custom_pass = preg_replace("/.*=/","",$VARDB_custom_pass);}
if (ereg("^VARDB_port", $DBCline))
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
}
}
else
{
#defaults for DB connection
$VARDB_server = 'localhost';
$VARDB_port = '3306';
$VARDB_user = 'cron';
$VARDB_pass = '1234';
$VARDB_custom_user = 'custom';
$VARDB_custom_pass = 'custom1234';
$VARDB_database = '1234';
$WeBServeRRooT = '/usr/local/apache2/htdocs';
}
}
else
{
#defaults for DB connection
$VARDB_server = 'localhost';
$VARDB_user = 'cron';
$VARDB_pass = '1234';
$VARDB_database = '1234';
$WeBServeRRooT = '/usr/local/apache2/htdocs';
}
$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass");
if (!$link) {
if ( ($use_slave_server > 0) and (strlen($slave_db_server)>5) )
{$VARDB_server = $slave_db_server;}
$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass");
if (!$link)
{
die('MySQL connect ERROR: ' . mysql_error());
}
}
mysql_select_db("$VARDB_database");
$local_DEF = 'Local/';
+63 -3
View File
@@ -14,6 +14,9 @@
# 90508-0644 - Changed to PHP long tags
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -39,12 +42,48 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
if (strlen($shift)<2) {$shift='ALL';}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$report_name = 'Fronter - Closer Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -53,6 +92,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -88,7 +148,7 @@ while ($i < $groups_to_print)
<?php
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>In-Group Fronter-Closer Stats Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -605,7 +665,7 @@ echo "+--------------------------+--------+------+------+------+------+-------+\
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
if ($DB) {echo "\nRun Time: $RUNtime seconds\n";}
if ($DB) {echo "\nRun Time: $RUNtime seconds|$db_source\n";}
}
@@ -12,6 +12,14 @@
# 90508-0644 - Changed to PHP long tags
# 90721-1238 - Added rank and owner as vicidial_list fields
# 100119-1039 - Filtered comments for \n newlines
# 100508-1439 - Added header row to output
# 100702-1335 - Added custom fields
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100804-1745 - Added option to download DNC and FPGN lists
# 100924-1609 - Added ALL-LISTS option for downloading everything
# 100929-1919 - Fixed ALL-LISTS download option to include custom fields
# 101004-2108 - Added generic custom column headers for custom fields
#
require("dbconnect.php");
@@ -27,12 +35,20 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];}
elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];}
if (isset($_GET["group_id"])) {$group_id=$_GET["group_id"];}
elseif (isset($_POST["group_id"])) {$group_id=$_POST["group_id"];}
if (isset($_GET["download_type"])) {$download_type=$_GET["download_type"];}
elseif (isset($_POST["download_type"])) {$download_type=$_POST["download_type"];}
if (strlen($shift)<2) {$shift='ALL';}
if ($group_id=='SYSTEM_INTERNAL') {$download_type='systemdnc';}
$report_name = 'Download List';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -40,14 +56,27 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
$custom_fields_enabled = $row[4];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
# echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and download_lists='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and download_lists='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
@@ -62,23 +91,182 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="select count(*) from vicidial_list where list_id='$list_id';";
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
$row=mysql_fetch_row($rslt);
$leads_count =$row[0];
$i++;
# Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
# Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
if ($leads_count < 1)
$LOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$LOGallowed_campaigns)) )
{
echo "There are no leads in list_id: $list_id\n";
exit;
$rawLOGallowed_campaignsSQL = preg_replace("/ -/",'',$LOGallowed_campaigns);
$rawLOGallowed_campaignsSQL = preg_replace("/ /","','",$rawLOGallowed_campaignsSQL);
$LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')";
}
if ($download_type == 'systemdnc')
{
##### System DNC list validation #####
$event_code_type='SYSTEM INTERNAL DNC';
if (strlen($LOGallowed_campaignsSQL) > 2)
{
echo "You are not allowed to download this list: $list_id\n";
exit;
}
$stmt="select count(*) from vicidial_dnc;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$leads_count =$row[0];
$i++;
}
if ($leads_count < 1)
{
echo "There are no phone numbers in list: SYSTEM INTERNAL DNC\n";
exit;
}
}
elseif ($download_type == 'dnc')
{
##### Campaña DNC list validation #####
$event_code_type='CAMPAIGN DNC';
$stmt="select count(*) from vicidial_campaigns where campaign_id='$group_id' $LOGallowed_campaignsSQL;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$lists_allowed =$row[0];
$i++;
}
if ($lists_allowed < 1)
{
echo "You are not allowed to download this list: $group_id\n";
exit;
}
$stmt="select count(*) from vicidial_campaign_dnc where campaign_id='$group_id';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$leads_count =$row[0];
$i++;
}
if ($leads_count < 1)
{
echo "There are no leads in Campaña DNC list: $group_id\n";
exit;
}
}
elseif ($download_type == 'fpgn')
{
##### Filter Phone Group list validation #####
$event_code_type='FILTER PHONE GROUP';
$stmt="select count(*) from vicidial_filter_phone_groups where filter_phone_group_id='$group_id';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$lists_allowed =$row[0];
$i++;
}
if ($lists_allowed < 1)
{
echo "You are not allowed to download this list: $group_id\n";
exit;
}
$stmt="select count(*) from vicidial_filter_phone_numbers where filter_phone_group_id='$group_id';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$leads_count =$row[0];
$i++;
}
if ($leads_count < 1)
{
echo "There are no leads in this filter phone group: $group_id\n";
exit;
}
}
else
{
##### list download validation #####
$event_code_type='LIST';
$stmt="select count(*) from vicidial_lists where list_id='$list_id' $LOGallowed_campaignsSQL;";
if ($list_id=='ALL-LISTAS')
{$stmt="select count(*) from vicidial_lists where list_id > 0 $LOGallowed_campaignsSQL;";}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$lists_allowed =$row[0];
$i++;
}
if ($lists_allowed < 1)
{
echo "You are not allowed to download this list: $list_id\n";
exit;
}
$stmt="select count(*) from vicidial_list where list_id='$list_id';";
if ($list_id=='ALL-LISTAS')
{$stmt="select count(*) from vicidial_list where list_id > 0;";}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$leads_count =$row[0];
$i++;
}
if ($leads_count < 1)
{
echo "There are no leads in list_id: $list_id\n";
exit;
}
}
$US='_';
$MT[0]='';
$ip = getenv("REMOTE_ADDR");
@@ -90,16 +278,41 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|$stmtA|";
$SQL_log = ereg_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='LEADS', event_type='EXPORT', record_id='$list_id', event_code='ADMIN EXPORT LIST', event_sql=\"$SQL_log\", event_notes='';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$TXTfilename = "LIST_$list_id$US$FILE_TIME.txt";
if ($download_type == 'systemdnc')
{
$TXTfilename = "SYSTEM_DNC_$FILE_TIME.txt";
$header_row = "phone_number";
$header_columns='';
$stmt="select phone_number from vicidial_dnc;";
}
elseif ($download_type == 'dnc')
{
$TXTfilename = "DNC_$group_id$US$FILE_TIME.txt";
$header_row = "phone_number";
$header_columns='';
$stmt="select phone_number from vicidial_campaign_dnc where campaign_id='$group_id';";
}
elseif ($download_type == 'fpgn')
{
$TXTfilename = "FPGN_$group_id$US$FILE_TIME.txt";
$header_row = "phone_number";
$header_columns='';
$stmt="select phone_number from vicidial_filter_phone_numbers where filter_phone_group_id='$group_id';";
}
else
{
$TXTfilename = "LIST_$list_id$US$FILE_TIME.txt";
$list_id_header='';
$stmt="select lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where list_id='$list_id';";
if ($list_id=='ALL-LISTAS')
{
$list_id_header="list_id\t";
$stmt="select list_id,lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where list_id > 0;";
}
$header_row = $list_id_header . "lead_id\tentry_date\tmodify_date\tstatus\tuser\tvendor_lead_code\tsource_id\tlist_id\tgmt_offset_now\tcalled_since_last_reset\tphone_code\tphone_number\ttitle\tfirst_name\tmiddle_initial\tlast_name\taddress1\taddress2\taddress3\tcity\tstate\tprovince\tpostal_code\tcountry_code\tgender\tdate_of_birth\talt_phone\temail\tsecurity_phrase\tcomments\tcalled_count\tlast_local_call_time\trank\towner";
$header_columns='';
}
// We'll be outputting a TXT file
header('Content-type: application/octet-stream');
@@ -112,7 +325,8 @@ header('Pragma: public');
ob_clean();
flush();
$stmt="select lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where list_id='$list_id';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$leads_to_print = mysql_num_rows($rslt);
@@ -121,9 +335,166 @@ while ($i < $leads_to_print)
{
$row=mysql_fetch_row($rslt);
$row[29] = preg_replace("/\n|\r/",'!N',$row[29]);
if ( ($download_type == 'systemdnc') or ($download_type == 'dnc') or ($download_type == 'fpgn') )
{
$row_data[$i] .= "$row[0]";
}
else
{
$row[29] = preg_replace("/\n|\r/",'!N',$row[29]);
echo "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]\r\n";
if ($list_id=='ALL-LISTAS')
{
$row_data[$i] .= "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]\t$row[34]";
$export_list_id[$i] = $row[0];
$export_lead_id[$i] = $row[1];
}
else
{
$row_data[$i] .= "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]";
$export_list_id[$i] = $list_id;
$export_lead_id[$i] = $row[0];
}
}
$i++;
}
$ch=0;
if ( ($custom_fields_enabled > 0) and ($event_code_type=='LIST') )
{
$valid_custom_table=0;
if ($list_id=='ALL-LISTAS')
{
$stmtA = "SELECT list_id from vicidial_lists;";
$rslt=mysql_query($stmtA, $link);
if ($DB) {echo "$stmtA\n";}
$lists_ct = mysql_num_rows($rslt);
$u=0;
while ($lists_ct > $u)
{
$row=mysql_fetch_row($rslt);
$custom_list_id[$u] = $row[0];
$u++;
}
$u=0;
while ($lists_ct > $u)
{
$stmt="DEMOSTRACIÓN TABLAS LIKE \"custom_$custom_list_id[$u]\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
$custom_tablecount[$u] = $tablecount_to_print;
$u++;
}
$u=0;
while ($lists_ct > $u)
{
$custom_columns[$u]=0;
if ($custom_tablecount[$u] > 0)
{
$stmtA = "describe custom_$custom_list_id[$u];";
$rslt=mysql_query($stmtA, $link);
if ($DB) {echo "$stmtA\n";}
$columns_ct = mysql_num_rows($rslt);
$custom_columns[$u] = $columns_ct;
}
if ($DB) {echo "$custom_list_id[$u]|$custom_tablecount[$u]|$custom_columns[$u]\n";}
$u++;
}
$valid_custom_table=1;
}
else
{
$stmt="DEMOSTRACIÓN TABLAS LIKE \"custom_$list_id\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmtA = "describe custom_$list_id;";
$rslt=mysql_query($stmtA, $link);
if ($DB) {echo "$stmtA\n";}
$columns_ct = mysql_num_rows($rslt);
$u=0;
while ($columns_ct > $u)
{
$row=mysql_fetch_row($rslt);
$column = $row[0];
if ($u > 0)
{$header_columns .= "\t$column";}
$u++;
}
if ($columns_ct > 1)
{
$valid_custom_table=1;
}
}
}
if ($valid_custom_table > 0)
{
$i=0;
while ($i < $leads_to_print)
{
if ($list_id=='ALL-LISTAS')
{
$valid_custom_table=0;
$u=0;
while ($lists_ct > $u)
{
if ( ($export_list_id[$i] == "$custom_list_id[$u]") and ($custom_columns[$u] > 1) )
{
$valid_custom_table=1;
$columns_ct = $custom_columns[$u];
}
$u++;
}
}
if ($valid_custom_table > 0)
{
$stmtA = "SELECT * from custom_$export_list_id[$i] where lead_id='$export_lead_id[$i]' limit 1;";
$rslt=mysql_query($stmtA, $link);
if ($DB) {echo "$columns_ct|$stmtA\n";}
$customfield_ct = mysql_num_rows($rslt);
if ($customfield_ct > 0)
{
$row=mysql_fetch_row($rslt);
$t=1;
while ($columns_ct > $t)
{
$custom_data[$i] .= "\t$row[$t]";
if ($ch <= $t)
{
$ch++;
$header_columns .= "\tcustom$ch";
}
$t++;
}
}
$custom_data[$i] = preg_replace("/\r\n/",'!N',$custom_data[$i]);
$custom_data[$i] = preg_replace("/\n/",'!N',$custom_data[$i]);
}
$i++;
}
}
}
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|$stmtA|";
$SQL_log = ereg_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='LEADS', event_type='EXPORT', record_id='$list_id', event_code='ADMIN EXPORT $event_code_type', event_sql=\"$SQL_log\", event_notes='';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
echo "$header_row$header_columns\r\n";
$i=0;
while ($i < $leads_to_print)
{
echo "$row_data[$i]$custom_data[$i]\r\n";
$i++;
}
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# listloader.pl version 2.2.0
# listloader.pl version 2.4
#
# Copyright (C) 2010 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
#
@@ -22,6 +22,8 @@
# 90721-1425 - Added rank and owner as vicidial_list fields
# 91112-0616 - Added title/alt-phone duplicate checking
# 100118-0537 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# 100630-1609 - Added a check for invalid ListIds and filtered out ' " ; ` \ from the field <mikec>
# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
#
### begin parsing run-time options ###
@@ -271,6 +273,38 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
$oWkC = $oWkS->{Cells}[$iR][24];
if ($oWkC) {$owner=$oWkC->Value; }
$entry_date =~ s/\'|\\|\"|;|\`|\224//gi;
$modify_date =~ s/\'|\\|\"|;|\`|\224//gi;
$status =~ s/\'|\\|\"|;|\`|\224//gi;
$user =~ s/\'|\\|\"|;|\`|\224//gi;
$vendor_lead_code =~ s/\'|\\|\"|;|\`|\224//gi;
$source_id =~ s/\'|\\|\"|;|\`|\224//gi;
$list_id =~ s/\'|\\|\"|;|\`|\224//gi;
$gmt_offset =~ s/\'|\\|\"|;|\`|\224//gi;
$called_since_last_reset =~ s/\'|\\|\"|;|\`|\224//gi;
$phone_code =~ s/\'|\\|\"|;|\`|\224//gi;
$phone_number =~ s/\'|\\|\"|;|\`|\224//gi;
$title =~ s/\'|\\|\"|;|\`|\224//gi;
$first_name =~ s/\'|\\|\"|;|\`|\224//gi;
$middle_initial =~ s/\'|\\|\"|;|\`|\224//gi;
$last_name =~ s/\'|\\|\"|;|\`|\224//gi;
$address1 =~ s/\'|\\|\"|;|\`|\224//gi;
$address2 =~ s/\'|\\|\"|;|\`|\224//gi;
$address3 =~ s/\'|\\|\"|;|\`|\224//gi;
$city =~ s/\'|\\|\"|;|\`|\224//gi;
$state =~ s/\'|\\|\"|;|\`|\224//gi;
$province =~ s/\'|\\|\"|;|\`|\224//gi;
$postal_code =~ s/\'|\\|\"|;|\`|\224//gi;
$country =~ s/\'|\\|\"|;|\`|\224//gi;
$gender =~ s/\'|\\|\"|;|\`|\224//gi;
$date_of_birth =~ s/\'|\\|\"|;|\`|\224//gi;
$alt_phone =~ s/\'|\\|\"|;|\`|\224//gi;
$email =~ s/\'|\\|\"|;|\`|\224//gi;
$security_phrase =~ s/\'|\\|\"|;|\`|\224//gi;
$comments =~ s/\'|\\|\"|;|\`|\224//gi;
$rank =~ s/\'|\\|\"|;|\`|\224//gi;
$owner =~ s/\'|\\|\"|;|\`|\224//gi;
if (length($forcelistid) > 0)
{
$list_id = $forcelistid; # set list_id to override value
@@ -426,7 +460,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
}
}
if ( (length($phone_number)>6) && ($dup_lead < 1) )
if ( (length($phone_number)>6) && ($dup_lead < 1) && ($list_id >= 100)
{
if ( ($duptapchecklist > 0) || ($duptapchecksys > 0) )
{$phone_list .= "$alt_phone$title$US$list_id|";}
@@ -640,20 +674,30 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
$affected_rows = $dbhA->do($stmtZ);
print STMT_FILE $stmtZ."\r\n";
$multistmt='';
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),";
$multi_insert_counter++;
}
$good++;
} else {
if ($bad < 10000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list</font><b>\n";}
if ($bad < 1000000)
{
if ( $list_id < 100 )
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| INVALID LIST ID</font><b>\n";
}
else
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";
}
}
$bad++;
}
$total++;
@@ -666,7 +710,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
}
if ($multi_insert_counter > 0) {
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values ".substr($multistmt, 0, -1).";";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values ".substr($multistmt, 0, -1).";";
$affected_rows = $dbhA->do($stmtZ);
print STMT_FILE $stmtZ."\r\n";
}
@@ -21,6 +21,8 @@
# 90721-1341 - Added rank and owner as vicidial_list fields
# 91112-0616 - Added title/alt-phone duplicate checking
# 100118-0539 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# 100630-1609 - Added a check for invalid ListIds and filtered out ' " ; ` \ from the field <mikec>
# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
#
### begin parsing run-time options ###
@@ -271,7 +273,37 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
$oWkC = $oWkS->{Cells}[$iR][$xls_fields[24]];
if ($oWkC) {$owner=$oWkC->Value; }
$entry_date =~ s/\'|\\|\"|;|\`|\224//gi;
$modify_date =~ s/\'|\\|\"|;|\`|\224//gi;
$status =~ s/\'|\\|\"|;|\`|\224//gi;
$user =~ s/\'|\\|\"|;|\`|\224//gi;
$vendor_lead_code =~ s/\'|\\|\"|;|\`|\224//gi;
$source_id =~ s/\'|\\|\"|;|\`|\224//gi;
$list_id =~ s/\'|\\|\"|;|\`|\224//gi;
$gmt_offset =~ s/\'|\\|\"|;|\`|\224//gi;
$called_since_last_reset =~ s/\'|\\|\"|;|\`|\224//gi;
$phone_code =~ s/\'|\\|\"|;|\`|\224//gi;
$phone_number =~ s/\'|\\|\"|;|\`|\224//gi;
$title =~ s/\'|\\|\"|;|\`|\224//gi;
$first_name =~ s/\'|\\|\"|;|\`|\224//gi;
$middle_initial =~ s/\'|\\|\"|;|\`|\224//gi;
$last_name =~ s/\'|\\|\"|;|\`|\224//gi;
$address1 =~ s/\'|\\|\"|;|\`|\224//gi;
$address2 =~ s/\'|\\|\"|;|\`|\224//gi;
$address3 =~ s/\'|\\|\"|;|\`|\224//gi;
$city =~ s/\'|\\|\"|;|\`|\224//gi;
$state =~ s/\'|\\|\"|;|\`|\224//gi;
$province =~ s/\'|\\|\"|;|\`|\224//gi;
$postal_code =~ s/\'|\\|\"|;|\`|\224//gi;
$country =~ s/\'|\\|\"|;|\`|\224//gi;
$gender =~ s/\'|\\|\"|;|\`|\224//gi;
$date_of_birth =~ s/\'|\\|\"|;|\`|\224//gi;
$alt_phone =~ s/\'|\\|\"|;|\`|\224//gi;
$email =~ s/\'|\\|\"|;|\`|\224//gi;
$security_phrase =~ s/\'|\\|\"|;|\`|\224//gi;
$comments =~ s/\'|\\|\"|;|\`|\224//gi;
$rank =~ s/\'|\\|\"|;|\`|\224//gi;
$owner =~ s/\'|\\|\"|;|\`|\224//gi;
if (length($forcelistid) > 0)
{
@@ -428,7 +460,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
}
}
if ( (length($phone_number)>6) && ($dup_lead < 1) )
if ( (length($phone_number)>6) && ($dup_lead < 1) && ($list_id >= 100))
{
if ( ($duptapchecklist > 0) || ($duptapchecksys > 0) )
{$phone_list .= "$alt_phone$title$US$list_id|";}
@@ -642,21 +674,31 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
$affected_rows = $dbhA->do($stmtZ);
print STMT_FILE $stmtZ."\r\n";
$multistmt='';
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),";
$multi_insert_counter++;
}
$good++;
} else {
if ($bad < 10000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list</font><b>\n";}
$bad++;
if ($bad < 1000000)
{
if ( $list_id < 100 )
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| INVALID LIST ID</font><b>\n";
}
else
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";
}
}
$bad++;
}
$total++;
if ($total%100==0) {
@@ -668,7 +710,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
}
if ($multi_insert_counter > 0) {
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values ".substr($multistmt, 0, -1).";";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values ".substr($multistmt, 0, -1).";";
$affected_rows = $dbhA->do($stmtZ);
print STMT_FILE $stmtZ."\r\n";
}
@@ -30,11 +30,15 @@
# 90721-1339 - Added rank and owner as vicidial_list fields
# 91112-0616 - Added title/alt-phone duplicate checking
# 100118-0543 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# 100621-1026 - Added admin_web_directory variable
# 100630-1609 - Added a check for invalid ListIds and filtered out ' " ; ` \ from the field <mikec>
# 100705-1507 - Added custom fields to field chooser, only when liast_id_override is used and only with TXT and CSV file formats
# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
#
# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time.
$version = '2.2.0-34';
$build = '100118-0543';
$version = '2.4-37';
$build = '100712-1416';
require("dbconnect.php");
@@ -127,22 +131,28 @@ if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];}
if (isset($_GET["phone_code_override"])) {$phone_code_override=$_GET["phone_code_override"];}
elseif (isset($_POST["phone_code_override"])) {$phone_code_override=$_POST["phone_code_override"];}
$phone_code_override = (preg_replace("/\D/","",$phone_code_override));
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
# $country_field=$_GET["country_field"]; if (!$country_field) {$country_field=$_POST["country_field"];}
### REGEX to prevent weird characters from ending up in the fields
$field_regx = "['\"`\\;]";
$vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|entry_list_id|';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,admin_web_directory,custom_fields_enabled FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
$i=0;
while ($i < $qm_conf_ct)
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$i++;
$non_latin = $row[0];
$admin_web_directory = $row[1];
$custom_fields_enabled = $row[2];
}
##### END SETTINGS LOOKUP #####
###########################################
@@ -348,6 +358,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
<form action=<?php echo $PHP_SELF ?> method=post onSubmit="ParseFileName()" enctype="multipart/form-data">
<input type=hidden name='leadfile_name' value="<?php echo $leadfile_name ?>">
<input type=hidden name='DB' value="<?php echo $DB ?>">
<?php if ($file_layout!="custom") { ?>
<table align=center width="700" border=0 cellpadding=5 cellspacing=0 bgcolor=#D9E6FE>
<tr>
@@ -384,7 +395,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
<tr>
<td align=center colspan=2><input type=submit value="ENVIAR" name='submit_file'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=button onClick="javascript:document.location='new_listloader_superL.php'" value="RECARGAR" name='reload_page'></td>
</tr>
<tr><td align=left><font size=1> &nbsp; &nbsp; &nbsp; &nbsp; <a href="admin.php?ADD=100" target="_parent">DE NUEVO AL ADMIN</a></font></td><td align=right><font size=1>LIST LOADER- &nbsp; &nbsp; VERSIÓN: <?php echo $version ?> &nbsp; &nbsp; CONSTRUCCION: <?php echo $build ?> &nbsp; &nbsp; </td></tr>
<tr><td align=left><font size=1> &nbsp; &nbsp; &nbsp; &nbsp; <a href="admin.php?ADD=100" target="_parent">DE NUEVO AL ADMIN</a> &nbsp; &nbsp; &nbsp; &nbsp; <a href="./admin_listloader_third_gen.php">3rd Gen Lead Loader</a> &nbsp; &nbsp; </font></td><td align=right><font size=1>LIST LOADER- &nbsp; &nbsp; VERSIÓN: <?php echo $version ?> &nbsp; &nbsp; CONSTRUCCION: <?php echo $build ?> &nbsp; &nbsp; </td></tr>
</table>
<?php } ?>
@@ -409,7 +420,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";}
$field_check=explode($delimiter, $buffer);
if (count($field_check)>=5) {
if (count($field_check)>=2) {
flush();
$file=fopen("$lead_file", "r");
print "<center><font face='arial, helvetica' size=3 color='#009900'><B>Procesando$delim_name-delimited file...\n";
@@ -445,7 +456,6 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$called_since_last_reset='N';
$phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]);
$phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]);
$USarea = substr($phone_number, 0, 3);
$title = $row[$title_field];
$first_name = $row[$first_name_field];
$middle_initial = $row[$middle_initial_field];
@@ -466,6 +476,36 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$comments = trim($row[$comments_field]);
$rank = $row[$rank_field];
$owner = $row[$owner_field];
# replace ' " ` \ ; with nothing
$vendor_lead_code = eregi_replace($field_regx, "", $vendor_lead_code);
$source_code = eregi_replace($field_regx, "", $source_code);
$source_id = eregi_replace($field_regx, "", $source_id);
$list_id = eregi_replace($field_regx, "", $list_id);
$phone_code = eregi_replace($field_regx, "", $phone_code);
$phone_number = eregi_replace($field_regx, "", $phone_number);
$title = eregi_replace($field_regx, "", $title);
$first_name = eregi_replace($field_regx, "", $first_name);
$middle_initial = eregi_replace($field_regx, "", $middle_initial);
$last_name = eregi_replace($field_regx, "", $last_name);
$address1 = eregi_replace($field_regx, "", $address1);
$address2 = eregi_replace($field_regx, "", $address2);
$address3 = eregi_replace($field_regx, "", $address3);
$city = eregi_replace($field_regx, "", $city);
$state = eregi_replace($field_regx, "", $state);
$province = eregi_replace($field_regx, "", $province);
$postal_code = eregi_replace($field_regx, "", $postal_code);
$country_code = eregi_replace($field_regx, "", $country_code);
$gender = eregi_replace($field_regx, "", $gender);
$date_of_birth = eregi_replace($field_regx, "", $date_of_birth);
$alt_phone = eregi_replace($field_regx, "", $alt_phone);
$email = eregi_replace($field_regx, "", $email);
$security_phrase = eregi_replace($field_regx, "", $security_phrase);
$comments = eregi_replace($field_regx, "", $comments);
$rank = eregi_replace($field_regx, "", $rank);
$owner = eregi_replace($field_regx, "", $owner);
$USarea = substr($phone_number, 0, 3);
if (strlen($list_id_override)>0)
{
@@ -477,6 +517,69 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$phone_code = $phone_code_override;
}
##### BEGIN custom fields columns list ###
$custom_SQL='';
if ($custom_fields_enabled > 0)
{
$stmt="DEMOSTRACIÓN TABLAS LIKE \"custom_$list_id_override\";";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmt="SELECT count(*) from vicidial_lists_fields where list_id='$list_id_override';";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$fieldscount_to_print = mysql_num_rows($rslt);
if ($fieldscount_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$custom_records_count = $rowx[0];
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id_override' order by field_rank,field_order,field_label;";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$A_field_label[$o] = $rowx[1];
$A_field_type[$o] = $rowx[6];
$A_field_value[$o] = '';
$field_name_id = $A_field_label[$o] . "_field";
if ($DB>0) {echo "$A_field_label[$o]|$A_field_type[$o]\n";}
if ( ($A_field_type[$o]!='DISPLAY') and ($A_field_type[$o]!='SCRIPT') )
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
if ($form_field_value >= 0)
{
$A_field_value[$o] = $row[$form_field_value];
# replace ' " ` \ ; with nothing
$A_field_value[$o] = eregi_replace($field_regx, "", $A_field_value[$o]);
$custom_SQL .= "$A_field_label[$o]='$A_field_value[$o]',";
}
}
}
$o++;
}
}
}
}
##### END custom fields columns list ###
$custom_SQL = preg_replace("/,$/","",$custom_SQL);
##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign #####
if (eregi("DUPCAMP",$dupcheck))
{
@@ -603,7 +706,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
}
if ( (strlen($phone_number)>6) and ($dup_lead<1) )
if ( (strlen($phone_number)>6) and ($dup_lead<1) and ($list_id >= 100 ))
{
if (strlen($phone_code)<1) {$phone_code = '1';}
@@ -614,23 +717,54 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code);
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');";
if (strlen($custom_SQL)>3)
{
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','$list_id');";
$rslt=mysql_query($stmtZ, $link);
$affected_rows = mysql_affected_rows($link);
$lead_id = mysql_insert_id($link);
if ($DB > 0) {echo "<!-- $affected_rows|$lead_id|$stmtZ -->";}
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
$multistmt='';
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),";
$multi_insert_counter++;
}
$custom_SQL_query = "INSERT INTO custom_$list_id_override SET lead_id='$lead_id',$custom_SQL;";
$rslt=mysql_query($custom_SQL_query, $link);
$affected_rows = mysql_affected_rows($link);
if ($DB > 0) {echo "<!-- $affected_rows|$custom_SQL_query -->";}
}
else
{
if ($multi_insert_counter > 8)
{
### insert good record into vicidial_list table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
$multistmt='';
$multi_insert_counter=0;
}
else
{
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),";
$multi_insert_counter++;
}
}
$good++;
} else {
if ($bad < 1000000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";}
if ($bad < 1000000)
{
if ( $list_id < 100 )
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| INVALID ID DE LA LISTA</font><b>\n";
}
else
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";
}
}
$bad++;
}
$total++;
@@ -642,7 +776,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
}
}
if ($multi_insert_counter!=0) {
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values".substr($multistmt, 0, -1).";";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";";
mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -666,7 +800,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
{
print "<BR><BR>INVALIDACIÓN DEL CÓDIGO DEL TELÉFONO PARA ESTE ARCHIVO: $phone_code_override<BR><BR>\n";
}
# print "|$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field,$rank_field,$owner_field, --forcelistid=$list_id_override --lead_file=$lead_file|";
# print "|$WeBServeRRooT/$admin_web_directory/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field,$rank_field,$owner_field, --forcelistid=$list_id_override --lead_file=$lead_file|";
$dupcheckCLI=''; $postalgmtCLI='';
if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';}
if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';}
@@ -674,13 +808,13 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
if (eregi("DUPTITLEALTPHONELIST",$dupcheck)) {$dupcheckCLI='--duplicate-tap-list-check';}
if (eregi("DUPTITLEALTPHONESYS",$dupcheck)) {$dupcheckCLI='--duplicate-tap-system-check';}
if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';}
passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field,$rank_field,$owner_field, --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
passthru("$WeBServeRRooT/$admin_web_directory/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field,$rank_field,$owner_field, --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
} else {
# copy($leadfile, "./vicidial_temp_file.csv");
$file=fopen("$lead_file", "r");
if ($WeBRooTWritablE > 0)
{$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");}
{$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");}
print "<center><font face='arial, helvetica' size=3 color='#009900'><B>ProcesandoCSV file... \n";
if (strlen($list_id_override)>0)
@@ -708,7 +842,6 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$called_since_last_reset='N';
$phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]);
$phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]);
$USarea = substr($phone_number, 0, 3);
$title = $row[$title_field];
$first_name = $row[$first_name_field];
$middle_initial = $row[$middle_initial_field];
@@ -729,18 +862,112 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$comments = trim($row[$comments_field]);
$rank = $row[$rank_field];
$owner = $row[$owner_field];
# replace ' " ` \ ; with nothing
$vendor_lead_code = eregi_replace($field_regx, "", $vendor_lead_code);
$source_code = eregi_replace($field_regx, "", $source_code);
$source_id = eregi_replace($field_regx, "", $source_id);
$list_id = eregi_replace($field_regx, "", $list_id);
$phone_code = eregi_replace($field_regx, "", $phone_code);
$phone_number = eregi_replace($field_regx, "", $phone_number);
$title = eregi_replace($field_regx, "", $title);
$first_name = eregi_replace($field_regx, "", $first_name);
$middle_initial = eregi_replace($field_regx, "", $middle_initial);
$last_name = eregi_replace($field_regx, "", $last_name);
$address1 = eregi_replace($field_regx, "", $address1);
$address2 = eregi_replace($field_regx, "", $address2);
$address3 = eregi_replace($field_regx, "", $address3);
$city = eregi_replace($field_regx, "", $city);
$state = eregi_replace($field_regx, "", $state);
$province = eregi_replace($field_regx, "", $province);
$postal_code = eregi_replace($field_regx, "", $postal_code);
$country_code = eregi_replace($field_regx, "", $country_code);
$gender = eregi_replace($field_regx, "", $gender);
$date_of_birth = eregi_replace($field_regx, "", $date_of_birth);
$alt_phone = eregi_replace($field_regx, "", $alt_phone);
$email = eregi_replace($field_regx, "", $email);
$security_phrase = eregi_replace($field_regx, "", $security_phrase);
$comments = eregi_replace($field_regx, "", $comments);
$rank = eregi_replace($field_regx, "", $rank);
$owner = eregi_replace($field_regx, "", $owner);
$USarea = substr($phone_number, 0, 3);
if (strlen($rank)<1) {$rank='0';}
if (strlen($list_id_override)>0)
if (strlen($rank)<1) {$rank='0';}
if (strlen($list_id_override)>0)
{
$list_id = $list_id_override;
}
if (strlen($phone_code_override)>0)
{
$phone_code = $phone_code_override;
}
##### BEGIN custom fields columns list ###
$custom_SQL='';
if ($custom_fields_enabled > 0)
{
$list_id = $list_id_override;
}
if (strlen($phone_code_override)>0)
{
$phone_code = $phone_code_override;
}
$stmt="DEMOSTRACIÓN TABLAS LIKE \"custom_$list_id_override\";";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmt="SELECT count(*) from vicidial_lists_fields where list_id='$list_id_override';";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$fieldscount_to_print = mysql_num_rows($rslt);
if ($fieldscount_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$custom_records_count = $rowx[0];
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id_override' order by field_rank,field_order,field_label;";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$A_field_label[$o] = $rowx[1];
$A_field_type[$o] = $rowx[6];
$A_field_value[$o] = '';
$field_name_id = $A_field_label[$o] . "_field";
if ($DB>0) {echo "$A_field_label[$o]|$A_field_type[$o]\n";}
if ( ($A_field_type[$o]!='DISPLAY') and ($A_field_type[$o]!='SCRIPT') )
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
if ($form_field_value >= 0)
{
$A_field_value[$o] = $row[$form_field_value];
# replace ' " ` \ ; with nothing
$A_field_value[$o] = eregi_replace($field_regx, "", $A_field_value[$o]);
$custom_SQL .= "$A_field_label[$o]='$A_field_value[$o]',";
}
}
}
$o++;
}
}
}
}
##### END custom fields columns list ###
$custom_SQL = preg_replace("/,$/","",$custom_SQL);
##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign #####
if (eregi("DUPCAMP",$dupcheck))
{
@@ -865,7 +1092,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
}
}
if ( (strlen($phone_number)>6) and ($dup_lead<1) )
if ( (strlen($phone_number)>6) and ($dup_lead<1) and ($list_id >= 100 ))
{
if (strlen($phone_code)<1) {$phone_code = '1';}
@@ -878,23 +1105,53 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code);
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
$multistmt='';
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),";
$multi_insert_counter++;
}
if (strlen($custom_SQL)>3)
{
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','$list_id');";
$rslt=mysql_query($stmtZ, $link);
$affected_rows = mysql_affected_rows($link);
$lead_id = mysql_insert_id($link);
if ($DB > 0) {echo "<!-- $affected_rows|$lead_id|$stmtZ -->";}
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
$multistmt='';
$custom_SQL_query = "INSERT INTO custom_$list_id_override SET lead_id='$lead_id',$custom_SQL;";
$rslt=mysql_query($custom_SQL_query, $link);
$affected_rows = mysql_affected_rows($link);
if ($DB > 0) {echo "<!-- $affected_rows|$custom_SQL_query -->";}
}
else
{
if ($multi_insert_counter > 8)
{
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
$multistmt='';
$multi_insert_counter=0;
}
else
{
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),";
$multi_insert_counter++;
}
}
$good++;
} else {
if ($bad < 1000000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
if ($bad < 1000000)
{
if ( $list_id < 100 )
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| INVALID ID DE LA LISTA</font><b>\n";
}
else
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";
}
}
$bad++;
}
$total++;
@@ -905,7 +1162,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
}
}
if ($multi_insert_counter!=0) {
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values".substr($multistmt, 0, -1).";";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";";
mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -932,7 +1189,7 @@ if ($leadfile) {
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt");
copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.txt");
$lead_file = "./vicidial_temp_file.txt";
}
else
@@ -942,7 +1199,7 @@ if ($leadfile) {
}
$file=fopen("$lead_file", "r");
if ($WeBRooTWritablE > 0)
{$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");}
{$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");}
$buffer=fgets($file, 4096);
$tab_count=substr_count($buffer, "\t");
@@ -951,7 +1208,7 @@ if ($leadfile) {
if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";}
$field_check=explode($delimiter, $buffer);
if (count($field_check)>=5) {
if (count($field_check)>=2) {
flush();
$file=fopen("$lead_file", "r");
$total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list='';
@@ -985,7 +1242,6 @@ if ($leadfile) {
$called_since_last_reset='N';
$phone_code = eregi_replace("[^0-9]", "", $row[3]);
$phone_number = eregi_replace("[^0-9]", "", $row[4]);
$USarea = substr($phone_number, 0, 3);
$title = $row[5];
$first_name = $row[6];
$middle_initial = $row[7];
@@ -1006,6 +1262,36 @@ if ($leadfile) {
$comments = trim($row[22]);
$rank = $row[23];
$owner = $row[24];
# replace ' " ` \ ; with nothing
$vendor_lead_code = eregi_replace($field_regx, "", $vendor_lead_code);
$source_code = eregi_replace($field_regx, "", $source_code);
$source_id = eregi_replace($field_regx, "", $source_id);
$list_id = eregi_replace($field_regx, "", $list_id);
$phone_code = eregi_replace($field_regx, "", $phone_code);
$phone_number = eregi_replace($field_regx, "", $phone_number);
$title = eregi_replace($field_regx, "", $title);
$first_name = eregi_replace($field_regx, "", $first_name);
$middle_initial = eregi_replace($field_regx, "", $middle_initial);
$last_name = eregi_replace($field_regx, "", $last_name);
$address1 = eregi_replace($field_regx, "", $address1);
$address2 = eregi_replace($field_regx, "", $address2);
$address3 = eregi_replace($field_regx, "", $address3);
$city = eregi_replace($field_regx, "", $city);
$state = eregi_replace($field_regx, "", $state);
$province = eregi_replace($field_regx, "", $province);
$postal_code = eregi_replace($field_regx, "", $postal_code);
$country_code = eregi_replace($field_regx, "", $country_code);
$gender = eregi_replace($field_regx, "", $gender);
$date_of_birth = eregi_replace($field_regx, "", $date_of_birth);
$alt_phone = eregi_replace($field_regx, "", $alt_phone);
$email = eregi_replace($field_regx, "", $email);
$security_phrase = eregi_replace($field_regx, "", $security_phrase);
$comments = eregi_replace($field_regx, "", $comments);
$rank = eregi_replace($field_regx, "", $rank);
$owner = eregi_replace($field_regx, "", $owner);
$USarea = substr($phone_number, 0, 3);
if (strlen($list_id_override)>0)
{
@@ -1140,7 +1426,7 @@ if ($leadfile) {
}
}
if ( (strlen($phone_number)>6) and ($dup_lead<1) )
if ( (strlen($phone_number)>6) and ($dup_lead<1) and ($list_id >= 100 ))
{
if (strlen($phone_code)<1) {$phone_code = '1';}
@@ -1155,7 +1441,7 @@ if ($leadfile) {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -1163,13 +1449,23 @@ if ($leadfile) {
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),";
$multi_insert_counter++;
}
$good++;
} else {
if ($bad < 1000000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
if ($bad < 1000000)
{
if ( $list_id < 100 )
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| INVALID ID DE LA LISTA</font><b>\n";
}
else
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";
}
}
$bad++;
}
$total++;
@@ -1181,7 +1477,7 @@ if ($leadfile) {
}
}
if ($multi_insert_counter!=0) {
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values".substr($multistmt, 0, -1).";";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";";
mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -1196,8 +1492,8 @@ if ($leadfile) {
{
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls");
$lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls";
copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.xls");
$lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.xls";
}
else
{
@@ -1206,7 +1502,7 @@ if ($leadfile) {
}
$file=fopen("$lead_file", "r");
# echo "|$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --lead-file=$lead_file|";
# echo "|$WeBServeRRooT/$admin_web_directory/listloader.pl --forcelistid=$list_id_override --lead-file=$lead_file|";
$dupcheckCLI=''; $postalgmtCLI='';
if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';}
if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';}
@@ -1214,15 +1510,15 @@ if ($leadfile) {
if (eregi("DUPTITLEALTPHONELIST",$dupcheck)) {$dupcheckCLI='--duplicate-tap-list-check';}
if (eregi("DUPTITLEALTPHONESYS",$dupcheck)) {$dupcheckCLI='--duplicate-tap-system-check';}
if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';}
passthru("$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
passthru("$WeBServeRRooT/$admin_web_directory/listloader.pl --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
}
else
{
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv");
$lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv";
copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.csv");
$lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.csv";
}
else
{
@@ -1231,7 +1527,7 @@ if ($leadfile) {
}
$file=fopen("$lead_file", "r");
if ($WeBRooTWritablE > 0)
{$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");}
{$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");}
print "<center><font face='arial, helvetica' size=3 color='#009900'><B>ProcesandoCSV file... \n";
@@ -1258,7 +1554,6 @@ if ($leadfile) {
$called_since_last_reset='N';
$phone_code = eregi_replace("[^0-9]", "", $row[3]);
$phone_number = eregi_replace("[^0-9]", "", $row[4]);
$USarea = substr($phone_number, 0, 3);
$title = $row[5];
$first_name = $row[6];
$middle_initial = $row[7];
@@ -1279,6 +1574,36 @@ if ($leadfile) {
$comments = trim($row[22]);
$rank = $row[23];
$owner = $row[24];
# replace ' " ` \ ; with nothing
$vendor_lead_code = eregi_replace($field_regx, "", $vendor_lead_code);
$source_code = eregi_replace($field_regx, "", $source_code);
$source_id = eregi_replace($field_regx, "", $source_id);
$list_id = eregi_replace($field_regx, "", $list_id);
$phone_code = eregi_replace($field_regx, "", $phone_code);
$phone_number = eregi_replace($field_regx, "", $phone_number);
$title = eregi_replace($field_regx, "", $title);
$first_name = eregi_replace($field_regx, "", $first_name);
$middle_initial = eregi_replace($field_regx, "", $middle_initial);
$last_name = eregi_replace($field_regx, "", $last_name);
$address1 = eregi_replace($field_regx, "", $address1);
$address2 = eregi_replace($field_regx, "", $address2);
$address3 = eregi_replace($field_regx, "", $address3);
$city = eregi_replace($field_regx, "", $city);
$state = eregi_replace($field_regx, "", $state);
$province = eregi_replace($field_regx, "", $province);
$postal_code = eregi_replace($field_regx, "", $postal_code);
$country_code = eregi_replace($field_regx, "", $country_code);
$gender = eregi_replace($field_regx, "", $gender);
$date_of_birth = eregi_replace($field_regx, "", $date_of_birth);
$alt_phone = eregi_replace($field_regx, "", $alt_phone);
$email = eregi_replace($field_regx, "", $email);
$security_phrase = eregi_replace($field_regx, "", $security_phrase);
$comments = eregi_replace($field_regx, "", $comments);
$rank = eregi_replace($field_regx, "", $rank);
$owner = eregi_replace($field_regx, "", $owner);
$USarea = substr($phone_number, 0, 3);
if (strlen($list_id_override)>0)
{
@@ -1413,7 +1738,7 @@ if ($leadfile) {
}
}
if ( (strlen($phone_number)>6) and ($dup_lead<1) )
if ( (strlen($phone_number)>6) and ($dup_lead<1) and ($list_id >= 100 ))
{
if (strlen($phone_code)<1) {$phone_code = '1';}
@@ -1427,7 +1752,7 @@ if ($leadfile) {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -1435,13 +1760,23 @@ if ($leadfile) {
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),";
$multi_insert_counter++;
}
$good++;
} else {
if ($bad < 1000000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
if ($bad < 1000000)
{
if ( $list_id < 100 )
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| INVALID ID DE LA LISTA</font><b>\n";
}
else
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";
}
}
$bad++;
}
$total++;
@@ -1452,7 +1787,7 @@ if ($leadfile) {
}
}
if ($multi_insert_counter!=0) {
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values".substr($multistmt, 0, -1).";";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";";
mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -1464,6 +1799,7 @@ if ($leadfile) {
print "<script language='JavaScript1.2'>document.forms[0].leadfile.disabled=false; document.forms[0].submit_file.disabled=false; document.forms[0].reload_page.disabled=false;</script>";
} else {
##### BEGIN field chooser #####
print "<script language='JavaScript1.2'>document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;</script><HR>";
flush();
print "<table border=0 cellpadding=3 cellspacing=0 width=700 align=center>\r\n";
@@ -1472,15 +1808,67 @@ if ($leadfile) {
print " <th><font class='standard' color='white'>Datos del archivo</font></th>\r\n";
print " </tr>\r\n";
$rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, rank, owner from vicidial_list limit 1", $link);
$fields_stmt = "SELECT vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, rank, owner from vicidial_list limit 1";
##### BEGIN custom fields columns list ###
if ($custom_fields_enabled > 0)
{
$stmt="DEMOSTRACIÓN TABLAS LIKE \"custom_$list_id_override\";";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmt="SELECT count(*) from vicidial_lists_fields where list_id='$list_id_override';";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$fieldscount_to_print = mysql_num_rows($rslt);
if ($fieldscount_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$custom_records_count = $rowx[0];
$custom_SQL='';
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id_override' order by field_rank,field_order,field_label;";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$A_field_label[$o] = $rowx[1];
$A_field_type[$o] = $rowx[6];
if ($DB>0) {echo "$A_field_label[$o]|$A_field_type[$o]\n";}
if ( ($A_field_type[$o]!='DISPLAY') and ($A_field_type[$o]!='SCRIPT') )
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
$custom_SQL .= ",$A_field_label[$o]";
}
}
$o++;
}
$fields_stmt = "SELECT vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, rank, owner $custom_SQL from vicidial_list, custom_$list_id_override limit 1";
}
}
}
##### END custom fields columns list ###
$rslt=mysql_query("$fields_stmt", $link);
if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name))
{
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt");
$lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.txt";
copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.txt");
$lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.txt";
}
else
{
@@ -1489,7 +1877,7 @@ if ($leadfile) {
}
$file=fopen("$lead_file", "r");
if ($WeBRooTWritablE > 0)
{$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");}
{$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");}
$buffer=fgets($file, 4096);
$tab_count=substr_count($buffer, "\t");
@@ -1538,8 +1926,8 @@ if ($leadfile) {
{
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls");
$lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls";
copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.xls");
$lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.xls";
}
else
{
@@ -1547,7 +1935,7 @@ if ($leadfile) {
$lead_file = "/tmp/vicidial_temp_file.xls";
}
# echo "|$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file|";
# echo "|$WeBServeRRooT/$admin_web_directory/listloader_rowdisplay.pl --lead-file=$lead_file|";
$dupcheckCLI=''; $postalgmtCLI='';
if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';}
if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';}
@@ -1555,14 +1943,14 @@ if ($leadfile) {
if (eregi("DUPTITLEALTPHONELIST",$dupcheck)) {$dupcheckCLI='--duplicate-tap-list-check';}
if (eregi("DUPTITLEALTPHONESYS",$dupcheck)) {$dupcheckCLI='--duplicate-tap-system-check';}
if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';}
passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
passthru("$WeBServeRRooT/$admin_web_directory/listloader_rowdisplay.pl --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
}
else
{
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv");
$lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv";
copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.csv");
$lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.csv";
}
else
{
@@ -1572,7 +1960,7 @@ if ($leadfile) {
$file=fopen("$lead_file", "r");
if ($WeBRooTWritablE > 0)
{$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");}
{$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");}
print "<center><font face='arial, helvetica' size=3 color='#009900'><B>ProcesandoCSV file... \n";
@@ -1617,6 +2005,8 @@ if ($leadfile) {
print "</table>\r\n";
# }
print "<script language='JavaScript1.2'>document.forms[0].leadfile.disabled=false; document.forms[0].submit_file.disabled=false; document.forms[0].reload_page.disabled=false;</script>";
##### END field chooser #####
}
#} else if (filesize($leadfile)>8388608) {
# print "<center><font face='arial, helvetica' size=3 color='#990000'><B>ERROR: File exceeds the 8MB limit.</B></font></center>";
@@ -1638,7 +2028,7 @@ exit;
function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code)
{
require("dbconnect.php");
global $link;
$postalgmt_found=0;
if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) )
@@ -9,7 +9,7 @@
# required variables:
# - $user
# - $pass
# - $function - ('add_lead','version')
# - $function - ('add_lead','update_lead','version','sounds_list','moh_list','vm_list','blind_monitor','agent_ingroup_info')
# - $source - ('vtiger','webform','adminweb')
# - $format - ('text','debug')
@@ -31,10 +31,16 @@
# 91203-1140 - Added agent_ingroup_info feature
# 91216-0331 - Added duplication check features to add_lead function
# 100118-0543 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# 100704-1148 - Added custom fields inserts to the add_lead function
# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
# 100718-0245 - Added update_lead function to update existing leads
# 100723-1333 - Added no_update option to the update_lead function
# 100728-1952 - Added delete_lead option to the update_lead function
# 100924-1403 - Added called_count as an update_lead option
#
$version = '2.2.0-17';
$build = '100118-0543';
$version = '2.4-23';
$build = '100924-1403';
require("dbconnect.php");
@@ -129,6 +135,31 @@ if (isset($_GET["agent_user"])) {$agent_user=$_GET["agent_user"];}
elseif (isset($_POST["agent_user"])) {$agent_user=$_POST["agent_user"];}
if (isset($_GET["duplicate_check"])) {$duplicate_check=$_GET["duplicate_check"];}
elseif (isset($_POST["duplicate_check"])) {$duplicate_check=$_POST["duplicate_check"];}
if (isset($_GET["custom_fields"])) {$custom_fields=$_GET["custom_fields"];}
elseif (isset($_POST["custom_fields"])) {$custom_fields=$_POST["custom_fields"];}
if (isset($_GET["search_method"])) {$search_method=$_GET["search_method"];}
elseif (isset($_POST["search_method"])) {$search_method=$_POST["search_method"];}
if (isset($_GET["insert_if_not_found"])) {$insert_if_not_found=$_GET["insert_if_not_found"];}
elseif (isset($_POST["insert_if_not_found"])) {$insert_if_not_found=$_POST["insert_if_not_found"];}
if (isset($_GET["records"])) {$records=$_GET["records"];}
elseif (isset($_POST["records"])) {$records=$_POST["records"];}
if (isset($_GET["search_location"])) {$search_location=$_GET["search_location"];}
elseif (isset($_POST["search_location"])) {$search_location=$_POST["search_location"];}
if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
if (isset($_GET["user_field"])) {$user_field=$_GET["user_field"];}
elseif (isset($_POST["user_field"])) {$user_field=$_POST["user_field"];}
if (isset($_GET["list_id_field"])) {$list_id_field=$_GET["list_id_field"];}
elseif (isset($_POST["list_id_field"])) {$list_id_field=$_POST["list_id_field"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["no_update"])) {$no_update=$_GET["no_update"];}
elseif (isset($_POST["no_update"])) {$no_update=$_POST["no_update"];}
if (isset($_GET["delete_lead"])) {$delete_lead=$_GET["delete_lead"];}
elseif (isset($_POST["delete_lead"])) {$delete_lead=$_POST["delete_lead"];}
if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];}
elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@@ -136,13 +167,14 @@ header ("Pragma: no-cache"); // HTTP/1.0
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;";
$rslt=mysql_query($stmt, $link);
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$non_latin = $row[0];
$custom_fields_enabled = $row[1];
}
##### END SETTINGS LOOKUP #####
###########################################
@@ -208,6 +240,17 @@ if ($non_latin < 1)
$rank = ereg_replace("[^0-9]","",$rank);
$owner = ereg_replace("[^-_0-9a-zA-Z]","",$owner);
$duplicate_check = ereg_replace("[^-_0-9a-zA-Z]","",$duplicate_check);
$custom_fields = ereg_replace("[^0-9a-zA-Z]","",$custom_fields);
$search_method = ereg_replace("[^-_0-9a-zA-Z]","",$search_method);
$insert_if_not_found = ereg_replace("[^A-Z]","",$insert_if_not_found);
$records = ereg_replace("[^0-9]","",$records);
$search_location = ereg_replace("[^A-Z]","",$search_location);
$user_field = ereg_replace("[^-_0-9a-zA-Z]","",$user_field);
$list_id_field = ereg_replace("[^0-9]","",$list_id_field);
$lead_id = ereg_replace("[^0-9]","",$lead_id);
$no_update = ereg_replace("[^A-Z]","",$no_update);
$delete_lead = ereg_replace("[^A-Z]","",$delete_lead);
$called_count=ereg_replace("[^0-9]","",$called_count);
}
else
{
@@ -216,12 +259,10 @@ else
$source = ereg_replace("'|\"|\\\\|;","",$source);
}
if (strlen($list_id)<1) {$list_id='999';}
if (strlen($phone_code)<1) {$phone_code='1';}
$USarea = substr($phone_number, 0, 3);
if (strlen($hopper_priority)<1) {$hopper_priority=0;}
if (strlen($gender)<1) {$gender='U';}
if (strlen($rank)<1) {$rank='0';}
if ($hopper_priority < -99) {$hopper_priority=-99;}
if ($hopper_priority > 99) {$hopper_priority=99;}
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
@@ -233,6 +274,7 @@ $postalgmt='';
$api_script = 'non-agent';
$api_logging = 1;
$vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|';
$secX = date("U");
$hour = date("H");
@@ -1167,6 +1209,11 @@ if ($function == 'add_lead')
}
else
{
if (strlen($gender)<1) {$gender='U';}
if (strlen($rank)<1) {$rank='0';}
if (strlen($list_id)<3) {$list_id='999';}
if (strlen($phone_code)<1) {$phone_code='1';}
if ( (strlen($phone_number)<6) || (strlen($phone_number)>16) )
{
$result = 'ERROR';
@@ -1419,7 +1466,7 @@ if ($function == 'add_lead')
### insert a new lead in the system with this phone number
$stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='NEW',user='$user',vendor_lead_code='$vendor_lead_code',source_id='$source_id',gmt_offset_now='$gmt_offset',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',called_since_last_reset='N',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',rank='$rank',owner='$owner';";
$stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='NEW',user='$user',vendor_lead_code='$vendor_lead_code',source_id='$source_id',gmt_offset_now='$gmt_offset',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',called_since_last_reset='N',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',rank='$rank',owner='$owner',entry_list_id='0';";
if ($DB>0) {echo "DEBUG: add_lead query - $stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
@@ -1470,6 +1517,114 @@ if ($function == 'add_lead')
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
### BEGIN custom fields insert section ###
if ($custom_fields == 'Y')
{
if ($custom_fields_enabled > 0)
{
$stmt="SHOW TABLES LIKE \"custom_$list_id\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$CFinsert_SQL='';
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;";
$rslt=mysql_query($stmt, $link);
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$new_field_value='';
$form_field_value='';
$rowx=mysql_fetch_row($rslt);
$A_field_id[$o] = $rowx[0];
$A_field_label[$o] = $rowx[1];
$A_field_name[$o] = $rowx[2];
$A_field_type[$o] = $rowx[6];
$A_field_size[$o] = $rowx[8];
$A_field_max[$o] = $rowx[9];
$A_field_required[$o] = $rowx[12];
$A_field_value[$o] = '';
$field_name_id = $A_field_label[$o];
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
$A_field_value[$o] = $form_field_value;
if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') )
{
$A_field_value[$o]='----IGNORE----';
}
else
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
$CFinsert_SQL .= "$A_field_label[$o]='$A_field_value[$o]',";
}
}
$o++;
}
if (strlen($CFinsert_SQL)>3)
{
$CFinsert_SQL = preg_replace("/,$/","",$CFinsert_SQL);
$custom_table_update_SQL = "INSERT INTO custom_$list_id SET lead_id='$lead_id',$CFinsert_SQL;";
$rslt=mysql_query($custom_table_update_SQL, $link);
$custom_insert_count = mysql_affected_rows($link);
if ($custom_insert_count > 0)
{
# Update vicidial_list entry to put list_id as entry_list_id
$vl_table_entry_update_SQL = "UPDATE vicidial_list SET entry_list_id='$list_id' where lead_id='$lead_id';";
$rslt=mysql_query($vl_table_entry_update_SQL, $link);
$vl_table_entry_update_count = mysql_affected_rows($link);
$result = 'NOTICE';
$result_reason = "add_lead CUSTOM FIELDS VALUES ADDED";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id|$vl_table_entry_update_count\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'NOTICE';
$result_reason = "add_lead CUSTOM FIELDS NOT ADDED, NO FIELDS DEFINED";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'NOTICE';
$result_reason = "add_lead CUSTOM FIELDS NOT ADDED, NO FIELDS DEFINED";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'NOTICE';
$result_reason = "add_lead CUSTOM FIELDS NOT ADDED, NO CUSTOM FIELDS DEFINED FOR THIS LIST";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'NOTICE';
$result_reason = "add_lead CUSTOM FIELDS NOT ADDED, CUSTOM FIELDS DISABLED";
echo "$result: $result_reason - $phone_number|$lead_id|$custom_fields|$custom_fields_enabled\n";
$data = "$phone_number|$lead_id|$custom_fields|$custom_fields_enabled";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
### END custom fields insert section ###
if ($add_to_hopper == 'Y')
{
$dialable=1;
@@ -1542,6 +1697,569 @@ if ($function == 'add_lead')
################################################################################
### update_lead - updates a lead in the vicidial_list table
################################################################################
if ($function == 'update_lead')
{
if(strlen($source)<2)
{
$result = 'ERROR';
$result_reason = "Invalid Source";
echo "$result: $result_reason - $source\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
echo "ERROR: Invalid Source: |$source|\n";
exit;
}
else
{
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and modify_leads='1' and user_level > 7;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$modify_leads=$row[0];
if ($modify_leads < 1)
{
$result = 'ERROR';
$result_reason = "update_lead USER DOES NOT HAVE PERMISSION TO UPDATE LEADS IN THE SYSTEM";
echo "$result: $result_reason: |$user|$modify_leads|\n";
$data = "$modify_leads";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$search_SQL='';
$lead_id_SQL='';
$vendor_lead_code_SQL='';
$phone_number_SQL='';
$find_lead_id=0;
$find_vendor_lead_code=0;
$find_phone_number=0;
if ( (strlen($search_location)<4) or ($list_id < 99) or (strlen($list_id)<3) )
{$search_location='SYSTEM';}
if (strlen($search_method)<6)
{$search_method='LEAD_ID';}
if (strlen($records)<1)
{$records='1';}
if ( (preg_match("/LEAD_ID/",$search_method)) and (strlen($lead_id)>0) )
{
$find_lead_id=1;
$lead_id_SQL = "lead_id='$lead_id'";
}
if ( (preg_match("/VENDOR_LEAD_CODE/",$search_method)) and (strlen($vendor_lead_code)>0) )
{
$find_vendor_lead_code=1;
$vendor_lead_code_SQL = "vendor_lead_code='$vendor_lead_code'";
}
if ( (preg_match("/PHONE_NUMBER/",$search_method)) and (strlen($phone_number)>5) and (strlen($phone_number)<19) )
{
$find_phone_number=1;
$phone_number_SQL = "phone_number='$phone_number'";
}
if ( ($find_lead_id<1) and ($find_vendor_lead_code<1) and ($find_phone_number<1) )
{
$result = 'ERROR';
$result_reason = "update_lead NO VALID SEARCH METHOD";
$data = "$search_method|$lead_id|$vendor_lead_code|$phone_number";
echo "$result: $result_reason - $user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
if (eregi("CAMPAIGN",$search_location)) # find lists within campaign
{
$stmt="SELECT campaign_id from vicidial_lists where list_id='$list_id';";
$rslt=mysql_query($stmt, $link);
$ci_recs = mysql_num_rows($rslt);
if ($ci_recs > 0)
{
$row=mysql_fetch_row($rslt);
$search_camp = $row[0];
$stmt="select list_id from vicidial_lists where campaign_id='$search_camp';";
$rslt=mysql_query($stmt, $link);
$li_recs = mysql_num_rows($rslt);
if ($li_recs > 0)
{
$L=0;
while ($li_recs > $L)
{
$row=mysql_fetch_row($rslt);
$search_lists .= "'$row[0]',";
$L++;
}
$search_lists = eregi_replace(",$",'',$search_lists);
$search_SQL = "and list_id IN($search_lists)";
}
}
}
if (eregi("LIST",$search_location)) # search check within list
{
$search_SQL = "and list_id='$list_id'";
}
$search_found=0;
if ($find_lead_id > 0) # search for the lead_id
{
if ($DB>0) {echo "DEBUG: Checking for lead_id - $lead_id\n";}
$stmt="SELECT lead_id,list_id,entry_list_id from vicidial_list where $lead_id_SQL $search_SQL order by entry_date desc limit $records;";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
$n=0;
while ($pc_recs > $n)
{
$row=mysql_fetch_row($rslt);
$search_lead_id[$n] = $row[0];
$search_lead_list[$n] = $row[1];
$search_entry_list[$n] = $row[2];
$n++;
$search_found++;
}
}
if ( ($find_vendor_lead_code > 0) and ($search_found < 1) ) # search for the vendor_lead_code
{
if ($DB>0) {echo "DEBUG: Checking for vendor_lead_code - $vendor_lead_code\n";}
$stmt="SELECT lead_id,list_id,entry_list_id from vicidial_list where $vendor_lead_code_SQL $search_SQL order by entry_date desc limit $records;";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
$n=0;
while ($pc_recs > $n)
{
$row=mysql_fetch_row($rslt);
$search_lead_id[$n] = $row[0];
$search_lead_list[$n] = $row[1];
$search_entry_list[$n] = $row[2];
$n++;
$search_found++;
}
}
if ( ($find_phone_number > 0) and ($search_found < 1) ) # search for the phone_number
{
if ($DB>0) {echo "DEBUG: Checking for phone_number - $phone_number\n";}
$stmt="SELECT lead_id,list_id,entry_list_id from vicidial_list where $phone_number_SQL $search_SQL order by entry_date desc limit $records;";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
$n=0;
while ($pc_recs > $n)
{
$row=mysql_fetch_row($rslt);
$search_lead_id[$n] = $row[0];
$search_lead_list[$n] = $row[1];
$search_entry_list[$n] = $row[2];
$n++;
$search_found++;
}
}
### END searching ###
if ($no_update=='Y')
{
if ($search_found > 0)
{
$result = 'NOTICE';
$result_reason = "update_lead LEADS FOUND IN THE SYSTEM";
$data = "$lead_id|$vendor_lead_code|$phone_number|$search_lead_list[0]|$search_entry_list[0]";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'NOTICE';
$result_reason = "update_lead NO MATCHES FOUND IN THE SYSTEM";
$data = "$lead_id|$vendor_lead_code|$phone_number";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
exit;
}
else
{
if ($search_found > 0)
{
$VL_update_SQL='';
##### BEGIN update lead information in the system #####
if (strlen($user_field)>0) {$VL_update_SQL .= "user='$user_field',";}
if (strlen($list_id_field)>0) {$VL_update_SQL .= "list_id='$list_id_field',";}
if (strlen($status)>0) {$VL_update_SQL .= "status='$status',";}
if (strlen($vendor_lead_code)>0) {$VL_update_SQL .= "vendor_lead_code='$vendor_lead_code',";}
if (strlen($source_id)>0) {$VL_update_SQL .= "source_id='$source_id',";}
if (strlen($gmt_offset_now)>0) {$VL_update_SQL .= "gmt_offset_now='$gmt_offset_now',";}
if (strlen($title)>0) {$VL_update_SQL .= "title='$title',";}
if (strlen($first_name)>0) {$VL_update_SQL .= "first_name='$first_name',";}
if (strlen($middle_initial)>0) {$VL_update_SQL .= "middle_initial='$middle_initial',";}
if (strlen($last_name)>0) {$VL_update_SQL .= "last_name='$last_name',";}
if (strlen($address1)>0) {$VL_update_SQL .= "address1='$address1',";}
if (strlen($address2)>0) {$VL_update_SQL .= "address2='$address2',";}
if (strlen($address3)>0) {$VL_update_SQL .= "address3='$address3',";}
if (strlen($city)>0) {$VL_update_SQL .= "city='$city',";}
if (strlen($state)>0) {$VL_update_SQL .= "state='$state',";}
if (strlen($province)>0) {$VL_update_SQL .= "province='$province',";}
if (strlen($postal_code)>0) {$VL_update_SQL .= "postal_code='$postal_code',";}
if (strlen($country_code)>0) {$VL_update_SQL .= "country_code='$country_code',";}
if (strlen($gender)>0) {$VL_update_SQL .= "gender='$gender',";}
if (strlen($date_of_birth)>0) {$VL_update_SQL .= "date_of_birth='$date_of_birth',";}
if (strlen($alt_phone)>0) {$VL_update_SQL .= "alt_phone='$alt_phone',";}
if (strlen($email)>0) {$VL_update_SQL .= "email='$email',";}
if (strlen($security_phrase)>0) {$VL_update_SQL .= "security_phrase='$security_phrase',";}
if (strlen($comments)>0) {$VL_update_SQL .= "comments='$comments',";}
if (strlen($rank)>0) {$VL_update_SQL .= "rank='$rank',";}
if (strlen($owner)>0) {$VL_update_SQL .= "owner='$owner',";}
if (strlen($called_count)>0) {$VL_update_SQL .= "called_count='$called_count',";}
$VL_update_SQL = preg_replace("/,$/","",$VL_update_SQL);
$VL_update_SQL = preg_replace("/'--BLANK--'/","''",$VL_update_SQL);
$VL_update_SQL = preg_replace("/\n/","!N",$VL_update_SQL);
$n=0;
while ($search_found > $n)
{
$VLaffected_rows=0;
$CFaffected_rows=0;
if ( (strlen($VL_update_SQL)>6) or ($delete_lead=='Y') )
{
if ($delete_lead=='Y')
{
$stmt = "DELETE from vicidial_list where lead_id='$search_lead_id[$n]';";
$result_reason = "update_lead LEAD HAS BEEN DELETED";
}
else
{
$stmt = "UPDATE vicidial_list SET $VL_update_SQL where lead_id='$search_lead_id[$n]';";
$result_reason = "update_lead LEAD HAS BEEN UPDATED";
}
if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";}
$rslt=mysql_query($stmt, $link);
$VLaffected_rows = mysql_affected_rows($link);
$result = 'SUCCESS';
echo "$result: $result_reason - $user|$search_lead_id[$n]\n";
$data = "$phone_number|$list_id|$lead_id|$gmt_offset";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
##### BEGIN custom fields update query build #####
if ($custom_fields=='Y')
{
$lead_custom_list = $search_lead_list[$n];
if ($search_entry_list[$n] > 99) {$lead_custom_list = $search_entry_list[$n];}
$update_sent=0;
$CFoutput='';
$stmt="SHOW TABLES LIKE \"custom_$lead_custom_list\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$update_SQL='';
$VL_update_SQL='';
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$lead_custom_list' order by field_rank,field_order,field_label;";
$rslt=mysql_query($stmt, $link);
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$new_field_value='';
$form_field_value='';
$rowx=mysql_fetch_row($rslt);
$A_field_id[$o] = $rowx[0];
$A_field_label[$o] = $rowx[1];
$A_field_name[$o] = $rowx[2];
$A_field_type[$o] = $rowx[6];
$A_field_size[$o] = $rowx[8];
$A_field_max[$o] = $rowx[9];
$A_field_required[$o] = $rowx[12];
$A_field_value[$o] = '';
$field_name_id = $A_field_label[$o];
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
$A_field_value[$o] = $form_field_value;
if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') )
{
$A_field_value[$o]='----IGNORE----';
}
else
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
$update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',";
}
}
$o++;
}
$custom_update_count=0;
if (strlen($update_SQL)>3)
{
$custom_record_lead_count=0;
$stmt="SELECT count(*) from custom_$lead_custom_list where lead_id='$search_lead_id[$n]';";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$fieldleadcount_to_print = mysql_num_rows($rslt);
if ($fieldleadcount_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$custom_record_lead_count = $rowx[0];
}
$update_SQL = preg_replace("/,$/","",$update_SQL);
$custom_table_update_SQL = "INSERT INTO custom_$lead_custom_list SET lead_id='$search_lead_id[$n]',$update_SQL;";
if ($custom_record_lead_count > 0)
{$custom_table_update_SQL = "UPDATE custom_$lead_custom_list SET $update_SQL where lead_id='$search_lead_id[$n]';";}
$rslt=mysql_query($custom_table_update_SQL, $link);
$custom_update_count = mysql_affected_rows($link);
if ($DB) {echo "$custom_update_count|$custom_table_update_SQL\n";}
if (!$rslt) {die('Could not execute: ' . mysql_error());}
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS VALUES UPDATED";
echo "$result: $result_reason - $phone_number|$search_lead_id[$n]|$search_lead_list[$n]|$search_entry_list[$n]|$lead_custom_list|$custom_update_count\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
$update_sent++;
}
if ($custom_update_count > 0)
{
$list_table_update_SQL = "UPDATE vicidial_list SET entry_list_id='$lead_custom_list' where lead_id='$search_lead_id[$n]';";
$rslt=mysql_query($list_table_update_SQL, $link);
$list_update_count = mysql_affected_rows($link);
if ($DB) {echo "$list_update_count|$list_table_update_SQL\n";}
if (!$rslt) {die('Could not execute: ' . mysql_error());}
}
}
else
{
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS NOT ADDED, NO CUSTOM FIELDS DEFINED FOR THIS LIST";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
##### END custom fields update query build #####
$n++;
}
##### END update lead information in the system #####
}
else
{
$result = 'ERROR';
if ($insert_if_not_found=='Y')
{$result = 'NOTICE';}
$result_reason = "update_lead NO MATCHES FOUND IN THE SYSTEM";
$data = "$lead_id|$vendor_lead_code|$phone_number";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
if ($insert_if_not_found!='Y')
{exit;}
else
{
if (strlen($list_id_field)>0) {$list_id=$list_id_field;}
##### BEGIN insert not-found lead into the system #####
if ( (strlen($phone_number)<6) or (strlen($phone_number)>18) or (strlen($phone_code)<1) or (strlen($list_id)<3) )
{
$result = 'ERROR';
$result_reason = "update_lead INVALID DATA FOR LEAD INSERTION";
$data = "$phone_number|$phone_code|$list_id|$insert_if_not_found";
echo "$result: $result_reason - $user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
### get current gmt_offset of the phone_number
$gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code);
if (strlen($status)<1)
{$status='NEW';}
### insert a new lead in the system with this phone number
$stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='$status',user='$user',vendor_lead_code='$vendor_lead_code',source_id='$source_id',gmt_offset_now='$gmt_offset',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',called_since_last_reset='N',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',rank='$rank',owner='$owner',entry_list_id='0';";
if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
if ($affected_rows > 0)
{
$lead_id = mysql_insert_id($link);
$result = 'SUCCESS';
$result_reason = "update_lead LEAD HAS BEEN ADDED";
echo "$result: $result_reason - $phone_number|$list_id|$lead_id|$gmt_offset|$user\n";
$data = "$phone_number|$list_id|$lead_id|$gmt_offset";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
if (strlen($multi_alt_phones) > 5)
{
$map=$MT; $ALTm_phone_code=$MT; $ALTm_phone_number=$MT; $ALTm_phone_note=$MT;
$map = explode('!', $multi_alt_phones);
$map_count = count($map);
if ($DB>0) {echo "DEBUG: update_lead multi-al-entry - $a|$map_count|$multi_alt_phones\n";}
$g++;
$r=0; $s=0; $inserted_alt_phones=0;
while ($r < $map_count)
{
$s++;
$ncn=$MT;
$ncn = explode('_', $map[$r]);
print "$ncn[0]|$ncn[1]|$ncn[2]";
if (strlen($forcephonecode) > 0)
{$ALTm_phone_code[$r] = $forcephonecode;}
else
{$ALTm_phone_code[$r] = $ncn[1];}
if (strlen($ALTm_phone_code[$r]) < 1)
{$ALTm_phone_code[$r]='1';}
$ALTm_phone_number[$r] = $ncn[0];
$ALTm_phone_note[$r] = $ncn[2];
$stmt = "INSERT INTO vicidial_list_alt_phones (lead_id,phone_code,phone_number,alt_phone_note,alt_phone_count) values('$lead_id','$ALTm_phone_code[$r]','$ALTm_phone_number[$r]','$ALTm_phone_note[$r]','$s');";
if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";}
$rslt=mysql_query($stmt, $link);
$Zaffected_rows = mysql_affected_rows($link);
$inserted_alt_phones = ($inserted_alt_phones + $Zaffected_rows);
$r++;
}
$result = 'NOTICE';
$result_reason = "update_lead MULTI-ALT-PHONE NUMBERS LOADED";
echo "$result: $result_reason - $inserted_alt_phones|$lead_id|$user\n";
$data = "$inserted_alt_phones|$lead_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
### BEGIN custom fields insert section ###
if ($custom_fields == 'Y')
{
if ($custom_fields_enabled > 0)
{
$stmt="SHOW TABLES LIKE \"custom_$list_id\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$CFinsert_SQL='';
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;";
$rslt=mysql_query($stmt, $link);
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$new_field_value='';
$form_field_value='';
$rowx=mysql_fetch_row($rslt);
$A_field_id[$o] = $rowx[0];
$A_field_label[$o] = $rowx[1];
$A_field_name[$o] = $rowx[2];
$A_field_type[$o] = $rowx[6];
$A_field_size[$o] = $rowx[8];
$A_field_max[$o] = $rowx[9];
$A_field_required[$o] = $rowx[12];
$A_field_value[$o] = '';
$field_name_id = $A_field_label[$o];
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
$A_field_value[$o] = $form_field_value;
if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') )
{
$A_field_value[$o]='----IGNORE----';
}
else
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
$CFinsert_SQL .= "$A_field_label[$o]='$A_field_value[$o]',";
}
}
$o++;
}
if (strlen($CFinsert_SQL)>3)
{
$CFinsert_SQL = preg_replace("/,$/","",$CFinsert_SQL);
$custom_table_update_SQL = "INSERT INTO custom_$list_id SET lead_id='$lead_id',$CFinsert_SQL;";
$rslt=mysql_query($custom_table_update_SQL, $link);
$custom_insert_count = mysql_affected_rows($link);
if ($custom_insert_count > 0)
{
# Update vicidial_list entry to put list_id as entry_list_id
$vl_table_entry_update_SQL = "UPDATE vicidial_list SET entry_list_id='$list_id' where lead_id='$lead_id';";
$rslt=mysql_query($vl_table_entry_update_SQL, $link);
$vl_table_entry_update_count = mysql_affected_rows($link);
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS VALUES ADDED";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id|$vl_table_entry_update_count\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS NOT ADDED, NO FIELDS DEFINED";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS NOT ADDED, NO FIELDS DEFINED";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS NOT ADDED, NO CUSTOM FIELDS DEFINED FOR THIS LIST";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS NOT ADDED, CUSTOM FIELDS DISABLED";
echo "$result: $result_reason - $phone_number|$lead_id|$custom_fields|$custom_fields_enabled\n";
$data = "$phone_number|$lead_id|$custom_fields|$custom_fields_enabled";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
### END custom fields insert section ###
}
}
##### END insert not-found lead into the system #####
}
}
}
}
}
exit;
}
}
################################################################################
### END update_lead
################################################################################
$result = 'ERROR';
$result_reason = "NO FUNCTION SPECIFIED";
echo "$result: $result_reason\n";
@@ -12,6 +12,9 @@
# 90508-0644 - Changed to PHP long tags
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -42,9 +45,12 @@ if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];}
if (strlen($shift)<2) {$shift='ALL';}
if (strlen($order)<2) {$order='hours_down';}
$report_name = 'UsuarioReloj de tiempo Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,webroot_writable FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -52,22 +58,39 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$webroot_writable = $row[1];
$SSoutbound_autodial_active = $row[2];
$SSoutbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
$webroot_writable = $row[4];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -76,6 +99,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -139,9 +183,10 @@ while ($i < $user_groups_to_print)
<link rel="stylesheet" href="calendar.css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<TITLE>UsuarioReloj de tiempo Report
<TITLE>
<?php
echo "$report_name";
##### BEGIN Set variables to make header show properly #####
$ADD = '311111';
@@ -373,20 +418,6 @@ echo "</TR>\n";
echo "</TABLE>\n";
echo "\n";
/*
$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
$TOTavgWAIT_MS = sprintf("%6s", $TOTavgWAIT_MS);
while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
*/
?>
</CENTER>
</BODY></HTML>
@@ -10,6 +10,9 @@
# 90310-2103 - Added admin header
# 90508-0644 - Changed to PHP long tags
# 100214-1421 - Sort menu alphabetically
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
header ("Content-type: text/html; charset=utf-8");
@@ -35,9 +38,12 @@ if (isset($_GET["ENVIAR"])) {$ENVIAR=$_GET["ENVIAR"];}
elseif (isset($_POST["ENVIAR"])) {$ENVIAR=$_POST["ENVIAR"];}
$report_name = 'Grupo Del UsuarioReloj de tiempo Status Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,webroot_writable,timeclock_end_of_day,outbound_autodial_active FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,webroot_writable,timeclock_end_of_day FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -45,13 +51,24 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$webroot_writable = $row[1];
$timeclock_end_of_day = $row[2];
$SSoutbound_autodial_active = $row[3];
$SSoutbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
$webroot_writable = $row[4];
$timeclock_end_of_day = $row[5];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
@@ -68,12 +85,18 @@ else
$EoDdate = date("Y-m-d H:i:s", $EoD);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
$fp = fopen ("./project_auth_entries.txt", "a");
$date = date("r");
$ip = getenv("REMOTE_ADDR");
@@ -86,32 +109,28 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
echo "Nombre y contraseña inválidos del usuario: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL INFORMES/",$LOGallowed_reports)) )
{
if($auth>0)
{
$stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGfullname=$row[0];
if ($webroot_writable > 0)
{
fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n");
fclose($fp);
}
}
else
{
if ($webroot_writable > 0)
{
fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n");
fclose($fp);
}
}
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$stmt="select user_group from vicidial_user_groups order by user_group;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
@@ -141,8 +160,9 @@ if (strlen($user_group) > 0)
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<title>ADMINISTRATION:Reloj de tiempo Status
<title>ADMINISTRATION:
<?php
echo "$report_name";
##### BEGIN Set variables to make header show properly #####
$ADD = '311111';
@@ -399,7 +419,7 @@ $RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n\n";
echo "<font size=0>\n\n\n<br><br><br>\nScript runtime: $RUNtime seconds</font>";
echo "<font size=0>\n\n\n<br><br><br>\nScript runtime: $RUNtime seconds|$db_source</font>";
?>
@@ -523,7 +543,7 @@ $RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n\n";
echo "<font size=0>\n\n\n<br><br><br>\nScript runtime: $RUNtime seconds</font>";
echo "<font size=0>\n\n\n<br><br><br>\nScript runtime: $RUNtime seconds|$db_source</font>";
?>
File diff suppressed because it is too large Load Diff
@@ -1,7 +1,7 @@
<?php
# user_status.php
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
#
@@ -14,6 +14,7 @@
# 91012-0536 - Added selected territories display
# 91130-2039 - Added user closer log manager flag display
# 91212-0656 - Added more complete logging of Emergency Logout process
# 100309-0544 - Added queuemetrics_loginout option
#
header ("Content-type: text/html; charset=utf-8");
@@ -338,7 +339,7 @@ if ($stage == "log_agent_out")
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_loginout FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "<BR>$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -351,11 +352,16 @@ if ($stage == "log_agent_out")
$queuemetrics_login = $row[3];
$queuemetrics_pass = $row[4];
$queuemetrics_log_id = $row[5];
$queuemetrics_loginout = $row[6];
}
##### END QUEUEMETRICS LOGGING LOOKUP #####
###########################################
if ($enable_queuemetrics_logging > 0)
{
$QM_LOGOFF = 'AGENTLOGOFF';
if ($queuemetrics_loginout=='CALLBACK')
{$QM_LOGOFF = 'AGENTCALLBACKLOGOFF';}
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
mysql_select_db("$queuemetrics_dbname", $linkB);
@@ -363,7 +369,7 @@ if ($stage == "log_agent_out")
$agent_logged_in='';
$time_logged_in='';
$stmtB = "SELECT agent,time_id FROM queue_log where agent='Agent/" . mysql_real_escape_string($user) . "' and verb='AGENTLOGIN' order by time_id desc limit 1;";
$stmtB = "SELECT agent,time_id,data1 FROM queue_log where agent='Agent/" . mysql_real_escape_string($user) . "' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') order by time_id desc limit 1;";
$rsltB=mysql_query($stmtB, $linkB);
if ($DB) {echo "<BR>$stmtB\n";}
$qml_ct = mysql_num_rows($rsltB);
@@ -372,12 +378,13 @@ if ($stage == "log_agent_out")
$row=mysql_fetch_row($rsltB);
$agent_logged_in = $row[0];
$time_logged_in = $row[1];
$phone_logged_in = $row[2];
}
$time_logged_in = ($now_date_epoch - $time_logged_in);
if ($time_logged_in > 1000000) {$time_logged_in=1;}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='NONE',agent='$agent_logged_in',verb='AGENTLOGOFF',serverid='$queuemetrics_log_id',data1='" . mysql_real_escape_string($user) . "$agents',data2='$time_logged_in';";
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='NONE',agent='$agent_logged_in',verb='$QM_LOGOFF',serverid='$queuemetrics_log_id',data1='$phone_logged_in',data2='$time_logged_in';";
if ($DB) {echo "<BR>$stmtB\n";}
$rsltB=mysql_query($stmtB, $linkB);
}
@@ -616,7 +616,7 @@ if ($lead_search > 0)
if (!$rslt) {die('Could not execute: ' . mysql_error());}
#Vtiger no longer use auto increment for vtiger_crmentity crmid, vtiger_crmentity_seq is used instead to list next aviable entity ID
# Get next aviable id to use as crmid in vtiger_crmentity
# Get next available id to use as crmid in vtiger_crmentity
$stmt="SELECT id from vtiger_crmentity_seq ;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkV);
@@ -624,7 +624,7 @@ if ($lead_search > 0)
$leadid = ($row[0] + 1);
if (!$rslt) {die('Could not execute: ' . mysql_error());}
# Increase next aviable crmid with 1 so next record gets proper id
# Increase next available crmid with 1 so next record gets proper id
$stmt="UPDATE vtiger_crmentity_seq SET id = '$leadid';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkV);
@@ -644,7 +644,7 @@ if ($lead_search > 0)
if (!$rslt) {die('Could not execute: ' . mysql_error());}
#Insert values into vtiger_leaddetails
$stmt = "INSERT INTO vtiger_leadaddress (leadaddressid,city,code,state,country,phone,mobile,lane) values('$leadid','$city','$postal_code','$province','$country','$phone','$alt_phone','$address1 $address2');";
$stmt = "INSERT INTO vtiger_leadaddress (leadaddressid,city,code,state,country,phone,mobile,lane) values('$leadid','$city','$postal_code','$state','$country','$phone','$alt_phone','$address1 $address2');";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $linkV);
if (!$rslt) {die('Could not execute: ' . mysql_error());}
@@ -3,12 +3,13 @@
# vicidial_users table into the Vtiger system as well as
# the groups from VICIDIAL to Vtiger
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 81231-1307 - First build
# 90228-2152 - Added Groups support
# 90508-0644 - Changed to PHP long tags
# 100127-0616 - Added Vtiger ViciDial user_level role lookup
#
header ("Content-type: text/html; charset=utf-8");
@@ -183,15 +184,25 @@ while ($i < $VD_users_ct)
$roleid = 'H5';
$status = 'Active';
$groupid = '1';
if ($user_level[$i] >= 7) {$roleid = 'H4';}
if ($user_level[$i] >= 8) {$roleid = 'H3';}
if ($user_level[$i] >= 9) {$roleid = 'H2';}
if ($user_level[$i] >= 9) {$is_admin = 'on';}
if (ereg('N',$active[$i])) {$status = 'Inactive';}
if ($user_level[$i] >= 7) {$roleid = 'H4';}
if ($user_level[$i] >= 8) {$roleid = 'H3';}
if ($user_level[$i] >= 9) {$roleid = 'H2';}
if ($user_level[$i] >= 9) {$is_admin = 'on';}
if (ereg('N',$active[$i])) {$status = 'Inactive';}
$salt = substr($user_name, 0, 2);
$salt = '$1$' . $salt . '$';
$encrypted_password = crypt($user_password, $salt);
$i++;
### search for role in ViciDial
$stmt = "SELECT vtiger_role FROM vtiger_vicidial_roles where user_level='$user_level';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$vvr_ct = mysql_num_rows($rslt);
if ($vvr_ct > 0)
{
$row=mysql_fetch_row($rslt);
$roleid = $row[0];
}
$j=0;
$all_VICIDIAL_groups_SQL='';
@@ -2,7 +2,7 @@
# welcome_demo.php - VICIDIAL welcome Demo page
#
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
header ("Content-type: text/html; charset=utf-8");
@@ -56,6 +56,9 @@ echo "<font size=3><b> &nbsp; <a href=\"../agc_nl/vicidial.php?relogin=YES&VD_lo
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_tw/vicidial.php?relogin=YES&VD_login=6666&VD_campaign=TESTCAMP&phone_login=phone&phone_pass=phone&VD_pass=1234\"><IMG SRC=\"../agc/images/tw.gif\" border=0> Chinese(T) Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_se/vicidial.php?relogin=YES&VD_login=6666&VD_campaign=TESTCAMP&phone_login=phone&phone_pass=phone&VD_pass=1234\"><IMG SRC=\"../agc/images/se.gif\" border=0> Swedish Agent Login</a>";
echo "</TD></TR></TABLE>\n";
echo "</TD><TD VALIGN=TOP>\n";
@@ -78,6 +81,9 @@ echo "<font size=3><b> &nbsp; <a href=\"../vicidial_el/admin.php\"><IMG SRC=\"..
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial_fr/admin.php\"><IMG SRC=\"../agc/images/fr.gif\" border=0> French Administration</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial_br/admin.php\"><IMG SRC=\"../agc/images/br.gif\" border=0> Brazilian Portuguese Administration</a>";
echo "</TD></TR></TABLE>\n";
echo "<TR><TD ALIGN=LEFT ><font size=1> &nbsp; </TD></TR>\n";
echo "</TABLE>\n";
@@ -1,8 +1,8 @@
<?php
# welcome_demo.php - VICIDIAL welcome Demo page
# welcome_languages.php - VICIDIAL welcome Languages page
#
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
header ("Content-type: text/html; charset=utf-8");
@@ -56,6 +56,9 @@ echo "<font size=3><b> &nbsp; <a href=\"../agc_nl/vicidial.php\"><IMG SRC=\"../a
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_tw/vicidial.php\"><IMG SRC=\"../agc/images/tw.gif\" border=0> Chinese(T) Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_se/vicidial.php\"><IMG SRC=\"../agc/images/se.gif\" border=0> Swedish Agent Login</a>";
echo "</TD></TR></TABLE>\n";
echo "</TD><TD VALIGN=TOP>\n";
@@ -78,6 +81,9 @@ echo "<font size=3><b> &nbsp; <a href=\"../vicidial_el/admin.php\"><IMG SRC=\"..
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial_fr/admin.php\"><IMG SRC=\"../agc/images/fr.gif\" border=0> French Administration</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial_br/admin.php\"><IMG SRC=\"../agc/images/br.gif\" border=0> Brazilian Portuguese Administration</a>";
echo "</TD></TR></TABLE>\n";
echo "<TR><TD ALIGN=LEFT ><font size=1> &nbsp; </TD></TR>\n";
echo "</TABLE>\n";
@@ -14,6 +14,9 @@
# 90801-0923 - Added in-group name to pulldown
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -39,9 +42,12 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
if (strlen($shift)<2) {$shift='ALL';}
$report_name = 'Inbound Service Level Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -49,17 +55,34 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';";
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
@@ -69,6 +92,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -106,7 +150,7 @@ echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Inbound Service Level Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -979,7 +1023,7 @@ echo "+-------------+-------+-----------------------------------------+ +------+
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\nRun Time: $RUNtime seconds\n";
echo "\nRun Time: $RUNtime seconds|$db_source\n";
}
@@ -27,6 +27,10 @@
# 100206-1454 - Fixed TMR(service level) calculation
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100709-1809 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100913-1634 - Added DID option to select by DIDs instead of In-groups
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -47,6 +51,8 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];}
elseif (isset($_POST["INVIA"])) {$INVIA=$_POST["INVIA"];}
if (isset($_GET["DID"])) {$DID=$_GET["DID"];}
elseif (isset($_POST["DID"])) {$DID=$_POST["DID"];}
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
@@ -56,9 +62,12 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$MT[0]='0';
if (strlen($shift)<2) {$shift='ALL';}
$report_name = 'Inbound Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -66,10 +75,23 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
@@ -82,13 +104,18 @@ if ($gmt_conf_ct > 0)
$epoch_offset = (($local_gmt + $dst) * 3600);
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
@@ -98,6 +125,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -105,7 +153,9 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select group_id,group_name from vicidial_inbound_groups order by group_id;";
$stmt="select group_id,group_name,8 from vicidial_inbound_groups order by group_id;";
if ($DID=='Y')
{$stmt="select did_pattern,did_description,did_id from vicidial_inbound_dids order by did_pattern;";}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
@@ -118,6 +168,7 @@ while ($i < $groups_to_print)
$row=mysql_fetch_row($rslt);
$LISTgroups[$i] = $row[0];
$LISTgroup_names[$i] = $row[1];
$LISTgroup_ids[$i] = $row[2];
$i++;
}
@@ -175,7 +226,7 @@ echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Inbound Stats</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -195,6 +246,7 @@ if ($DB > 0)
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET name=vicidial_report id=vicidial_report>\n";
echo "<TABLE Border=0><TR><TD VALIGN=TOP>\n";
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
echo "<INPUT TYPE=HIDDEN NAME=DID VALUE=\"$DID\">\n";
echo "Date:<BR>\n";
echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">";
@@ -227,7 +279,10 @@ o_cal.a_tpl.yearscroll = false;
<?php
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "Gruppi Inbound: \n";
if ($DID=='Y')
{echo "Inbound DIDs: \n";}
else
{echo "Gruppi Inbound: \n";}
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "<SELECT SIZE=5 NAME=group[] multiple>\n";
$o=0;
@@ -242,9 +297,12 @@ while ($groups_to_print > $o)
echo "</SELECT>\n";
echo "</TD><TD ROWSPAN=2 VALIGN=TOP>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ";
echo "<a href=\"./admin.php?ADD=3111&group_id=$group[0]\">MODIFICA</a> | ";
if ($DID!='Y')
{
echo "<a href=\"./admin.php?ADD=3111&group_id=$group[0]\">MODIFICA</a> | ";
echo "<a href=\"./AST_IVRstats.php?query_date=$query_date&end_date=$end_date&shift=$shift$groupQS\">IVR REPORT</a> | \n";
}
echo "<a href=\"./admin.php?ADD=999999\">REPORT</a> | ";
echo "<a href=\"./AST_IVRstats.php?query_date=$query_date&end_date=$end_date&shift=$shift$groupQS\">IVR REPORT</a> \n";
echo "</FONT>\n";
echo "</TD></TR>\n";
@@ -274,10 +332,13 @@ echo "<PRE><FONT SIZE=2>\n\n";
if ($groups_to_print < 1)
{
echo "\n\n";
echo "SELEZIONA UN GRUPPO IN-E DATE SOPRA e fare clic su Invia\n";
}
{
echo "\n\n";
if ($DID=='Y')
{echo "PLEASE SELECT A DID AND DATE RANGE ABOVE AND CLICK INVIA\n";}
else
{echo "SELEZIONA UN GRUPPO IN-E DATE SOPRA e fare clic su Invia\n";}
}
else
{
@@ -310,30 +371,111 @@ echo "Inbound Call Stats: $group_string $NOW_TIME\n";
if ($DID=='Y')
{
$stmt="select did_id from vicidial_inbound_dids where did_pattern IN($group_SQL);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$dids_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $dids_to_print)
{
$row=mysql_fetch_row($rslt);
$did_id[$i] = $row[0];
$did_SQL .= "'$row[0]',";
$i++;
}
$did_SQL = eregi_replace(",$",'',$did_SQL);
if (strlen($did_SQL)<3) {$did_SQL="''";}
$stmt="select uniqueid from vicidial_did_log where did_id IN($did_SQL);";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$unids_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $unids_to_print)
{
$row=mysql_fetch_row($rslt);
$unid_SQL .= "'$row[0]',";
$i++;
}
$unid_SQL = eregi_replace(",$",'',$unid_SQL);
if (strlen($unid_SQL)<3) {$unid_SQL="''";}
if ($DB > 0)
{echo "|$did_SQL|$unid_SQL|\n";}
}
if ($group_ct > 1)
{
echo "\n";
echo "---------- MULTI-GROUP BREAKDOWN:\n";
echo "+----------------------+---------+---------+---------+---------+\n";
echo "| IN-GROUP | CALLS | DROPS | DROP % | IVR |\n";
echo "+----------------------+---------+---------+---------+---------+\n";
if ($DID=='Y')
{
echo "+----------------------+---------+---------+---------+---------+\n";
echo "| DID | CALLS | DROPS | DROP % | IVR |\n";
echo "+----------------------+---------+---------+---------+---------+\n";
}
else
{
echo "+----------------------+---------+---------+---------+---------+\n";
echo "| IN-GROUP | CALLS | DROPS | DROP % | IVR |\n";
echo "+----------------------+---------+---------+---------+---------+\n";
}
$i=0;
while($i < $group_ct)
{
$did_id[$i]='0';
$DIDunid_SQL='';
$stmt="select did_id from vicidial_inbound_dids where did_pattern='$group[$i]';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$Sdids_to_print = mysql_num_rows($rslt);
if ($Sdids_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$did_id[$i] = $row[0];
}
$stmt="select uniqueid from vicidial_did_log where did_id='$did_id[$i]';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$DIDunids_to_print = mysql_num_rows($rslt);
$k=0;
while ($k < $DIDunids_to_print)
{
$row=mysql_fetch_row($rslt);
$DIDunid_SQL .= "'$row[0]',";
$k++;
}
$DIDunid_SQL = eregi_replace(",$",'',$DIDunid_SQL);
if (strlen($DIDunid_SQL)<3) {$DIDunid_SQL="''";}
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]';";
if ($DID=='Y')
{
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($DIDunid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a='$group[$i]' and comment_b='START';";
if ($DID=='Y')
{
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and uniqueid IN($DIDunid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rowx=mysql_fetch_row($rslt);
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);";
if ($DID=='Y')
{
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null) and uniqueid IN($DIDunid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rowy=mysql_fetch_row($rslt);
@@ -364,17 +506,30 @@ echo "\n";
echo "Intervallo Di Tempo: $query_date_BEGIN to $query_date_END\n\n";
echo "---------- TOTALI\n";
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL);";
if ($DID=='Y')
{
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND');";
if ($DID=='Y')
{
$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND') and uniqueid IN($unid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rowy=mysql_fetch_row($rslt);
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a IN($group_SQL) and comment_b='START';";
if ($DID=='Y')
{
$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and uniqueid IN($unid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$rowx=mysql_fetch_row($rslt);
@@ -419,6 +574,10 @@ echo "\n";
echo "---------- ABBATTUTE\n";
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);";
if ($DID=='Y')
{
$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null) and uniqueid IN($unid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -458,41 +617,47 @@ echo "Average hold time for DROP Calls: $average_hold_seconds second
if (strlen($group_SQL)>3)
{
$stmt = "SELECT answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two from vicidial_inbound_groups where group_id IN($group_SQL) order by answer_sec_pct_rt_stat_one desc limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$Sanswer_sec_pct_rt_stat_one = $row[0];
$Sanswer_sec_pct_rt_stat_two = $row[1];
$stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_one and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$answer_sec_pct_rt_stat_one = $row[0];
$stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_two and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$answer_sec_pct_rt_stat_two = $row[0];
if ( ($RISPOSTAEDcalls > 0) and ($answer_sec_pct_rt_stat_one > 0) and ($answer_sec_pct_rt_stat_two > 0) )
if ($DID!='Y')
{
$PCTanswer_sec_pct_rt_stat_one = (($answer_sec_pct_rt_stat_one / $RISPOSTAEDcalls) * 100);
$PCTanswer_sec_pct_rt_stat_one = round($PCTanswer_sec_pct_rt_stat_one, 0);
#$PCTanswer_sec_pct_rt_stat_one = sprintf("%10s", $PCTanswer_sec_pct_rt_stat_one);
$PCTanswer_sec_pct_rt_stat_two = (($answer_sec_pct_rt_stat_two / $RISPOSTAEDcalls) * 100);
$PCTanswer_sec_pct_rt_stat_two = round($PCTanswer_sec_pct_rt_stat_two, 0);
#$PCTanswer_sec_pct_rt_stat_two = sprintf("%10s", $PCTanswer_sec_pct_rt_stat_two);
$stmt = "SELECT answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two from vicidial_inbound_groups where group_id IN($group_SQL) order by answer_sec_pct_rt_stat_one desc limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$Sanswer_sec_pct_rt_stat_one = $row[0];
$Sanswer_sec_pct_rt_stat_two = $row[1];
$stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_one and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$answer_sec_pct_rt_stat_one = $row[0];
$stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_two and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND');";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$answer_sec_pct_rt_stat_two = $row[0];
if ( ($RISPOSTAEDcalls > 0) and ($answer_sec_pct_rt_stat_one > 0) and ($answer_sec_pct_rt_stat_two > 0) )
{
$PCTanswer_sec_pct_rt_stat_one = (($answer_sec_pct_rt_stat_one / $RISPOSTAEDcalls) * 100);
$PCTanswer_sec_pct_rt_stat_one = round($PCTanswer_sec_pct_rt_stat_one, 0);
#$PCTanswer_sec_pct_rt_stat_one = sprintf("%10s", $PCTanswer_sec_pct_rt_stat_one);
$PCTanswer_sec_pct_rt_stat_two = (($answer_sec_pct_rt_stat_two / $RISPOSTAEDcalls) * 100);
$PCTanswer_sec_pct_rt_stat_two = round($PCTanswer_sec_pct_rt_stat_two, 0);
#$PCTanswer_sec_pct_rt_stat_two = sprintf("%10s", $PCTanswer_sec_pct_rt_stat_two);
}
}
}
echo "\n";
echo "---------- CUSTOM INDICATORS\n";
echo "GDE (Answered/Llamadas totales tomadas in to this In-Group): $RISPOSTAEDpercent%\n";
echo "ACR (Dropped/Answered): $DROP_RISPOSTAEDpercent%\n";
echo "TMR1 (Answered within $Sanswer_sec_pct_rt_stat_one seconds/Answered): $PCTanswer_sec_pct_rt_stat_one%\n";
echo "TMR2 (Answered within $Sanswer_sec_pct_rt_stat_two seconds/Answered): $PCTanswer_sec_pct_rt_stat_two%\n";
if ($DID!='Y')
{
echo "TMR1 (Answered within $Sanswer_sec_pct_rt_stat_one seconds/Answered): $PCTanswer_sec_pct_rt_stat_one%\n";
echo "TMR2 (Answered within $Sanswer_sec_pct_rt_stat_two seconds/Answered): $PCTanswer_sec_pct_rt_stat_two%\n";
}
# GET LIST OF ALL STATUSES and create SQL from human_answered statuses
@@ -538,6 +703,10 @@ echo "\n";
echo "---------- QUEUE STATS\n";
$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and (queue_seconds > 0);";
if ($DID=='Y')
{
$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and (queue_seconds > 0) and uniqueid IN($unid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
@@ -587,6 +756,10 @@ echo "| 0 5 10 15 20 25 30 35 40 45 50 55
echo "+-------------------------------------------------------------------------------------------+------------+\n";
$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_seconds;";
if ($DID=='Y')
{
$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_seconds;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$reasons_to_print = mysql_num_rows($rslt);
@@ -650,6 +823,10 @@ echo "| 0 5 10 15 20 25 30 35 40 45 50 55
echo "+-------------------------------------------------------------------------------------------+------------+\n";
$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') group by queue_seconds;";
if ($DID=='Y')
{
$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') group by queue_seconds;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$reasons_to_print = mysql_num_rows($rslt);
@@ -714,6 +891,10 @@ echo " | 0 5 10 15 20 25 30 35 40 45
echo "----------+-------------------------------------------------------------------------------------------+------------+\n";
$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND') group by queue_seconds;";
if ($DID=='Y')
{
$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND') group by queue_seconds;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$reasons_to_print = mysql_num_rows($rslt);
@@ -922,6 +1103,10 @@ echo "| HANGUP REASON | CALLS |\n";
echo "+----------------------+------------+\n";
$stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by term_reason;";
if ($DID=='Y')
{
$stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by term_reason;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$reasons_to_print = mysql_num_rows($rslt);
@@ -964,6 +1149,10 @@ echo "+--------+----------------------+----------------------+------------+-----
## get counts and time totals for all statuses in this campaign
$stmt="select count(*),status,sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by status;";
if ($DID=='Y')
{
$stmt="select count(*),status,sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by status;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$statuses_to_print = mysql_num_rows($rslt);
@@ -1095,6 +1284,10 @@ echo "| 1 2 3 4 5 6 7 8 9 10 15 20
echo "+-------------------------------------------------------------------------------------+------------+\n";
$stmt="select count(*),queue_position from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_position;";
if ($DID=='Y')
{
$stmt="select count(*),queue_position from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_position;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$positions_to_print = mysql_num_rows($rslt);
@@ -1159,6 +1352,10 @@ echo "| AGENT | CALLS | TIME H:M:S |AVERAGE |\n";
echo "+--------------------------+------------+------------+--------+\n";
$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 0 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
if ($DID=='Y')
{
$stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 0 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$users_to_print = mysql_num_rows($rslt);
@@ -1228,6 +1425,10 @@ echo "<FONT SIZE=0>\n";
######### 15-minute increment breakdowns of total calls and drops, then answered table
$BDansweredCALLS = 0;
$stmt="SELECT status,queue_seconds,UNIX_TIMESTAMP(call_date),call_date from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL);";
if ($DID=='Y')
{
$stmt="SELECT status,queue_seconds,UNIX_TIMESTAMP(call_date),call_date from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL);";
}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$calls_to_print = mysql_num_rows($rslt);
@@ -1524,7 +1725,7 @@ echo "+------+------------------------------------------------------------------
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\nRun Time: $RUNtime seconds\n";
echo "\nRun Time: $RUNtime seconds|$db_source\n";
}
@@ -9,6 +9,9 @@
# 90809-0216 - Added Exclude Outbound Drop Group option
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -52,9 +55,12 @@ $MT[0]='0';
if (strlen($shift)<2) {$shift='ALL';}
if (strlen($exclude_rollover)<2) {$exclude_rollover='NO';}
$report_name = 'Inbound Summary Hourly Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -62,10 +68,22 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
@@ -78,13 +96,19 @@ if ($gmt_conf_ct > 0)
$epoch_offset = (($local_gmt + $dst) * 3600);
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -93,6 +117,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -187,7 +232,7 @@ echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Inbound Summary Hourly Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
if ($bareformat < 1)
{
@@ -676,7 +721,7 @@ else
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\nRun Time: $RUNtime seconds\n";
echo "\n\nRun Time: $RUNtime seconds|$db_source\n";
}
@@ -13,6 +13,9 @@
# 91112-0719 - Added in-group names to select list
# 100214-1421 - Sort menu alphabetically
# 100301-1401 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -40,9 +43,12 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
if (strlen($shift)<2) {$shift='ALL';}
$report_name = 'Inbound IVR Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -50,17 +56,34 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';";
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
@@ -70,6 +93,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -85,6 +129,7 @@ $i=0;
$LISTgroups[$i]='CALLMENU';
$LISTgroups_names[$i]='IVR';
$i++;
$groups_to_print++;
$LISTgroups[$i]='XMLPULL';
$LISTgroups_names[$i]='Dynamic Application';
$i++;
@@ -197,7 +242,7 @@ $end_date_T = $end_dateARRAY[1];
<?php
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>IVR Stats Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -720,7 +765,7 @@ else
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\nRun Time: $RUNtime seconds\n";
echo "\nRun Time: $RUNtime seconds|$db_source\n";
}
@@ -9,6 +9,9 @@
# 091129-0017 - Added Sales-type and DNC-type tallies
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -50,9 +53,12 @@ $MT[0]='0';
if (strlen($shift)<2) {$shift='ALL';}
if (strlen($include_rollover)<2) {$include_rollover='NO';}
$report_name = 'Outbound Summary Interval Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -60,10 +66,22 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt = "SELECT local_gmt FROM servers where active='Y' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
@@ -91,6 +109,12 @@ if ($records_to_print > 0)
$auth++;
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -101,28 +125,31 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ($user_level < 9)
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$user_group';";
$rslt=mysql_query($stmt, $link);
$records_to_print = mysql_num_rows($rslt);
if ($records_to_print > 0)
{
$stmt="SELECT allowed_campaigns from vicidial_user_groups where user_group='$user_group';";
$rslt=mysql_query($stmt, $link);
$records_to_print = mysql_num_rows($rslt);
if ($records_to_print > 0)
$row=mysql_fetch_row($rslt);
$LOGallowed_reports = $row[1];
if ( (!eregi("ALL-CAMPAIGNS",$row[0])) )
{
$row=mysql_fetch_row($rslt);
if ( (!eregi("ALL-CAMPAIGNS",$row[0])) )
{
$rawLOGallowed_campaignsSQL = eregi_replace(' -','',$row[0]);
$rawLOGallowed_campaignsSQL = eregi_replace(' ',"','",$rawLOGallowed_campaignsSQL);
$LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')";
$whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')";
}
$rawLOGallowed_campaignsSQL = eregi_replace(' -','',$row[0]);
$rawLOGallowed_campaignsSQL = eregi_replace(' ',"','",$rawLOGallowed_campaignsSQL);
$LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')";
$whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')";
}
else
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
echo "Campaigns Permissions Error: |$PHP_AUTH_USER|$user_group|\n";
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
}
else
{
echo "Campaigns Permissions Error: |$PHP_AUTH_USER|$user_group|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -163,10 +190,6 @@ $group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
$stmt="select campaign_name from vicidial_campaigns where campaign_id='$group[$i]' $LOGallowed_campaignsSQL;";
$rslt=mysql_query($stmt, $link);
$campaign_names_to_print = mysql_num_rows($rslt);
@@ -174,6 +197,9 @@ while($i < $group_ct)
{
$row=mysql_fetch_row($rslt);
$group_cname[$i] = $row[0];
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
}
if (eregi("YES",$include_rollover))
@@ -336,7 +362,7 @@ echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Outbound Summary Interval Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
if ($bareformat < 1)
{
@@ -1167,8 +1193,8 @@ else
$hTOTcalls_count = sprintf("%6s", $hTOTcalls_count);
$hTOTsystem_count = sprintf("%6s", $hTOTsystem_count);
$hTOTagent_count = sprintf("%6s", $hTOTagent_count);
$hTOTptp_count = sprintf("%6s", $hTOTrtp_count);
$hTOTrtp_count = sprintf("%6s", $hTOTptp_count);
$hTOTptp_count = sprintf("%6s", $hTOTptp_count);
$hTOTrtp_count = sprintf("%6s", $hTOTrtp_count);
if ( ($hTOTcalls_count < 1) or ($hTOTna_count < 1) )
{$hTOTna_percent=0;}
else
@@ -1268,7 +1294,7 @@ else
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\nRun Time: $RUNtime seconds\n";
echo "\n\nRun Time: $RUNtime seconds|$db_source\n";
}
@@ -26,6 +26,10 @@
# 100202-1034 - Added statuses to no-answer section
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100814-2307 - Added display of preset dials if presets are enabled in the campaign
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
header ("Content-type: text/html; charset=utf-8");
@@ -73,10 +77,12 @@ if (strlen($bottom_graph)<2) {$bottom_graph='NO';}
if (strlen($carrier_stats)<2) {$carrier_stats='NO';}
if (strlen($include_rollover)<2) {$include_rollover='NO';}
$report_name = 'Outbound Calling Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -84,10 +90,22 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
##### SERVER CARRIER LOGGING LOOKUP #####
$stmt = "SELECT count(*) FROM servers where carrier_logging_active='Y' and max_vicidial_trunks > 0;";
$rslt=mysql_query($stmt, $link);
@@ -99,13 +117,19 @@ if ($srv_conf_ct > 0)
$carrier_logging_active = $row[0];
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 7 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -114,6 +138,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -130,7 +175,18 @@ while($i < $group_ct)
$i++;
}
$stmt="select campaign_id,campaign_name from vicidial_campaigns order by campaign_id;";
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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 ";
$stmt="select campaign_id,campaign_name from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
@@ -140,7 +196,7 @@ while ($i < $campaigns_to_print)
$row=mysql_fetch_row($rslt);
$groups[$i] = $row[0];
$group_names[$i] = $row[1];
if (ereg("--ALL",$group_string) )
if (ereg("-ALL",$group_string) )
{$group[$i] = $groups[$i];}
$i++;
}
@@ -151,13 +207,16 @@ $group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
if ( (preg_match("/ $group[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) )
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
}
if (eregi("YES",$include_rollover))
{
$stmt="select drop_inbound_group from vicidial_campaigns where campaign_id='$group[$i]' and drop_inbound_group NOT LIKE \"%NONE%\" and drop_inbound_group is NOT NULL and drop_inbound_group != '';";
$stmt="select drop_inbound_group from vicidial_campaigns where campaign_id='$group[$i]' $LOGallowed_campaignsSQL and drop_inbound_group NOT LIKE \"%NONE%\" and drop_inbound_group is NOT NULL and drop_inbound_group != '';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$in_groups_to_print = mysql_num_rows($rslt);
@@ -174,9 +233,9 @@ while($i < $group_ct)
}
if (strlen($group_drop_SQL) < 2)
{$group_drop_SQL = "''";}
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) or (strlen($group_string) < 2) )
{
$group_SQL = "";
$group_SQL = "$LOGallowed_campaignsSQL";
$group_drop_SQL = "";
}
else
@@ -252,7 +311,7 @@ echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Outbound Stats</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -981,7 +1040,7 @@ else
if ( ($carrier_logging_active > 0) and ($carrier_stats == 'YES') )
{
##############################
######### STATUS CATEGORIA STATS
######### CARRIER STATS
$OUToutput .= "\n";
$OUToutput .= "---------- CARRIER CALL STATUSES\n";
@@ -1016,6 +1075,55 @@ else
}
## find if any selected campaigns have presets enabled
$presets_enabled=0;
$stmt="select count(*) from vicidial_campaigns where enable_xfer_presets='ENABLED' $group_SQLand;";
$rslt=mysql_query($stmt, $link);
if ($DB) {$OUToutput .= "$stmt\n";}
$presets_enabled_count = mysql_num_rows($rslt);
if ($presets_enabled_count > 0)
{
$row=mysql_fetch_row($rslt);
$presets_enabled = $row[0];
}
if ($presets_enabled > 0)
{
##############################
######### PRESET DIAL STATS
$OUToutput .= "\n";
$OUToutput .= "---------- AGENT PRESET DIALS\n";
$OUToutput .= "+------------------------------------------+------------+\n";
$OUToutput .= "| PRESET NAME | CALLS |\n";
$OUToutput .= "+------------------------------------------+------------+\n";
## get counts and time totals for all statuses in this campaign
$stmt="select preset_name,count(*) from user_call_log where call_date > \"$query_date_BEGIN\" and call_date < \"$query_date_END\" and preset_name!='' and preset_name is not NULL $group_SQLand group by preset_name order by preset_name;";
$rslt=mysql_query($stmt, $link);
if ($DB) {$OUToutput .= "$stmt\n";}
$carrierstatuses_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $carrierstatuses_to_print)
{
$row=mysql_fetch_row($rslt);
$TOTPREcalls = ($TOTPREcalls + $row[1]);
$PREstatus = sprintf("%-40s", $row[0]); while(strlen($PREstatus)>40) {$PREstatus = substr("$PREstatus", 0, -1);}
$PREcount = sprintf("%10s", $row[1]); while(strlen($PREcount)>10) {$PREcount = substr("$PREcount", 0, -1);}
$OUToutput .= "| $PREstatus | $PREcount |\n";
$i++;
}
$TOTPREcalls = sprintf("%10s", $TOTPREcalls); while(strlen($TOTPREcalls)>10) {$TOTPREcalls = substr("$TOTPREcalls", 0, -1);}
$OUToutput .= "+------------------------------------------+------------+\n";
$OUToutput .= "| TOTAL | $TOTPREcalls |\n";
$OUToutput .= "+------------------------------------------+------------+\n";
}
##############################
######### STATUS CATEGORIA STATS
@@ -1446,7 +1554,7 @@ else
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\nRun Time: $RUNtime seconds\n";
echo "\nRun Time: $RUNtime seconds|$db_source\n";
}
@@ -19,12 +19,14 @@ require("dbconnect.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["group"])) {$group=$_GET["group"];}
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];}
elseif (isset($_POST["INVIA"])) {$INVIA=$_POST["INVIA"];}
elseif (isset($_POST["INVIA"])) {$INVIA=$_POST["INVIA"];}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
@@ -77,10 +79,14 @@ while ($i < $campaigns_to_print)
<?php
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Coda Chiamate Report</TITLE></HEAD><BODY BGCOLOR=WHITE>\n";
echo "<TITLE>Coda Chiamate Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
require("admin_header.php");
echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET>\n";
#echo "<INPUT TYPE=HIDDEN NAME=server_ip VALUE=\"$server_ip\">\n";
#echo "<INPUT TYPE=TEXT NAME=query_date SIZE=10 MAXLENGTH=10 VALUE=\"$query_date\">\n";
echo "<SELECT SIZE=1 NAME=group>\n";
$o=0;
while ($campaigns_to_print > $o)
@@ -164,4 +170,6 @@ else
?>
</PRE>
</TD></TR></TABLE>
</BODY></HTML>
@@ -11,6 +11,9 @@
# 90508-0644 - Changed to PHP long tags
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
@@ -42,9 +45,12 @@ if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];}
if (strlen($shift)<2) {$shift='ALL';}
$report_name = 'Single Agent Daily';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -52,20 +58,38 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -74,6 +98,38 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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 ";
$MT[0]='';
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -82,7 +138,16 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns;";
$i=0;
$group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$i++;
}
$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
@@ -91,6 +156,8 @@ while ($i < $campaigns_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
if (ereg("-ALL",$group_string) )
{$group[$i] = $groups[$i];}
$i++;
}
@@ -99,9 +166,12 @@ $group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
if ( (preg_match("/ $group[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) )
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
}
$i++;
}
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
@@ -164,7 +234,7 @@ if ($file_download < 1)
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Agent Giorni di stato Report</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>Single Agent Daily</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<span style=\"position:absolute;left:0px;top:0px;z-index:20;\" id=admin_header>";
$short_header=1;
@@ -273,12 +343,12 @@ else
{
echo "LEAD STATS BREAKDOWN:\n";
echo "+------------+--------+--------+--------+$statusesHEAD\n";
echo "| <a href=\"$LINKbase\">DATE</a> | <a href=\"$LINKbase&stage=LEADS\">LEADS</a> | <a href=\"$LINKbase&stage=CI\">CIcalls</a>| <a href=\"$LINKbase&stage=DNCCI\">DNC/CI%</a>|$statusesHTML\n";
echo "| <a href=\"$LINKbase\">DATE</a> | <a href=\"$LINKbase&stage=LEADS\">CALLS</a> | <a href=\"$LINKbase&stage=CI\">CIcalls</a>| <a href=\"$LINKbase&stage=DNCCI\">DNC/CI%</a>|$statusesHTML\n";
echo "+------------+--------+--------+--------+$statusesHEAD\n";
}
else
{
$file_output .= "DATE,LEADS,CIcalls,DNC-CI%,$statusesFILE\n";
$file_output .= "DATE,CALLS,CIcalls,DNC-CI%,$statusesFILE\n";
}
### BEGIN loop through each user ###
@@ -596,7 +666,7 @@ else
echo "<a href=\"./admin.php?ADD=999999\">REPORT</a> </FONT>\n";
echo "</TD></TR></TABLE>";
echo "</FORM>\n\n";
echo "</FORM>\n\n<BR>$db_source";
echo "</span>\n";
echo "<span style=\"position:absolute;left:3px;top:3px;z-index:18;\" id=agent_status_bars>\n";
@@ -23,6 +23,9 @@
# 100203-1131 - Added CUSTOMER time statistics
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -55,9 +58,12 @@ if (strlen($shift)<2) {$shift='ALL';}
$LINKbase = "$PHP_SELF?query_date=$query_date&end_date=$end_date&group=$group&user_group=$user_group&shift=$shift&DB=$DB";
$report_name = 'Agent Performance Dettagliata';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -65,20 +71,38 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -87,6 +111,38 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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 ";
$MT[0]='';
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -95,7 +151,17 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns order by campaign_id;";
$i=0;
$group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$i++;
}
$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
@@ -104,6 +170,8 @@ while ($i < $campaigns_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
if (ereg("-ALL",$group_string) )
{$group[$i] = $groups[$i];}
$i++;
}
$stmt="select user_group from vicidial_user_groups order by user_group;";
@@ -123,9 +191,12 @@ $group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
if ( (preg_match("/ $group[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) )
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
}
$i++;
}
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
@@ -174,7 +245,7 @@ echo "<script language=\"JavaScript\" src=\"calendar_db.js\"></script>\n";
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Agent Performance Dettagliata</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -364,7 +435,7 @@ while ($i < $rows_to_print)
echo "CALL STATS BREAKDOWN: (Statistics related to handling of calls only)\n";
echo "+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n";
echo "| <a href=\"$LINKbase\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">LEADS</a> | <a href=\"$LINKbase&stage=TIME\">TIME</a> | PAUSE |PAUSAVG | WAIT |WAITAVG | TALK |TALKAVG | DISPO |DISPAVG | DEAD |DEADAVG | CUSTOMER |CUSTAVG |$statusesHTML\n";
echo "| <a href=\"$LINKbase\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">CALLS</a> | <a href=\"$LINKbase&stage=TIME\">TIME</a> | PAUSE |PAUSAVG | WAIT |WAITAVG | TALK |TALKAVG | DISPO |DISPAVG | DEAD |DEADAVG | CUSTOMER |CUSTAVG |$statusesHTML\n";
echo "+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n";
@@ -863,7 +934,7 @@ echo "+-----------------+----------+----------+----------+----------+ +$sub_sta
echo "| TOTALI AGENTS:$TOT_AGENTS |$TOTtotTOTAL_MS|$TOTtotNONPAUSE_MS|$TOTtotPAUSE_MS| |$SUMstatusesHTML\n";
echo "+----------------------------+----------+----------+----------+ +$sub_statusesHEAD\n";
echo "\n\n";
echo "\n\n<BR>$db_source";
}
@@ -12,6 +12,9 @@
# 100119-0935 - Fixed bug 291
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
@@ -43,9 +46,12 @@ if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];}
if (strlen($shift)<2) {$shift='ALL';}
$report_name = 'Agent Status Dettagliata';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -53,20 +59,38 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -75,6 +99,39 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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 ";
$MT[0]='';
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -83,7 +140,17 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns order by campaign_id;";
$i=0;
$group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$i++;
}
$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
@@ -92,6 +159,8 @@ while ($i < $campaigns_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
if (ereg("-ALL",$group_string) )
{$group[$i] = $groups[$i];}
$i++;
}
$stmt="select user_group from vicidial_user_groups order by user_group;";
@@ -111,9 +180,12 @@ $group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
if ( (preg_match("/ $group[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) )
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
}
$i++;
}
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
@@ -210,7 +282,7 @@ if ($file_download < 1)
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Agent Status Dettagliata Report</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<span style=\"position:absolute;left:0px;top:0px;z-index:20;\" id=admin_header>";
$short_header=1;
@@ -319,14 +391,14 @@ else
if ($file_download < 1)
{
echo "LEADS STATS BREAKDOWN:\n";
echo "CALLS STATS BREAKDOWN:\n";
echo "+-----------------+----------+--------+--------+--------+$statusesHEAD\n";
echo "| <a href=\"$LINKbase\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">LEADS</a> | <a href=\"$LINKbase&stage=CI\">CIcalls</a>| <a href=\"$LINKbase&stage=DNCCI\">DNC/CI%</a>|$statusesHTML\n";
echo "| <a href=\"$LINKbase\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">CALLS</a> | <a href=\"$LINKbase&stage=CI\">CIcalls</a>| <a href=\"$LINKbase&stage=DNCCI\">DNC/CI%</a>|$statusesHTML\n";
echo "+-----------------+----------+--------+--------+--------+$statusesHEAD\n";
}
else
{
$file_output .= "USER,ID,LEADS,CIcalls,DNC-CI%,$statusesFILE\n";
$file_output .= "USER,ID,CALLS,CIcalls,DNC-CI%,$statusesFILE\n";
}
@@ -338,7 +410,7 @@ else
{
$Suser=$usersARY[$m];
$Sfull_name=$user_namesARY[$m];
$Scalls=$calls[$m];
$Scalls=0;
$SstatusesHTML='';
$SstatusesFILE='';
$CIScount=0;
@@ -663,7 +735,7 @@ echo " <a href=\"./admin.php?ADD=999999\">REPORT</a> </FONT>\n";
echo "</FONT>\n";
echo "</TD></TR></TABLE>";
echo "</FORM>\n\n";
echo "</FORM>\n\n<BR>$db_source";
echo "</span>\n";
echo "<span style=\"position:absolute;left:3px;top:3px;z-index:18;\" id=agent_status_bars>\n";
@@ -12,6 +12,9 @@
# 100203-1147 - Added CUSTOMER time statistics
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -44,9 +47,12 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
if (strlen($shift)<2) {$shift='ALL';}
if (strlen($stage)<2) {$stage='NAME';}
$report_name = 'Agent Time Detail';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -54,20 +60,38 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -76,6 +100,38 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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 ";
$MT[0]='';
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -84,7 +140,18 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns order by campaign_id;";
$i=0;
$group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$i++;
}
$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
@@ -93,8 +160,32 @@ while ($i < $campaigns_to_print)
{
$row=mysql_fetch_row($rslt);
$groups[$i] =$row[0];
if (ereg("-ALL",$group_string) )
{$group[$i] = $groups[$i];}
$i++;
}
$i=0;
$group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
if ( (preg_match("/ $group[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) )
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
}
$i++;
}
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
{$group_SQL = "";}
else
{
$group_SQL = eregi_replace(",$",'',$group_SQL);
$group_SQL = "and campaign_id IN($group_SQL)";
}
$stmt="select user_group from vicidial_user_groups order by user_group;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
@@ -107,24 +198,6 @@ while ($i < $user_groups_to_print)
$i++;
}
$i=0;
$group_string='|';
$group_ct = count($group);
while($i < $group_ct)
{
$group_string .= "$group[$i]|";
$group_SQL .= "'$group[$i]',";
$groupQS .= "&group[]=$group[$i]";
$i++;
}
if ( (ereg("--ALL--",$group_string) ) or ($group_ct < 1) )
{$group_SQL = "";}
else
{
$group_SQL = eregi_replace(",$",'',$group_SQL);
$group_SQL = "and campaign_id IN($group_SQL)";
}
$i=0;
$user_group_string='|';
$user_group_ct = count($user_group);
@@ -183,7 +256,7 @@ if ($file_download < 1)
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Agent Time Detail</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<span style=\"position:absolute;left:0px;top:0px;z-index:20;\" id=admin_header>";
$short_header=1;
@@ -421,12 +494,12 @@ else
{
echo "AGENT TIME BREAKDOWN:\n";
echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
echo "| <a href=\"$LINKbase&stage=NAME\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">LEADS</a> | <a href=\"$LINKbase&stage=TCLOCK\">TIME CLOCK</a> | <a href=\"$LINKbase&stage=TIME\">AGENT TIME</a> | WAIT | TALK | DISPO | PAUSE | DEAD | CUSTOMER | |$sub_statusesHTML\n";
echo "| <a href=\"$LINKbase&stage=NAME\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">CALLS</a> | <a href=\"$LINKbase&stage=TCLOCK\">TIME CLOCK</a> | <a href=\"$LINKbase&stage=TIME\">AGENT TIME</a> | WAIT | TALK | DISPO | PAUSE | DEAD | CUSTOMER | |$sub_statusesHTML\n";
echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
}
else
{
$file_output .= "USER,ID,LEADS,TIME CLOCK,AGENT TIME,WAIT,TALK,DISPO,PAUSE,DEAD,CUSTOMER$sub_statusesFILE\n";
$file_output .= "USER,ID,CALLS,TIME CLOCK,AGENT TIME,WAIT,TALK,DISPO,PAUSE,DEAD,CUSTOMER$sub_statusesFILE\n";
}
##### END print the output to screen or put into file output variable
@@ -861,7 +934,7 @@ echo " <a href=\"./admin.php?ADD=999999\">REPORTS</a> </FONT>\n";
echo "</FONT>\n";
echo "</TD></TR></TABLE>";
echo "</FORM>\n\n";
echo "</FORM>\n\n<BR>$db_source";
############################################################################
##### END HTML form section
############################################################################
@@ -1,7 +1,7 @@
<?php
# AST_agent_time_sheet.php
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
#
@@ -11,27 +11,44 @@
# 90310-0745 - Added admin header
# 90508-0644 - Changed to PHP long tags
# 90524-2231 - Changed to use functions.php for seconds to HH:MM:SS conversion
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
require("functions.php");
$report_name = 'Utente Time Sheet';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,user_territories_active FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,user_territories_active FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$ss_conf_ct = mysql_num_rows($rslt);
if ($ss_conf_ct > 0)
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$SSoutbound_autodial_active = $row[1];
$user_territories_active = $row[2];
$non_latin = $row[0];
$SSoutbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
$user_territories_active = $row[4];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
@@ -51,14 +68,20 @@ $user=$agent;
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
@@ -66,6 +89,27 @@ $auth=$row[0];
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -86,7 +130,7 @@ if (!isset($query_date)) {$query_date = $NOW_DATE;}
<?php
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Agent Time Sheet";
echo "<TITLE>$report_name";
##### BEGIN Set variables to make header show properly #####
@@ -298,7 +342,7 @@ echo "<td align=right><font size=2> </td>\n";
echo "<td align=right colspan=2><font size=2><font size=2>TOTALE </td>\n";
echo "<td align=right><font size=2> $total_login_hours_minutes </td></tr>\n";
echo "</TABLE>\n";
echo "</TABLE><BR>$db_source\n";
@@ -8,6 +8,9 @@
# CHANGES
# 90602-2244 - First build
# 100301-1401 - Added popup date selector
# 100712-1324 - Added system setting slave server option and added user stats link dates
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
@@ -41,9 +44,12 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
if (strlen($shift)<2) {$shift='ALL';}
if (strlen($stage)<2) {$stage='ID';}
$report_name = 'User Timeclock Detail Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -51,20 +57,38 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -73,6 +97,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$MT[0]='';
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
@@ -145,6 +190,7 @@ if ( (ereg("--ALL--",$user_group_string) ) or ($user_group_ct < 1) )
{$user_group_SQL = "";}
else
{
$TCuser_group_SQL = $user_group_SQL;
$user_group_SQL = eregi_replace(",$",'',$user_group_SQL);
$user_group_SQL = "and vicidial_agent_log.user_group IN($user_group_SQL)";
$TCuser_group_SQL = eregi_replace(",$",'',$TCuser_group_SQL);
@@ -188,7 +234,7 @@ if ($file_download < 1)
<?php
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>User Time-Clock Detail</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<span style=\"position:absolute;left:0px;top:0px;z-index:20;\" id=admin_header>";
$short_header=1;
@@ -428,7 +474,7 @@ else
if ($file_download < 1)
{
$Toutput = "| $Sname[$m] | <a href=\"./user_stats.php?user=$RAWuser\">$Suser[$m]</a> | $Sgroup[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $TCdetail\n";
$Toutput = "| $Sname[$m] | <a href=\"./user_stats.php?user=$RAWuser&begin_date=$query_date_D&end_date=$end_date_D\">$Suser[$m]</a> | $Sgroup[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $TCdetail\n";
}
else
{
@@ -636,7 +682,7 @@ else
$o=0;
while ($user_groups_to_print > $o)
{
if (eregi("$user_groups[$o]\|",$user_group_string)) {echo "<option selected value=\"$user_groups[$o]\">$user_groups[$o]</option>\n";}
if (eregi("\|$user_groups[$o]\|",$user_group_string)) {echo "<option selected value=\"$user_groups[$o]\">$user_groups[$o]</option>\n";}
else {echo "<option value=\"$user_groups[$o]\">$user_groups[$o]</option>\n";}
$o++;
}
@@ -684,7 +730,7 @@ echo "</FORM>\n\n";
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "<font size=1 color=white>$RUNtime</font>\n";
echo "<font size=1 color=white>$RUNtime|$db_source</font>\n";
?>
@@ -13,6 +13,9 @@
# 90310-2151 - Added admin header
# 90508-0644 - Changed to PHP long tags
# 100214-1421 - Sort menu alphabetically
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -36,12 +39,47 @@ if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and modify_servers='1';";
$report_name = 'Server Performance Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -50,6 +88,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
# path from root to where ploticus files will be stored
$PLOTroot = "vicidial/ploticus";
$DOCroot = "$WeBServeRRooT/$PLOTroot/";
@@ -88,7 +147,7 @@ while ($i < $servers_to_print)
<?php
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>Server Performance Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -343,5 +402,6 @@ echo "<!-- /usr/local/bin/pl -png $DOCroot/$HTMfile -o $DOCroot/$PNGfile -->";
?>
</TD></TR></TABLE>
<BR>
<?php echo "$db_source"; ?>
</BODY></HTML>
@@ -60,10 +60,19 @@
# 91204-1548 - Added ability to change agent in-groups and blended
# 100214-1127 - Added no-dialable-leads alert and in-groups stats option
# 100301-1229 - Added 3-WAY status for consultative transfer agents
# 100303-0930 - Added carrier stats display option
# 100424-0943 - Added realtime_block_user_info option
# 100709-1054 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100805-0704 - Fixed minor bug in campaigns restrictions
# 100815-0002 - Added optional display of preset dials if presets are enabled in the campaign
# 100912-0839 - Changed several stats to limit to 2 or 3 decimal spaces
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
# 101024-0832 - Added Agent time stats option and agents-in-dispo counter
#
$version = '2.2.0-51';
$build = '100301-1229';
$version = '2.4-60';
$build = '101024-0832';
header ("Content-type: text/html; charset=utf-8");
@@ -123,11 +132,19 @@ if (isset($_GET["monitor_active"])) {$monitor_active=$_GET["monitor_active"];
elseif (isset($_POST["monitor_active"])) {$monitor_active=$_POST["monitor_active"];}
if (isset($_GET["monitor_phone"])) {$monitor_phone=$_GET["monitor_phone"];}
elseif (isset($_POST["monitor_phone"])) {$monitor_phone=$_POST["monitor_phone"];}
if (isset($_GET["CARRIERstats"])) {$CARRIERstats=$_GET["CARRIERstats"];}
elseif (isset($_POST["CARRIERstats"])) {$CARRIERstats=$_POST["CARRIERstats"];}
if (isset($_GET["PRESETstats"])) {$PRESETstats=$_GET["PRESETstats"];}
elseif (isset($_POST["PRESETstats"])) {$PRESETstats=$_POST["PRESETstats"];}
if (isset($_GET["AGENTtimeSTATS"])) {$AGENTtimeSTATS=$_GET["AGENTtimeSTATS"];}
elseif (isset($_POST["AGENTtimeSTATS"])) {$AGENTtimeSTATS=$_POST["AGENTtimeSTATS"];}
$report_name = 'Real-Time Main Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -136,13 +153,24 @@ if ($qm_conf_ct > 0)
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
if (!isset($DB)) {$DB=0;}
if (!isset($RR)) {$RR=40;}
if (!isset($group)) {$group='';}
if (!isset($group)) {$group='ALL-ACTIVE';}
if (!isset($usergroup)) {$usergroup='';}
if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes
if (!isset($UidORname)) {$UidORname=1;} # 0=id, 1=name
@@ -155,13 +183,13 @@ if (!isset($PAUSEcodes)) {$PAUSEcodes='N';} # 0=no, 1=yes
if (!isset($with_inbound))
{
if ($outbound_autodial_active > 0)
{$with_inbound='N';} # N=no, Y=yes, O=only
{$with_inbound='Y';} # N=no, Y=yes, O=only
else
{$with_inbound='O';} # N=no, Y=yes, O=only
}
$ingroup_detail='';
if (strlen($group)>1) {$groups[0] = $group; $RR=40;}
if ( (strlen($group)>1) and (strlen($groups[0])<1) ) {$groups[0] = $group; $RR=40;}
else {$group = $groups[0];}
function get_server_load($windows = false)
@@ -216,8 +244,18 @@ $NOW_TIME = date("Y-m-d H:i:s");
$NOW_DAY = date("Y-m-d");
$NOW_HOUR = date("H:i:s");
$STARTtime = date("U");
$epochONEminuteAGO = ($STARTtime - 60);
$timeONEminuteAGO = date("Y-m-d H:i:s",$epochONEminuteAGO);
$epochFIVEminutesAGO = ($STARTtime - 300);
$timeFIVEminutesAGO = date("Y-m-d H:i:s",$epochFIVEminutesAGO);
$epochFIFTEENminutesAGO = ($STARTtime - 900);
$timeFIFTEENminutesAGO = date("Y-m-d H:i:s",$epochFIFTEENminutesAGO);
$epochONEhourAGO = ($STARTtime - 3600);
$timeONEhourAGO = date("Y-m-d H:i:s",$epochONEhourAGO);
$epochSIXhoursAGO = ($STARTtime - 21600);
$timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO);
$epochTWENTYFOURhoursAGO = ($STARTtime - 86400);
$timeTWENTYFOURhoursAGO = date("Y-m-d H:i:s",$epochTWENTYFOURhoursAGO);
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
@@ -230,7 +268,13 @@ $rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
@@ -247,7 +291,41 @@ if ( (!isset($monitor_phone)) or (strlen($monitor_phone)<1) )
$monitor_phone = $row[0];
}
$stmt="select campaign_id,campaign_name from vicidial_campaigns where active='Y' order by campaign_id;";
$stmt="SELECT realtime_block_user_info,user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$realtime_block_user_info = $row[0];
$LOGuser_group = $row[1];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!preg_match("/ALL-/",$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 ";
$allactivecampaigns='';
$stmt="select campaign_id,campaign_name from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$groups_to_print = mysql_num_rows($rslt);
@@ -260,26 +338,32 @@ while ($i < $groups_to_print)
$row=mysql_fetch_row($rslt);
$LISTgroups[$i] =$row[0];
$LISTnames[$i] =$row[1];
$allactivecampaigns .= "'$LISTgroups[$i]',";
$i++;
}
$allactivecampaigns .= "''";
$i=0;
$group_string='|';
$group_ct = count($groups);
while($i < $group_ct)
{
$group_string .= "$groups[$i]|";
$group_SQL .= "'$groups[$i]',";
$groupQS .= "&groups[]=$groups[$i]";
if ( (preg_match("/ $groups[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/ALL-/",$LOGallowed_campaigns)) )
{
$group_string .= "$groups[$i]|";
$group_SQL .= "'$groups[$i]',";
$groupQS .= "&groups[]=$groups[$i]";
}
$i++;
}
$group_SQL = eregi_replace(",$",'',$group_SQL);
### if no campaigns selected, display all
if ($group_ct < 1)
if ( ($group_ct < 1) or (strlen($group_string) < 2) )
{
$groups[0] = 'ALL-ACTIVE';
$group_string = 'ALL-ACTIVE';
$group_string = '|ALL-ACTIVE|';
$group = 'ALL-ACTIVE';
$groupQS .= "&groups[]=ALL-ACTIVE";
}
@@ -294,9 +378,9 @@ if ( (ereg("--NONE--",$group_string) ) or ($group_ct < 1) )
elseif ( eregi('ALL-ACTIVE',$group_string) )
{
$all_active = 1;
$group_SQL = "''";
$group_SQLand = "";
$group_SQLwhere = "";
$group_SQL = $allactivecampaigns;
$group_SQLand = "and campaign_id IN($allactivecampaigns)";
$group_SQLwhere = "where campaign_id IN($allactivecampaigns)";
}
else
{
@@ -325,7 +409,7 @@ $NFB = '<b><font size=6 face="courier">';
$NFE = '</font></b>';
$F=''; $FG=''; $B=''; $BG='';
$select_list = "<TABLE WIDTH=200 CELLPADDING=5 BGCOLOR=\"#D9E6FE\"><TR><TD>Select Campagnas: <BR>";
$select_list = "<TABLE WIDTH=700 CELLPADDING=5 BGCOLOR=\"#D9E6FE\"><TR><TD VALIGN=TOP>Select Campagnas: <BR>";
$select_list .= "<SELECT SIZE=15 NAME=groups[] multiple>";
$o=0;
while ($groups_to_print > $o)
@@ -340,23 +424,10 @@ $select_list .= "</SELECT>";
$select_list .= "<BR><font size=1>(Per selezionare più di campagna 1, tenere premuto il tasto Ctrl e fare clic su)<font>";
$select_list .= "</TD><TD VALIGN=TOP ALIGN=CENTER>";
$select_list .= "<a href=\"#\" onclick=\"closeDiv(\'campaign_select_list\');\">Chiudi pannello</a><BR><BR>";
$select_list .= "<TABLE CELLPADDING=2 CELLSPACING=2 Border=0>";
if ($UGdisplay > 0)
{
$select_list .= "Select Gruppo Utente:<BR>";
$select_list .= "<SELECT SIZE=1 NAME=usergroup>";
$select_list .= "<option value=\"\">ALL GRUPPI UTENTI</option>";
$o=0;
while ($usergroups_to_print > $o)
{
if ($usergroups[$o] == $usergroup) {$select_list .= "<option selected value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
else {$select_list .= "<option value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
$o++;
}
$select_list .= "</SELECT><BR><BR>";
}
$select_list .= " &nbsp; Inbound: <SELECT SIZE=1 NAME=with_inbound>";
$select_list .= "<TR><TD align=right>";
$select_list .= "Inbound: </TD><TD align=left><SELECT SIZE=1 NAME=with_inbound>";
$select_list .= "<option value=\"N\"";
if ($with_inbound=='N') {$select_list .= " selected";}
$select_list .= ">No</option>";
@@ -366,9 +437,10 @@ $select_list .= ">Yes</option>";
$select_list .= "<option value=\"O\"";
if ($with_inbound=='O') {$select_list .= " selected";}
$select_list .= ">Only</option>";
$select_list .= "</SELECT><BR><BR>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= " &nbsp; Monitor: <SELECT SIZE=1 NAME=monitor_active>";
$select_list .= "<TR><TD align=right>";
$select_list .= "Monitor: </TD><TD align=left><SELECT SIZE=1 NAME=monitor_active>";
$select_list .= "<option value=\"\"";
if (strlen($monitor_active) < 2) {$select_list .= " selected";}
$select_list .= ">NESSUNO</option>";
@@ -381,37 +453,101 @@ $select_list .= ">BARGE</option>";
#$select_list .= "<option value=\"HIJACK\"";
# if ($monitor_active=='HIJACK') {$select_list .= " selected";}
#$select_list .= ">HIJACK</option>";
$select_list .= "</SELECT><BR>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= "Phone: ";
$select_list .= "<TR><TD align=right>";
$select_list .= "Phone: </TD><TD align=left>";
$select_list .= "<INPUT type=text size=10 maxlength=20 NAME=monitor_phone VALUE=\"$monitor_phone\">";
$select_list .= "<BR><BR>";
$select_list .= "</TD></TR>";
$select_list .= "<TR><TD align=center COLSPAN=2> &nbsp; </TD></TR>";
$select_list .= " &nbsp; Dialable Leads Alert:<BR><SELECT SIZE=1 NAME=NOLEADSalert>";
if ($UGdisplay > 0)
{
$select_list .= "<TR><TD align=right>";
$select_list .= "Select Gruppo Utente: </TD><TD align=left>";
$select_list .= "<SELECT SIZE=1 NAME=usergroup>";
$select_list .= "<option value=\"\">ALL GRUPPI UTENTI</option>";
$o=0;
while ($usergroups_to_print > $o)
{
if ($usergroups[$o] == $usergroup) {$select_list .= "<option selected value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
else {$select_list .= "<option value=\"$usergroups[$o]\">$usergroups[$o]</option>";}
$o++;
}
$select_list .= "</SELECT></TD></TR>";
}
$select_list .= "<TR><TD align=right>";
$select_list .= "Dialable Leads Alert: </TD><TD align=left><SELECT SIZE=1 NAME=NOLEADSalert>";
$select_list .= "<option value=\"\"";
if (strlen($NOLEADSalert) < 2) {$select_list .= " selected";}
$select_list .= ">NO</option>";
$select_list .= "<option value=\"YES\"";
if ($NOLEADSalert=='YES') {$select_list .= " selected";}
$select_list .= ">YES</option>";
$select_list .= "</SELECT><BR><BR>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= " &nbsp; Show Drop In-Group Row:<BR><SELECT SIZE=1 NAME=DROPINGROUPstats>";
$select_list .= "<TR><TD align=right>";
$select_list .= "Show Drop In-Group Row: </TD><TD align=left><SELECT SIZE=1 NAME=DROPINGROUPstats>";
$select_list .= "<option value=\"0\"";
if ($DROPINGROUPstats < 1) {$select_list .= " selected";}
$select_list .= ">NO</option>";
$select_list .= "<option value=\"1\"";
if ($DROPINGROUPstats=='1') {$select_list .= " selected";}
$select_list .= ">YES</option>";
$select_list .= "</SELECT><BR><BR>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= "<TR><TD align=right>";
$select_list .= "Show Carrier Stats: </TD><TD align=left><SELECT SIZE=1 NAME=CARRIERstats>";
$select_list .= "<option value=\"0\"";
if ($CARRIERstats < 1) {$select_list .= " selected";}
$select_list .= ">NO</option>";
$select_list .= "<option value=\"1\"";
if ($CARRIERstats=='1') {$select_list .= " selected";}
$select_list .= ">YES</option>";
$select_list .= "</SELECT></TD></TR>";
## find if any selected campaigns have presets enabled
$presets_enabled=0;
$stmt="select count(*) from vicidial_campaigns where enable_xfer_presets='ENABLED' $group_SQLand;";
$rslt=mysql_query($stmt, $link);
if ($DB) {$OUToutput .= "$stmt\n";}
$presets_enabled_count = mysql_num_rows($rslt);
if ($presets_enabled_count > 0)
{
$row=mysql_fetch_row($rslt);
$presets_enabled = $row[0];
}
if ($presets_enabled > 0)
{
$select_list .= "<TR><TD align=right>";
$select_list .= "Show Presets Stats: </TD><TD align=left><SELECT SIZE=1 NAME=PRESETstats>";
$select_list .= "<option value=\"0\"";
if ($PRESETstats < 1) {$select_list .= " selected";}
$select_list .= ">NO</option>";
$select_list .= "<option value=\"1\"";
if ($PRESETstats=='1') {$select_list .= " selected";}
$select_list .= ">YES</option>";
$select_list .= "</SELECT></TD></TR>";
}
$select_list .= "<TR><TD align=right>";
$select_list .= "Agent Time Stats: </TD><TD align=left><SELECT SIZE=1 NAME=AGENTtimeSTATS>";
$select_list .= "<option value=\"0\"";
if ($AGENTtimeSTATS < 1) {$select_list .= " selected";}
$select_list .= ">NO</option>";
$select_list .= "<option value=\"1\"";
if ($AGENTtimeSTATS=='1') {$select_list .= " selected";}
$select_list .= ">YES</option>";
$select_list .= "</SELECT></TD></TR>";
$select_list .= "</TABLE><BR>";
$select_list .= "<INPUT type=submit NAME=INVIA VALUE=INVIA><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2> &nbsp; &nbsp; &nbsp; &nbsp; ";
$select_list .= "</TD></TR>";
$select_list .= "<TR><TD ALIGN=CENTER>";
$select_list .= "<font size=1> &nbsp; </font>";
$select_list .= "</TD>";
$select_list .= "<TD NOWRAP>";
$select_list .= "<TD NOWRAP align=right>";
$select_list .= "<font size=1>VERSIONE: $version &nbsp; BUILD: $build</font>";
$select_list .= "</TD></TR></TABLE>";
@@ -707,8 +843,8 @@ $rslt=mysql_query($stmt, $link);
$campaign_allow_inbound = $row[0];
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo"<META HTTP-EQUIV=Refresh CONTENT=\"$RR; URL=$PHP_SELF?RR=$RR&DB=$DB$groupQS&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">\n";
echo "<TITLE>Real-Time Report: $group</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo"<META HTTP-EQUIV=Refresh CONTENT=\"$RR; URL=$PHP_SELF?RR=$RR&DB=$DB$groupQS&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">\n";
echo "<TITLE>$report_name: $group</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -734,6 +870,9 @@ echo "<INPUT TYPE=HIDDEN NAME=PHONEdisplay VALUE=\"$PHONEdisplay\">\n";
echo "<INPUT TYPE=HIDDEN NAME=CUSTPHONEdisplay VALUE=\"$CUSTPHONEdisplay\">\n";
echo "<INPUT TYPE=HIDDEN NAME=DROPINGROUPstats VALUE=\"$DROPINGROUPstats\">\n";
echo "<INPUT TYPE=HIDDEN NAME=ALLINGROUPstats VALUE=\"$ALLINGROUPstats\">\n";
echo "<INPUT TYPE=HIDDEN NAME=CARRIERstats VALUE=\"$CARRIERstats\">\n";
echo "<INPUT TYPE=HIDDEN NAME=PRESETstats VALUE=\"$PRESETstats\">\n";
echo "<INPUT TYPE=HIDDEN NAME=AGENTtimeSTATS VALUE=\"$AGENTtimeSTATS\">\n";
echo "Real-Time Report &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \n";
echo "<span style=\"position:absolute;left:160px;top:27px;z-index:19;\" id=campaign_select_list>\n";
echo "<TABLE WIDTH=250 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#D9E6FE\"><TR><TD ALIGN=CENTER>\n";
@@ -743,9 +882,9 @@ echo "</span>\n";
echo "<span style=\"position:absolute;left:10px;top:120px;z-index:18;\" id=agent_ingroup_display>\n";
echo " &nbsp; ";
echo "</span>\n";
echo "<a href=\"$PHP_SELF?RR=4000$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">STOP</a> | ";
echo "<a href=\"$PHP_SELF?RR=40$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">PIU LENTO</a> | ";
echo "<a href=\"$PHP_SELF?RR=4$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">INIZIA</a>";
echo "<a href=\"$PHP_SELF?RR=4000$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">STOP</a> | ";
echo "<a href=\"$PHP_SELF?RR=40$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">PIU LENTO</a> | ";
echo "<a href=\"$PHP_SELF?RR=4$groupQS&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">INIZIA</a>";
if (eregi('ALL-ACTIVE',$group_string))
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"./admin.php?ADD=10\">MODIFICA</a> | \n";
@@ -798,10 +937,9 @@ if ( ( ereg('Y',$with_inbound) or ereg('O',$with_inbound) ) and ($campaign_allow
}
$closer_campaignsSQL = preg_replace("/,$/","",$closer_campaignsSQL);
}
else
{
$closer_campaignsSQL = "''";
}
if (strlen($closer_campaignsSQL)<2)
{$closer_campaignsSQL="''";}
if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";}
@@ -936,6 +1074,7 @@ if ( ($DROPINGROUPstats > 0) and (!preg_match("/ALL-ACTIVE/",$group_string)) )
$dtp++;
}
$DIGcampaigns = preg_replace("/,$/",'',$DIGcampaigns);
if (strlen($DIGcampaigns) < 2) {$DIGcampaigns = "''";}
$stmtB="select sum(calls_today),sum(drops_today),sum(answers_today) from vicidial_campaign_stats where campaign_id IN($DIGcampaigns);";
if ($DB > 0) {echo "\n|$stmtB|\n";}
@@ -963,6 +1102,200 @@ if ( ($DROPINGROUPstats > 0) and (!preg_match("/ALL-ACTIVE/",$group_string)) )
}
##### CARRIER STATS TOTALS ###
$CARRIERstatsHTML='';
if ($CARRIERstats > 0)
{
$stmtB="select dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeTWENTYFOURhoursAGO\" group by dialstatus;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$car_to_print = mysql_num_rows($rslt);
$ctp=0;
while ($car_to_print > $ctp)
{
$row=mysql_fetch_row($rslt);
$TFhour_status[$ctp] = $row[0];
$TFhour_count[$ctp] = $row[1];
$dialstatuses .= "'$row[0]',";
$ctp++;
}
$dialstatuses = preg_replace("/,$/",'',$dialstatuses);
$CARRIERstatsHTML .= "<TR BGCOLOR=white><TD ALIGN=left COLSPAN=8>";
$CARRIERstatsHTML .= "<TABLE CELLPADDING=1 CELLSPACING=1 Border=0 BGCOLOR=white>";
$CARRIERstatsHTML .= "<TR BGCOLOR=\"#E6E6E6\">";
$CARRIERstatsHTML .= "<TD ALIGN=LEFT><font size=2><B>CARRIER STATS: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=LEFT><font size=2><B>&nbsp; HANGUP STATUS &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B>&nbsp; 24 HOURS &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B>&nbsp; 6 HOURS &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B>&nbsp; 1 HOUR &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B>&nbsp; 15 MIN &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B>&nbsp; 5 MIN &nbsp; </B></TD>";
$CARRIERstatsHTML .= "<TD ALIGN=CENTER><font size=2><B>&nbsp; 1 MIN &nbsp; </B></TD>";
$CARRIERstatsHTML .= "</TR>";
if (strlen($dialstatuses) > 1)
{
$stmtB="select dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeSIXhoursAGO\" group by dialstatus;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$scar_to_print = mysql_num_rows($rslt);
$print_sctp=0;
while ($scar_to_print > $print_sctp)
{
$row=mysql_fetch_row($rslt);
$print_ctp=0;
while ($print_ctp < $ctp)
{
if ($TFhour_status[$print_ctp] == $row[0])
{$SIXhour_count[$print_ctp] = $row[1];}
$print_ctp++;
}
$print_sctp++;
}
$stmtB="select dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeONEhourAGO\" group by dialstatus;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$scar_to_print = mysql_num_rows($rslt);
$print_sctp=0;
while ($scar_to_print > $print_sctp)
{
$row=mysql_fetch_row($rslt);
$print_ctp=0;
while ($print_ctp < $ctp)
{
if ($TFhour_status[$print_ctp] == $row[0])
{$ONEhour_count[$print_ctp] = $row[1];}
$print_ctp++;
}
$print_sctp++;
}
$stmtB="select dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeFIFTEENminutesAGO\" group by dialstatus;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$scar_to_print = mysql_num_rows($rslt);
$print_sctp=0;
while ($scar_to_print > $print_sctp)
{
$row=mysql_fetch_row($rslt);
$print_ctp=0;
while ($print_ctp < $ctp)
{
if ($TFhour_status[$print_ctp] == $row[0])
{$FTminute_count[$print_ctp] = $row[1];}
$print_ctp++;
}
$print_sctp++;
}
$stmtB="select dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeFIVEminutesAGO\" group by dialstatus;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$scar_to_print = mysql_num_rows($rslt);
$print_sctp=0;
while ($scar_to_print > $print_sctp)
{
$row=mysql_fetch_row($rslt);
$print_ctp=0;
while ($print_ctp < $ctp)
{
if ($TFhour_status[$print_ctp] == $row[0])
{$FIVEminute_count[$print_ctp] = $row[1];}
$print_ctp++;
}
$print_sctp++;
}
$stmtB="select dialstatus,count(*) from vicidial_carrier_log where call_date >= \"$timeONEminuteAGO\" group by dialstatus;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$scar_to_print = mysql_num_rows($rslt);
$print_sctp=0;
while ($scar_to_print > $print_sctp)
{
$row=mysql_fetch_row($rslt);
$print_ctp=0;
while ($print_ctp < $ctp)
{
if ($TFhour_status[$print_ctp] == $row[0])
{$ONEminute_count[$print_ctp] = $row[1];}
$print_ctp++;
}
$print_sctp++;
}
$print_ctp=0;
while ($print_ctp < $ctp)
{
if (strlen($TFhour_count[$print_ctp])<1) {$TFhour_count[$print_ctp]=0;}
if (strlen($SIXhour_count[$print_ctp])<1) {$SIXhour_count[$print_ctp]=0;}
if (strlen($ONEhour_count[$print_ctp])<1) {$ONEhour_count[$print_ctp]=0;}
if (strlen($FTminute_count[$print_ctp])<1) {$FTminute_count[$print_ctp]=0;}
if (strlen($FIVEminute_count[$print_ctp])<1) {$FIVEminute_count[$print_ctp]=0;}
if (strlen($ONEminute_count[$print_ctp])<1) {$ONEminute_count[$print_ctp]=0;}
$CARRIERstatsHTML .= "<TR>";
$CARRIERstatsHTML .= "<TD BGCOLOR=white><font size=2>&nbsp;</TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=LEFT><font size=2>&nbsp; &nbsp; $TFhour_status[$print_ctp]</TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $TFhour_count[$print_ctp] </TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $SIXhour_count[$print_ctp] </TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $ONEhour_count[$print_ctp] </TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $FTminute_count[$print_ctp] </TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $FIVEminute_count[$print_ctp] </TD>";
$CARRIERstatsHTML .= "<TD BGCOLOR=\"#E6E6E6\" ALIGN=CENTER><font size=2> $ONEminute_count[$print_ctp] </TD>";
$CARRIERstatsHTML .= "</TR>";
$print_ctp++;
}
}
else
{
$CARRIERstatsHTML .= "<TR><TD BGCOLOR=white colspan=7><font size=2>no log entries</TD></TR>";
}
$CARRIERstatsHTML .= "</TABLE>";
$CARRIERstatsHTML .= "</TD></TR>";
}
##### PRESET STATS TOTALS ###
$PRESETstatsHTML='';
if ($PRESETstats > 0)
{
$PRESETstatsHTML .= "<TR BGCOLOR=white><TD ALIGN=left COLSPAN=8>";
$PRESETstatsHTML .= "<TABLE CELLPADDING=1 CELLSPACING=1 Border=0 BGCOLOR=white>";
$PRESETstatsHTML .= "<TR BGCOLOR=\"#E6E6E6\">";
$PRESETstatsHTML .= "<TD ALIGN=LEFT><font size=2><B> &nbsp; AGENT DIAL PRESETS: &nbsp; </B></TD>";
$PRESETstatsHTML .= "<TD ALIGN=LEFT><font size=2><B> &nbsp; PRESET NAMES &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </B></TD>";
$PRESETstatsHTML .= "<TD ALIGN=LEFT><font size=2><B> &nbsp; CALLS &nbsp; </B></TD>";
$PRESETstatsHTML .= "</TR>";
$stmtB="select preset_name,xfer_count from vicidial_xfer_stats where preset_name!='' and preset_name is not NULL $group_SQLand order by preset_name;";
if ($DB > 0) {echo "\n|$stmtB|\n";}
$rslt=mysql_query($stmtB, $link);
$pre_to_print = mysql_num_rows($rslt);
$ctp=0;
while ($pre_to_print > $ctp)
{
$row=mysql_fetch_row($rslt);
$PRESETstatsHTML .= "<TR>";
$PRESETstatsHTML .= "<TD><font size=2> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </TD>";
$PRESETstatsHTML .= "<TD ALIGN=LEFT BGCOLOR=\"#E6E6E6\"><font size=2><B> &nbsp; $row[0] &nbsp; </B></TD>";
$PRESETstatsHTML .= "<TD ALIGN=RIGHT BGCOLOR=\"#E6E6E6\"><font size=2> &nbsp; $row[1] &nbsp; </TD>";
$PRESETstatsHTML .= "</TR>";
$ctp++;
}
if ($ctp < 1)
{
$PRESETstatsHTML .= "<TR><TD BGCOLOR=white colspan=2><font size=2>no log entries</TD></TR>";
}
$PRESETstatsHTML .= "</TABLE>";
$PRESETstatsHTML .= "</TD></TR>";
}
# http://server/vicidial/AST_timeonVDADall.php?&groups[]=ALL-ACTIVE&RR=4000&DB=0&adastats=&SIPmonitorLINK=&IAXmonitorLINK=&usergroup=&UGdisplay=1&UidORname=1&orderby=timeup&SERVdisplay=0&CALLSdisplay=1&PHONEdisplay=0&CUSTPHONEdisplay=0&with_inbound=Y&monitor_active=&monitor_phone=350a&ALLINGROUPstats=1&DROPINGROUPstats=0&NOLEADSalert=&CARRIERstats=1
##### INBOUND ONLY ###
if (ereg('O',$with_inbound))
{
@@ -974,10 +1307,8 @@ if (ereg('O',$with_inbound))
if (eregi('ALL-ACTIVE',$group_string))
{
$non_inboundSQL='';
if (ereg('N',$with_inbound))
{$non_inboundSQL = "where campaign_id NOT IN ($ALLcloser_campaignsSQL)";}
$stmtB="select sum(calls_today),sum(drops_today),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(hold_sec_stat_one),sum(hold_sec_stat_two),sum(hold_sec_answer_calls),sum(hold_sec_drop_calls),sum(hold_sec_queue_calls) from vicidial_campaign_stats $non_inboundSQL;";
$inboundSQL = "where campaign_id IN ($closer_campaignsSQL)";
$stmtB="select sum(calls_today),sum(drops_today),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(hold_sec_stat_one),sum(hold_sec_stat_two),sum(hold_sec_answer_calls),sum(hold_sec_drop_calls),sum(hold_sec_queue_calls) from vicidial_campaign_stats $inboundSQL;";
}
$stmtC="select agent_non_pause_sec from vicidial_campaign_stats $group_SQLwhere;";
@@ -1100,11 +1431,13 @@ else
{
$non_inboundSQL='';
if (ereg('N',$with_inbound))
{$non_inboundSQL = "where campaign_id NOT IN ($ALLcloser_campaignsSQL)";}
{$non_inboundSQL = "and campaign_id NOT IN($ALLcloser_campaignsSQL)";}
else
{$non_inboundSQL = "and campaign_id IN($group_SQL,$closer_campaignsSQL)";}
$multi_drop++;
$stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses),max(agent_pause_codes_active),max(list_order_mix) from vicidial_campaigns where active='Y';";
$stmt="select avg(auto_dial_level),min(dial_status_a),min(dial_status_b),min(dial_status_c),min(dial_status_d),min(dial_status_e),min(lead_order),min(lead_filter_id),sum(hopper_level),min(dial_method),avg(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),min(available_only_ratio_tally),min(adaptive_latest_server_time),min(local_call_time),avg(dial_timeout),min(dial_statuses),max(agent_pause_codes_active),max(list_order_mix) from vicidial_campaigns where active='Y' $group_SQLand;";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats $non_inboundSQL;";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(agent_calls_today),sum(agent_wait_today),sum(agent_custtalk_today),sum(agent_acw_today),sum(agent_pause_today) from vicidial_campaign_stats where calls_today > -1 $non_inboundSQL;";
}
else
{
@@ -1117,13 +1450,13 @@ else
$stmt="select auto_dial_level,dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,hopper_level,dial_method,adaptive_maximum_level,adaptive_dropped_percentage,adaptive_dl_diff_target,adaptive_intensity,available_only_ratio_tally,adaptive_latest_server_time,local_call_time,dial_timeout,dial_statuses,agent_pause_codes_active,list_order_mix from vicidial_campaigns where campaign_id IN ($group_SQL,$closer_campaignsSQL);";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats where campaign_id IN ($group_SQL,$closer_campaignsSQL);";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(agent_calls_today),sum(agent_wait_today),sum(agent_custtalk_today),sum(agent_acw_today),sum(agent_pause_today) from vicidial_campaign_stats where campaign_id IN ($group_SQL,$closer_campaignsSQL);";
}
else
{
$stmt="select avg(auto_dial_level),max(dial_status_a),max(dial_status_b),max(dial_status_c),max(dial_status_d),max(dial_status_e),max(lead_order),max(lead_filter_id),max(hopper_level),max(dial_method),max(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),max(available_only_ratio_tally),max(adaptive_latest_server_time),max(local_call_time),max(dial_timeout),max(dial_statuses),max(agent_pause_codes_active),max(list_order_mix) from vicidial_campaigns where campaign_id IN($group_SQL);";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4) from vicidial_campaign_stats where campaign_id IN($group_SQL);";
$stmtB="select sum(dialable_leads),sum(calls_today),sum(drops_today),avg(drops_answers_today_pct),avg(differential_onemin),avg(agents_average_onemin),sum(balance_trunk_fill),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(agent_calls_today),sum(agent_wait_today),sum(agent_custtalk_today),sum(agent_acw_today),sum(agent_pause_today) from vicidial_campaign_stats where campaign_id IN($group_SQL);";
}
}
if ($DB > 0) {echo "\n|$stmt|$stmtB|\n";}
@@ -1187,6 +1520,11 @@ else
$VSCcat3tally = $row[13];
$VSCcat4 = $row[14];
$VSCcat4tally = $row[15];
$VSCagentcalls = $row[16];
$VSCagentwait = $row[17];
$VSCagentcust = $row[18];
$VSCagentacw = $row[19];
$VSCagentpause = $row[20];
if ( ($diffONEMIN != 0) and ($agentsONEMIN > 0) )
{
@@ -1207,7 +1545,7 @@ else
}
else
{
$stmt="select vcl_id from vicidial_campaigns_list_mix where status='ACTIVE' $groupSQLand limit 1;";
$stmt="select vcl_id from vicidial_campaigns_list_mix where status='ACTIVE' $group_SQLand limit 1;";
$rslt=mysql_query($stmt, $link);
$Lmix_to_print = mysql_num_rows($rslt);
if ($Lmix_to_print > 0)
@@ -1217,6 +1555,10 @@ else
$DIALorder = "Elenco Mix: $row[0]";
}
}
$DIALlev = sprintf("%01.3f", $DIALlev);
$agentsONEMIN = sprintf("%01.2f", $agentsONEMIN);
$diffONEMIN = sprintf("%01.2f", $diffONEMIN);
echo "<BR><table cellpadding=0 cellspacing=0><TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>LIVELLO CHIAMATE:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALlev&nbsp; &nbsp; </TD>";
@@ -1271,7 +1613,55 @@ else
echo "<TD ALIGN=RIGHT><font size=2><B>ORDINE:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $DIALorder &nbsp; &nbsp; </TD>";
echo "</TR>";
if ($AGENTtimeSTATS>0)
{
if ( ($VSCagentcalls > 0) and ($VSCagentpause > 0) )
{
$avgpauseTODAY = ($VSCagentpause / $VSCagentcalls);
$avgpauseTODAY = round($avgpauseTODAY, 0);
$avgpauseTODAY = sprintf("%01.0f", $avgpauseTODAY);
}
else
{$avgpauseTODAY=0;}
if ( ($VSCagentcalls > 0) and ($VSCagentwait > 0) )
{
$avgwaitTODAY = ($VSCagentwait / $VSCagentcalls);
$avgwaitTODAY = round($avgwaitTODAY, 0);
$avgwaitTODAY = sprintf("%01.0f", $avgwaitTODAY);
}
else
{$avgwaitTODAY=0;}
if ( ($VSCagentcalls > 0) and ($VSCagentcust > 0) )
{
$avgcustTODAY = ($VSCagentcust / $VSCagentcalls);
$avgcustTODAY = round($avgcustTODAY, 0);
$avgcustTODAY = sprintf("%01.0f", $avgcustTODAY);
}
else
{$avgcustTODAY=0;}
if ( ($VSCagentcalls > 0) and ($VSCagentacw > 0) )
{
$avgacwTODAY = ($VSCagentacw / $VSCagentcalls);
$avgacwTODAY = round($avgacwTODAY, 0);
$avgacwTODAY = sprintf("%01.0f", $avgacwTODAY);
}
else
{$avgacwTODAY=0;}
echo "<TR>";
echo "<TD ALIGN=RIGHT><font size=2><B>AGENT AVG WAIT:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $avgwaitTODAY &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVG CUSTTIME:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $avgcustTODAY &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVG ACW:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $avgacwTODAY &nbsp;</TD>";
echo "<TD ALIGN=RIGHT><font size=2><B>AVG PAUSE:</B></TD><TD ALIGN=LEFT><font size=2>&nbsp; $avgpauseTODAY &nbsp;</TD>";
echo "</TR>";
}
echo "$DROPINGROUPstatsHTML\n";
echo "$CARRIERstatsHTML\n";
echo "$PRESETstatsHTML\n";
}
echo "<TR>";
@@ -1292,60 +1682,60 @@ echo "$ingroup_detail";
if ($adastats<2)
{
echo "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=2&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>+ VIEW MORE</font></a>";
echo "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=2&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>+ VIEW MORE</font></a>";
}
else
{
echo "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=1&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>+ VIEW LESS</font></a>";
echo "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=1&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>+ VIEW LESS</font></a>";
}
if ($UGdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=0&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>NASCONDI GRUPPI UTENTI</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=0&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>NASCONDI GRUPPI UTENTI</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=1&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>MOSTRA GRUPPI UTENTI</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=1&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>MOSTRA GRUPPI UTENTI</font></a>";
}
if ($SERVdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=0&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>NASCONDI INFO SERVER</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=0&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>NASCONDI INFO SERVER</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=1&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>MOSTRA INFO SERVER</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=1&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>MOSTRA INFO SERVER</font></a>";
}
if ($CALLSdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=0&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>NASCONDI WAITING CALLS</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=0&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>NASCONDI WAITING CALLS</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=1&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>MOSTRA WAITING CALLS</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=1&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>MOSTRA WAITING CALLS</font></a>";
}
if ($ALLINGROUPstats>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=0&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>NASCONDI IN-GROUP STATS</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=0&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>NASCONDI IN-GROUP STATS</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=1&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>MOSTRA IN-GROUP STATS</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=1&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>MOSTRA IN-GROUP STATS</font></a>";
}
if ($PHONEdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=0&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>NASCONDI PHONES</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=0&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>NASCONDI PHONES</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=1&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>MOSTRA PHONES</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=1&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>MOSTRA PHONES</font></a>";
}
if ($CUSTPHONEdisplay>0)
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=0&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>NASCONDI CUSTPHONES</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=0&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>NASCONDI CUSTPHONES</font></a>";
}
else
{
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=1&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\"><font size=1>MOSTRA CUSTPHONES</font></a>";
echo " &nbsp; &nbsp; &nbsp; <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=1&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\"><font size=1>MOSTRA CUSTPHONES</font></a>";
}
echo "</TD>";
echo "</TR>";
@@ -1390,6 +1780,20 @@ if ( ($with_inbound != 'O') and ($NOLEADSalert == 'YES') )
###################################################################################
if ($campaign_allow_inbound > 0)
{
if (eregi('ALL-ACTIVE',$group_string))
{
$stmt="select closer_campaigns from vicidial_campaigns where active='Y' $group_SQLand";
$rslt=mysql_query($stmt, $link);
$closer_campaigns="";
while ($row=mysql_fetch_row($rslt))
{
$closer_campaigns.="$row[0]";
}
$closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns);
$closer_campaigns = preg_replace("/ - /"," ",$closer_campaigns);
$closer_campaigns = preg_replace("/ /","','",$closer_campaigns);
$closer_campaignsSQL = "'$closer_campaigns'";
}
$stmtB="from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaignsSQL)) or (call_type IN('OUT','OUTBALANCE') $group_SQLand) ) order by queue_priority desc,campaign_id,call_time;";
}
else
@@ -1515,15 +1919,15 @@ if ($agentonlycount > 0)
{$agentonlyheader = 'AGENTONLY';}
$Cecho = '';
$Cecho .= "VICIDIAL: Calls Waiting $NOW_TIME\n";
$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+----------+\n";
$Cecho .= "| STATUS | CAMPAIGN | PHONE NUMBER | SERVER_IP | DIALTIME| CALL TYPE | PRIORITY | $agentonlyheader\n";
$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+----------+\n";
$Cecho .= "+--------+----------------------+--------------+-----------------+---------+------------+----------+\n";
$Cecho .= "| STATUS | CAMPAIGN | PHONE NUMBER | SERVER_IP | DIALTIME| CALL TYPE | PRIORITY | $agentonlyheader\n";
$Cecho .= "+--------+----------------------+--------------+-----------------+---------+------------+----------+\n";
$p=0;
while($p<$k)
{
$Cstatus = sprintf("%-6s", $CDstatus[$p]);
$Ccampaign_id = sprintf("%-12s", $CDcampaign_id[$p]);
$Ccampaign_id = sprintf("%-20s", $CDcampaign_id[$p]);
$Cphone_number = sprintf("%-12s", $CDphone_number[$p]);
$Cserver_ip = sprintf("%-15s", $CDserver_ip[$p]);
$Ccall_type = sprintf("%-10s", $CDcall_type[$p]);
@@ -1548,7 +1952,7 @@ while($p<$k)
$p++;
}
$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+----------+\n";
$Cecho .= "+--------+----------------------+--------------+-----------------+---------+------------+----------+\n";
if ($p<1)
{$Cecho='';}
@@ -1560,6 +1964,7 @@ if ($p<1)
$agent_incall=0;
$agent_ready=0;
$agent_paused=0;
$agent_dispo=0;
$agent_dead=0;
$agent_total=0;
@@ -1589,25 +1994,25 @@ $HTbegin = "|";
$HDstation = "----------------+";
$HTstation = " STATION |";
$HDphone = "-------------+";
$HTphone = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$phoneord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">PHONE</a> |";
$HTphone = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$phoneord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">PHONE</a> |";
$HDuser = "------------------------+";
$HTuser = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$userord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">UTENTE</a> ";
$HTuser = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$userord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">UTENTE</a> ";
if ($UidORname>0)
{
$HTuser .= "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=0&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">MOSTRA ID</a> ";
$HTuser .= "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=0&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">MOSTRA ID</a> ";
}
else
{
$HTuser .= "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=1&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">MOSTRA NAME</a>";
$HTuser .= "<a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=1&orderby=$orderby&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">MOSTRA NAME</a>";
}
$HTuser .= " INFO |";
$HDusergroup = "--------------+";
$HTusergroup = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$groupord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">Utente Group</a> |";
$HTusergroup = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$groupord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">Utente Group</a> |";
$HDsessionid = "------------------+";
$HTsessionid = " SESSIONID |";
$HDbarge = "-------+";
@@ -1621,9 +2026,9 @@ $HTserver_ip = " SERVER IP |";
$HDcall_server_ip = "-----------------+";
$HTcall_server_ip = " CALL SERVER IP |";
$HDtime = "---------+";
$HTtime = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$timeord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">MM:SS</a> |";
$HTtime = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$timeord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">MM:SS</a> |";
$HDcampaign = "------------+";
$HTcampaign = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$campaignord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert\">CAMPAGNA</a> |";
$HTcampaign = " <a href=\"$PHP_SELF?$groupQS&RR=$RR&DB=$DB&adastats=$adastats&SIPmonitorLINK=$SIPmonitorLINK&IAXmonitorLINK=$IAXmonitorLINK&usergroup=$usergroup&UGdisplay=$UGdisplay&UidORname=$UidORname&orderby=$campaignord&SERVdisplay=$SERVdisplay&CALLSdisplay=$CALLSdisplay&PHONEdisplay=$PHONEdisplay&CUSTPHONEdisplay=$CUSTPHONEdisplay&with_inbound=$with_inbound&monitor_active=$monitor_active&monitor_phone=$monitor_phone&ALLINGROUPstats=$ALLINGROUPstats&DROPINGROUPstats=$DROPINGROUPstats&NOLEADSalert=$NOLEADSalert&CARRIERstats=$CARRIERstats&PRESETstats=$PRESETstats&AGENTtimeSTATS=$AGENTtimeSTATS\">CAMPAGNA</a> |";
$HDcalls = "-------+";
$HTcalls = " CALLS |";
$HDpause = '';
@@ -1672,9 +2077,16 @@ if ($SERVdisplay < 1)
}
$Aline = "$HDbegin$HDstation$HDphone$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDpause$HDcustphone$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign$HDcalls$HDigcall\n";
$Bline = "$HTbegin$HTstation$HTphone$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTpause$HTcustphone$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign$HTcalls$HTigcall\n";
if ($realtime_block_user_info > 0)
{
$Aline = "$HDbegin$HDusergroup$HDsessionid$HDbarge$HDstatus$HDpause$HDcustphone$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign$HDcalls$HDigcall\n";
$Bline = "$HTbegin$HTusergroup$HTsessionid$HTbarge$HTstatus$HTpause$HTcustphone$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign$HTcalls$HTigcall\n";
}
else
{
$Aline = "$HDbegin$HDstation$HDphone$HDuser$HDusergroup$HDsessionid$HDbarge$HDstatus$HDpause$HDcustphone$HDserver_ip$HDcall_server_ip$HDtime$HDcampaign$HDcalls$HDigcall\n";
$Bline = "$HTbegin$HTstation$HTphone$HTuser$HTusergroup$HTsessionid$HTbarge$HTstatus$HTpause$HTcustphone$HTserver_ip$HTcall_server_ip$HTtime$HTcampaign$HTcalls$HTigcall\n";
}
$Aecho .= "$Aline";
$Aecho .= "$Bline";
$Aecho .= "$Aline";
@@ -1698,7 +2110,7 @@ else
if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';}
}
if (eregi('ALL-ACTIVE',$group_string)) {$UgroupSQL = '';}
if ( (eregi('ALL-ACTIVE',$group_string)) and (strlen($group_SQL) < 3) ) {$UgroupSQL = '';}
else {$UgroupSQL = " and vicidial_live_agents.campaign_id IN($group_SQL)";}
if (strlen($usergroup)<1) {$usergroupSQL = '';}
else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";}
@@ -2000,7 +2412,7 @@ $calls_to_list = mysql_num_rows($rslt);
{$j++; continue;}
else
{
$agent_paused++; $agent_total++;
$agent_dispo++; $agent_total++;
$G=''; $EG='';
if ($call_time_S >= 10) {$G='<SPAN class="khaki"><B>'; $EG='</B></SPAN>';}
if ($call_time_S >= 60) {$G='<SPAN class="yellow"><B>'; $EG='</B></SPAN>';}
@@ -2088,14 +2500,20 @@ $calls_to_list = mysql_num_rows($rslt);
$agentcount++;
$Aecho .= "| $G$extension$EG |$phoneD<a href=\"./user_status.php?user=$Luser\" target=\"_blank\">$G$user$EG</a> <a href=\"javascript:ingroup_info('$Luser','$j');\">+</a> |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM $pausecode| $CP$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG |$INGRP\n";
if ($realtime_block_user_info > 0)
{
$Aecho .= "|$UGD $G$sessionid$EG$L$R | $G$status$EG $CM $pausecode| $CP$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG |$INGRP\n";
}
if ($realtime_block_user_info < 1)
{
$Aecho .= "| $G$extension$EG |$phoneD<a href=\"./user_status.php?user=$Luser\" target=\"_blank\">$G$user$EG</a> <a href=\"javascript:ingroup_info('$Luser','$j');\">+</a> |$UGD $G$sessionid$EG$L$R | $G$status$EG $CM $pausecode| $CP$SVD$G$call_time_MS$EG | $G$campaign_id$EG | $G$calls_today$EG |$INGRP\n";
}
$j++;
}
$Aecho .= "$Aline";
$Aecho .= " $agentcount agents logged in on all servers\n";
$Aecho .= " Sistema di carico Average: $load_ave\n\n";
$Aecho .= " Sistema di carico Average: $load_ave &nbsp; $db_source\n\n";
# $Aecho .= " <SPAN class=\"orange\"><B> </SPAN> - Balanced call</B>\n";
$Aecho .= " <SPAN class=\"lightblue\"><B> </SPAN> - Agent waiting for call</B>\n";
@@ -2123,6 +2541,7 @@ $calls_to_list = mysql_num_rows($rslt);
echo "$NFB$B &nbsp;$agent_ready $BG$NFE agents waiting &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$agent_paused$NFE paused agents &nbsp; &nbsp; &nbsp; \n";
echo "$NFB$agent_dead$NFE agenti morti chiamate&nbsp; &nbsp; &nbsp; \n";
echo "$NFB$agent_dispo$NFE agents in dispo&nbsp; &nbsp; &nbsp; \n";
echo "<PRE><FONT SIZE=2>";
echo "";
@@ -1,7 +1,7 @@
<?php
# AST_timeonVDADallSUMMARY.php
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# Summary for all campaigns live real-time stats for the VICIDIAL Auto-Dialer all servers
#
@@ -16,6 +16,9 @@
# 80525-1040 - Added IVR status summary display for inbound calls
# 90310-2119 - Added admin header
# 90508-0644 - Changed to PHP long tags
# 100709-1806 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
header ("Content-type: text/html; charset=utf-8");
@@ -38,17 +41,52 @@ if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];}
if (!isset($RR)) {$gRRroup=4;}
$report_name = 'Real-Time Campagna Summary';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
@@ -56,10 +94,41 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
$stmt="select campaign_id from vicidial_campaigns where active='Y';";
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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')";
}
$stmt="select campaign_id from vicidial_campaigns where active='Y' $LOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if (!isset($DB)) {$DB=0;}
if ($DB) {echo "$stmt\n";}
@@ -107,7 +176,7 @@ if (!isset($RR)) {$RR=4;}
<?php
echo"<META HTTP-EQUIV=Refresh CONTENT=\"$RR; URL=$PHP_SELF?RR=$RR&DB=$DB&adastats=$adastats\">\n";
echo "<TITLE>Real-Time All Campagne Summary</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -446,10 +515,12 @@ echo "</TD>";
echo "</TR>";
echo "</TABLE>";
echo "</FORM>\n\n";
echo "</FORM>\n\n<BR>";
$k++;
}
echo "$db_source\n";
?>
</PRE>
</TD></TR></TABLE>
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
<?php
# admin_header.php - VICIDIAL administration header
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
@@ -18,6 +18,15 @@
# 90904-1534 - Added launch_moh_chooser
# 90916-2334 - Added Voicemail options
# 91223-1030 - Added VIDPROMPT options for in-group routing in Call Menus
# 100311-2210 - Added callcard_enabled Admin element
# 100428-1039 - Added custom fields display
# 100507-1339 - Added copy carrier submenu
# 100616-2350 - Added VIDPROMPT call menu options
# 100728-0904 - Changed Lead Loader link to the new 3rd gen lead loader
# 100802-2127 - Changed Admin to point to links page instead of Phones listings
# 100831-2255 - Added password strength checking function
# 100914-1311 - Removed other links for reports-only users
# 101022-1323 - Added IGU_selectall function
#
@@ -27,15 +36,23 @@ if($short_header)
?>
<TABLE CELLPADDING=0 CELLSPACING=0 BGCOLOR="#015B91"><TR>
<TD><IMG SRC="vicidial_admin_web_logo_small.gif" WIDTH=71 HEIGHT=22> &nbsp; </TD>
<?php if ($reports_only_user < 1) {
?>
<TD> &nbsp; <A HREF="admin.php" ALT="Utenti"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Utenti</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=10" ALT="Campagnas"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Campagnas</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=100" ALT="Liste"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Liste</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=1000000" ALT="Script"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Script</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=10000000" ALT="Filtri"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Filtri</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=1000" ALT="In-Groups"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>In-Groups</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=1000" ALT="Inbound"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Inbound</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=100000" ALT="Gruppi Utenti"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Gruppi Utenti</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=10000" ALT="Operatori Remoti"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Operatori Remoti</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=10000000000" ALT="Admin"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Admin</B></A> &nbsp; </TD>
<TD> &nbsp; <A HREF="admin.php?ADD=999998" ALT="Admin"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Admin</B></A> &nbsp; </TD>
<?php
}
else
{ ?>
<TD width=600> &nbsp; &nbsp; </TD>
<?php } ?>
<TD> &nbsp; <A HREF="admin.php?ADD=999999" ALT="Rapporti"><FONT FACE="ARIAL,HELVETICA" COLOR=WHITE SIZE=2><B>Rapporti</B></A> &nbsp; </TD>
</TR>
</TABLE>
@@ -319,34 +336,72 @@ if ( ( ($ADD==34) or ($ADD==31) or ($ADD==49) ) and ($SUB==29) and ($LOGmodify_c
<?php
}
?>
var weak = Image();
weak.src = "images/weak.png";
var medium = Image();
medium.src = "images/medium.png";
var strong = Image();
strong.src = "images/strong.png";
function openNewWindow(url) {
window.open (url,"",'width=620,height=300,scrollbars=yes,menubar=yes,address=yes');
}
function scriptInsertField() {
function pwdChanged(pwd_field_str, pwd_img_str)
{
var pwd_field = document.getElementById(pwd_field_str);
var pwd_img = document.getElementById(pwd_img_str);
var strong_regex = new RegExp( "^(?=.{8,})(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])", "g" );
var medium_regex = new RegExp( "^(?=.{6,})(((?=.*[a-z])(?=.*[A-Z]))|((?=.*[a-z])(?=.*[0-9]))|((?=.*[A-Z])(?=.*[0-9]))).*$", "g" );
if (strong_regex.test(pwd_field.value) )
{
if (pwd_img.src != strong.src)
{pwd_img.src = strong.src;}
}
else if (medium_regex.test( pwd_field.value) )
{
if (pwd_img.src != medium.src)
{pwd_img.src = medium.src;}
}
else
{
if (pwd_img.src != weak.src)
{pwd_img.src = weak.src;}
}
}
function openNewWindow(url)
{
window.open (url,"",'width=620,height=300,scrollbars=yes,menubar=yes,address=yes');
}
function scriptInsertField()
{
openField = '--A--';
closeField = '--B--';
var textBox = document.scriptForm.script_text;
var scriptIndex = document.getElementById("selectedField").selectedIndex;
var insValue = document.getElementById('selectedField').options[scriptIndex].value;
if (document.selection) {
//IE
textBox = document.scriptForm.script_text;
insValue = document.scriptForm.selectedField.options[document.scriptForm.selectedField.selectedIndex].text;
textBox.focus();
sel = document.selection.createRange();
sel.text = openField + insValue + closeField;
} else if (textBox.selectionStart || textBox.selectionStart == 0) {
//Mozilla
var startPos = textBox.selectionStart;
var endPos = textBox.selectionEnd;
textBox.value = textBox.value.substring(0, startPos)
+ openField + insValue + closeField
+ textBox.value.substring(endPos, textBox.value.length);
} else {
textBox.value += openField + insValue + closeField;
}
}
if (document.selection)
{
//IE
textBox = document.scriptForm.script_text;
insValue = document.scriptForm.selectedField.options[document.scriptForm.selectedField.selectedIndex].text;
textBox.focus();
sel = document.selection.createRange();
sel.text = openField + insValue + closeField;
}
else if (textBox.selectionStart || textBox.selectionStart == 0)
{
//Mozilla
var startPos = textBox.selectionStart;
var endPos = textBox.selectionEnd;
textBox.value = textBox.value.substring(0, startPos)
+ openField + insValue + closeField
+ textBox.value.substring(endPos, textBox.value.length);
}
else
{
textBox.value += openField + insValue + closeField;
}
}
<?php
@@ -519,6 +574,31 @@ if ( ($ADD==131111111) or ($ADD==331111111) or ($ADD==431111111) )
}
### Javascript for shift end-time calculation and display
if ( ($ADD==3111) or ($ADD==4111) or ($ADD==5111) )
{
?>
function IGU_selectall(temp_count,temp_fields)
{
var fields_array=temp_fields.split('|');
var inc=0;
while (temp_count >= inc)
{
if (fields_array[inc].length > 0)
{
document.getElementById(fields_array[inc]).checked=true;
// document.admin_form.fields_array[inc].checked=true;
}
inc++;
}
}
<?php
}
### select list contents generation for dynamic route displays in call menu and in-group screens
if ( ($ADD==3511) or ($ADD==2511) or ($ADD==2611) or ($ADD==4511) or ($ADD==5511) or ($ADD==3111) or ($ADD==2111) or ($ADD==2011) or ($ADD==4111) or ($ADD==5111) )
{
@@ -622,13 +702,17 @@ if ( ($ADD==3511) or ($ADD==2511) or ($ADD==2611) or ($ADD==4511) or ($ADD==5511
if (selected_route=='INGROUP')
{
if (value_context.length < 10)
{value_context = 'CID,LB,998,TESTCAMP,1';}
var value_context_split = value_context.split(",");
var IGhandle_method = value_context_split[0];
var IGsearch_method = value_context_split[1];
var IGlist_id = value_context_split[2];
var IGcampaign_id = value_context_split[3];
var IGphone_code = value_context_split[4];
{value_context = 'CID,LB,998,TESTCAMP,1,,,,';}
var value_context_split = value_context.split(",");
var IGhandle_method = value_context_split[0];
var IGsearch_method = value_context_split[1];
var IGlist_id = value_context_split[2];
var IGcampaign_id = value_context_split[3];
var IGphone_code = value_context_split[4];
var IGvid_enter_filename = value_context_split[5];
var IGvid_id_number_filename = value_context_split[6];
var IGvid_confirm_filename = value_context_split[7];
var IGvid_validate_digits = value_context_split[8];
if (route == selected_route)
{
@@ -642,12 +726,17 @@ if ( ($ADD==3511) or ($ADD==2511) or ($ADD==2611) or ($ADD==4511) or ($ADD==5511
new_content = new_content + '' + ingroup_list + "\n" + selected_value + '</select>';
new_content = new_content + ' &nbsp; Handle Method: <select size=1 name=IGhandle_method_' + option + ' id=IGhandle_method_' + option + '>';
new_content = new_content + '' + IGhandle_method_list + "\n" + '<option SELECTED>' + IGhandle_method + '</select>';
new_content = new_content + ' &nbsp; <a href="javascript:openNewWindow(\'admin.php?ADD=99999#vicidial_call_menu-ingroup_settings\')"><IMG SRC="help.gif" WIDTH=20 HEIGHT=20 Border=0 ALT="AIUTO" ALIGN=TOP></a>';
new_content = new_content + '<BR>Search Method: <select size=1 name=IGsearch_method_' + option + ' id=IGsearch_method_' + option + '>';
new_content = new_content + '' + IGsearch_method_list + "\n" + '<option SELECTED>' + IGsearch_method + '</select>';
new_content = new_content + ' &nbsp; ID Lista: <input type=text size=5 maxlength=14 name=IGlist_id_' + option + ' id=IGlist_id_' + option + ' value="' + IGlist_id + '">';
new_content = new_content + '<BR>ID Campagna: <select size=1 name=IGcampaign_id_' + option + ' id=IGcampaign_id_' + option + '>';
new_content = new_content + '' + IGcampaign_id_list + "\n" + '<option SELECTED>' + IGcampaign_id + '</select>';
new_content = new_content + ' &nbsp; Phone Code: <input type=text size=5 maxlength=14 name=IGphone_code_' + option + ' id=IGphone_code_' + option + ' value="' + IGphone_code + '">';
new_content = new_content + "<BR> &nbsp; VID Enter Filename: <input type=text name=IGvid_enter_filename_" + option + " id=IGvid_enter_filename_" + option + " size=40 maxlength=255 value=\"" + IGvid_enter_filename + "\"> <a href=\"javascript:launch_chooser('IGvid_enter_filename_" + option + "','date'," + chooser_height + ");\">audio chooser</a>";
new_content = new_content + "<BR> &nbsp; VID ID Number Filename: <input type=text name=IGvid_id_number_filename_" + option + " id=IGvid_id_number_filename_" + option + " size=40 maxlength=255 value=\"" + IGvid_id_number_filename + "\"> <a href=\"javascript:launch_chooser('IGvid_id_number_filename_" + option + "','date'," + chooser_height + ");\">audio chooser</a>";
new_content = new_content + "<BR> &nbsp; VID Confirm Filename: <input type=text name=IGvid_confirm_filename_" + option + " id=IGvid_confirm_filename_" + option + " size=40 maxlength=255 value=\"" + IGvid_confirm_filename + "\"> <a href=\"javascript:launch_chooser('IGvid_confirm_filename_" + option + "','date'," + chooser_height + ");\">audio chooser</a>";
new_content = new_content + ' &nbsp; VID Digits: <input type=text size=3 maxlength=3 name=IGvid_validate_digits_' + option + ' id=IGvid_validate_digits_' + option + ' value="' + IGvid_validate_digits + '">';
}
if (selected_route=='DID')
{
@@ -782,14 +871,18 @@ if ( ($ADD==3111) or ($ADD==2111) or ($ADD==2011) or ($ADD==4111) or ($ADD==5111
if (selected_route=='INGROUP')
{
if ( (route != selected_route) || (value.length < 10) )
{value = 'SALESLINE,CID,LB,998,TESTCAMP,1';}
{value = 'SALESLINE,CID,LB,998,TESTCAMP,1,,,,';}
var value_split = value.split(",");
var IGgroup_id = value_split[0];
var IGhandle_method = value_split[1];
var IGsearch_method = value_split[2];
var IGlist_id = value_split[3];
var IGcampaign_id = value_split[4];
var IGphone_code = value_split[5];
var IGgroup_id = value_split[0];
var IGhandle_method = value_split[1];
var IGsearch_method = value_split[2];
var IGlist_id = value_split[3];
var IGcampaign_id = value_split[4];
var IGphone_code = value_split[5];
var IGvid_enter_filename = value_split[6];
var IGvid_id_number_filename = value_split[7];
var IGvid_confirm_filename = value_split[8];
var IGvid_validate_digits = value_split[9];
if (route == selected_route)
{
@@ -807,6 +900,11 @@ if ( ($ADD==3111) or ($ADD==2111) or ($ADD==2011) or ($ADD==4111) or ($ADD==5111
new_content = new_content + '<BR>ID Campagna: <select size=1 name=IGcampaign_id_' + option + ' id=IGcampaign_id_' + option + '>';
new_content = new_content + '' + IGcampaign_id_list + "\n" + '<option SELECTED>' + IGcampaign_id + '</select>';
new_content = new_content + ' &nbsp; Phone Code: <input type=text size=5 maxlength=14 name=IGphone_code_' + option + ' id=IGphone_code_' + option + ' value="' + IGphone_code + '">';
// new_content = new_content + "<BR> &nbsp; VID Enter Filename: <input type=text name=IGvid_enter_filename_" + option + " id=IGvid_enter_filename_" + option + " size=40 maxlength=255 value=\"" + IGvid_enter_filename + "\"> <a href=\"javascript:launch_chooser('IGvid_enter_filename_" + option + "','date'," + chooser_height + ");\">audio chooser</a>";
// new_content = new_content + "<BR> &nbsp; VID ID Number Filename: <input type=text name=IGvid_id_number_filename_" + option + " id=IGvid_id_number_filename_" + option + " size=40 maxlength=255 value=\"" + IGvid_id_number_filename + "\"> <a href=\"javascript:launch_chooser('IGvid_id_number_filename_" + option + "','date'," + chooser_height + ");\">audio chooser</a>";
// new_content = new_content + "<BR> &nbsp; VID Confirm Filename: <input type=text name=IGvid_confirm_filename_" + option + " id=IGvid_confirm_filename_" + option + " size=40 maxlength=255 value=\"" + IGvid_confirm_filename + "\"> <a href=\"javascript:launch_chooser('IGvid_confirm_filename_" + option + "','date'," + chooser_height + ");\">audio chooser</a>";
// new_content = new_content + ' &nbsp; VID Digits: <input type=text size=3 maxlength=3 name=IGvid_validate_digits_' + option + ' id=IGvid_validate_digits_' + option + ' value="' + IGvid_validate_digits + '">';
}
if (selected_route=='DID')
{
@@ -896,11 +994,13 @@ echo "</head>\n";
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<!-- ILPV -->\n";
echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP NOWRAP><a href=\"../vicidial_en/admin.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">English <img src=\"../agc/images/en.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";echo "<TD WIDTH=100 ALIGN=RIGHT VALIGN=TOP BGCOLOR=\"#CCFFCC\" NOWRAP><a href=\"../vicidial_it/admin.php?relogin=YES&VD_login=$VD_login&VD_campaign=$VD_campaign&phone_login=$phone_login&phone_pass=$phone_pass&VD_pass=$VD_pass\">Italiano <img src=\"../agc/images/it.gif\" BORDER=0 HEIGHT=14 WIDTH=20></a></TD>\n";
$stmt="SELECT admin_home_url,enable_tts_integration from system_settings;";
$stmt="SELECT admin_home_url,enable_tts_integration,callcard_enabled,custom_fields_enabled from system_settings;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$admin_home_url_LU = $row[0];
$admin_home_url_LU = $row[0];
$SSenable_tts_integration = $row[1];
$SScallcard_enabled = $row[2];
$SScustom_fields_enabled = $row[3];
?>
<CENTER>
@@ -911,6 +1011,8 @@ $SSenable_tts_integration = $row[1];
<IMG SRC="./vicidial_admin_web_logo.gif" WIDTH=170 HEIGHT=45 ALT="VICIDIAL logo">
<B><FONT FACE="ARIAL,HELVETICA" COLOR=white>ADMINISTRATION</FONT></B><BR>
<TABLE CELLPADDING=2 CELLSPACING=0 BGCOLOR=#015B91 WIDTH=160>
<?php if ($reports_only_user < 1) {
?>
<!-- USERS NAVIGATION -->
<TR WIDTH=160><TD <?php echo $users_hh ?> WIDTH=160>
<a href="<?php echo $ADMIN ?>?ADD=0"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $users_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $users_bold ?>Utenti</a>
@@ -966,6 +1068,8 @@ $SSenable_tts_integration = $row[1];
else {$pause_sh=''; $pause_fc='BLACK';}
if ($sh=='listmix') {$listmix_sh="bgcolor=\"$subcamp_color\""; $listmix_fc="$subcamp_font";}
else {$listmix_sh=''; $listmix_fc='BLACK';}
if ($sh=='preset') {$preset_sh="bgcolor=\"$subcamp_color\""; $preset_fc="$subcamp_font";}
else {$preset_sh=''; $preset_fc='BLACK';}
?>
<TR BGCOLOR=<?php echo $campaigns_color ?>>
@@ -989,6 +1093,8 @@ $SSenable_tts_integration = $row[1];
?>
</TR><TR BGCOLOR=<?php echo $campaigns_color ?>>
<TD ALIGN=LEFT <?php echo $pause_sh ?>> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=37"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $pause_fc ?> SIZE=<?php echo $subcamp_font_size ?>>Codici Pausa</a></TD>
</TR><TR BGCOLOR=<?php echo $campaigns_color ?>>
<TD ALIGN=LEFT <?php echo $preset_sh ?>> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=301"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $preset_fc ?> SIZE=<?php echo $subcamp_font_size ?>>Presets</a></TD>
<?php }
?>
<!-- LISTE NAVIGATION -->
@@ -998,22 +1104,35 @@ $SSenable_tts_integration = $row[1];
?>
<TR><TD ALIGN=LEFT <?php echo $lists_hh ?>><a href="<?php echo $ADMIN ?>?ADD=100"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $lists_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $lists_bold ?>Liste</a></TD></TR>
<?php
if (strlen($lists_hh) > 1) {
if ($LOGdelete_from_dnc > 0) {$DNClink = 'Add-Eliminare numero da DNC';}
else {$DNClink = 'Add Number To DNC';}
if (strlen($lists_hh) > 1)
{
if ($LOGdelete_from_dnc > 0) {$DNClink = 'Add-EliminareDNC Number';}
else {$DNClink = 'Add DNC Number';}
?>
<TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=100"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Visualizza Liste </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Nuova Lista </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="admin_search_lead.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Ricerca Contatti </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=121"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo $DNClink ?> </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="./new_listloader_superL.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Carica Nuovi Contatti </a>
</TD></TR>
<?php }
<TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=100"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Visualizza Liste </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Nuova Lista </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="admin_search_lead.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Ricerca Contatti </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=121"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo $DNClink ?> </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="./admin_listloader_third_gen.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Carica Nuovi Contatti </a>
<?php
if ($SScustom_fields_enabled > 0)
{
?>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="./admin_lists_custom.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> List Custom Fields </a>
</TR><TR BGCOLOR=<?php echo $lists_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="./admin_lists_custom.php?action=COPY_FIELDS_FORM"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> CopiaCustom Fields </a>
<?php
}
?>
</TD></TR>
<?php
}
}
?>
<!-- SCRIPT NAVIGATION -->
@@ -1051,11 +1170,13 @@ $SSenable_tts_integration = $row[1];
?>
<!-- INGROUPS NAVIGATION -->
<TR><TD <?php echo $ingroups_hh ?>>
<a href="<?php echo $ADMIN ?>?ADD=1000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $ingroups_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $ingroups_bold ?> Gruppi Inbound </a>
<a href="<?php echo $ADMIN ?>?ADD=1000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $ingroups_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $ingroups_bold ?> Inbound </a>
</TD></TR>
<?php
if (strlen($ingroups_hh) > 1)
{
{
if ($LOGdelete_from_dnc > 0) {$FPGlink = 'Add-EliminareFPG Number';}
else {$FPGlink = 'Add FPG Number';}
?>
<TR BGCOLOR=<?php echo $ingroups_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=1000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Visualizza Gruppi Inbound </a>
@@ -1074,7 +1195,13 @@ $SSenable_tts_integration = $row[1];
</TD></TR><TR BGCOLOR=<?php echo $ingroups_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=1511"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Aggiungi un nuovo menu Call </a>
</TD></TR><TR BGCOLOR=<?php echo $ingroups_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=1611"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Copia Call Menu </a>
<a href="<?php echo $ADMIN ?>?ADD=1611"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Copia Call Menu </a><HR>
</TD></TR><TR BGCOLOR=<?php echo $ingroups_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=1700"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Filter Phone Groups </a>
</TD></TR><TR BGCOLOR=<?php echo $ingroups_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=1711"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Add Filter Phone Group </a>
</TD></TR><TR BGCOLOR=<?php echo $ingroups_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=171"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> <?php echo $FPGlink ?> </a>
</TD></TR>
<?php }
?>
@@ -1109,12 +1236,16 @@ $SSenable_tts_integration = $row[1];
<a href="<?php echo $ADMIN ?>?ADD=10000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Visualizza Operatori Remoti </a>
</TR><TR BGCOLOR=<?php echo $remoteagent_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=11111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>>Aggiungi Operatore Remoto </a>
</TR><TR BGCOLOR=<?php echo $remoteagent_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=12000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Show Extension Groups </a>
</TR><TR BGCOLOR=<?php echo $remoteagent_color ?>><TD ALIGN=LEFT> &nbsp;
<a href="<?php echo $ADMIN ?>?ADD=12111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Add Extension Group </a>
</TD></TR>
<?php }
?>
<!-- ADMIN NAVIGATION -->
<TR><TD <?php echo $admin_hh ?>>
<a href="<?php echo $ADMIN ?>?ADD=10000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $admin_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $admin_bold ?> Admin </a>
<a href="<?php echo $ADMIN ?>?ADD=999998"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $admin_fc ?> SIZE=<?php echo $header_font_size ?>><?php echo $admin_bold ?> Admin </a>
</TD></TR>
<?php
if (strlen($admin_hh) > 1)
@@ -1145,6 +1276,8 @@ $SSenable_tts_integration = $row[1];
else {$vm_sh=''; $vm_fc='BLACK';}
if ($sh=='tts') {$tts_sh="bgcolor=\"$tts_color\""; $tts_fc="$tts_font";}
else {$tts_sh=''; $tts_fc='BLACK';}
if ($sh=='cc') {$cc_sh="bgcolor=\"$cc_color\""; $cc_fc="$cc_font";}
else {$cc_sh=''; $cc_fc='BLACK';}
?>
<TR BGCOLOR=<?php echo $admin_color ?>>
@@ -1185,8 +1318,16 @@ $SSenable_tts_integration = $row[1];
<a href="<?php echo $ADMIN ?>?ADD=150000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $tts_fc ?> SIZE=<?php echo $header_font_size ?>> Text To Speech </a></TD>
</TR>
<?php }
if ($SScallcard_enabled > 0)
{ ?>
<TR BGCOLOR=<?php echo $admin_color ?>><TD ALIGN=LEFT <?php echo $cc_sh ?>> &nbsp;
<a href="callcard_admin.php"><FONT FACE="ARIAL,HELVETICA" COLOR=<?php echo $cc_fc ?> SIZE=<?php echo $header_font_size ?>> CallCard Admin </a></TD>
</TR>
<?php }
}
}
?>
<!-- REPORT NAVIGATION -->
<TR><TD <?php echo $reports_hh ?>>
@@ -1245,12 +1386,16 @@ $SSenable_tts_integration = $row[1];
<?php }
if ( (strlen($carriers_sh) > 1) and (strlen($admin_hh) > 1) ) {
?>
<TR BGCOLOR=<?php echo $carriers_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=140000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Show Vettori </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=141111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Add A New Carrier </a></TD></TR>
<TR BGCOLOR=<?php echo $carriers_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=140000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Show Vettori </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=141111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Add A New Carrier </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=140111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> CopiaA Carrier </a></TD></TR>
<?php }
if ( (strlen($tts_sh) > 1) and (strlen($admin_hh) > 1) ) {
?>
<TR BGCOLOR=<?php echo $tts_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=150000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Mostra TTS Entries </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=151111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Aggiungere una nuova voce TTS </a></TD></TR>
<?php }
if ( (strlen($cc_sh) > 1) and (strlen($admin_hh) > 1) ) {
?>
<TR BGCOLOR=<?php echo $cc_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="callcard_admin.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> CallCard Summary </a> &nbsp; | &nbsp; <a href="callcard_admin.php?action=CALLCARD_RUNS"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Runs </a> &nbsp; | &nbsp; <a href="callcard_admin.php?action=CALLCARD_BATCHES"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Batches </a> &nbsp; | &nbsp; <a href="callcard_admin.php?action=SEARCH"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> CallCard Search </a> &nbsp; | &nbsp; <a href="callcard_report_export.php"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> CallCard Log Export </a> &nbsp; | &nbsp; <a href="callcard_admin.php?action=GENERATE"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> CallCard Generate New Numbers </a></TD></TR>
<?php }
if ( (strlen($moh_sh) > 1) and (strlen($admin_hh) > 1) ) {
?>
<TR BGCOLOR=<?php echo $moh_color ?>><TD ALIGN=LEFT COLSPAN=2> &nbsp; <a href="<?php echo $ADMIN ?>?ADD=160000000000"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Mostra MOH Entries </a> &nbsp; | &nbsp; <a href="<?php echo $ADMIN ?>?ADD=161111111111"><FONT FACE="ARIAL,HELVETICA" COLOR=BLACK SIZE=<?php echo $subheader_font_size ?>> Aggiungere una nuova voce MOH </a></TD></TR>
@@ -1,5 +1,5 @@
<?php
# admin_modify_lead.php
# admin_modify_lead.php version 2.4
#
# ViciDial database administration modify lead in vicidial_list
# admin_modify_lead.php
@@ -8,7 +8,7 @@
# just needs to enter the leadID and then they can view and modify the
# information in the record for that lead
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
#
@@ -33,6 +33,12 @@
# 90708-1549 - Added phone number dialed to outbound log
# 90721-1246 - Added rank and owner as vicidial_list fields
# 90917-2355 - Added extended alt phone entries
# 100405-1333 - Changed to show logs of non-found leads
# 100618-0148 - Added Middle name modify and fixes statuses list
# 100622-0945 - Added field labels
# 100703-1122 - Added custom fields display/edit
# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
# 100924-1431 - Added Called Count display
#
require("dbconnect.php");
@@ -48,8 +54,12 @@ if (isset($_GET["old_phone"])) {$old_phone=$_GET["old_phone"];}
elseif (isset($_POST["old_phone"])) {$old_phone=$_POST["old_phone"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["title"])) {$title=$_GET["title"];}
elseif (isset($_POST["title"])) {$title=$_POST["title"];}
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
@@ -131,8 +141,8 @@ if (isset($_GET["modify_agent_logs"])) {$modify_agent_logs=$_GET["modify_agent
if (isset($_GET["add_closer_record"])) {$add_closer_record=$_GET["add_closer_record"];}
elseif (isset($_POST["add_closer_record"])) {$add_closer_record=$_POST["add_closer_record"];}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW);
$STARTtime = date("U");
$TODAY = date("Y-m-d");
@@ -140,26 +150,34 @@ $NOW_TIME = date("Y-m-d H:i:s");
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
$i=0;
while ($i < $qm_conf_ct)
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$i++;
$non_latin = $row[0];
$custom_fields_enabled = $row[1];
}
##### END SETTINGS LOOKUP #####
###########################################
if ($non_latin < 1)
{
$PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW);
$old_phone = ereg_replace("[^0-9]","",$old_phone);
$phone_number = ereg_replace("[^0-9]","",$phone_number);
$alt_phone = ereg_replace("[^0-9]","",$alt_phone);
} # end of non_latin
else
{
$PHP_AUTH_USER = ereg_replace("'|\"|\\\\|;","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("'|\"|\\\\|;","",$PHP_AUTH_PW);
}
if (strlen($phone_number)<6) {$phone_number=$old_phone;}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';";
@@ -210,6 +228,50 @@ else
}
}
$label_title = 'Title';
$label_first_name = 'First';
$label_middle_initial = 'MI';
$label_last_name = 'Last';
$label_address1 = 'Address1';
$label_address2 = 'Address2';
$label_address3 = 'Address3';
$label_city = 'Citta`';
$label_state = 'State';
$label_province = 'Provincia';
$label_postal_code = 'CAP';
$label_vendor_lead_code = 'Vendor ID';
$label_gender = 'Sesso';
$label_phone_number = 'Phone';
$label_phone_code = 'DialCode';
$label_alt_phone = 'Alt. Phone';
$label_security_phrase = 'Show';
$label_email = 'Email';
$label_comments = 'Note';
### find any custom field labels
$stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if (strlen($row[0])>0) {$label_title = $row[0];}
if (strlen($row[1])>0) {$label_first_name = $row[1];}
if (strlen($row[2])>0) {$label_middle_initial = $row[2];}
if (strlen($row[3])>0) {$label_last_name = $row[3];}
if (strlen($row[4])>0) {$label_address1 = $row[4];}
if (strlen($row[5])>0) {$label_address2 = $row[5];}
if (strlen($row[6])>0) {$label_address3 = $row[6];}
if (strlen($row[7])>0) {$label_city = $row[7];}
if (strlen($row[8])>0) {$label_state = $row[8];}
if (strlen($row[9])>0) {$label_province = $row[9];}
if (strlen($row[10])>0) {$label_postal_code = $row[10];}
if (strlen($row[11])>0) {$label_vendor_lead_code = $row[11];}
if (strlen($row[12])>0) {$label_gender = $row[12];}
if (strlen($row[13])>0) {$label_phone_number = $row[13];}
if (strlen($row[14])>0) {$label_phone_code = $row[14];}
if (strlen($row[15])>0) {$label_alt_phone = $row[15];}
if (strlen($row[16])>0) {$label_security_phrase = $row[16];}
if (strlen($row[17])>0) {$label_email = $row[17];}
if (strlen($row[18])>0) {$label_comments = $row[18];}
?>
<html>
<head>
@@ -224,7 +286,7 @@ echo "<a href=\"./admin.php?ADD=100\">ADMINISTRATION</a>: Registro del Lead modi
if ($end_call > 0)
{
### update the lead record in the vicidial_list table
$stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',first_name='" . mysql_real_escape_string($first_name) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',phone_number='$phone_number',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "',rank='" . mysql_real_escape_string($rank) . "',owner='" . mysql_real_escape_string($owner) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$stmt="UPDATE vicidial_list set status='" . mysql_real_escape_string($status) . "',title='" . mysql_real_escape_string($title) . "',first_name='" . mysql_real_escape_string($first_name) . "',middle_initial='" . mysql_real_escape_string($middle_initial) . "',last_name='" . mysql_real_escape_string($last_name) . "',address1='" . mysql_real_escape_string($address1) . "',address2='" . mysql_real_escape_string($address2) . "',address3='" . mysql_real_escape_string($address3) . "',city='" . mysql_real_escape_string($city) . "',state='" . mysql_real_escape_string($state) . "',province='" . mysql_real_escape_string($province) . "',postal_code='" . mysql_real_escape_string($postal_code) . "',country_code='" . mysql_real_escape_string($country_code) . "',alt_phone='" . mysql_real_escape_string($alt_phone) . "',phone_number='$phone_number',phone_code='$phone_code',email='" . mysql_real_escape_string($email) . "',security_phrase='" . mysql_real_escape_string($security) . "',comments='" . mysql_real_escape_string($comments) . "',rank='" . mysql_real_escape_string($rank) . "',owner='" . mysql_real_escape_string($owner) . "' where lead_id='" . mysql_real_escape_string($lead_id) . "'";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
@@ -366,271 +428,6 @@ else
$alts_output .= "<td align=left><font size=2> $row[4] </td></tr>\n";
}
##### grab vicidial_log records #####
$stmt="select uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,user_group,term_reason,alt_dial from vicidial_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid desc limit 500;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
$u=0;
$call_log = '';
$log_campaign = '';
while ($logs_to_print > $u)
{
$row=mysql_fetch_row($rslt);
if (strlen($log_campaign)<1) {$log_campaign = $row[3];}
if (eregi("1$|3$|5$|7$|9$", $u))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$u++;
$call_log .= "<tr $bgcolor>";
$call_log .= "<td><font size=1>$u</td>";
$call_log .= "<td><font size=2>$row[4]</td>";
$call_log .= "<td align=left><font size=2> $row[7]</td>\n";
$call_log .= "<td align=left><font size=2> $row[8]</td>\n";
$call_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[11]\" target=\"_blank\">$row[11]</A> </td>\n";
$call_log .= "<td align=right><font size=2> $row[3] </td>\n";
$call_log .= "<td align=right><font size=2> $row[2] </td>\n";
$call_log .= "<td align=right><font size=2> $row[1] </td>\n";
$call_log .= "<td align=right><font size=2> $row[15] </td>\n";
$call_log .= "<td align=right><font size=2>&nbsp; $row[10] </td></tr>\n";
$campaign_id = $row[3];
}
##### grab vicidial_agent_log records #####
$stmt="select agent_log_id,user,server_ip,event_time,lead_id,campaign_id,pause_epoch,pause_sec,wait_epoch,wait_sec,talk_epoch,talk_sec,dispo_epoch,dispo_sec,status,user_group,comments,sub_status from vicidial_agent_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 500;";
$rslt=mysql_query($stmt, $link);
$Alogs_to_print = mysql_num_rows($rslt);
$y=0;
$agent_log = '';
$Alog_campaign = '';
while ($Alogs_to_print > $y)
{
$row=mysql_fetch_row($rslt);
if (strlen($Alog_campaign)<1) {$Alog_campaign = $row[5];}
if (eregi("1$|3$|5$|7$|9$", $y))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$y++;
$agent_log .= "<tr $bgcolor>";
$agent_log .= "<td><font size=1>$y</td>";
$agent_log .= "<td><font size=2>$row[3]</td>";
$agent_log .= "<td align=left><font size=2> $row[5]</td>\n";
$agent_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[1]\" target=\"_blank\">$row[1]</A> </td>\n";
$agent_log .= "<td align=right><font size=2> $row[7]</td>\n";
$agent_log .= "<td align=right><font size=2> $row[9] </td>\n";
$agent_log .= "<td align=right><font size=2> $row[11] </td>\n";
$agent_log .= "<td align=right><font size=2> $row[13] </td>\n";
$agent_log .= "<td align=right><font size=2> &nbsp; $row[14] </td>\n";
$agent_log .= "<td align=right><font size=2> &nbsp; $row[15] </td>\n";
$agent_log .= "<td align=right><font size=2> &nbsp; $row[17] </td></tr>\n";
$campaign_id = $row[5];
}
##### grab vicidial_closer_log records #####
$stmt="select closecallid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,queue_seconds,user_group,xfercallid,term_reason,uniqueid,agent_only from vicidial_closer_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by closecallid desc limit 500;";
$rslt=mysql_query($stmt, $link);
$Clogs_to_print = mysql_num_rows($rslt);
$y=0;
$closer_log = '';
$Clog_campaign = '';
while ($Clogs_to_print > $y)
{
$row=mysql_fetch_row($rslt);
if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];}
if (eregi("1$|3$|5$|7$|9$", $y))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$y++;
$closer_log .= "<tr $bgcolor>";
$closer_log .= "<td><font size=1>$y</td>";
$closer_log .= "<td><font size=2>$row[4]</td>";
$closer_log .= "<td align=left><font size=2> $row[7]</td>\n";
$closer_log .= "<td align=left><font size=2> $row[8]</td>\n";
$closer_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[11]\" target=\"_blank\">$row[11]</A> </td>\n";
$closer_log .= "<td align=right><font size=2> $row[3] </td>\n";
$closer_log .= "<td align=right><font size=2> $row[2] </td>\n";
$closer_log .= "<td align=right><font size=2> $row[1] </td>\n";
$closer_log .= "<td align=right><font size=2> &nbsp; $row[14] </td>\n";
$closer_log .= "<td align=right><font size=2> &nbsp; $row[17] </td></tr>\n";
$campaign_id = $row[3];
}
##### grab vicidial_list data for lead #####
$stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
$lead_id = "$row[0]";
$dispo = "$row[3]";
$tsr = "$row[4]";
$vendor_id = "$row[5]";
$list_id = "$row[7]";
$gmt_offset_now = "$row[8]";
$phone_code = "$row[10]";
$phone_number = "$row[11]";
$title = "$row[12]";
$first_name = "$row[13]";
$middle_initial = "$row[14]";
$last_name = "$row[15]";
$address1 = "$row[16]";
$address2 = "$row[17]";
$address3 = "$row[18]";
$city = "$row[19]";
$state = "$row[20]";
$province = "$row[21]";
$postal_code = "$row[22]";
$country_code = "$row[23]";
$gender = "$row[24]";
$date_of_birth = "$row[25]";
$alt_phone = "$row[26]";
$email = "$row[27]";
$security = "$row[28]";
$comments = "$row[29]";
$called_count = "$row[30]";
$last_local_call_time = "$row[31]";
$rank = "$row[32]";
$owner = "$row[33]";
echo "<br>Informazioni Chiamata: $first_name $last_name - $phone_number<br><br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=end_call value=1>\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=dispo value=\"$dispo\">\n";
echo "<input type=hidden name=list_id value=\"$list_id\">\n";
echo "<input type=hidden name=campaign_id value=\"$campaign_id\">\n";
echo "<input type=hidden name=phone_code value=\"$phone_code\">\n";
echo "<input type=hidden name=old_phone value=\"$phone_number\">\n";
echo "<input type=hidden name=server_ip value=\"$server_ip\">\n";
echo "<input type=hidden name=extension value=\"$extension\">\n";
echo "<input type=hidden name=channel value=\"$channel\">\n";
echo "<input type=hidden name=call_began value=\"$call_began\">\n";
echo "<input type=hidden name=parked_time value=\"$parked_time\">\n";
echo "<table cellpadding=1 cellspacing=0>\n";
echo "<tr><td colspan=2>Vendor ID: $vendor_id &nbsp; &nbsp; Lead ID: $lead_id</td></tr>\n";
echo "<tr><td colspan=2>Fronter: <A HREF=\"user_stats.php?user=$tsr\">$tsr</A> &nbsp; &nbsp; ID Lista: $list_id</td></tr>\n";
echo "<tr><td align=right>Nome: </td><td align=left><input type=text name=first_name size=15 maxlength=30 value=\"$first_name\"> &nbsp; \n";
echo " Cognome: <input type=text name=last_name size=15 maxlength=30 value=\"$last_name\"> </td></tr>\n";
echo "<tr><td align=right>Indirizzo 1 : </td><td align=left><input type=text name=address1 size=30 maxlength=30 value=\"$address1\"></td></tr>\n";
echo "<tr><td align=right>Indirizzo 2 : </td><td align=left><input type=text name=address2 size=30 maxlength=30 value=\"$address2\"></td></tr>\n";
echo "<tr><td align=right>Indirizzo 3 : </td><td align=left><input type=text name=address3 size=30 maxlength=30 value=\"$address3\"></td></tr>\n";
echo "<tr><td align=right>Citta` : </td><td align=left><input type=text name=city size=30 maxlength=30 value=\"$city\"></td></tr>\n";
echo "<tr><td align=right>Estado: </td><td align=left><input type=text name=state size=2 maxlength=2 value=\"$state\"> &nbsp; \n";
echo " CAP: <input type=text name=postal_code size=10 maxlength=10 value=\"$postal_code\"> </td></tr>\n";
echo "<tr><td align=right>Provincia : </td><td align=left><input type=text name=province size=30 maxlength=30 value=\"$province\"></td></tr>\n";
echo "<tr><td align=right>Stato : </td><td align=left><input type=text name=country_code size=3 maxlength=3 value=\"$country_code\"></td></tr>\n";
echo "<tr><td align=right>Main Phone : </td><td align=left><input type=text name=phone_number size=20 maxlength=20 value=\"$phone_number\"></td></tr>\n";
echo "<tr><td align=right>Numero Alt : </td><td align=left><input type=text name=alt_phone size=20 maxlength=20 value=\"$alt_phone\"></td></tr>\n";
echo "<tr><td align=right>Email : </td><td align=left><input type=text name=email size=30 maxlength=50 value=\"$email\"></td></tr>\n";
echo "<tr><td align=right>Seguridad: </td><td align=left><input type=text name=security size=30 maxlength=100 value=\"$security\"></td></tr>\n";
echo "<tr><td align=right>Rank : </td><td align=left><input type=text name=rank size=7 maxlength=5 value=\"$rank\"></td></tr>\n";
echo "<tr><td align=right>Owner : </td><td align=left><input type=text name=owner size=22 maxlength=20 value=\"$owner\"></td></tr>\n";
echo "<tr><td align=right>Note : </td><td align=left><TEXTAREA name=comments ROWS=3 COLS=65>$comments</TEXTAREA></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Esito: </td><td align=left><select size=1 name=status>\n";
$stmt="SELECT status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable from vicidial_statuses where selectable='Y' order by status";
$rslt=mysql_query($stmt, $link);
$statuses_to_print = mysql_num_rows($rslt);
$statuses_list='';
$o=0;
$DS=0;
while ($statuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
if ( (strlen($dispo) == strlen($rowx[0])) and (eregi($dispo,$rowx[0])) )
{$statuses_list .= "<option SELECTED value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; $DS++;}
else
{$statuses_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";}
$o++;
}
$stmt="SELECT status,status_name,selectable,campaign_id,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable from vicidial_campaign_statuses where selectable='Y' and campaign_id='$log_campaign' order by status";
$rslt=mysql_query($stmt, $link);
$CAMPstatuses_to_print = mysql_num_rows($rslt);
$o=0;
while ($CAMPstatuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
if ( (strlen($dispo) == strlen($rowx[0])) and (eregi($dispo,$rowx[0])) )
{$statuses_list .= "<option SELECTED value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; $DS++;}
else
{$statuses_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";}
$o++;
}
if ($DS < 1) {$statuses_list .= "<option SELECTED value=\"$dispo\">$dispo</option>\n";}
echo "$statuses_list";
echo "</select> <i>(with $log_campaign statuses)</i></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modificarevicidial log </td><td align=left><input type=checkbox name=modify_logs value=\"1\" CHECKED></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modificareagent log </td><td align=left><input type=checkbox name=modify_agent_logs value=\"1\" CHECKED></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modificarecloser log </td><td align=left><input type=checkbox name=modify_closer_logs value=\"1\"></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Add closer log record </td><td align=left><input type=checkbox name=add_closer_record value=\"1\"></td></tr>\n";
echo "<tr><td colspan=2 align=center><input type=submit name=submit value=\"INVIA\"></td></tr>\n";
echo "</table></form>\n";
echo "<BR><BR><BR>\n";
if ( ($dispo == 'CALLBK') or ($dispo == 'CBHOLD') )
{
### find any vicidial_callback records for this lead
$stmt="select callback_id,lead_id,list_id,campaign_id,status,entry_time,callback_time,modify_date,user,recipient,comments,user_group from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$CB_to_print = mysql_num_rows($rslt);
$rowx=mysql_fetch_row($rslt);
if ($CB_to_print>0)
{
if ($rowx[9] == 'USERONLY')
{
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeUSERtoANY value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "<input type=submit name=submit value=\"CHANGE TO ANYONE CALLBACK\"></form><BR>\n";
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeUSERtoUSER value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "New Callback Owner UtenteID: <input type=text name=CBuser size=8 maxlength=10 value=\"$rowx[8]\"> \n";
echo "<input type=submit name=submit value=\"CHANGE USERONLY CALLBACK USER\"></form><BR>\n";
}
else
{
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeANYtoUSER value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "New Callback Owner UtenteID: <input type=text name=CBuser size=8 maxlength=10 value=\"$rowx[8]\"> \n";
echo "<input type=submit name=submit value=\"CHANGE TO USERONLY CALLBACK\"></form><BR>\n";
}
}
else
{
echo "<BR>No Callback records found<BR>\n";
}
}
}
else
{
@@ -638,6 +435,288 @@ else
# echo "<a href=\"$PHP_SELF\">Close this window</a>\n<BR><BR>\n";
}
##### grab vicidial_log records #####
$stmt="select uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,user_group,term_reason,alt_dial from vicidial_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by uniqueid desc limit 500;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
$u=0;
$call_log = '';
$log_campaign = '';
while ($logs_to_print > $u)
{
$row=mysql_fetch_row($rslt);
if (strlen($log_campaign)<1) {$log_campaign = $row[3];}
if (eregi("1$|3$|5$|7$|9$", $u))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$u++;
$call_log .= "<tr $bgcolor>";
$call_log .= "<td><font size=1>$u</td>";
$call_log .= "<td><font size=2>$row[4]</td>";
$call_log .= "<td align=left><font size=2> $row[7]</td>\n";
$call_log .= "<td align=left><font size=2> $row[8]</td>\n";
$call_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[11]\" target=\"_blank\">$row[11]</A> </td>\n";
$call_log .= "<td align=right><font size=2> $row[3] </td>\n";
$call_log .= "<td align=right><font size=2> $row[2] </td>\n";
$call_log .= "<td align=right><font size=2> $row[1] </td>\n";
$call_log .= "<td align=right><font size=2> $row[15] </td>\n";
$call_log .= "<td align=right><font size=2>&nbsp; $row[10] </td></tr>\n";
$campaign_id = $row[3];
}
##### grab vicidial_agent_log records #####
$stmt="select agent_log_id,user,server_ip,event_time,lead_id,campaign_id,pause_epoch,pause_sec,wait_epoch,wait_sec,talk_epoch,talk_sec,dispo_epoch,dispo_sec,status,user_group,comments,sub_status from vicidial_agent_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by agent_log_id desc limit 500;";
$rslt=mysql_query($stmt, $link);
$Alogs_to_print = mysql_num_rows($rslt);
$y=0;
$agent_log = '';
$Alog_campaign = '';
while ($Alogs_to_print > $y)
{
$row=mysql_fetch_row($rslt);
if (strlen($Alog_campaign)<1) {$Alog_campaign = $row[5];}
if (eregi("1$|3$|5$|7$|9$", $y))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$y++;
$agent_log .= "<tr $bgcolor>";
$agent_log .= "<td><font size=1>$y</td>";
$agent_log .= "<td><font size=2>$row[3]</td>";
$agent_log .= "<td align=left><font size=2> $row[5]</td>\n";
$agent_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[1]\" target=\"_blank\">$row[1]</A> </td>\n";
$agent_log .= "<td align=right><font size=2> $row[7]</td>\n";
$agent_log .= "<td align=right><font size=2> $row[9] </td>\n";
$agent_log .= "<td align=right><font size=2> $row[11] </td>\n";
$agent_log .= "<td align=right><font size=2> $row[13] </td>\n";
$agent_log .= "<td align=right><font size=2> &nbsp; $row[14] </td>\n";
$agent_log .= "<td align=right><font size=2> &nbsp; $row[15] </td>\n";
$agent_log .= "<td align=right><font size=2> &nbsp; $row[17] </td></tr>\n";
$campaign_id = $row[5];
}
##### grab vicidial_closer_log records #####
$stmt="select closecallid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,queue_seconds,user_group,xfercallid,term_reason,uniqueid,agent_only from vicidial_closer_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by closecallid desc limit 500;";
$rslt=mysql_query($stmt, $link);
$Clogs_to_print = mysql_num_rows($rslt);
$y=0;
$closer_log = '';
$Clog_campaign = '';
while ($Clogs_to_print > $y)
{
$row=mysql_fetch_row($rslt);
if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];}
if (eregi("1$|3$|5$|7$|9$", $y))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
$y++;
$closer_log .= "<tr $bgcolor>";
$closer_log .= "<td><font size=1>$y</td>";
$closer_log .= "<td><font size=2>$row[4]</td>";
$closer_log .= "<td align=left><font size=2> $row[7]</td>\n";
$closer_log .= "<td align=left><font size=2> $row[8]</td>\n";
$closer_log .= "<td align=left><font size=2> <A HREF=\"user_stats.php?user=$row[11]\" target=\"_blank\">$row[11]</A> </td>\n";
$closer_log .= "<td align=right><font size=2> $row[3] </td>\n";
$closer_log .= "<td align=right><font size=2> $row[2] </td>\n";
$closer_log .= "<td align=right><font size=2> $row[1] </td>\n";
$closer_log .= "<td align=right><font size=2> &nbsp; $row[14] </td>\n";
$closer_log .= "<td align=right><font size=2> &nbsp; $row[17] </td></tr>\n";
$campaign_id = $row[3];
}
##### grab vicidial_list data for lead #####
$stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id from vicidial_list where lead_id='" . mysql_real_escape_string($lead_id) . "'";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$row=mysql_fetch_row($rslt);
if (strlen($row[0]) > 0)
{$lead_id = $row[0];}
$dispo = $row[3];
$tsr = $row[4];
$vendor_id = $row[5];
$list_id = $row[7];
$gmt_offset_now = $row[8];
$phone_code = $row[10];
$phone_number = $row[11];
$title = $row[12];
$first_name = $row[13];
$middle_initial = $row[14];
$last_name = $row[15];
$address1 = $row[16];
$address2 = $row[17];
$address3 = $row[18];
$city = $row[19];
$state = $row[20];
$province = $row[21];
$postal_code = $row[22];
$country_code = $row[23];
$gender = $row[24];
$date_of_birth = $row[25];
$alt_phone = $row[26];
$email = $row[27];
$security = $row[28];
$comments = $row[29];
$called_count = $row[30];
$last_local_call_time = $row[31];
$rank = $row[32];
$owner = $row[33];
$entry_list_id = $row[34];
echo "<br>Informazioni Chiamata: $first_name $last_name - $phone_number<br><br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=end_call value=1>\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=dispo value=\"$dispo\">\n";
echo "<input type=hidden name=list_id value=\"$list_id\">\n";
echo "<input type=hidden name=campaign_id value=\"$campaign_id\">\n";
echo "<input type=hidden name=old_phone value=\"$phone_number\">\n";
echo "<input type=hidden name=server_ip value=\"$server_ip\">\n";
echo "<input type=hidden name=extension value=\"$extension\">\n";
echo "<input type=hidden name=channel value=\"$channel\">\n";
echo "<input type=hidden name=call_began value=\"$call_began\">\n";
echo "<input type=hidden name=parked_time value=\"$parked_time\">\n";
echo "<table cellpadding=1 cellspacing=0>\n";
echo "<tr><td colspan=2>$label_vendor_lead_code: $vendor_id &nbsp; &nbsp; Lead ID: $lead_id</td></tr>\n";
echo "<tr><td colspan=2>Fronter: <A HREF=\"user_stats.php?user=$tsr\">$tsr</A> &nbsp; &nbsp; ID Lista: $list_id &nbsp; &nbsp; Called Count: $called_count</td></tr>\n";
echo "<tr><td align=right>$label_title: </td><td align=left><input type=text name=title size=4 maxlength=4 value=\"$title\"> &nbsp; \n";
echo "$label_first_name: <input type=text name=first_name size=15 maxlength=30 value=\"$first_name\"> </td></tr>\n";
echo "<tr><td align=right>$label_middle_initial: </td><td align=left><input type=text name=middle_initial size=4 maxlength=1 value=\"$middle_initial\"> &nbsp; \n";
echo " $label_last_name: <input type=text name=last_name size=15 maxlength=30 value=\"$last_name\"> </td></tr>\n";
echo "<tr><td align=right>$label_address1 : </td><td align=left><input type=text name=address1 size=30 maxlength=30 value=\"$address1\"></td></tr>\n";
echo "<tr><td align=right>$label_address2 : </td><td align=left><input type=text name=address2 size=30 maxlength=30 value=\"$address2\"></td></tr>\n";
echo "<tr><td align=right>$label_address3 : </td><td align=left><input type=text name=address3 size=30 maxlength=30 value=\"$address3\"></td></tr>\n";
echo "<tr><td align=right>$label_city : </td><td align=left><input type=text name=city size=30 maxlength=30 value=\"$city\"></td></tr>\n";
echo "<tr><td align=right>$label_state: </td><td align=left><input type=text name=state size=2 maxlength=2 value=\"$state\"> &nbsp; \n";
echo " $label_postal_code: <input type=text name=postal_code size=10 maxlength=10 value=\"$postal_code\"> </td></tr>\n";
echo "<tr><td align=right>$label_province : </td><td align=left><input type=text name=province size=30 maxlength=30 value=\"$province\"></td></tr>\n";
echo "<tr><td align=right>Stato : </td><td align=left><input type=text name=country_code size=3 maxlength=3 value=\"$country_code\"></td></tr>\n";
echo "<tr><td align=right>$label_phone_number : </td><td align=left><input type=text name=phone_number size=20 maxlength=20 value=\"$phone_number\"></td></tr>\n";
echo "<tr><td align=right>$label_phone_code : </td><td align=left><input type=text name=phone_code size=10 maxlength=10 value=\"$phone_code\"></td></tr>\n";
echo "<tr><td align=right>$label_alt_phone : </td><td align=left><input type=text name=alt_phone size=20 maxlength=20 value=\"$alt_phone\"></td></tr>\n";
echo "<tr><td align=right>$label_email : </td><td align=left><input type=text name=email size=30 maxlength=50 value=\"$email\"></td></tr>\n";
echo "<tr><td align=right>$label_security_phrase : </td><td align=left><input type=text name=security size=30 maxlength=100 value=\"$security\"></td></tr>\n";
echo "<tr><td align=right>Rank : </td><td align=left><input type=text name=rank size=7 maxlength=5 value=\"$rank\"></td></tr>\n";
echo "<tr><td align=right>Owner : </td><td align=left><input type=text name=owner size=22 maxlength=20 value=\"$owner\"></td></tr>\n";
echo "<tr><td align=right>$label_comments : </td><td align=left><TEXTAREA name=comments ROWS=3 COLS=65>$comments</TEXTAREA></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Esito: </td><td align=left><select size=1 name=status>\n";
$list_campaign='';
$stmt="SELECT campaign_id from vicidial_lists where list_id='$list_id'";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$Cstatuses_to_print = mysql_num_rows($rslt);
if ($Cstatuses_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$list_campaign = $row[0];
}
$stmt="SELECT status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable from vicidial_statuses where selectable='Y' order by status";
$rslt=mysql_query($stmt, $link);
$statuses_to_print = mysql_num_rows($rslt);
$statuses_list='';
$o=0;
$DS=0;
while ($statuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
if ( (strlen($dispo) == strlen($rowx[0])) and (eregi($dispo,$rowx[0])) )
{$statuses_list .= "<option SELECTED value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; $DS++;}
else
{$statuses_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";}
$o++;
}
$stmt="SELECT status,status_name,selectable,campaign_id,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable from vicidial_campaign_statuses where selectable='Y' and campaign_id='$list_campaign' order by status";
$rslt=mysql_query($stmt, $link);
$CAMPstatuses_to_print = mysql_num_rows($rslt);
$o=0;
while ($CAMPstatuses_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
if ( (strlen($dispo) == strlen($rowx[0])) and (eregi($dispo,$rowx[0])) )
{$statuses_list .= "<option SELECTED value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n"; $DS++;}
else
{$statuses_list .= "<option value=\"$rowx[0]\">$rowx[0] - $rowx[1]</option>\n";}
$o++;
}
if ($DS < 1) {$statuses_list .= "<option SELECTED value=\"$dispo\">$dispo</option>\n";}
echo "$statuses_list";
echo "</select> <i>(with $list_campaign statuses)</i></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modificarevicidial log </td><td align=left><input type=checkbox name=modify_logs value=\"1\" CHECKED></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modificareagent log </td><td align=left><input type=checkbox name=modify_agent_logs value=\"1\" CHECKED></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Modificarecloser log </td><td align=left><input type=checkbox name=modify_closer_logs value=\"1\"></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=left>Add closer log record </td><td align=left><input type=checkbox name=add_closer_record value=\"1\"></td></tr>\n";
echo "<tr><td colspan=2 align=center><input type=submit name=submit value=\"INVIA\"></td></tr>\n";
echo "</table></form>\n";
echo "<BR><BR><BR>\n";
if ( ($dispo == 'CALLBK') or ($dispo == 'CBHOLD') )
{
### find any vicidial_callback records for this lead
$stmt="select callback_id,lead_id,list_id,campaign_id,status,entry_time,callback_time,modify_date,user,recipient,comments,user_group from vicidial_callbacks where lead_id='" . mysql_real_escape_string($lead_id) . "' and status IN('ACTIVE','LIVE') order by callback_id desc LIMIT 1;";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$CB_to_print = mysql_num_rows($rslt);
$rowx=mysql_fetch_row($rslt);
if ($CB_to_print>0)
{
if ($rowx[9] == 'USERONLY')
{
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeUSERtoANY value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "<input type=submit name=submit value=\"CHANGE TO ANYONE CALLBACK\"></form><BR>\n";
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeUSERtoUSER value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "New Callback Owner UtenteID: <input type=text name=CBuser size=8 maxlength=10 value=\"$rowx[8]\"> \n";
echo "<input type=submit name=submit value=\"CHANGE USERONLY CALLBACK USER\"></form><BR>\n";
}
else
{
echo "<br><form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=CBchangeANYtoUSER value=\"YES\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
echo "<input type=hidden name=lead_id value=\"$lead_id\">\n";
echo "<input type=hidden name=callback_id value=\"$rowx[0]\">\n";
echo "New Callback Owner UtenteID: <input type=text name=CBuser size=8 maxlength=10 value=\"$rowx[8]\"> \n";
echo "<input type=submit name=submit value=\"CHANGE TO USERONLY CALLBACK\"></form><BR>\n";
}
}
else
{
echo "<BR>No Callback records found<BR>\n";
}
}
echo "<br><br>\n";
@@ -656,6 +735,37 @@ else
echo "<BR><BR>\n";
}
### iframe for custom fields display/editing
if ($custom_fields_enabled > 0)
{
$CLlist_id = $list_id;
if (strlen($entry_list_id) > 2)
{$CLlist_id = $entry_list_id;}
$stmt="MOSTRA TABELLAS LIKE \"custom_$CLlist_id\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmt="SELECT count(*) from custom_$CLlist_id where lead_id='$lead_id';";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$fieldscount_to_print = mysql_num_rows($rslt);
if ($fieldscount_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$custom_records_count = $rowx[0];
echo "<B>CUSTOM FIELDS FOR THIS LEAD:</B><BR>\n";
echo "<iframe src=\"../agc/vdc_form_display.php?lead_id=$lead_id&list_id=$CLlist_id&stage=DISPLAY&submit_button=YES&user=$PHP_AUTH_USER&pass=$PHP_AUTH_PW&bgcolor=E6E6E6\" style=\"background-color:transparent;\" scrolling=\"auto\" frameborder=\"2\" allowtransparency=\"true\" id=\"vcFormIFrame\" name=\"vcFormIFrame\" width=\"740\" height=\"300\" STYLE=\"z-index:18\"> </iframe>\n";
echo "<BR><BR>";
}
}
}
echo "<B>CHIAMATE VERSO QUESTO CONTATTO:</B>\n";
echo "<TABLE width=750 cellspacing=0 cellpadding=1>\n";
echo "<tr><td><font size=1># </td><td><font size=2>DATE/TIME </td><td align=left><font size=2>LENGTH</td><td align=left><font size=2> STATUS</td><td align=left><font size=2> TSR</td><td align=right><font size=2> CAMPAGNA</td><td align=right><font size=2> LIST</td><td align=right><font size=2> LEAD</td><td align=right><font size=2> HANGUP REASON</td><td align=right><font size=2> PHONE</td></tr>\n";
@@ -692,6 +802,7 @@ else
$stmt="select recording_id,channel,server_ip,extension,start_time,start_epoch,end_time,end_epoch,length_in_sec,length_in_min,filename,location,lead_id,user,vicidial_id from recording_log where lead_id='" . mysql_real_escape_string($lead_id) . "' order by recording_id desc limit 500;";
$rslt=mysql_query($stmt, $link);
$logs_to_print = mysql_num_rows($rslt);
if ($DB) {echo "$logs_to_print|$stmt|\n";}
$u=0;
while ($logs_to_print > $u)
@@ -731,7 +842,7 @@ else
{$locat = substr($location,0,27); $locat = "$locat...";}
else
{$locat = $location;}
if (eregi("http",$location))
if ( (eregi("ftp",$location)) or (eregi("http",$location)) )
{$location = "<a href=\"$location\">$locat</a>";}
else
{$location = $locat;}
@@ -750,7 +861,21 @@ else
}
echo "</TABLE></center>\n";
echo "</TABLE><BR><BR>\n";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level >= 9 and modify_leads='1';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$admin_display=$row[0];
if ($admin_display > 0)
{
echo "<a href=\"./admin.php?ADD=720000000000000&stage=$lead_id&category=LEADS\">Click here to see Lead Modificarechanges to this lead</a>\n";
}
echo "</center>\n";
}
@@ -1,5 +1,5 @@
<?php
# admin_search_lead.php
# admin_search_lead.php version 2.4
#
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
@@ -22,6 +22,8 @@
# 90917-2307 - Added alternate phone number searching option
# 90921-0713 - Removed SELECT STAR
# 100224-1621 - Added first/last name search and changed format of the page
# 100405-1331 - Added log search ability
# 100622-0928 - Added field labels
#
require("dbconnect.php");
@@ -39,6 +41,10 @@ if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["log_phone"])) {$log_phone=$_GET["log_phone"];}
elseif (isset($_POST["log_phone"])) {$log_phone=$_POST["log_phone"];}
if (isset($_GET["log_lead_id"])) {$log_lead_id=$_GET["log_lead_id"];}
elseif (isset($_POST["log_lead_id"])) {$log_lead_id=$_POST["log_lead_id"];}
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];}
@@ -141,13 +147,58 @@ $subcamp_color = '#C6C6C6';
require("admin_header.php");
$label_title = 'Title';
$label_first_name = 'First';
$label_middle_initial = 'MI';
$label_last_name = 'Last';
$label_address1 = 'Address1';
$label_address2 = 'Address2';
$label_address3 = 'Address3';
$label_city = 'Citta`';
$label_state = 'State';
$label_province = 'Provincia';
$label_postal_code = 'CAP';
$label_vendor_lead_code = 'Vendor ID';
$label_gender = 'Sesso';
$label_phone_number = 'Phone';
$label_phone_code = 'DialCode';
$label_alt_phone = 'Alt. Phone';
$label_security_phrase = 'Show';
$label_email = 'Email';
$label_comments = 'Note';
### find any custom field labels
$stmt="SELECT label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments from system_settings;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
if (strlen($row[0])>0) {$label_title = $row[0];}
if (strlen($row[1])>0) {$label_first_name = $row[1];}
if (strlen($row[2])>0) {$label_middle_initial = $row[2];}
if (strlen($row[3])>0) {$label_last_name = $row[3];}
if (strlen($row[4])>0) {$label_address1 = $row[4];}
if (strlen($row[5])>0) {$label_address2 = $row[5];}
if (strlen($row[6])>0) {$label_address3 = $row[6];}
if (strlen($row[7])>0) {$label_city = $row[7];}
if (strlen($row[8])>0) {$label_state = $row[8];}
if (strlen($row[9])>0) {$label_province = $row[9];}
if (strlen($row[10])>0) {$label_postal_code = $row[10];}
if (strlen($row[11])>0) {$label_vendor_lead_code = $row[11];}
if (strlen($row[12])>0) {$label_gender = $row[12];}
if (strlen($row[13])>0) {$label_phone_number = $row[13];}
if (strlen($row[14])>0) {$label_phone_code = $row[14];}
if (strlen($row[15])>0) {$label_alt_phone = $row[15];}
if (strlen($row[16])>0) {$label_security_phrase = $row[16];}
if (strlen($row[17])>0) {$label_email = $row[17];}
if (strlen($row[18])>0) {$label_comments = $row[18];}
echo " Lead search: $vendor_id $phone $lead_id $status $list_id $user\n";
echo date("l F j, Y G:i:s A");
echo "<BR>\n";
if ( (!$vendor_id) and (!$phone) and (!$lead_id) and ( (strlen($status)<1) and (strlen($list_id)<1) and (strlen($user)<1) ) and ( (strlen($first_name)<1) and (strlen($last_name)<1) ))
if ( (!$vendor_id) and (!$phone) and (!$lead_id) and (!$log_phone) and (!$log_lead_id) and ( (strlen($status)<1) and (strlen($list_id)<1) and (strlen($user)<1) ) and ( (strlen($first_name)<1) and (strlen($last_name)<1) ))
{
### Lead search
echo "<br><center>\n";
echo "<form method=post name=search action=\"$PHP_SELF\">\n";
echo "<input type=hidden name=DB value=\"$DB\">\n";
@@ -156,16 +207,16 @@ if ( (!$vendor_id) and (!$phone) and (!$lead_id) and ( (strlen($status)<1) and
echo "<TD colspan=3 align=center><b>Ricerca Contatti Opziones:</TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>Vendor ID(co`digo del vendedor del Lead): &nbsp; </TD><TD ALIGN=left><input type=text name=vendor_id size=10 maxlength=10></TD>";
echo "<TD ALIGN=right>$label_vendor_lead_code(co`digo del vendedor del Lead): &nbsp; </TD><TD ALIGN=left><input type=text name=vendor_id size=10 maxlength=10></TD>";
echo "<TD><input type=submit name=submit value=INVIA></TD>\n";
echo "</TR><TR>";
echo "<TD colspan=3 align=center> &nbsp; </TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>Home Numero di Telefono: &nbsp; </TD><TD ALIGN=left><input type=text name=phone size=14 maxlength=18></TD>";
echo "<TD ALIGN=right>$label_phone_number: &nbsp; </TD><TD ALIGN=left><input type=text name=phone size=14 maxlength=18></TD>";
echo "<TD rowspan=2><input type=submit name=submit value=INVIA></TD>\n";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>Alt phone search: &nbsp; </TD><TD ALIGN=left><select size=1 name=alt_phone_search><option>No</option><option>Yes</option><option SELECTED>$alt_phone_search</option></select></TD>";
echo "<TD ALIGN=right>$label_alt_phone search: &nbsp; </TD><TD ALIGN=left><select size=1 name=alt_phone_search><option>No</option><option>Yes</option><option SELECTED>$alt_phone_search</option></select></TD>";
echo "</TR><TR>";
echo "<TD colspan=3 align=center> &nbsp; </TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
@@ -186,12 +237,33 @@ if ( (!$vendor_id) and (!$phone) and (!$lead_id) and ( (strlen($status)<1) and
echo "<TD colspan=3 align=center> &nbsp; </TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>Nome: &nbsp; </TD><TD ALIGN=left><input type=text name=first_name size=15 maxlength=30></TD>";
echo "<TD ALIGN=right>$label_first_name: &nbsp; </TD><TD ALIGN=left><input type=text name=first_name size=15 maxlength=30></TD>";
echo "<TD rowspan=2><input type=submit name=submit value=INVIA></TD>\n";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>Cognome: &nbsp; </TD><TD ALIGN=left><input type=text name=last_name size=15 maxlength=30></TD>";
echo "<TD ALIGN=right>$label_last_name: &nbsp; </TD><TD ALIGN=left><input type=text name=last_name size=15 maxlength=30></TD>";
echo "</TR>";
### Log search
echo "<br><center>\n";
echo "<TD colspan=3 align=center> &nbsp; </TD>";
echo "</TR><TR>";
echo "<TD colspan=3 align=center><b>Log Search Opziones:</TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>Lead ID: &nbsp; </TD><TD ALIGN=left><input type=text name=log_lead_id size=10 maxlength=10></TD>";
echo "<TD><input type=submit name=submit value=INVIA></TD>\n";
echo "</TR><TR>";
echo "<TD colspan=3 align=center> &nbsp; </TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "<TD ALIGN=right>$label_phone_number Dialed: &nbsp; </TD><TD ALIGN=left><input type=text name=log_phone size=18 maxlength=18></TD>";
echo "<TD><input type=submit name=submit value=INVIA></TD>\n";
echo "</TR><TR>";
echo "<TD colspan=3 align=center> &nbsp; </TD>";
echo "</TR><TR bgcolor=#B9CBFD>";
echo "</TABLE>\n";
echo "</form>\n</center>\n";
echo "</body></html>\n";
@@ -200,6 +272,189 @@ if ( (!$vendor_id) and (!$phone) and (!$lead_id) and ( (strlen($status)<1) and
else
{
##### BEGIN Log search #####
if ( (strlen($log_lead_id)>0) or (strlen($log_phone)>0) )
{
if (strlen($log_lead_id)>0)
{
$stmtA="SELECT lead_id,phone_number,campaign_id,call_date,status,user,list_id,length_in_sec,alt_dial from vicidial_log where lead_id='" . mysql_real_escape_string($log_lead_id) . "'";
$stmtB="SELECT lead_id,phone_number,campaign_id,call_date,status,user,list_id,length_in_sec from vicidial_closer_log where lead_id='" . mysql_real_escape_string($log_lead_id) . "'";
}
if (strlen($log_phone)>0)
{
$stmtA="SELECT lead_id,phone_number,campaign_id,call_date,status,user,list_id,length_in_sec,alt_dial from vicidial_log where phone_number='" . mysql_real_escape_string($log_phone) . "'";
$stmtB="SELECT lead_id,phone_number,campaign_id,call_date,status,user,list_id,length_in_sec from vicidial_closer_log where phone_number='" . mysql_real_escape_string($log_phone) . "'";
$stmtC="SELECT extension,caller_id_number,did_id,call_date from vicidial_did_log where caller_id_number='" . mysql_real_escape_string($log_phone) . "'";
}
$rslt=mysql_query("$stmtA", $link);
$results_to_print = mysql_num_rows($rslt);
if ( ($results_to_print < 1) and ($results_to_printX < 1) )
{
echo "\n<br><br><center>\n";
echo "<b>There are no outbound calls matching your search criteria</b><br><br>\n";
echo "</center>\n";
}
else
{
echo "<BR><b>OUTBOUND LOG RESULTS: $results_to_print</b><BR>\n";
echo "<TABLE BGCOLOR=WHITE CELLPADDING=1 CELLSPACING=0 WIDTH=770>\n";
echo "<TR BGCOLOR=BLACK>\n";
echo "<TD ALIGN=LEFT VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>#</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>LEAD ID</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>PHONE</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>CAMPAGNA</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>CALL DATA</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>ESITO</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>UTENTE</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>ID LISTA</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>LENGTH</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>DIAL</B></FONT></TD>\n";
echo "</TR>\n";
$o=0;
while ($results_to_print > $o)
{
$row=mysql_fetch_row($rslt);
$o++;
$search_lead = $row[0];
if (eregi("1$|3$|5$|7$|9$", $o))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
echo "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$o</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><a href=\"admin_modify_lead.php?lead_id=$row[0]\" target=\"_blank\">$row[0]</a></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[1]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[2]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[3]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[4]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[5]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[6]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[7]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[8]</FONT></TD>\n";
echo "</TR>\n";
}
echo "</TABLE>\n";
}
$rslt=mysql_query("$stmtB", $link);
$results_to_print = mysql_num_rows($rslt);
if ( ($results_to_print < 1) and ($results_to_printX < 1) )
{
echo "\n<br><br><center>\n";
echo "<b>There are no inbound calls matching your search criteria</b><br><br>\n";
echo "</center>\n";
}
else
{
echo "<BR><b>INBOUND LOG RESULTS: $results_to_print</b><BR>\n";
echo "<TABLE BGCOLOR=WHITE CELLPADDING=1 CELLSPACING=0 WIDTH=770>\n";
echo "<TR BGCOLOR=BLACK>\n";
echo "<TD ALIGN=LEFT VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>#</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>LEAD ID</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>PHONE</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>INGROUP</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>CALL DATA</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>ESITO</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>UTENTE</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>ID LISTA</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>LENGTH</B> &nbsp;</FONT></TD>\n";
echo "</TR>\n";
$o=0;
while ($results_to_print > $o)
{
$row=mysql_fetch_row($rslt);
$o++;
$search_lead = $row[0];
if (eregi("1$|3$|5$|7$|9$", $o))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
echo "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$o</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1><a href=\"admin_modify_lead.php?lead_id=$row[0]\" target=\"_blank\">$row[0]</a></FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[1]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[2]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[3]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[4]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[5]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[6]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[7]</FONT></TD>\n";
echo "</TR>\n";
}
echo "</TABLE>\n";
}
if (strlen($stmtC) > 10)
{
$rslt=mysql_query("$stmtC", $link);
$results_to_print = mysql_num_rows($rslt);
if ( ($results_to_print < 1) and ($results_to_printX < 1) )
{
echo "\n<br><br><center>\n";
echo "<b>There are no inbound did calls matching your search criteria</b><br><br>\n";
echo "</center>\n";
}
else
{
echo "<BR><b>INBOUND DID LOG RESULTS: $results_to_print</b><BR>\n";
echo "<TABLE BGCOLOR=WHITE CELLPADDING=1 CELLSPACING=0 WIDTH=770>\n";
echo "<TR BGCOLOR=BLACK>\n";
echo "<TD ALIGN=LEFT VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>#</B></FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>DID</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>PHONE</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>DID ID</B> &nbsp;</FONT></TD>\n";
echo "<TD ALIGN=CENTER VALIGN=TOP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=WHITE><B>CALL DATA</B> &nbsp;</FONT></TD>\n";
echo "</TR>\n";
$o=0;
while ($results_to_print > $o)
{
$row=mysql_fetch_row($rslt);
$o++;
$search_lead = $row[0];
if (eregi("1$|3$|5$|7$|9$", $o))
{$bgcolor='bgcolor="#B9CBFD"';}
else
{$bgcolor='bgcolor="#9BB9FB"';}
echo "<TR $bgcolor>\n";
echo "<TD ALIGN=LEFT><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$o</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[0]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[1]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[2]</FONT></TD>\n";
echo "<TD ALIGN=CENTER><FONT FACE=\"ARIAL,HELVETICA\" SIZE=1>$row[3]</FONT></TD>\n";
echo "</TR>\n";
}
echo "</TABLE>\n";
}
}
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|";
$SQL_log = ereg_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='LEADS', event_type='SEARCH', record_id='$search_lead', event_code='ADMIN SEARCH LEAD', event_sql=\"$SQL_log\", event_notes='';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n<a href=\"$PHP_SELF\">NUOVA RICERCA</a>";
echo "\n\n\n<br><br><br>\nTempo Esecuzione Script: $RUNtime seconds";
echo "\n\n\n</body></html>";
exit;
}
##### END Log search #####
##### BEGIN Lead search #####
if ($vendor_id)
{
$stmt="SELECT $vicidial_list_fields from vicidial_list where vendor_lead_code='" . mysql_real_escape_string($vendor_id) . "'";
@@ -365,6 +620,7 @@ else
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
}
##### END Lead search #####
@@ -1,17 +1,18 @@
<?php
# audio_store.php
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# Central Audio Storage script
#
# CHANGES
# 90511-1325 - First build
# 90618-0640 - Fix for users going through proxy or tunnel
# 100401-1037 - remove spaces and special characters from filenames, admin log uploads
#
$version = '2.2.0-2';
$build = '90618-0640';
$version = '2.2.0-3';
$build = '100401-1037';
$MT[0]='';
@@ -191,8 +192,12 @@ if ($action == "LIST")
# curl 'http://10.0.0.4/vicidial/audio_store.php?action=AUTOUPLOAD' -F "audiofile=@/var/lib/asterisk/sounds/beep.gsm"
if ($action == "AUTOUPLOAD")
{
if ($audiofile)
if ($audiofile)
{
$AF_path = preg_replace("/ /",'\ ',$AF_path);
$AF_path = preg_replace("/@/",'\@',$AF_path);
$audiofile_name = preg_replace("/ /",'',$audiofile_name);
$audiofile_name = preg_replace("/@/",'',$audiofile_name);
copy($AF_path, "$WeBServeRRooT/$sounds_web_directory/$audiofile_name");
chmod("$WeBServeRRooT/$sounds_web_directory/$audiofile_name", 0766);
@@ -277,6 +282,10 @@ if ($action == "MANUALUPLOAD")
{
if ($audiofile)
{
$AF_path = preg_replace("/ /",'\ ',$AF_path);
$AF_path = preg_replace("/@/",'\@',$AF_path);
$audiofile_name = preg_replace("/ /",'',$audiofile_name);
$audiofile_name = preg_replace("/@/",'',$audiofile_name);
copy($AF_path, "$WeBServeRRooT/$sounds_web_directory/$audiofile_name");
chmod("$WeBServeRRooT/$sounds_web_directory/$audiofile_name", 0766);
@@ -284,6 +293,14 @@ if ($action == "MANUALUPLOAD")
$stmt="UPDATE servers SET sounds_update='Y';";
$rslt=mysql_query($stmt, $link);
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|";
$SQL_log = ereg_replace(';','',$SQL_log);
$SQL_log = addslashes($SQL_log);
$stmt="INSERT INTO vicidial_admin_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$ip', event_section='AUDIOSTORE', event_type='LOAD', record_id='manualupload', event_code='$audiofile_name " . filesize("$WeBServeRRooT/$sounds_web_directory/$audiofile_name") . "', event_sql=\"$SQL_log\", event_notes='$audiofile_name $AF_path $AF_orig';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
}
else
{
@@ -309,8 +326,18 @@ if ($action == "MANUALUPLOAD")
<tr><td align=left><font size=1> &nbsp; </font></td><td align=right><font size=1>Audio Store- &nbsp; &nbsp; VERSION: <?php echo $version ?> &nbsp; &nbsp; BUILD: <?php echo $build ?> &nbsp; &nbsp; </td></tr>
</table>
<BR><BR>
<CENTER><B>We STRONGLY recommend uploading only 16bit 8k PCM WAV audio files(.wav)
<BR><BR>
<a href="javascript:launch_chooser('sample_prompt','date',30);">audio file list</a></CENTER>
<CENTER><B>We STRONGLY recommend uploading only 16bit Mono 8k PCM WAV audio files(.wav)</B>
<BR><BR><font size=1>All spaces will be stripped from uploaded audio file names</font><BR><BR>
<B><a href="javascript:launch_chooser('sample_prompt','date',30);">audio file list</a></CENTER>
<?php
echo "<BR><BR><BR><BR><BR><BR>\n";
echo "</B></B><br><br><a href=\"admin.php?ADD=720000000000000&category=AUDIOSTORE&stage=manualupload\">Click here to see a log of the uploads to the audio store</FONT>\n";
?>
</TD></TR></TABLE>
@@ -17,6 +17,14 @@
# 100119-1039 - Filtered comments for \n newlines
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100507-1413 - Added headers for export
# 100702-1332 - Added custom fields option
# 100712-1324 - Added system setting slave server option
# 100713-0101 - Added recordings fields option (for filename, recording ID and URL)
# 100713-1050 - Fixed minor custom fields issue
# 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
# Allow level 7 users to view this report
#
require("dbconnect.php");
@@ -42,6 +50,12 @@ if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
if (isset($_GET["run_export"])) {$run_export=$_GET["run_export"];}
elseif (isset($_POST["run_export"])) {$run_export=$_POST["run_export"];}
if (isset($_GET["header_row"])) {$header_row=$_GET["header_row"];}
elseif (isset($_POST["header_row"])) {$header_row=$_POST["header_row"];}
if (isset($_GET["rec_fields"])) {$rec_fields=$_GET["rec_fields"];}
elseif (isset($_POST["rec_fields"])) {$rec_fields=$_POST["rec_fields"];}
if (isset($_GET["custom_fields"])) {$custom_fields=$_GET["custom_fields"];}
elseif (isset($_POST["custom_fields"])) {$custom_fields=$_POST["custom_fields"];}
if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
@@ -49,30 +63,52 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];}
if (strlen($shift)<2) {$shift='ALL';}
$report_name = 'Export Calls Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
$custom_fields_enabled = $row[4];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and export_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and export_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
# Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -81,6 +117,38 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$LOGallowed_campaignsSQL='';
$whereLOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$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 ";
##### START RUN THE EXPORT AND OUTPUT FLAT DATA FILE #####
if ($run_export > 0)
@@ -110,8 +178,11 @@ if ($run_export > 0)
$i=0;
while($i < $campaign_ct)
{
$campaign_string .= "$campaign[$i]|";
$campaign_SQL .= "'$campaign[$i]',";
if ( (preg_match("/ $campaign[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/-ALL/",$LOGallowed_campaigns)) )
{
$campaign_string .= "$campaign[$i]|";
$campaign_SQL .= "'$campaign[$i]',";
}
$i++;
}
if ( (ereg("--NONE--",$campaign_string) ) or ($campaign_ct < 1) )
@@ -218,7 +289,7 @@ if ($run_export > 0)
$k=0;
if ($RUNcampaign > 0)
{
$stmt = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id from vicidial_users vu,vicidial_log vl,vicidial_list vi where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;";
$stmt = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.alt_dial,vi.rank,vi.owner,vi.lead_id,vl.uniqueid,vi.entry_list_id from vicidial_users vu,vicidial_log vl,vicidial_list vi where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $campaign_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$outbound_to_print = mysql_num_rows($rslt);
@@ -236,8 +307,11 @@ if ($run_export > 0)
$row[29] = preg_replace("/\n|\r/",'!N',$row[29]);
$export_status[$k] = $row[2];
$export_list_id[$k] = $row[8];
$export_status[$k] = $row[2];
$export_list_id[$k] = $row[8];
$export_lead_id[$k] = $row[35];
$export_vicidial_id[$k] = $row[36];
$export_entry_list_id[$k] = $row[37];
$export_rows[$k] = "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]\t$row[34]\t$row[35]\t";
$i++;
$k++;
@@ -248,7 +322,7 @@ if ($run_export > 0)
if ($RUNgroup > 0)
{
$stmtA = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.queue_seconds,vi.rank,vi.owner,vi.lead_id from vicidial_users vu,vicidial_closer_log vl,vicidial_list vi where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $group_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;";
$stmtA = "SELECT vl.call_date,vl.phone_number,vl.status,vl.user,vu.full_name,vl.campaign_id,vi.vendor_lead_code,vi.source_id,vi.list_id,vi.gmt_offset_now,vi.phone_code,vi.phone_number,vi.title,vi.first_name,vi.middle_initial,vi.last_name,vi.address1,vi.address2,vi.address3,vi.city,vi.state,vi.province,vi.postal_code,vi.country_code,vi.gender,vi.date_of_birth,vi.alt_phone,vi.email,vi.security_phrase,vi.comments,vl.length_in_sec,vl.user_group,vl.queue_seconds,vi.rank,vi.owner,vi.lead_id,vl.closecallid,vi.entry_list_id from vicidial_users vu,vicidial_closer_log vl,vicidial_list vi where vl.call_date >= '$query_date 00:00:00' and vl.call_date <= '$end_date 23:59:59' and vu.user=vl.user and vi.lead_id=vl.lead_id $list_SQL $group_SQL $user_group_SQL $status_SQL order by vl.call_date limit 100000;";
$rslt=mysql_query($stmtA, $link);
if ($DB) {echo "$stmt\n";}
$inbound_to_print = mysql_num_rows($rslt);
@@ -266,8 +340,11 @@ if ($run_export > 0)
$row[29] = preg_replace("/\n|\r/",'!N',$row[29]);
$export_status[$k] = $row[2];
$export_list_id[$k] = $row[8];
$export_status[$k] = $row[2];
$export_list_id[$k] = $row[8];
$export_lead_id[$k] = $row[35];
$export_vicidial_id[$k] = $row[36];
$export_entry_list_id[$k] = $row[37];
$export_rows[$k] = "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]\t$row[34]\t$row[35]\t";
$i++;
$k++;
@@ -299,9 +376,28 @@ if ($run_export > 0)
ob_clean();
flush();
if ($header_row=='YES')
{
$CFheader = '';
$RFheader = '';
if ( ($custom_fields_enabled > 0) and ($custom_fields=='YES') )
{$CFheader = "\tcustom_fields";}
if ($rec_fields=='ID')
{$RFheader = "\trecording_id";}
if ($rec_fields=='FILENAME')
{$RFheader = "\trecording_filename";}
if ($rec_fields=='LOCATION')
{$RFheader = "\trecording_location";}
if ($rec_fields=='ALL')
{$RFheader = "\trecording_id\trecording_filename\trecording_location";}
echo "call_date\tphone_number\tstatus\tuser\tfull_name\tcampaign_id\tvendor_lead_code\tsource_id\tlist_id\tgmt_offset_now\tphone_code\tphone_number\ttitle\tfirst_name\tmiddle_initial\tlast_name\taddress1\taddress2\taddress3\tcity\tstate\tprovince\tpostal_code\tcountry_code\tgender\tdate_of_birth\talt_phone\temail\tsecurity_phrase\tcomments\tlength_in_sec\tuser_group\talt_dial\trank\towner\tlead_id\tlist_name\tlist_description\tstatus_name$RFheader$CFheader\r\n";
}
$i=0;
while ($k > $i)
{
$custom_data='';
$ex_list_name='';
$ex_list_description='';
$stmt = "SELECT list_name,list_description FROM vicidial_lists where list_id='$export_list_id[$i]';";
@@ -338,7 +434,85 @@ if ($run_export > 0)
}
}
echo "$export_rows[$i]$ex_list_name\t$ex_list_description\t$ex_status_name\r\n";
$rec_data='';
if ( ($rec_fields=='ID') or ($rec_fields=='FILENAME') or ($rec_fields=='LOCATION') or ($rec_fields=='ALL') )
{
$rec_id='';
$rec_filename='';
$rec_location='';
$stmt = "SELECT recording_id,filename,location from recording_log where vicidial_id='$export_vicidial_id[$i]' order by recording_id desc LIMIT 10;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$recordings_ct = mysql_num_rows($rslt);
$u=0;
while ($recordings_ct > $u)
{
$row=mysql_fetch_row($rslt);
$rec_id .= "$row[0]|";
$rec_filename .= "$row[1]|";
$rec_location .= "$row[2]|";
$u++;
}
$rec_id = preg_replace("/.$/",'',$rec_id);
$rec_filename = preg_replace("/.$/",'',$rec_filename);
$rec_location = preg_replace("/.$/",'',$rec_location);
if ($rec_fields=='ID')
{$rec_data = "\t$rec_id";}
if ($rec_fields=='FILENAME')
{$rec_data = "\t$rec_filename";}
if ($rec_fields=='LOCATION')
{$rec_data = "\t$rec_location";}
if ($rec_fields=='ALL')
{$rec_data = "\t$rec_id\t$rec_filename\t$rec_location";}
}
if ( ($custom_fields_enabled > 0) and ($custom_fields=='YES') )
{
$CF_list_id = $export_list_id[$i];
if ($export_entry_list_id[$i] > 99)
{$CF_list_id = $export_entry_list_id[$i];}
$stmt="SHOW TABLES LIKE \"custom_$CF_list_id\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmt = "describe custom_$CF_list_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$columns_ct = mysql_num_rows($rslt);
$u=0;
while ($columns_ct > $u)
{
$row=mysql_fetch_row($rslt);
$column = $row[0];
$u++;
}
if ($columns_ct > 1)
{
$stmt = "SELECT * from custom_$CF_list_id where lead_id='$export_lead_id[$i]' limit 1;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$customfield_ct = mysql_num_rows($rslt);
if ($customfield_ct > 0)
{
$row=mysql_fetch_row($rslt);
$t=1;
while ($columns_ct > $t)
{
$custom_data .= "\t$row[$t]";
$t++;
}
}
}
$custom_data = preg_replace("/\r\n/",'!N',$custom_data);
$custom_data = preg_replace("/\n/",'!N',$custom_data);
}
}
echo "$export_rows[$i]$ex_list_name\t$ex_list_description\t$ex_status_name$rec_data$custom_data\r\n";
$i++;
}
}
@@ -360,7 +534,7 @@ else
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
$stmt="select campaign_id from vicidial_campaigns order by campaign_id;";
$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$campaigns_to_print = mysql_num_rows($rslt);
@@ -405,7 +579,7 @@ else
$i++;
}
$stmt="select list_id from vicidial_lists order by list_id;";
$stmt="select list_id from vicidial_lists $whereLOGallowed_campaignsSQL order by list_id;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$lists_to_print = mysql_num_rows($rslt);
@@ -435,7 +609,7 @@ else
$i++;
}
$stmt="select distinct status from vicidial_campaign_statuses order by status;";
$stmt="select distinct status from vicidial_campaign_statuses $whereLOGallowed_campaignsSQL order by status;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$Cstatuses_to_print = mysql_num_rows($rslt);
@@ -455,7 +629,7 @@ else
echo "<link rel=\"stylesheet\" href=\"calendar.css\">\n";
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>ADMINISTRATION: Export Calls Report";
echo "<TITLE>ADMINISTRATION: $report_name";
##### BEGIN Set variables to make header show properly #####
$ADD = '100';
@@ -518,6 +692,30 @@ else
</script>
<?php
echo "<BR><BR>\n";
echo "Header Row:<BR>\n";
echo "<select size=1 name=header_row><option selected>YES</option><option>NO</option></select>\n";
echo "<BR><BR>\n";
echo "Recording Fields:<BR>\n";
echo "<select size=1 name=rec_fields>";
echo "<option>ID</option>";
echo "<option>FILENAME</option>";
echo "<option>LOCATION</option>";
echo "<option>ALL</option>";
echo "<option selected>NONE</option>";
echo "</select>\n";
if ($custom_fields_enabled > 0)
{
echo "<BR><BR>\n";
echo "Custom Fields:<BR>\n";
echo "<select size=1 name=custom_fields><option>YES</option><option selected>NO</option></select>\n";
}
echo "</TD><TD ALIGN=LEFT VALIGN=TOP ROWSPAN=2>\n";
echo "<font class=\"select_bold\"><B>Campaigns:</B></font><BR><CENTER>\n";
echo "<SELECT SIZE=15 NAME=campaign[] multiple>\n";
@@ -1,50 +1,63 @@
<?php
#
# dbconnect.php version 2.2.0
# dbconnect.php version 2.4
#
# database connection settings and some global web settings
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 100712-1430 - Added slave server option for connection
#
if ( file_exists("/etc/astguiclient.conf") )
{
$DBCagc = file("/etc/astguiclient.conf");
foreach ($DBCagc as $DBCline)
{
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
if (ereg("^PATHlogs", $DBCline))
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
if (ereg("^PATHweb", $DBCline))
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
if (ereg("^VARserver_ip", $DBCline))
{$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);}
if (ereg("^VARDB_server", $DBCline))
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
if (ereg("^VARDB_database", $DBCline))
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
if (ereg("^VARDB_user", $DBCline))
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
if (ereg("^VARDB_pass", $DBCline))
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
if (ereg("^VARDB_port", $DBCline))
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
$DBCagc = file("/etc/astguiclient.conf");
foreach ($DBCagc as $DBCline)
{
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
if (ereg("^PATHlogs", $DBCline))
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
if (ereg("^PATHweb", $DBCline))
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
if (ereg("^VARserver_ip", $DBCline))
{$WEBserver_ip = $DBCline; $WEBserver_ip = preg_replace("/.*=/","",$WEBserver_ip);}
if (ereg("^VARDB_server", $DBCline))
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
if (ereg("^VARDB_database", $DBCline))
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
if (ereg("^VARDB_user", $DBCline))
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
if (ereg("^VARDB_pass", $DBCline))
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
if (ereg("^VARDB_custom_user", $DBCline))
{$VARDB_custom_user = $DBCline; $VARDB_custom_user = preg_replace("/.*=/","",$VARDB_custom_user);}
if (ereg("^VARDB_custom_pass", $DBCline))
{$VARDB_custom_pass = $DBCline; $VARDB_custom_pass = preg_replace("/.*=/","",$VARDB_custom_pass);}
if (ereg("^VARDB_port", $DBCline))
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
}
}
else
{
#defaults for DB connection
$VARDB_server = 'localhost';
$VARDB_port = '3306';
$VARDB_user = 'cron';
$VARDB_pass = '1234';
$VARDB_custom_user = 'custom';
$VARDB_custom_pass = 'custom1234';
$VARDB_database = '1234';
$WeBServeRRooT = '/usr/local/apache2/htdocs';
}
}
else
{
#defaults for DB connection
$VARDB_server = 'localhost';
$VARDB_user = 'cron';
$VARDB_pass = '1234';
$VARDB_database = '1234';
$WeBServeRRooT = '/usr/local/apache2/htdocs';
}
$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass");
if (!$link) {
if ( ($use_slave_server > 0) and (strlen($slave_db_server)>5) )
{$VARDB_server = $slave_db_server;}
$link=mysql_connect("$VARDB_server:$VARDB_port", "$VARDB_user", "$VARDB_pass");
if (!$link)
{
die('MySQL connect ERROR: ' . mysql_error());
}
}
mysql_select_db("$VARDB_database");
$local_DEF = 'Local/';
+63 -3
View File
@@ -14,6 +14,9 @@
# 90508-0644 - Changed to PHP long tags
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -39,12 +42,48 @@ $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
if (strlen($shift)<2) {$shift='ALL';}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$report_name = 'Fronter - Closer Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -53,6 +92,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -88,7 +148,7 @@ while ($i < $groups_to_print)
<?php
echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
echo "<TITLE>In-Group Fronter-Closer Stats Report</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
echo "<TITLE>$report_name</TITLE></HEAD><BODY BGCOLOR=WHITE marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
$short_header=1;
@@ -605,7 +665,7 @@ echo "+--------------------------+--------+------+------+------+------+-------+\
$ENDtime = date("U");
$RUNtime = ($ENDtime - $STARTtime);
if ($DB) {echo "\nRun Time: $RUNtime seconds\n";}
if ($DB) {echo "\nRun Time: $RUNtime seconds|$db_source\n";}
}
@@ -12,6 +12,14 @@
# 90508-0644 - Changed to PHP long tags
# 90721-1238 - Added rank and owner as vicidial_list fields
# 100119-1039 - Filtered comments for \n newlines
# 100508-1439 - Added header row to output
# 100702-1335 - Added custom fields
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100804-1745 - Added option to download DNC and FPGN lists
# 100924-1609 - Added ALL-LISTS option for downloading everything
# 100929-1919 - Fixed ALL-LISTS download option to include custom fields
# 101004-2108 - Added generic custom column headers for custom fields
#
require("dbconnect.php");
@@ -27,12 +35,20 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];}
elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];}
if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];}
elseif (isset($_POST["INVIA"])) {$INVIA=$_POST["INVIA"];}
if (isset($_GET["group_id"])) {$group_id=$_GET["group_id"];}
elseif (isset($_POST["group_id"])) {$group_id=$_POST["group_id"];}
if (isset($_GET["download_type"])) {$download_type=$_GET["download_type"];}
elseif (isset($_POST["download_type"])) {$download_type=$_POST["download_type"];}
if (strlen($shift)<2) {$shift='ALL';}
if ($group_id=='SYSTEM_INTERNAL') {$download_type='systemdnc';}
$report_name = 'Download List';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,custom_fields_enabled FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -40,14 +56,27 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$outbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
$custom_fields_enabled = $row[4];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
# echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and download_lists='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and download_lists='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
@@ -62,23 +91,182 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="select count(*) from vicidial_list where list_id='$list_id';";
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
$row=mysql_fetch_row($rslt);
$leads_count =$row[0];
$i++;
# Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
# Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
if ($leads_count < 1)
$LOGallowed_campaignsSQL='';
if ( (!eregi("-ALL",$LOGallowed_campaigns)) )
{
echo "There are no leads in list_id: $list_id\n";
exit;
$rawLOGallowed_campaignsSQL = preg_replace("/ -/",'',$LOGallowed_campaigns);
$rawLOGallowed_campaignsSQL = preg_replace("/ /","','",$rawLOGallowed_campaignsSQL);
$LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')";
}
if ($download_type == 'systemdnc')
{
##### System DNC list validation #####
$event_code_type='SYSTEM INTERNAL DNC';
if (strlen($LOGallowed_campaignsSQL) > 2)
{
echo "You are not allowed to download this list: $list_id\n";
exit;
}
$stmt="select count(*) from vicidial_dnc;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$leads_count =$row[0];
$i++;
}
if ($leads_count < 1)
{
echo "There are no phone numbers in list: SYSTEM INTERNAL DNC\n";
exit;
}
}
elseif ($download_type == 'dnc')
{
##### Campagna DNC list validation #####
$event_code_type='CAMPAIGN DNC';
$stmt="select count(*) from vicidial_campaigns where campaign_id='$group_id' $LOGallowed_campaignsSQL;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$lists_allowed =$row[0];
$i++;
}
if ($lists_allowed < 1)
{
echo "You are not allowed to download this list: $group_id\n";
exit;
}
$stmt="select count(*) from vicidial_campaign_dnc where campaign_id='$group_id';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$leads_count =$row[0];
$i++;
}
if ($leads_count < 1)
{
echo "There are no leads in Campagna DNC list: $group_id\n";
exit;
}
}
elseif ($download_type == 'fpgn')
{
##### Filter Phone Group list validation #####
$event_code_type='FILTER PHONE GROUP';
$stmt="select count(*) from vicidial_filter_phone_groups where filter_phone_group_id='$group_id';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$lists_allowed =$row[0];
$i++;
}
if ($lists_allowed < 1)
{
echo "You are not allowed to download this list: $group_id\n";
exit;
}
$stmt="select count(*) from vicidial_filter_phone_numbers where filter_phone_group_id='$group_id';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$leads_count =$row[0];
$i++;
}
if ($leads_count < 1)
{
echo "There are no leads in this filter phone gruppo: $group_id\n";
exit;
}
}
else
{
##### list download validation #####
$event_code_type='LIST';
$stmt="select count(*) from vicidial_lists where list_id='$list_id' $LOGallowed_campaignsSQL;";
if ($list_id=='ALL-LISTE')
{$stmt="select count(*) from vicidial_lists where list_id > 0 $LOGallowed_campaignsSQL;";}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$lists_allowed =$row[0];
$i++;
}
if ($lists_allowed < 1)
{
echo "You are not allowed to download this list: $list_id\n";
exit;
}
$stmt="select count(*) from vicidial_list where list_id='$list_id';";
if ($list_id=='ALL-LISTE')
{$stmt="select count(*) from vicidial_list where list_id > 0;";}
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$count_to_print = mysql_num_rows($rslt);
if ($count_to_print > 0)
{
$row=mysql_fetch_row($rslt);
$leads_count =$row[0];
$i++;
}
if ($leads_count < 1)
{
echo "There are no leads in list_id: $list_id\n";
exit;
}
}
$US='_';
$MT[0]='';
$ip = getenv("REMOTE_ADDR");
@@ -90,16 +278,41 @@ if (!isset($group)) {$group = '';}
if (!isset($query_date)) {$query_date = $NOW_DATE;}
if (!isset($end_date)) {$end_date = $NOW_DATE;}
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|$stmtA|";
$SQL_log = ereg_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='LEADS', event_type='EXPORT', record_id='$list_id', event_code='ADMIN EXPORT LIST', event_sql=\"$SQL_log\", event_notes='';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$TXTfilename = "LIST_$list_id$US$FILE_TIME.txt";
if ($download_type == 'systemdnc')
{
$TXTfilename = "SYSTEM_DNC_$FILE_TIME.txt";
$header_row = "phone_number";
$header_columns='';
$stmt="select phone_number from vicidial_dnc;";
}
elseif ($download_type == 'dnc')
{
$TXTfilename = "DNC_$group_id$US$FILE_TIME.txt";
$header_row = "phone_number";
$header_columns='';
$stmt="select phone_number from vicidial_campaign_dnc where campaign_id='$group_id';";
}
elseif ($download_type == 'fpgn')
{
$TXTfilename = "FPGN_$group_id$US$FILE_TIME.txt";
$header_row = "phone_number";
$header_columns='';
$stmt="select phone_number from vicidial_filter_phone_numbers where filter_phone_group_id='$group_id';";
}
else
{
$TXTfilename = "LIST_$list_id$US$FILE_TIME.txt";
$list_id_header='';
$stmt="select lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where list_id='$list_id';";
if ($list_id=='ALL-LISTE')
{
$list_id_header="list_id\t";
$stmt="select list_id,lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where list_id > 0;";
}
$header_row = $list_id_header . "lead_id\tentry_date\tmodify_date\tstatus\tuser\tvendor_lead_code\tsource_id\tlist_id\tgmt_offset_now\tcalled_since_last_reset\tphone_code\tphone_number\ttitle\tfirst_name\tmiddle_initial\tlast_name\taddress1\taddress2\taddress3\tcity\tstate\tprovince\tpostal_code\tcountry_code\tgender\tdate_of_birth\talt_phone\temail\tsecurity_phrase\tcomments\tcalled_count\tlast_local_call_time\trank\towner";
$header_columns='';
}
// We'll be outputting a TXT file
header('Content-type: application/octet-stream');
@@ -112,7 +325,8 @@ header('Pragma: public');
ob_clean();
flush();
$stmt="select lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner from vicidial_list where list_id='$list_id';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$leads_to_print = mysql_num_rows($rslt);
@@ -121,9 +335,166 @@ while ($i < $leads_to_print)
{
$row=mysql_fetch_row($rslt);
$row[29] = preg_replace("/\n|\r/",'!N',$row[29]);
if ( ($download_type == 'systemdnc') or ($download_type == 'dnc') or ($download_type == 'fpgn') )
{
$row_data[$i] .= "$row[0]";
}
else
{
$row[29] = preg_replace("/\n|\r/",'!N',$row[29]);
echo "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]\r\n";
if ($list_id=='ALL-LISTE')
{
$row_data[$i] .= "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]\t$row[34]";
$export_list_id[$i] = $row[0];
$export_lead_id[$i] = $row[1];
}
else
{
$row_data[$i] .= "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]";
$export_list_id[$i] = $list_id;
$export_lead_id[$i] = $row[0];
}
}
$i++;
}
$ch=0;
if ( ($custom_fields_enabled > 0) and ($event_code_type=='LIST') )
{
$valid_custom_table=0;
if ($list_id=='ALL-LISTE')
{
$stmtA = "SELECT list_id from vicidial_lists;";
$rslt=mysql_query($stmtA, $link);
if ($DB) {echo "$stmtA\n";}
$lists_ct = mysql_num_rows($rslt);
$u=0;
while ($lists_ct > $u)
{
$row=mysql_fetch_row($rslt);
$custom_list_id[$u] = $row[0];
$u++;
}
$u=0;
while ($lists_ct > $u)
{
$stmt="MOSTRA TABELLAS LIKE \"custom_$custom_list_id[$u]\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
$custom_tablecount[$u] = $tablecount_to_print;
$u++;
}
$u=0;
while ($lists_ct > $u)
{
$custom_columns[$u]=0;
if ($custom_tablecount[$u] > 0)
{
$stmtA = "describe custom_$custom_list_id[$u];";
$rslt=mysql_query($stmtA, $link);
if ($DB) {echo "$stmtA\n";}
$columns_ct = mysql_num_rows($rslt);
$custom_columns[$u] = $columns_ct;
}
if ($DB) {echo "$custom_list_id[$u]|$custom_tablecount[$u]|$custom_columns[$u]\n";}
$u++;
}
$valid_custom_table=1;
}
else
{
$stmt="MOSTRA TABELLAS LIKE \"custom_$list_id\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmtA = "describe custom_$list_id;";
$rslt=mysql_query($stmtA, $link);
if ($DB) {echo "$stmtA\n";}
$columns_ct = mysql_num_rows($rslt);
$u=0;
while ($columns_ct > $u)
{
$row=mysql_fetch_row($rslt);
$column = $row[0];
if ($u > 0)
{$header_columns .= "\t$column";}
$u++;
}
if ($columns_ct > 1)
{
$valid_custom_table=1;
}
}
}
if ($valid_custom_table > 0)
{
$i=0;
while ($i < $leads_to_print)
{
if ($list_id=='ALL-LISTE')
{
$valid_custom_table=0;
$u=0;
while ($lists_ct > $u)
{
if ( ($export_list_id[$i] == "$custom_list_id[$u]") and ($custom_columns[$u] > 1) )
{
$valid_custom_table=1;
$columns_ct = $custom_columns[$u];
}
$u++;
}
}
if ($valid_custom_table > 0)
{
$stmtA = "SELECT * from custom_$export_list_id[$i] where lead_id='$export_lead_id[$i]' limit 1;";
$rslt=mysql_query($stmtA, $link);
if ($DB) {echo "$columns_ct|$stmtA\n";}
$customfield_ct = mysql_num_rows($rslt);
if ($customfield_ct > 0)
{
$row=mysql_fetch_row($rslt);
$t=1;
while ($columns_ct > $t)
{
$custom_data[$i] .= "\t$row[$t]";
if ($ch <= $t)
{
$ch++;
$header_columns .= "\tcustom$ch";
}
$t++;
}
}
$custom_data[$i] = preg_replace("/\r\n/",'!N',$custom_data[$i]);
$custom_data[$i] = preg_replace("/\n/",'!N',$custom_data[$i]);
}
$i++;
}
}
}
### LOG INSERTION Admin Log Table ###
$SQL_log = "$stmt|$stmtA|";
$SQL_log = ereg_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='LEADS', event_type='EXPORT', record_id='$list_id', event_code='ADMIN EXPORT $event_code_type', event_sql=\"$SQL_log\", event_notes='';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
echo "$header_row$header_columns\r\n";
$i=0;
while ($i < $leads_to_print)
{
echo "$row_data[$i]$custom_data[$i]\r\n";
$i++;
}
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
# listloader.pl version 2.2.0
# listloader.pl version 2.4
#
# Copyright (C) 2010 Matt Florell,Joe Johnson <vicidial@gmail.com> LICENSE: AGPLv2
#
@@ -22,6 +22,8 @@
# 90721-1425 - Added rank and owner as vicidial_list fields
# 91112-0616 - Added title/alt-phone duplicate checking
# 100118-0537 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# 100630-1609 - Added a check for invalid ListIds and filtered out ' " ; ` \ from the field <mikec>
# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
#
### begin parsing run-time options ###
@@ -271,6 +273,38 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
$oWkC = $oWkS->{Cells}[$iR][24];
if ($oWkC) {$owner=$oWkC->Value; }
$entry_date =~ s/\'|\\|\"|;|\`|\224//gi;
$modify_date =~ s/\'|\\|\"|;|\`|\224//gi;
$status =~ s/\'|\\|\"|;|\`|\224//gi;
$user =~ s/\'|\\|\"|;|\`|\224//gi;
$vendor_lead_code =~ s/\'|\\|\"|;|\`|\224//gi;
$source_id =~ s/\'|\\|\"|;|\`|\224//gi;
$list_id =~ s/\'|\\|\"|;|\`|\224//gi;
$gmt_offset =~ s/\'|\\|\"|;|\`|\224//gi;
$called_since_last_reset =~ s/\'|\\|\"|;|\`|\224//gi;
$phone_code =~ s/\'|\\|\"|;|\`|\224//gi;
$phone_number =~ s/\'|\\|\"|;|\`|\224//gi;
$title =~ s/\'|\\|\"|;|\`|\224//gi;
$first_name =~ s/\'|\\|\"|;|\`|\224//gi;
$middle_initial =~ s/\'|\\|\"|;|\`|\224//gi;
$last_name =~ s/\'|\\|\"|;|\`|\224//gi;
$address1 =~ s/\'|\\|\"|;|\`|\224//gi;
$address2 =~ s/\'|\\|\"|;|\`|\224//gi;
$address3 =~ s/\'|\\|\"|;|\`|\224//gi;
$city =~ s/\'|\\|\"|;|\`|\224//gi;
$state =~ s/\'|\\|\"|;|\`|\224//gi;
$province =~ s/\'|\\|\"|;|\`|\224//gi;
$postal_code =~ s/\'|\\|\"|;|\`|\224//gi;
$country =~ s/\'|\\|\"|;|\`|\224//gi;
$gender =~ s/\'|\\|\"|;|\`|\224//gi;
$date_of_birth =~ s/\'|\\|\"|;|\`|\224//gi;
$alt_phone =~ s/\'|\\|\"|;|\`|\224//gi;
$email =~ s/\'|\\|\"|;|\`|\224//gi;
$security_phrase =~ s/\'|\\|\"|;|\`|\224//gi;
$comments =~ s/\'|\\|\"|;|\`|\224//gi;
$rank =~ s/\'|\\|\"|;|\`|\224//gi;
$owner =~ s/\'|\\|\"|;|\`|\224//gi;
if (length($forcelistid) > 0)
{
$list_id = $forcelistid; # set list_id to override value
@@ -426,7 +460,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
}
}
if ( (length($phone_number)>6) && ($dup_lead < 1) )
if ( (length($phone_number)>6) && ($dup_lead < 1) && ($list_id >= 100)
{
if ( ($duptapchecklist > 0) || ($duptapchecksys > 0) )
{$phone_list .= "$alt_phone$title$US$list_id|";}
@@ -640,20 +674,30 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
$affected_rows = $dbhA->do($stmtZ);
print STMT_FILE $stmtZ."\r\n";
$multistmt='';
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),";
$multi_insert_counter++;
}
$good++;
} else {
if ($bad < 10000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list</font><b>\n";}
if ($bad < 1000000)
{
if ( $list_id < 100 )
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| INVALID LIST ID</font><b>\n";
}
else
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";
}
}
$bad++;
}
$total++;
@@ -666,7 +710,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
}
if ($multi_insert_counter > 0) {
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values ".substr($multistmt, 0, -1).";";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values ".substr($multistmt, 0, -1).";";
$affected_rows = $dbhA->do($stmtZ);
print STMT_FILE $stmtZ."\r\n";
}
@@ -21,6 +21,8 @@
# 90721-1341 - Added rank and owner as vicidial_list fields
# 91112-0616 - Added title/alt-phone duplicate checking
# 100118-0539 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# 100630-1609 - Added a check for invalid ListIds and filtered out ' " ; ` \ from the field <mikec>
# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
#
### begin parsing run-time options ###
@@ -271,7 +273,37 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
$oWkC = $oWkS->{Cells}[$iR][$xls_fields[24]];
if ($oWkC) {$owner=$oWkC->Value; }
$entry_date =~ s/\'|\\|\"|;|\`|\224//gi;
$modify_date =~ s/\'|\\|\"|;|\`|\224//gi;
$status =~ s/\'|\\|\"|;|\`|\224//gi;
$user =~ s/\'|\\|\"|;|\`|\224//gi;
$vendor_lead_code =~ s/\'|\\|\"|;|\`|\224//gi;
$source_id =~ s/\'|\\|\"|;|\`|\224//gi;
$list_id =~ s/\'|\\|\"|;|\`|\224//gi;
$gmt_offset =~ s/\'|\\|\"|;|\`|\224//gi;
$called_since_last_reset =~ s/\'|\\|\"|;|\`|\224//gi;
$phone_code =~ s/\'|\\|\"|;|\`|\224//gi;
$phone_number =~ s/\'|\\|\"|;|\`|\224//gi;
$title =~ s/\'|\\|\"|;|\`|\224//gi;
$first_name =~ s/\'|\\|\"|;|\`|\224//gi;
$middle_initial =~ s/\'|\\|\"|;|\`|\224//gi;
$last_name =~ s/\'|\\|\"|;|\`|\224//gi;
$address1 =~ s/\'|\\|\"|;|\`|\224//gi;
$address2 =~ s/\'|\\|\"|;|\`|\224//gi;
$address3 =~ s/\'|\\|\"|;|\`|\224//gi;
$city =~ s/\'|\\|\"|;|\`|\224//gi;
$state =~ s/\'|\\|\"|;|\`|\224//gi;
$province =~ s/\'|\\|\"|;|\`|\224//gi;
$postal_code =~ s/\'|\\|\"|;|\`|\224//gi;
$country =~ s/\'|\\|\"|;|\`|\224//gi;
$gender =~ s/\'|\\|\"|;|\`|\224//gi;
$date_of_birth =~ s/\'|\\|\"|;|\`|\224//gi;
$alt_phone =~ s/\'|\\|\"|;|\`|\224//gi;
$email =~ s/\'|\\|\"|;|\`|\224//gi;
$security_phrase =~ s/\'|\\|\"|;|\`|\224//gi;
$comments =~ s/\'|\\|\"|;|\`|\224//gi;
$rank =~ s/\'|\\|\"|;|\`|\224//gi;
$owner =~ s/\'|\\|\"|;|\`|\224//gi;
if (length($forcelistid) > 0)
{
@@ -428,7 +460,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
}
}
if ( (length($phone_number)>6) && ($dup_lead < 1) )
if ( (length($phone_number)>6) && ($dup_lead < 1) && ($list_id >= 100))
{
if ( ($duptapchecklist > 0) || ($duptapchecksys > 0) )
{$phone_list .= "$alt_phone$title$US$list_id|";}
@@ -642,21 +674,31 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
$affected_rows = $dbhA->do($stmtZ);
print STMT_FILE $stmtZ."\r\n";
$multistmt='';
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),";
$multi_insert_counter++;
}
$good++;
} else {
if ($bad < 10000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| $dup_lead_list</font><b>\n";}
$bad++;
if ($bad < 1000000)
{
if ( $list_id < 100 )
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| INVALID LIST ID</font><b>\n";
}
else
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";
}
}
$bad++;
}
$total++;
if ($total%100==0) {
@@ -668,7 +710,7 @@ foreach $oWkS (@{$oBook->{Worksheet}}) {
}
if ($multi_insert_counter > 0) {
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values ".substr($multistmt, 0, -1).";";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values ".substr($multistmt, 0, -1).";";
$affected_rows = $dbhA->do($stmtZ);
print STMT_FILE $stmtZ."\r\n";
}
@@ -30,11 +30,15 @@
# 90721-1339 - Added rank and owner as vicidial_list fields
# 91112-0616 - Added title/alt-phone duplicate checking
# 100118-0543 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# 100621-1026 - Added admin_web_directory variable
# 100630-1609 - Added a check for invalid ListIds and filtered out ' " ; ` \ from the field <mikec>
# 100705-1507 - Added custom fields to field chooser, only when liast_id_override is used and only with TXT and CSV file formats
# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
#
# make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time.
$version = '2.2.0-34';
$build = '100118-0543';
$version = '2.4-37';
$build = '100712-1416';
require("dbconnect.php");
@@ -127,22 +131,28 @@ if (isset($_GET["postalgmt"])) {$postalgmt=$_GET["postalgmt"];}
if (isset($_GET["phone_code_override"])) {$phone_code_override=$_GET["phone_code_override"];}
elseif (isset($_POST["phone_code_override"])) {$phone_code_override=$_POST["phone_code_override"];}
$phone_code_override = (preg_replace("/\D/","",$phone_code_override));
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
# $country_field=$_GET["country_field"]; if (!$country_field) {$country_field=$_POST["country_field"];}
### REGEX to prevent weird characters from ending up in the fields
$field_regx = "['\"`\\;]";
$vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|entry_list_id|';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,admin_web_directory,custom_fields_enabled FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
$i=0;
while ($i < $qm_conf_ct)
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$i++;
$non_latin = $row[0];
$admin_web_directory = $row[1];
$custom_fields_enabled = $row[2];
}
##### END SETTINGS LOOKUP #####
###########################################
@@ -348,6 +358,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
<form action=<?php echo $PHP_SELF ?> method=post onSubmit="ParseFileName()" enctype="multipart/form-data">
<input type=hidden name='leadfile_name' value="<?php echo $leadfile_name ?>">
<input type=hidden name='DB' value="<?php echo $DB ?>">
<?php if ($file_layout!="custom") { ?>
<table align=center width="700" border=0 cellpadding=5 cellspacing=0 bgcolor=#D9E6FE>
<tr>
@@ -384,7 +395,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
<tr>
<td align=center colspan=2><input type=submit value="INVIA" name='submit_file'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=button onClick="javascript:document.location='new_listloader_superL.php'" value="RICOMINCIA" name='reload_page'></td>
</tr>
<tr><td align=left><font size=1> &nbsp; &nbsp; &nbsp; &nbsp; <a href="admin.php?ADD=100" target="_parent">TORNA AD AMMINISTRAZIONE</a></font></td><td align=right><font size=1>LIST LOADER- &nbsp; &nbsp; VERSIONE: <?php echo $version ?> &nbsp; &nbsp; BUILD: <?php echo $build ?> &nbsp; &nbsp; </td></tr>
<tr><td align=left><font size=1> &nbsp; &nbsp; &nbsp; &nbsp; <a href="admin.php?ADD=100" target="_parent">TORNA AD AMMINISTRAZIONE</a> &nbsp; &nbsp; &nbsp; &nbsp; <a href="./admin_listloader_third_gen.php">3rd Gen Lead Loader</a> &nbsp; &nbsp; </font></td><td align=right><font size=1>LIST LOADER- &nbsp; &nbsp; VERSIONE: <?php echo $version ?> &nbsp; &nbsp; BUILD: <?php echo $build ?> &nbsp; &nbsp; </td></tr>
</table>
<?php } ?>
@@ -409,7 +420,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";}
$field_check=explode($delimiter, $buffer);
if (count($field_check)>=5) {
if (count($field_check)>=2) {
flush();
$file=fopen("$lead_file", "r");
print "<center><font face='arial, helvetica' size=3 color='#009900'><B>Elaborazione in corso$delim_name-delimited file...\n";
@@ -445,7 +456,6 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$called_since_last_reset='N';
$phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]);
$phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]);
$USarea = substr($phone_number, 0, 3);
$title = $row[$title_field];
$first_name = $row[$first_name_field];
$middle_initial = $row[$middle_initial_field];
@@ -466,6 +476,36 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$comments = trim($row[$comments_field]);
$rank = $row[$rank_field];
$owner = $row[$owner_field];
# replace ' " ` \ ; with nothing
$vendor_lead_code = eregi_replace($field_regx, "", $vendor_lead_code);
$source_code = eregi_replace($field_regx, "", $source_code);
$source_id = eregi_replace($field_regx, "", $source_id);
$list_id = eregi_replace($field_regx, "", $list_id);
$phone_code = eregi_replace($field_regx, "", $phone_code);
$phone_number = eregi_replace($field_regx, "", $phone_number);
$title = eregi_replace($field_regx, "", $title);
$first_name = eregi_replace($field_regx, "", $first_name);
$middle_initial = eregi_replace($field_regx, "", $middle_initial);
$last_name = eregi_replace($field_regx, "", $last_name);
$address1 = eregi_replace($field_regx, "", $address1);
$address2 = eregi_replace($field_regx, "", $address2);
$address3 = eregi_replace($field_regx, "", $address3);
$city = eregi_replace($field_regx, "", $city);
$state = eregi_replace($field_regx, "", $state);
$province = eregi_replace($field_regx, "", $province);
$postal_code = eregi_replace($field_regx, "", $postal_code);
$country_code = eregi_replace($field_regx, "", $country_code);
$gender = eregi_replace($field_regx, "", $gender);
$date_of_birth = eregi_replace($field_regx, "", $date_of_birth);
$alt_phone = eregi_replace($field_regx, "", $alt_phone);
$email = eregi_replace($field_regx, "", $email);
$security_phrase = eregi_replace($field_regx, "", $security_phrase);
$comments = eregi_replace($field_regx, "", $comments);
$rank = eregi_replace($field_regx, "", $rank);
$owner = eregi_replace($field_regx, "", $owner);
$USarea = substr($phone_number, 0, 3);
if (strlen($list_id_override)>0)
{
@@ -477,6 +517,69 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$phone_code = $phone_code_override;
}
##### BEGIN custom fields columns list ###
$custom_SQL='';
if ($custom_fields_enabled > 0)
{
$stmt="MOSTRA TABELLAS LIKE \"custom_$list_id_override\";";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmt="SELECT count(*) from vicidial_lists_fields where list_id='$list_id_override';";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$fieldscount_to_print = mysql_num_rows($rslt);
if ($fieldscount_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$custom_records_count = $rowx[0];
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id_override' order by field_rank,field_order,field_label;";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$A_field_label[$o] = $rowx[1];
$A_field_type[$o] = $rowx[6];
$A_field_value[$o] = '';
$field_name_id = $A_field_label[$o] . "_field";
if ($DB>0) {echo "$A_field_label[$o]|$A_field_type[$o]\n";}
if ( ($A_field_type[$o]!='DISPLAY') and ($A_field_type[$o]!='SCRIPT') )
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
if ($form_field_value >= 0)
{
$A_field_value[$o] = $row[$form_field_value];
# replace ' " ` \ ; with nothing
$A_field_value[$o] = eregi_replace($field_regx, "", $A_field_value[$o]);
$custom_SQL .= "$A_field_label[$o]='$A_field_value[$o]',";
}
}
}
$o++;
}
}
}
}
##### END custom fields columns list ###
$custom_SQL = preg_replace("/,$/","",$custom_SQL);
##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign #####
if (eregi("DUPCAMP",$dupcheck))
{
@@ -603,7 +706,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
}
if ( (strlen($phone_number)>6) and ($dup_lead<1) )
if ( (strlen($phone_number)>6) and ($dup_lead<1) and ($list_id >= 100 ))
{
if (strlen($phone_code)<1) {$phone_code = '1';}
@@ -614,23 +717,54 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code);
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');";
if (strlen($custom_SQL)>3)
{
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','$list_id');";
$rslt=mysql_query($stmtZ, $link);
$affected_rows = mysql_affected_rows($link);
$lead_id = mysql_insert_id($link);
if ($DB > 0) {echo "<!-- $affected_rows|$lead_id|$stmtZ -->";}
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
$multistmt='';
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),";
$multi_insert_counter++;
}
$custom_SQL_query = "INSERT INTO custom_$list_id_override SET lead_id='$lead_id',$custom_SQL;";
$rslt=mysql_query($custom_SQL_query, $link);
$affected_rows = mysql_affected_rows($link);
if ($DB > 0) {echo "<!-- $affected_rows|$custom_SQL_query -->";}
}
else
{
if ($multi_insert_counter > 8)
{
### insert good record into vicidial_list table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
$multistmt='';
$multi_insert_counter=0;
}
else
{
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),";
$multi_insert_counter++;
}
}
$good++;
} else {
if ($bad < 1000000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";}
if ($bad < 1000000)
{
if ( $list_id < 100 )
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| INVALID ID LISTA</font><b>\n";
}
else
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";
}
}
$bad++;
}
$total++;
@@ -642,7 +776,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
}
}
if ($multi_insert_counter!=0) {
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values".substr($multistmt, 0, -1).";";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";";
mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -666,7 +800,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
{
print "<BR><BR>SOVRASCRITTURA DEL CODICE TELEFONO PER QUESTO FILE: $phone_code_override<BR><BR>\n";
}
# print "|$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field,$rank_field,$owner_field, --forcelistid=$list_id_override --lead_file=$lead_file|";
# print "|$WeBServeRRooT/$admin_web_directory/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field,$rank_field,$owner_field, --forcelistid=$list_id_override --lead_file=$lead_file|";
$dupcheckCLI=''; $postalgmtCLI='';
if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';}
if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';}
@@ -674,13 +808,13 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
if (eregi("DUPTITLEALTPHONELIST",$dupcheck)) {$dupcheckCLI='--duplicate-tap-list-check';}
if (eregi("DUPTITLEALTPHONESYS",$dupcheck)) {$dupcheckCLI='--duplicate-tap-system-check';}
if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';}
passthru("$WeBServeRRooT/vicidial/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field,$rank_field,$owner_field, --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
passthru("$WeBServeRRooT/$admin_web_directory/listloader_super.pl $vendor_lead_code_field,$source_id_field,$list_id_field,$phone_code_field,$phone_number_field,$title_field,$first_name_field,$middle_initial_field,$last_name_field,$address1_field,$address2_field,$address3_field,$city_field,$state_field,$province_field,$postal_code_field,$country_code_field,$gender_field,$date_of_birth_field,$alt_phone_field,$email_field,$security_phrase_field,$comments_field,$rank_field,$owner_field, --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
} else {
# copy($leadfile, "./vicidial_temp_file.csv");
$file=fopen("$lead_file", "r");
if ($WeBRooTWritablE > 0)
{$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");}
{$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");}
print "<center><font face='arial, helvetica' size=3 color='#009900'><B>Elaborazione in corsoCSV file... \n";
if (strlen($list_id_override)>0)
@@ -708,7 +842,6 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$called_since_last_reset='N';
$phone_code = eregi_replace("[^0-9]", "", $row[$phone_code_field]);
$phone_number = eregi_replace("[^0-9]", "", $row[$phone_number_field]);
$USarea = substr($phone_number, 0, 3);
$title = $row[$title_field];
$first_name = $row[$first_name_field];
$middle_initial = $row[$middle_initial_field];
@@ -729,18 +862,112 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$comments = trim($row[$comments_field]);
$rank = $row[$rank_field];
$owner = $row[$owner_field];
# replace ' " ` \ ; with nothing
$vendor_lead_code = eregi_replace($field_regx, "", $vendor_lead_code);
$source_code = eregi_replace($field_regx, "", $source_code);
$source_id = eregi_replace($field_regx, "", $source_id);
$list_id = eregi_replace($field_regx, "", $list_id);
$phone_code = eregi_replace($field_regx, "", $phone_code);
$phone_number = eregi_replace($field_regx, "", $phone_number);
$title = eregi_replace($field_regx, "", $title);
$first_name = eregi_replace($field_regx, "", $first_name);
$middle_initial = eregi_replace($field_regx, "", $middle_initial);
$last_name = eregi_replace($field_regx, "", $last_name);
$address1 = eregi_replace($field_regx, "", $address1);
$address2 = eregi_replace($field_regx, "", $address2);
$address3 = eregi_replace($field_regx, "", $address3);
$city = eregi_replace($field_regx, "", $city);
$state = eregi_replace($field_regx, "", $state);
$province = eregi_replace($field_regx, "", $province);
$postal_code = eregi_replace($field_regx, "", $postal_code);
$country_code = eregi_replace($field_regx, "", $country_code);
$gender = eregi_replace($field_regx, "", $gender);
$date_of_birth = eregi_replace($field_regx, "", $date_of_birth);
$alt_phone = eregi_replace($field_regx, "", $alt_phone);
$email = eregi_replace($field_regx, "", $email);
$security_phrase = eregi_replace($field_regx, "", $security_phrase);
$comments = eregi_replace($field_regx, "", $comments);
$rank = eregi_replace($field_regx, "", $rank);
$owner = eregi_replace($field_regx, "", $owner);
$USarea = substr($phone_number, 0, 3);
if (strlen($rank)<1) {$rank='0';}
if (strlen($list_id_override)>0)
if (strlen($rank)<1) {$rank='0';}
if (strlen($list_id_override)>0)
{
$list_id = $list_id_override;
}
if (strlen($phone_code_override)>0)
{
$phone_code = $phone_code_override;
}
##### BEGIN custom fields columns list ###
$custom_SQL='';
if ($custom_fields_enabled > 0)
{
$list_id = $list_id_override;
}
if (strlen($phone_code_override)>0)
{
$phone_code = $phone_code_override;
}
$stmt="MOSTRA TABELLAS LIKE \"custom_$list_id_override\";";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmt="SELECT count(*) from vicidial_lists_fields where list_id='$list_id_override';";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$fieldscount_to_print = mysql_num_rows($rslt);
if ($fieldscount_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$custom_records_count = $rowx[0];
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id_override' order by field_rank,field_order,field_label;";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$A_field_label[$o] = $rowx[1];
$A_field_type[$o] = $rowx[6];
$A_field_value[$o] = '';
$field_name_id = $A_field_label[$o] . "_field";
if ($DB>0) {echo "$A_field_label[$o]|$A_field_type[$o]\n";}
if ( ($A_field_type[$o]!='DISPLAY') and ($A_field_type[$o]!='SCRIPT') )
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
if ($form_field_value >= 0)
{
$A_field_value[$o] = $row[$form_field_value];
# replace ' " ` \ ; with nothing
$A_field_value[$o] = eregi_replace($field_regx, "", $A_field_value[$o]);
$custom_SQL .= "$A_field_label[$o]='$A_field_value[$o]',";
}
}
}
$o++;
}
}
}
}
##### END custom fields columns list ###
$custom_SQL = preg_replace("/,$/","",$custom_SQL);
##### Check for duplicate phone numbers in vicidial_list table for all lists in a campaign #####
if (eregi("DUPCAMP",$dupcheck))
{
@@ -865,7 +1092,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
}
}
if ( (strlen($phone_number)>6) and ($dup_lead<1) )
if ( (strlen($phone_number)>6) and ($dup_lead<1) and ($list_id >= 100 ))
{
if (strlen($phone_code)<1) {$phone_code = '1';}
@@ -878,23 +1105,53 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
$gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code);
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
$multistmt='';
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),";
$multi_insert_counter++;
}
if (strlen($custom_SQL)>3)
{
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','$list_id');";
$rslt=mysql_query($stmtZ, $link);
$affected_rows = mysql_affected_rows($link);
$lead_id = mysql_insert_id($link);
if ($DB > 0) {echo "<!-- $affected_rows|$lead_id|$stmtZ -->";}
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
$multistmt='';
$custom_SQL_query = "INSERT INTO custom_$list_id_override SET lead_id='$lead_id',$custom_SQL;";
$rslt=mysql_query($custom_SQL_query, $link);
$affected_rows = mysql_affected_rows($link);
if ($DB > 0) {echo "<!-- $affected_rows|$custom_SQL_query -->";}
}
else
{
if ($multi_insert_counter > 8)
{
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
$multistmt='';
$multi_insert_counter=0;
}
else
{
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),";
$multi_insert_counter++;
}
}
$good++;
} else {
if ($bad < 1000000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
if ($bad < 1000000)
{
if ( $list_id < 100 )
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| INVALID ID LISTA</font><b>\n";
}
else
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";
}
}
$bad++;
}
$total++;
@@ -905,7 +1162,7 @@ echo "<TABLE CELLPADDING=4 CELLSPACING=0><TR><TD>";
}
}
if ($multi_insert_counter!=0) {
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values".substr($multistmt, 0, -1).";";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";";
mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -932,7 +1189,7 @@ if ($leadfile) {
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt");
copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.txt");
$lead_file = "./vicidial_temp_file.txt";
}
else
@@ -942,7 +1199,7 @@ if ($leadfile) {
}
$file=fopen("$lead_file", "r");
if ($WeBRooTWritablE > 0)
{$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");}
{$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");}
$buffer=fgets($file, 4096);
$tab_count=substr_count($buffer, "\t");
@@ -951,7 +1208,7 @@ if ($leadfile) {
if ($tab_count>$pipe_count) {$delimiter="\t"; $delim_name="tab";} else {$delimiter="|"; $delim_name="pipe";}
$field_check=explode($delimiter, $buffer);
if (count($field_check)>=5) {
if (count($field_check)>=2) {
flush();
$file=fopen("$lead_file", "r");
$total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list='';
@@ -985,7 +1242,6 @@ if ($leadfile) {
$called_since_last_reset='N';
$phone_code = eregi_replace("[^0-9]", "", $row[3]);
$phone_number = eregi_replace("[^0-9]", "", $row[4]);
$USarea = substr($phone_number, 0, 3);
$title = $row[5];
$first_name = $row[6];
$middle_initial = $row[7];
@@ -1006,6 +1262,36 @@ if ($leadfile) {
$comments = trim($row[22]);
$rank = $row[23];
$owner = $row[24];
# replace ' " ` \ ; with nothing
$vendor_lead_code = eregi_replace($field_regx, "", $vendor_lead_code);
$source_code = eregi_replace($field_regx, "", $source_code);
$source_id = eregi_replace($field_regx, "", $source_id);
$list_id = eregi_replace($field_regx, "", $list_id);
$phone_code = eregi_replace($field_regx, "", $phone_code);
$phone_number = eregi_replace($field_regx, "", $phone_number);
$title = eregi_replace($field_regx, "", $title);
$first_name = eregi_replace($field_regx, "", $first_name);
$middle_initial = eregi_replace($field_regx, "", $middle_initial);
$last_name = eregi_replace($field_regx, "", $last_name);
$address1 = eregi_replace($field_regx, "", $address1);
$address2 = eregi_replace($field_regx, "", $address2);
$address3 = eregi_replace($field_regx, "", $address3);
$city = eregi_replace($field_regx, "", $city);
$state = eregi_replace($field_regx, "", $state);
$province = eregi_replace($field_regx, "", $province);
$postal_code = eregi_replace($field_regx, "", $postal_code);
$country_code = eregi_replace($field_regx, "", $country_code);
$gender = eregi_replace($field_regx, "", $gender);
$date_of_birth = eregi_replace($field_regx, "", $date_of_birth);
$alt_phone = eregi_replace($field_regx, "", $alt_phone);
$email = eregi_replace($field_regx, "", $email);
$security_phrase = eregi_replace($field_regx, "", $security_phrase);
$comments = eregi_replace($field_regx, "", $comments);
$rank = eregi_replace($field_regx, "", $rank);
$owner = eregi_replace($field_regx, "", $owner);
$USarea = substr($phone_number, 0, 3);
if (strlen($list_id_override)>0)
{
@@ -1140,7 +1426,7 @@ if ($leadfile) {
}
}
if ( (strlen($phone_number)>6) and ($dup_lead<1) )
if ( (strlen($phone_number)>6) and ($dup_lead<1) and ($list_id >= 100 ))
{
if (strlen($phone_code)<1) {$phone_code = '1';}
@@ -1155,7 +1441,7 @@ if ($leadfile) {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -1163,13 +1449,23 @@ if ($leadfile) {
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),";
$multi_insert_counter++;
}
$good++;
} else {
if ($bad < 1000000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
if ($bad < 1000000)
{
if ( $list_id < 100 )
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| INVALID ID LISTA</font><b>\n";
}
else
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";
}
}
$bad++;
}
$total++;
@@ -1181,7 +1477,7 @@ if ($leadfile) {
}
}
if ($multi_insert_counter!=0) {
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values".substr($multistmt, 0, -1).";";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";";
mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -1196,8 +1492,8 @@ if ($leadfile) {
{
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls");
$lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls";
copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.xls");
$lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.xls";
}
else
{
@@ -1206,7 +1502,7 @@ if ($leadfile) {
}
$file=fopen("$lead_file", "r");
# echo "|$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --lead-file=$lead_file|";
# echo "|$WeBServeRRooT/$admin_web_directory/listloader.pl --forcelistid=$list_id_override --lead-file=$lead_file|";
$dupcheckCLI=''; $postalgmtCLI='';
if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';}
if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';}
@@ -1214,15 +1510,15 @@ if ($leadfile) {
if (eregi("DUPTITLEALTPHONELIST",$dupcheck)) {$dupcheckCLI='--duplicate-tap-list-check';}
if (eregi("DUPTITLEALTPHONESYS",$dupcheck)) {$dupcheckCLI='--duplicate-tap-system-check';}
if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';}
passthru("$WeBServeRRooT/vicidial/listloader.pl --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
passthru("$WeBServeRRooT/$admin_web_directory/listloader.pl --forcelistid=$list_id_override --forcephonecode=$phone_code_override --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
}
else
{
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv");
$lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv";
copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.csv");
$lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.csv";
}
else
{
@@ -1231,7 +1527,7 @@ if ($leadfile) {
}
$file=fopen("$lead_file", "r");
if ($WeBRooTWritablE > 0)
{$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");}
{$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");}
print "<center><font face='arial, helvetica' size=3 color='#009900'><B>Elaborazione in corsoCSV file... \n";
@@ -1258,7 +1554,6 @@ if ($leadfile) {
$called_since_last_reset='N';
$phone_code = eregi_replace("[^0-9]", "", $row[3]);
$phone_number = eregi_replace("[^0-9]", "", $row[4]);
$USarea = substr($phone_number, 0, 3);
$title = $row[5];
$first_name = $row[6];
$middle_initial = $row[7];
@@ -1279,6 +1574,36 @@ if ($leadfile) {
$comments = trim($row[22]);
$rank = $row[23];
$owner = $row[24];
# replace ' " ` \ ; with nothing
$vendor_lead_code = eregi_replace($field_regx, "", $vendor_lead_code);
$source_code = eregi_replace($field_regx, "", $source_code);
$source_id = eregi_replace($field_regx, "", $source_id);
$list_id = eregi_replace($field_regx, "", $list_id);
$phone_code = eregi_replace($field_regx, "", $phone_code);
$phone_number = eregi_replace($field_regx, "", $phone_number);
$title = eregi_replace($field_regx, "", $title);
$first_name = eregi_replace($field_regx, "", $first_name);
$middle_initial = eregi_replace($field_regx, "", $middle_initial);
$last_name = eregi_replace($field_regx, "", $last_name);
$address1 = eregi_replace($field_regx, "", $address1);
$address2 = eregi_replace($field_regx, "", $address2);
$address3 = eregi_replace($field_regx, "", $address3);
$city = eregi_replace($field_regx, "", $city);
$state = eregi_replace($field_regx, "", $state);
$province = eregi_replace($field_regx, "", $province);
$postal_code = eregi_replace($field_regx, "", $postal_code);
$country_code = eregi_replace($field_regx, "", $country_code);
$gender = eregi_replace($field_regx, "", $gender);
$date_of_birth = eregi_replace($field_regx, "", $date_of_birth);
$alt_phone = eregi_replace($field_regx, "", $alt_phone);
$email = eregi_replace($field_regx, "", $email);
$security_phrase = eregi_replace($field_regx, "", $security_phrase);
$comments = eregi_replace($field_regx, "", $comments);
$rank = eregi_replace($field_regx, "", $rank);
$owner = eregi_replace($field_regx, "", $owner);
$USarea = substr($phone_number, 0, 3);
if (strlen($list_id_override)>0)
{
@@ -1413,7 +1738,7 @@ if ($leadfile) {
}
}
if ( (strlen($phone_number)>6) and ($dup_lead<1) )
if ( (strlen($phone_number)>6) and ($dup_lead<1) and ($list_id >= 100 ))
{
if (strlen($phone_code)<1) {$phone_code = '1';}
@@ -1427,7 +1752,7 @@ if ($leadfile) {
if ($multi_insert_counter > 8) {
### insert good deal into pending_transactions table ###
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner');";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');";
$rslt=mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -1435,13 +1760,23 @@ if ($leadfile) {
$multi_insert_counter=0;
} else {
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner'),";
$multistmt .= "('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0'),";
$multi_insert_counter++;
}
$good++;
} else {
if ($bad < 1000000) {print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead</font><b>\n";}
if ($bad < 1000000)
{
if ( $list_id < 100 )
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| INVALID ID LISTA</font><b>\n";
}
else
{
print "<BR></b><font size=1 color=red>record $total BAD- PHONE: $phone_number ROW: |$row[0]| DUP: $dup_lead $dup_lead_list</font><b>\n";
}
}
$bad++;
}
$total++;
@@ -1452,7 +1787,7 @@ if ($leadfile) {
}
}
if ($multi_insert_counter!=0) {
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner) values".substr($multistmt, 0, -1).";";
$stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";";
mysql_query($stmtZ, $link);
if ($WeBRooTWritablE > 0)
{fwrite($stmt_file, $stmtZ."\r\n");}
@@ -1464,6 +1799,7 @@ if ($leadfile) {
print "<script language='JavaScript1.2'>document.forms[0].leadfile.disabled=false; document.forms[0].submit_file.disabled=false; document.forms[0].reload_page.disabled=false;</script>";
} else {
##### BEGIN field chooser #####
print "<script language='JavaScript1.2'>document.forms[0].leadfile.disabled=true; document.forms[0].submit_file.disabled=true; document.forms[0].reload_page.disabled=true;</script><HR>";
flush();
print "<table border=0 cellpadding=3 cellspacing=0 width=700 align=center>\r\n";
@@ -1472,15 +1808,67 @@ if ($leadfile) {
print " <th><font class='standard' color='white'>Dati File</font></th>\r\n";
print " </tr>\r\n";
$rslt=mysql_query("select vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, rank, owner from vicidial_list limit 1", $link);
$fields_stmt = "SELECT vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, rank, owner from vicidial_list limit 1";
##### BEGIN custom fields columns list ###
if ($custom_fields_enabled > 0)
{
$stmt="MOSTRA TABELLAS LIKE \"custom_$list_id_override\";";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$stmt="SELECT count(*) from vicidial_lists_fields where list_id='$list_id_override';";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$fieldscount_to_print = mysql_num_rows($rslt);
if ($fieldscount_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$custom_records_count = $rowx[0];
$custom_SQL='';
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id_override' order by field_rank,field_order,field_label;";
if ($DB>0) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $link);
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$rowx=mysql_fetch_row($rslt);
$A_field_label[$o] = $rowx[1];
$A_field_type[$o] = $rowx[6];
if ($DB>0) {echo "$A_field_label[$o]|$A_field_type[$o]\n";}
if ( ($A_field_type[$o]!='DISPLAY') and ($A_field_type[$o]!='SCRIPT') )
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
$custom_SQL .= ",$A_field_label[$o]";
}
}
$o++;
}
$fields_stmt = "SELECT vendor_lead_code, source_id, list_id, phone_code, phone_number, title, first_name, middle_initial, last_name, address1, address2, address3, city, state, province, postal_code, country_code, gender, date_of_birth, alt_phone, email, security_phrase, comments, rank, owner $custom_SQL from vicidial_list, custom_$list_id_override limit 1";
}
}
}
##### END custom fields columns list ###
$rslt=mysql_query("$fields_stmt", $link);
if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name))
{
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.txt");
$lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.txt";
copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.txt");
$lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.txt";
}
else
{
@@ -1489,7 +1877,7 @@ if ($leadfile) {
}
$file=fopen("$lead_file", "r");
if ($WeBRooTWritablE > 0)
{$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");}
{$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");}
$buffer=fgets($file, 4096);
$tab_count=substr_count($buffer, "\t");
@@ -1538,8 +1926,8 @@ if ($leadfile) {
{
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.xls");
$lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.xls";
copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.xls");
$lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.xls";
}
else
{
@@ -1547,7 +1935,7 @@ if ($leadfile) {
$lead_file = "/tmp/vicidial_temp_file.xls";
}
# echo "|$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file|";
# echo "|$WeBServeRRooT/$admin_web_directory/listloader_rowdisplay.pl --lead-file=$lead_file|";
$dupcheckCLI=''; $postalgmtCLI='';
if (eregi("DUPLIST",$dupcheck)) {$dupcheckCLI='--duplicate-check';}
if (eregi("DUPCAMP",$dupcheck)) {$dupcheckCLI='--duplicate-campaign-check';}
@@ -1555,14 +1943,14 @@ if ($leadfile) {
if (eregi("DUPTITLEALTPHONELIST",$dupcheck)) {$dupcheckCLI='--duplicate-tap-list-check';}
if (eregi("DUPTITLEALTPHONESYS",$dupcheck)) {$dupcheckCLI='--duplicate-tap-system-check';}
if (eregi("POSTAL",$postalgmt)) {$postalgmtCLI='--postal-code-gmt';}
passthru("$WeBServeRRooT/vicidial/listloader_rowdisplay.pl --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
passthru("$WeBServeRRooT/$admin_web_directory/listloader_rowdisplay.pl --lead-file=$lead_file $postalgmtCLI $dupcheckCLI");
}
else
{
if ($WeBRooTWritablE > 0)
{
copy($LF_path, "$WeBServeRRooT/vicidial/vicidial_temp_file.csv");
$lead_file = "$WeBServeRRooT/vicidial/vicidial_temp_file.csv";
copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.csv");
$lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.csv";
}
else
{
@@ -1572,7 +1960,7 @@ if ($leadfile) {
$file=fopen("$lead_file", "r");
if ($WeBRooTWritablE > 0)
{$stmt_file=fopen("$WeBServeRRooT/vicidial/listloader_stmts.txt", "w");}
{$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");}
print "<center><font face='arial, helvetica' size=3 color='#009900'><B>Elaborazione in corsoCSV file... \n";
@@ -1617,6 +2005,8 @@ if ($leadfile) {
print "</table>\r\n";
# }
print "<script language='JavaScript1.2'>document.forms[0].leadfile.disabled=false; document.forms[0].submit_file.disabled=false; document.forms[0].reload_page.disabled=false;</script>";
##### END field chooser #####
}
#} else if (filesize($leadfile)>8388608) {
# print "<center><font face='arial, helvetica' size=3 color='#990000'><B>ERROR: File exceeds the 8MB limit.</B></font></center>";
@@ -1638,7 +2028,7 @@ exit;
function lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code)
{
require("dbconnect.php");
global $link;
$postalgmt_found=0;
if ( (eregi("POSTAL",$postalgmt)) && (strlen($postal_code)>4) )
@@ -9,7 +9,7 @@
# required variables:
# - $user
# - $pass
# - $function - ('add_lead','version')
# - $function - ('add_lead','update_lead','version','sounds_list','moh_list','vm_list','blind_monitor','agent_ingroup_info')
# - $source - ('vtiger','webform','adminweb')
# - $format - ('text','debug')
@@ -31,10 +31,16 @@
# 91203-1140 - Added agent_ingroup_info feature
# 91216-0331 - Added duplication check features to add_lead function
# 100118-0543 - Added new Australian and New Zealand DST schemes (FSO-FSA and LSS-FSA)
# 100704-1148 - Added custom fields inserts to the add_lead function
# 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any
# 100718-0245 - Added update_lead function to update existing leads
# 100723-1333 - Added no_update option to the update_lead function
# 100728-1952 - Added delete_lead option to the update_lead function
# 100924-1403 - Added called_count as an update_lead option
#
$version = '2.2.0-17';
$build = '100118-0543';
$version = '2.4-23';
$build = '100924-1403';
require("dbconnect.php");
@@ -129,6 +135,31 @@ if (isset($_GET["agent_user"])) {$agent_user=$_GET["agent_user"];}
elseif (isset($_POST["agent_user"])) {$agent_user=$_POST["agent_user"];}
if (isset($_GET["duplicate_check"])) {$duplicate_check=$_GET["duplicate_check"];}
elseif (isset($_POST["duplicate_check"])) {$duplicate_check=$_POST["duplicate_check"];}
if (isset($_GET["custom_fields"])) {$custom_fields=$_GET["custom_fields"];}
elseif (isset($_POST["custom_fields"])) {$custom_fields=$_POST["custom_fields"];}
if (isset($_GET["search_method"])) {$search_method=$_GET["search_method"];}
elseif (isset($_POST["search_method"])) {$search_method=$_POST["search_method"];}
if (isset($_GET["insert_if_not_found"])) {$insert_if_not_found=$_GET["insert_if_not_found"];}
elseif (isset($_POST["insert_if_not_found"])) {$insert_if_not_found=$_POST["insert_if_not_found"];}
if (isset($_GET["records"])) {$records=$_GET["records"];}
elseif (isset($_POST["records"])) {$records=$_POST["records"];}
if (isset($_GET["search_location"])) {$search_location=$_GET["search_location"];}
elseif (isset($_POST["search_location"])) {$search_location=$_POST["search_location"];}
if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
if (isset($_GET["user_field"])) {$user_field=$_GET["user_field"];}
elseif (isset($_POST["user_field"])) {$user_field=$_POST["user_field"];}
if (isset($_GET["list_id_field"])) {$list_id_field=$_GET["list_id_field"];}
elseif (isset($_POST["list_id_field"])) {$list_id_field=$_POST["list_id_field"];}
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
if (isset($_GET["no_update"])) {$no_update=$_GET["no_update"];}
elseif (isset($_POST["no_update"])) {$no_update=$_POST["no_update"];}
if (isset($_GET["delete_lead"])) {$delete_lead=$_GET["delete_lead"];}
elseif (isset($_POST["delete_lead"])) {$delete_lead=$_POST["delete_lead"];}
if (isset($_GET["called_count"])) {$called_count=$_GET["called_count"];}
elseif (isset($_POST["called_count"])) {$called_count=$_POST["called_count"];}
header ("Content-type: text/html; charset=utf-8");
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
@@ -136,13 +167,14 @@ header ("Pragma: no-cache"); // HTTP/1.0
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin FROM system_settings;";
$stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;";
$rslt=mysql_query($stmt, $link);
$qm_conf_ct = mysql_num_rows($rslt);
if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$non_latin = $row[0];
$custom_fields_enabled = $row[1];
}
##### END SETTINGS LOOKUP #####
###########################################
@@ -208,6 +240,17 @@ if ($non_latin < 1)
$rank = ereg_replace("[^0-9]","",$rank);
$owner = ereg_replace("[^-_0-9a-zA-Z]","",$owner);
$duplicate_check = ereg_replace("[^-_0-9a-zA-Z]","",$duplicate_check);
$custom_fields = ereg_replace("[^0-9a-zA-Z]","",$custom_fields);
$search_method = ereg_replace("[^-_0-9a-zA-Z]","",$search_method);
$insert_if_not_found = ereg_replace("[^A-Z]","",$insert_if_not_found);
$records = ereg_replace("[^0-9]","",$records);
$search_location = ereg_replace("[^A-Z]","",$search_location);
$user_field = ereg_replace("[^-_0-9a-zA-Z]","",$user_field);
$list_id_field = ereg_replace("[^0-9]","",$list_id_field);
$lead_id = ereg_replace("[^0-9]","",$lead_id);
$no_update = ereg_replace("[^A-Z]","",$no_update);
$delete_lead = ereg_replace("[^A-Z]","",$delete_lead);
$called_count=ereg_replace("[^0-9]","",$called_count);
}
else
{
@@ -216,12 +259,10 @@ else
$source = ereg_replace("'|\"|\\\\|;","",$source);
}
if (strlen($list_id)<1) {$list_id='999';}
if (strlen($phone_code)<1) {$phone_code='1';}
$USarea = substr($phone_number, 0, 3);
if (strlen($hopper_priority)<1) {$hopper_priority=0;}
if (strlen($gender)<1) {$gender='U';}
if (strlen($rank)<1) {$rank='0';}
if ($hopper_priority < -99) {$hopper_priority=-99;}
if ($hopper_priority > 99) {$hopper_priority=99;}
$StarTtime = date("U");
$NOW_DATE = date("Y-m-d");
@@ -233,6 +274,7 @@ $postalgmt='';
$api_script = 'non-agent';
$api_logging = 1;
$vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_now|called_since_last_reset|phone_code|phone_number|title|first_name|middle_initial|last_name|address1|address2|address3|city|state|province|postal_code|country_code|gender|date_of_birth|alt_phone|email|security_phrase|comments|called_count|last_local_call_time|rank|owner|';
$secX = date("U");
$hour = date("H");
@@ -1167,6 +1209,11 @@ if ($function == 'add_lead')
}
else
{
if (strlen($gender)<1) {$gender='U';}
if (strlen($rank)<1) {$rank='0';}
if (strlen($list_id)<3) {$list_id='999';}
if (strlen($phone_code)<1) {$phone_code='1';}
if ( (strlen($phone_number)<6) || (strlen($phone_number)>16) )
{
$result = 'ERROR';
@@ -1419,7 +1466,7 @@ if ($function == 'add_lead')
### insert a new lead in the system with this phone number
$stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='NEW',user='$user',vendor_lead_code='$vendor_lead_code',source_id='$source_id',gmt_offset_now='$gmt_offset',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',called_since_last_reset='N',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',rank='$rank',owner='$owner';";
$stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='NEW',user='$user',vendor_lead_code='$vendor_lead_code',source_id='$source_id',gmt_offset_now='$gmt_offset',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',called_since_last_reset='N',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',rank='$rank',owner='$owner',entry_list_id='0';";
if ($DB>0) {echo "DEBUG: add_lead query - $stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
@@ -1470,6 +1517,114 @@ if ($function == 'add_lead')
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
### BEGIN custom fields insert section ###
if ($custom_fields == 'Y')
{
if ($custom_fields_enabled > 0)
{
$stmt="SHOW TABLES LIKE \"custom_$list_id\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$CFinsert_SQL='';
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;";
$rslt=mysql_query($stmt, $link);
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$new_field_value='';
$form_field_value='';
$rowx=mysql_fetch_row($rslt);
$A_field_id[$o] = $rowx[0];
$A_field_label[$o] = $rowx[1];
$A_field_name[$o] = $rowx[2];
$A_field_type[$o] = $rowx[6];
$A_field_size[$o] = $rowx[8];
$A_field_max[$o] = $rowx[9];
$A_field_required[$o] = $rowx[12];
$A_field_value[$o] = '';
$field_name_id = $A_field_label[$o];
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
$A_field_value[$o] = $form_field_value;
if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') )
{
$A_field_value[$o]='----IGNORE----';
}
else
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
$CFinsert_SQL .= "$A_field_label[$o]='$A_field_value[$o]',";
}
}
$o++;
}
if (strlen($CFinsert_SQL)>3)
{
$CFinsert_SQL = preg_replace("/,$/","",$CFinsert_SQL);
$custom_table_update_SQL = "INSERT INTO custom_$list_id SET lead_id='$lead_id',$CFinsert_SQL;";
$rslt=mysql_query($custom_table_update_SQL, $link);
$custom_insert_count = mysql_affected_rows($link);
if ($custom_insert_count > 0)
{
# Update vicidial_list entry to put list_id as entry_list_id
$vl_table_entry_update_SQL = "UPDATE vicidial_list SET entry_list_id='$list_id' where lead_id='$lead_id';";
$rslt=mysql_query($vl_table_entry_update_SQL, $link);
$vl_table_entry_update_count = mysql_affected_rows($link);
$result = 'NOTICE';
$result_reason = "add_lead CUSTOM FIELDS VALUES ADDED";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id|$vl_table_entry_update_count\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'NOTICE';
$result_reason = "add_lead CUSTOM FIELDS NOT ADDED, NO FIELDS DEFINED";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'NOTICE';
$result_reason = "add_lead CUSTOM FIELDS NOT ADDED, NO FIELDS DEFINED";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'NOTICE';
$result_reason = "add_lead CUSTOM FIELDS NOT ADDED, NO CUSTOM FIELDS DEFINED FOR THIS LIST";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'NOTICE';
$result_reason = "add_lead CUSTOM FIELDS NOT ADDED, CUSTOM FIELDS DISABLED";
echo "$result: $result_reason - $phone_number|$lead_id|$custom_fields|$custom_fields_enabled\n";
$data = "$phone_number|$lead_id|$custom_fields|$custom_fields_enabled";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
### END custom fields insert section ###
if ($add_to_hopper == 'Y')
{
$dialable=1;
@@ -1542,6 +1697,569 @@ if ($function == 'add_lead')
################################################################################
### update_lead - updates a lead in the vicidial_list table
################################################################################
if ($function == 'update_lead')
{
if(strlen($source)<2)
{
$result = 'ERROR';
$result_reason = "Invalid Source";
echo "$result: $result_reason - $source\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
echo "ERROR: Invalid Source: |$source|\n";
exit;
}
else
{
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and vdc_agent_api_access='1' and modify_leads='1' and user_level > 7;";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$modify_leads=$row[0];
if ($modify_leads < 1)
{
$result = 'ERROR';
$result_reason = "update_lead USER DOES NOT HAVE PERMISSION TO UPDATE LEADS IN THE SYSTEM";
echo "$result: $result_reason: |$user|$modify_leads|\n";
$data = "$modify_leads";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
$search_SQL='';
$lead_id_SQL='';
$vendor_lead_code_SQL='';
$phone_number_SQL='';
$find_lead_id=0;
$find_vendor_lead_code=0;
$find_phone_number=0;
if ( (strlen($search_location)<4) or ($list_id < 99) or (strlen($list_id)<3) )
{$search_location='SYSTEM';}
if (strlen($search_method)<6)
{$search_method='LEAD_ID';}
if (strlen($records)<1)
{$records='1';}
if ( (preg_match("/LEAD_ID/",$search_method)) and (strlen($lead_id)>0) )
{
$find_lead_id=1;
$lead_id_SQL = "lead_id='$lead_id'";
}
if ( (preg_match("/VENDOR_LEAD_CODE/",$search_method)) and (strlen($vendor_lead_code)>0) )
{
$find_vendor_lead_code=1;
$vendor_lead_code_SQL = "vendor_lead_code='$vendor_lead_code'";
}
if ( (preg_match("/PHONE_NUMBER/",$search_method)) and (strlen($phone_number)>5) and (strlen($phone_number)<19) )
{
$find_phone_number=1;
$phone_number_SQL = "phone_number='$phone_number'";
}
if ( ($find_lead_id<1) and ($find_vendor_lead_code<1) and ($find_phone_number<1) )
{
$result = 'ERROR';
$result_reason = "update_lead NO VALID SEARCH METHOD";
$data = "$search_method|$lead_id|$vendor_lead_code|$phone_number";
echo "$result: $result_reason - $user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
if (eregi("CAMPAIGN",$search_location)) # find lists within campaign
{
$stmt="SELECT campaign_id from vicidial_lists where list_id='$list_id';";
$rslt=mysql_query($stmt, $link);
$ci_recs = mysql_num_rows($rslt);
if ($ci_recs > 0)
{
$row=mysql_fetch_row($rslt);
$search_camp = $row[0];
$stmt="select list_id from vicidial_lists where campaign_id='$search_camp';";
$rslt=mysql_query($stmt, $link);
$li_recs = mysql_num_rows($rslt);
if ($li_recs > 0)
{
$L=0;
while ($li_recs > $L)
{
$row=mysql_fetch_row($rslt);
$search_lists .= "'$row[0]',";
$L++;
}
$search_lists = eregi_replace(",$",'',$search_lists);
$search_SQL = "and list_id IN($search_lists)";
}
}
}
if (eregi("LIST",$search_location)) # search check within list
{
$search_SQL = "and list_id='$list_id'";
}
$search_found=0;
if ($find_lead_id > 0) # search for the lead_id
{
if ($DB>0) {echo "DEBUG: Checking for lead_id - $lead_id\n";}
$stmt="SELECT lead_id,list_id,entry_list_id from vicidial_list where $lead_id_SQL $search_SQL order by entry_date desc limit $records;";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
$n=0;
while ($pc_recs > $n)
{
$row=mysql_fetch_row($rslt);
$search_lead_id[$n] = $row[0];
$search_lead_list[$n] = $row[1];
$search_entry_list[$n] = $row[2];
$n++;
$search_found++;
}
}
if ( ($find_vendor_lead_code > 0) and ($search_found < 1) ) # search for the vendor_lead_code
{
if ($DB>0) {echo "DEBUG: Checking for vendor_lead_code - $vendor_lead_code\n";}
$stmt="SELECT lead_id,list_id,entry_list_id from vicidial_list where $vendor_lead_code_SQL $search_SQL order by entry_date desc limit $records;";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
$n=0;
while ($pc_recs > $n)
{
$row=mysql_fetch_row($rslt);
$search_lead_id[$n] = $row[0];
$search_lead_list[$n] = $row[1];
$search_entry_list[$n] = $row[2];
$n++;
$search_found++;
}
}
if ( ($find_phone_number > 0) and ($search_found < 1) ) # search for the phone_number
{
if ($DB>0) {echo "DEBUG: Checking for phone_number - $phone_number\n";}
$stmt="SELECT lead_id,list_id,entry_list_id from vicidial_list where $phone_number_SQL $search_SQL order by entry_date desc limit $records;";
$rslt=mysql_query($stmt, $link);
$pc_recs = mysql_num_rows($rslt);
$n=0;
while ($pc_recs > $n)
{
$row=mysql_fetch_row($rslt);
$search_lead_id[$n] = $row[0];
$search_lead_list[$n] = $row[1];
$search_entry_list[$n] = $row[2];
$n++;
$search_found++;
}
}
### END searching ###
if ($no_update=='Y')
{
if ($search_found > 0)
{
$result = 'NOTICE';
$result_reason = "update_lead LEADS FOUND IN THE SYSTEM";
$data = "$lead_id|$vendor_lead_code|$phone_number|$search_lead_list[0]|$search_entry_list[0]";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'NOTICE';
$result_reason = "update_lead NO MATCHES FOUND IN THE SYSTEM";
$data = "$lead_id|$vendor_lead_code|$phone_number";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
exit;
}
else
{
if ($search_found > 0)
{
$VL_update_SQL='';
##### BEGIN update lead information in the system #####
if (strlen($user_field)>0) {$VL_update_SQL .= "user='$user_field',";}
if (strlen($list_id_field)>0) {$VL_update_SQL .= "list_id='$list_id_field',";}
if (strlen($status)>0) {$VL_update_SQL .= "status='$status',";}
if (strlen($vendor_lead_code)>0) {$VL_update_SQL .= "vendor_lead_code='$vendor_lead_code',";}
if (strlen($source_id)>0) {$VL_update_SQL .= "source_id='$source_id',";}
if (strlen($gmt_offset_now)>0) {$VL_update_SQL .= "gmt_offset_now='$gmt_offset_now',";}
if (strlen($title)>0) {$VL_update_SQL .= "title='$title',";}
if (strlen($first_name)>0) {$VL_update_SQL .= "first_name='$first_name',";}
if (strlen($middle_initial)>0) {$VL_update_SQL .= "middle_initial='$middle_initial',";}
if (strlen($last_name)>0) {$VL_update_SQL .= "last_name='$last_name',";}
if (strlen($address1)>0) {$VL_update_SQL .= "address1='$address1',";}
if (strlen($address2)>0) {$VL_update_SQL .= "address2='$address2',";}
if (strlen($address3)>0) {$VL_update_SQL .= "address3='$address3',";}
if (strlen($city)>0) {$VL_update_SQL .= "city='$city',";}
if (strlen($state)>0) {$VL_update_SQL .= "state='$state',";}
if (strlen($province)>0) {$VL_update_SQL .= "province='$province',";}
if (strlen($postal_code)>0) {$VL_update_SQL .= "postal_code='$postal_code',";}
if (strlen($country_code)>0) {$VL_update_SQL .= "country_code='$country_code',";}
if (strlen($gender)>0) {$VL_update_SQL .= "gender='$gender',";}
if (strlen($date_of_birth)>0) {$VL_update_SQL .= "date_of_birth='$date_of_birth',";}
if (strlen($alt_phone)>0) {$VL_update_SQL .= "alt_phone='$alt_phone',";}
if (strlen($email)>0) {$VL_update_SQL .= "email='$email',";}
if (strlen($security_phrase)>0) {$VL_update_SQL .= "security_phrase='$security_phrase',";}
if (strlen($comments)>0) {$VL_update_SQL .= "comments='$comments',";}
if (strlen($rank)>0) {$VL_update_SQL .= "rank='$rank',";}
if (strlen($owner)>0) {$VL_update_SQL .= "owner='$owner',";}
if (strlen($called_count)>0) {$VL_update_SQL .= "called_count='$called_count',";}
$VL_update_SQL = preg_replace("/,$/","",$VL_update_SQL);
$VL_update_SQL = preg_replace("/'--BLANK--'/","''",$VL_update_SQL);
$VL_update_SQL = preg_replace("/\n/","!N",$VL_update_SQL);
$n=0;
while ($search_found > $n)
{
$VLaffected_rows=0;
$CFaffected_rows=0;
if ( (strlen($VL_update_SQL)>6) or ($delete_lead=='Y') )
{
if ($delete_lead=='Y')
{
$stmt = "DELETE from vicidial_list where lead_id='$search_lead_id[$n]';";
$result_reason = "update_lead LEAD HAS BEEN DELETED";
}
else
{
$stmt = "UPDATE vicidial_list SET $VL_update_SQL where lead_id='$search_lead_id[$n]';";
$result_reason = "update_lead LEAD HAS BEEN UPDATED";
}
if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";}
$rslt=mysql_query($stmt, $link);
$VLaffected_rows = mysql_affected_rows($link);
$result = 'SUCCESS';
echo "$result: $result_reason - $user|$search_lead_id[$n]\n";
$data = "$phone_number|$list_id|$lead_id|$gmt_offset";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
##### BEGIN custom fields update query build #####
if ($custom_fields=='Y')
{
$lead_custom_list = $search_lead_list[$n];
if ($search_entry_list[$n] > 99) {$lead_custom_list = $search_entry_list[$n];}
$update_sent=0;
$CFoutput='';
$stmt="SHOW TABLES LIKE \"custom_$lead_custom_list\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$update_SQL='';
$VL_update_SQL='';
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$lead_custom_list' order by field_rank,field_order,field_label;";
$rslt=mysql_query($stmt, $link);
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$new_field_value='';
$form_field_value='';
$rowx=mysql_fetch_row($rslt);
$A_field_id[$o] = $rowx[0];
$A_field_label[$o] = $rowx[1];
$A_field_name[$o] = $rowx[2];
$A_field_type[$o] = $rowx[6];
$A_field_size[$o] = $rowx[8];
$A_field_max[$o] = $rowx[9];
$A_field_required[$o] = $rowx[12];
$A_field_value[$o] = '';
$field_name_id = $A_field_label[$o];
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
$A_field_value[$o] = $form_field_value;
if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') )
{
$A_field_value[$o]='----IGNORE----';
}
else
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
$update_SQL .= "$A_field_label[$o]='$A_field_value[$o]',";
}
}
$o++;
}
$custom_update_count=0;
if (strlen($update_SQL)>3)
{
$custom_record_lead_count=0;
$stmt="SELECT count(*) from custom_$lead_custom_list where lead_id='$search_lead_id[$n]';";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$fieldleadcount_to_print = mysql_num_rows($rslt);
if ($fieldleadcount_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$custom_record_lead_count = $rowx[0];
}
$update_SQL = preg_replace("/,$/","",$update_SQL);
$custom_table_update_SQL = "INSERT INTO custom_$lead_custom_list SET lead_id='$search_lead_id[$n]',$update_SQL;";
if ($custom_record_lead_count > 0)
{$custom_table_update_SQL = "UPDATE custom_$lead_custom_list SET $update_SQL where lead_id='$search_lead_id[$n]';";}
$rslt=mysql_query($custom_table_update_SQL, $link);
$custom_update_count = mysql_affected_rows($link);
if ($DB) {echo "$custom_update_count|$custom_table_update_SQL\n";}
if (!$rslt) {die('Could not execute: ' . mysql_error());}
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS VALUES UPDATED";
echo "$result: $result_reason - $phone_number|$search_lead_id[$n]|$search_lead_list[$n]|$search_entry_list[$n]|$lead_custom_list|$custom_update_count\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
$update_sent++;
}
if ($custom_update_count > 0)
{
$list_table_update_SQL = "UPDATE vicidial_list SET entry_list_id='$lead_custom_list' where lead_id='$search_lead_id[$n]';";
$rslt=mysql_query($list_table_update_SQL, $link);
$list_update_count = mysql_affected_rows($link);
if ($DB) {echo "$list_update_count|$list_table_update_SQL\n";}
if (!$rslt) {die('Could not execute: ' . mysql_error());}
}
}
else
{
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS NOT ADDED, NO CUSTOM FIELDS DEFINED FOR THIS LIST";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
##### END custom fields update query build #####
$n++;
}
##### END update lead information in the system #####
}
else
{
$result = 'ERROR';
if ($insert_if_not_found=='Y')
{$result = 'NOTICE';}
$result_reason = "update_lead NO MATCHES FOUND IN THE SYSTEM";
$data = "$lead_id|$vendor_lead_code|$phone_number";
echo "$result: $result_reason: |$user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
if ($insert_if_not_found!='Y')
{exit;}
else
{
if (strlen($list_id_field)>0) {$list_id=$list_id_field;}
##### BEGIN insert not-found lead into the system #####
if ( (strlen($phone_number)<6) or (strlen($phone_number)>18) or (strlen($phone_code)<1) or (strlen($list_id)<3) )
{
$result = 'ERROR';
$result_reason = "update_lead INVALID DATA FOR LEAD INSERTION";
$data = "$phone_number|$phone_code|$list_id|$insert_if_not_found";
echo "$result: $result_reason - $user|$data\n";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
exit;
}
else
{
### get current gmt_offset of the phone_number
$gmt_offset = lookup_gmt($phone_code,$USarea,$state,$LOCAL_GMT_OFF_STD,$Shour,$Smin,$Ssec,$Smon,$Smday,$Syear,$postalgmt,$postal_code);
if (strlen($status)<1)
{$status='NEW';}
### insert a new lead in the system with this phone number
$stmt = "INSERT INTO vicidial_list SET phone_code='$phone_code',phone_number='$phone_number',list_id='$list_id',status='$status',user='$user',vendor_lead_code='$vendor_lead_code',source_id='$source_id',gmt_offset_now='$gmt_offset',title='$title',first_name='$first_name',middle_initial='$middle_initial',last_name='$last_name',address1='$address1',address2='$address2',address3='$address3',city='$city',state='$state',province='$province',postal_code='$postal_code',country_code='$country_code',gender='$gender',date_of_birth='$date_of_birth',alt_phone='$alt_phone',email='$email',security_phrase='$security_phrase',comments='$comments',called_since_last_reset='N',entry_date='$ENTRYdate',last_local_call_time='$NOW_TIME',rank='$rank',owner='$owner',entry_list_id='0';";
if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";}
$rslt=mysql_query($stmt, $link);
$affected_rows = mysql_affected_rows($link);
if ($affected_rows > 0)
{
$lead_id = mysql_insert_id($link);
$result = 'SUCCESS';
$result_reason = "update_lead LEAD HAS BEEN ADDED";
echo "$result: $result_reason - $phone_number|$list_id|$lead_id|$gmt_offset|$user\n";
$data = "$phone_number|$list_id|$lead_id|$gmt_offset";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
if (strlen($multi_alt_phones) > 5)
{
$map=$MT; $ALTm_phone_code=$MT; $ALTm_phone_number=$MT; $ALTm_phone_note=$MT;
$map = explode('!', $multi_alt_phones);
$map_count = count($map);
if ($DB>0) {echo "DEBUG: update_lead multi-al-entry - $a|$map_count|$multi_alt_phones\n";}
$g++;
$r=0; $s=0; $inserted_alt_phones=0;
while ($r < $map_count)
{
$s++;
$ncn=$MT;
$ncn = explode('_', $map[$r]);
print "$ncn[0]|$ncn[1]|$ncn[2]";
if (strlen($forcephonecode) > 0)
{$ALTm_phone_code[$r] = $forcephonecode;}
else
{$ALTm_phone_code[$r] = $ncn[1];}
if (strlen($ALTm_phone_code[$r]) < 1)
{$ALTm_phone_code[$r]='1';}
$ALTm_phone_number[$r] = $ncn[0];
$ALTm_phone_note[$r] = $ncn[2];
$stmt = "INSERT INTO vicidial_list_alt_phones (lead_id,phone_code,phone_number,alt_phone_note,alt_phone_count) values('$lead_id','$ALTm_phone_code[$r]','$ALTm_phone_number[$r]','$ALTm_phone_note[$r]','$s');";
if ($DB>0) {echo "DEBUG: update_lead query - $stmt\n";}
$rslt=mysql_query($stmt, $link);
$Zaffected_rows = mysql_affected_rows($link);
$inserted_alt_phones = ($inserted_alt_phones + $Zaffected_rows);
$r++;
}
$result = 'NOTICE';
$result_reason = "update_lead MULTI-ALT-PHONE NUMBERS LOADED";
echo "$result: $result_reason - $inserted_alt_phones|$lead_id|$user\n";
$data = "$inserted_alt_phones|$lead_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
### BEGIN custom fields insert section ###
if ($custom_fields == 'Y')
{
if ($custom_fields_enabled > 0)
{
$stmt="SHOW TABLES LIKE \"custom_$list_id\";";
if ($DB>0) {echo "$stmt";}
$rslt=mysql_query($stmt, $link);
$tablecount_to_print = mysql_num_rows($rslt);
if ($tablecount_to_print > 0)
{
$CFinsert_SQL='';
$stmt="SELECT field_id,field_label,field_name,field_description,field_rank,field_help,field_type,field_options,field_size,field_max,field_default,field_cost,field_required,multi_position,name_position,field_order from vicidial_lists_fields where list_id='$list_id' order by field_rank,field_order,field_label;";
$rslt=mysql_query($stmt, $link);
$fields_to_print = mysql_num_rows($rslt);
$fields_list='';
$o=0;
while ($fields_to_print > $o)
{
$new_field_value='';
$form_field_value='';
$rowx=mysql_fetch_row($rslt);
$A_field_id[$o] = $rowx[0];
$A_field_label[$o] = $rowx[1];
$A_field_name[$o] = $rowx[2];
$A_field_type[$o] = $rowx[6];
$A_field_size[$o] = $rowx[8];
$A_field_max[$o] = $rowx[9];
$A_field_required[$o] = $rowx[12];
$A_field_value[$o] = '';
$field_name_id = $A_field_label[$o];
if (isset($_GET["$field_name_id"])) {$form_field_value=$_GET["$field_name_id"];}
elseif (isset($_POST["$field_name_id"])) {$form_field_value=$_POST["$field_name_id"];}
$A_field_value[$o] = $form_field_value;
if ( ($A_field_type[$o]=='DISPLAY') or ($A_field_type[$o]=='SCRIPT') )
{
$A_field_value[$o]='----IGNORE----';
}
else
{
if (!preg_match("/\|$A_field_label[$o]\|/",$vicidial_list_fields))
{
$CFinsert_SQL .= "$A_field_label[$o]='$A_field_value[$o]',";
}
}
$o++;
}
if (strlen($CFinsert_SQL)>3)
{
$CFinsert_SQL = preg_replace("/,$/","",$CFinsert_SQL);
$custom_table_update_SQL = "INSERT INTO custom_$list_id SET lead_id='$lead_id',$CFinsert_SQL;";
$rslt=mysql_query($custom_table_update_SQL, $link);
$custom_insert_count = mysql_affected_rows($link);
if ($custom_insert_count > 0)
{
# Update vicidial_list entry to put list_id as entry_list_id
$vl_table_entry_update_SQL = "UPDATE vicidial_list SET entry_list_id='$list_id' where lead_id='$lead_id';";
$rslt=mysql_query($vl_table_entry_update_SQL, $link);
$vl_table_entry_update_count = mysql_affected_rows($link);
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS VALUES ADDED";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id|$vl_table_entry_update_count\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
else
{
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS NOT ADDED, NO FIELDS DEFINED";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS NOT ADDED, NO FIELDS DEFINED";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS NOT ADDED, NO CUSTOM FIELDS DEFINED FOR THIS LIST";
echo "$result: $result_reason - $phone_number|$lead_id|$list_id\n";
$data = "$phone_number|$lead_id|$list_id";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
else
{
$result = 'NOTICE';
$result_reason = "update_lead CUSTOM FIELDS NOT ADDED, CUSTOM FIELDS DISABLED";
echo "$result: $result_reason - $phone_number|$lead_id|$custom_fields|$custom_fields_enabled\n";
$data = "$phone_number|$lead_id|$custom_fields|$custom_fields_enabled";
api_log($link,$api_logging,$api_script,$user,$agent_user,$function,$value,$result,$result_reason,$source,$data);
}
}
### END custom fields insert section ###
}
}
##### END insert not-found lead into the system #####
}
}
}
}
}
exit;
}
}
################################################################################
### END update_lead
################################################################################
$result = 'ERROR';
$result_reason = "NO FUNCTION SPECIFIED";
echo "$result: $result_reason\n";
@@ -12,6 +12,9 @@
# 90508-0644 - Changed to PHP long tags
# 100214-1421 - Sort menu alphabetically
# 100216-0042 - Added popup date selector
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
require("dbconnect.php");
@@ -42,9 +45,12 @@ if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];}
if (strlen($shift)<2) {$shift='ALL';}
if (strlen($order)<2) {$order='hours_down';}
$report_name = 'UtenteOrologio Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,webroot_writable FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -52,22 +58,39 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$webroot_writable = $row[1];
$SSoutbound_autodial_active = $row[2];
$SSoutbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
$webroot_writable = $row[4];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
@@ -76,6 +99,27 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
exit;
}
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$NOW_DATE = date("Y-m-d");
$NOW_TIME = date("Y-m-d H:i:s");
$STARTtime = date("U");
@@ -139,9 +183,10 @@ while ($i < $user_groups_to_print)
<link rel="stylesheet" href="calendar.css">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<TITLE>UtenteOrologio Report
<TITLE>
<?php
echo "$report_name";
##### BEGIN Set variables to make header show properly #####
$ADD = '311111';
@@ -373,20 +418,6 @@ echo "</TR>\n";
echo "</TABLE>\n";
echo "\n";
/*
$TOTavgWAIT_M = ( ($TOTtotWAIT / $TOTcalls) / 60);
$TOTavgWAIT_M = round($TOTavgWAIT_M, 2);
$TOTavgWAIT_M_int = intval("$TOTavgWAIT_M");
$TOTavgWAIT_S = ($TOTavgWAIT_M - $TOTavgWAIT_M_int);
$TOTavgWAIT_S = ($TOTavgWAIT_S * 60);
$TOTavgWAIT_S = round($TOTavgWAIT_S, 0);
if ($TOTavgWAIT_S < 10) {$TOTavgWAIT_S = "0$TOTavgWAIT_S";}
$TOTavgWAIT_MS = "$TOTavgWAIT_M_int:$TOTavgWAIT_S";
$TOTavgWAIT_MS = sprintf("%6s", $TOTavgWAIT_MS);
while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);}
*/
?>
</CENTER>
</BODY></HTML>
@@ -10,6 +10,9 @@
# 90310-2103 - Added admin header
# 90508-0644 - Changed to PHP long tags
# 100214-1421 - Sort menu alphabetically
# 100712-1324 - Added system setting slave server option
# 100802-2347 - Added User Group Allowed Reports option validation
# 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
#
header ("Content-type: text/html; charset=utf-8");
@@ -35,9 +38,12 @@ if (isset($_GET["INVIA"])) {$INVIA=$_GET["INVIA"];}
elseif (isset($_POST["INVIA"])) {$INVIA=$_POST["INVIA"];}
$report_name = 'Gruppo UtenteOrologio Status Report';
$db_source = 'M';
#############################################
##### START SYSTEM_SETTINGS LOOKUP #####
$stmt = "SELECT use_non_latin,webroot_writable,timeclock_end_of_day,outbound_autodial_active FROM system_settings;";
$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,webroot_writable,timeclock_end_of_day FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -45,13 +51,24 @@ if ($qm_conf_ct > 0)
{
$row=mysql_fetch_row($rslt);
$non_latin = $row[0];
$webroot_writable = $row[1];
$timeclock_end_of_day = $row[2];
$SSoutbound_autodial_active = $row[3];
$SSoutbound_autodial_active = $row[1];
$slave_db_server = $row[2];
$reports_use_slave_db = $row[3];
$webroot_writable = $row[4];
$timeclock_end_of_day = $row[5];
}
##### END SETTINGS LOOKUP #####
###########################################
if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) )
{
mysql_close($link);
$use_slave_server=1;
$db_source = 'S';
require("dbconnect.php");
echo "<!-- Using slave server $slave_db_server $db_source -->\n";
}
$PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER);
$PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW);
@@ -68,12 +85,18 @@ else
$EoDdate = date("Y-m-d H:i:s", $EoD);
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';";
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$auth=$row[0];
$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level='7' and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$reports_only_user=$row[0];
$fp = fopen ("./project_auth_entries.txt", "a");
$date = date("r");
$ip = getenv("REMOTE_ADDR");
@@ -86,32 +109,28 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth))
echo "Utentename/Password non validi: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n";
exit;
}
else
$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGuser_group = $row[0];
$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGallowed_campaigns = $row[0];
$LOGallowed_reports = $row[1];
if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORT/",$LOGallowed_reports)) )
{
if($auth>0)
{
$stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";
$rslt=mysql_query($stmt, $link);
$row=mysql_fetch_row($rslt);
$LOGfullname=$row[0];
if ($webroot_writable > 0)
{
fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n");
fclose($fp);
}
}
else
{
if ($webroot_writable > 0)
{
fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n");
fclose($fp);
}
}
Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\"");
Header("HTTP/1.0 401 Unauthorized");
echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n";
exit;
}
$stmt="select user_group from vicidial_user_groups order by user_group;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
@@ -141,8 +160,9 @@ if (strlen($user_group) > 0)
<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<title>ADMINISTRATION:Orologio Status
<title>ADMINISTRATION:
<?php
echo "$report_name";
##### BEGIN Set variables to make header show properly #####
$ADD = '311111';
@@ -399,7 +419,7 @@ $RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n\n";
echo "<font size=0>\n\n\n<br><br><br>\nTempo Esecuzione Script: $RUNtime seconds</font>";
echo "<font size=0>\n\n\n<br><br><br>\nTempo Esecuzione Script: $RUNtime seconds|$db_source</font>";
?>
@@ -523,7 +543,7 @@ $RUNtime = ($ENDtime - $STARTtime);
echo "\n\n\n<br><br><br>\n\n";
echo "<font size=0>\n\n\n<br><br><br>\nTempo Esecuzione Script: $RUNtime seconds</font>";
echo "<font size=0>\n\n\n<br><br><br>\nTempo Esecuzione Script: $RUNtime seconds|$db_source</font>";
?>
File diff suppressed because it is too large Load Diff
@@ -1,7 +1,7 @@
<?php
# user_status.php
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
#
@@ -14,6 +14,7 @@
# 91012-0536 - Added selected territories display
# 91130-2039 - Added user closer log manager flag display
# 91212-0656 - Added more complete logging of Emergency Logout process
# 100309-0544 - Added queuemetrics_loginout option
#
header ("Content-type: text/html; charset=utf-8");
@@ -338,7 +339,7 @@ if ($stage == "log_agent_out")
#############################################
##### START QUEUEMETRICS LOGGING LOOKUP #####
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
$stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id,queuemetrics_loginout FROM system_settings;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "<BR>$stmt\n";}
$qm_conf_ct = mysql_num_rows($rslt);
@@ -351,11 +352,16 @@ if ($stage == "log_agent_out")
$queuemetrics_login = $row[3];
$queuemetrics_pass = $row[4];
$queuemetrics_log_id = $row[5];
$queuemetrics_loginout = $row[6];
}
##### END QUEUEMETRICS LOGGING LOOKUP #####
###########################################
if ($enable_queuemetrics_logging > 0)
{
$QM_LOGOFF = 'AGENTLOGOFF';
if ($queuemetrics_loginout=='CALLBACK')
{$QM_LOGOFF = 'AGENTCALLBACKLOGOFF';}
$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
mysql_select_db("$queuemetrics_dbname", $linkB);
@@ -363,7 +369,7 @@ if ($stage == "log_agent_out")
$agent_logged_in='';
$time_logged_in='';
$stmtB = "SELECT agent,time_id FROM queue_log where agent='Agent/" . mysql_real_escape_string($user) . "' and verb='AGENTLOGIN' order by time_id desc limit 1;";
$stmtB = "SELECT agent,time_id,data1 FROM queue_log where agent='Agent/" . mysql_real_escape_string($user) . "' and verb IN('AGENTLOGIN','AGENTCALLBACKLOGIN') order by time_id desc limit 1;";
$rsltB=mysql_query($stmtB, $linkB);
if ($DB) {echo "<BR>$stmtB\n";}
$qml_ct = mysql_num_rows($rsltB);
@@ -372,12 +378,13 @@ if ($stage == "log_agent_out")
$row=mysql_fetch_row($rsltB);
$agent_logged_in = $row[0];
$time_logged_in = $row[1];
$phone_logged_in = $row[2];
}
$time_logged_in = ($now_date_epoch - $time_logged_in);
if ($time_logged_in > 1000000) {$time_logged_in=1;}
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='NONE',agent='$agent_logged_in',verb='AGENTLOGOFF',serverid='$queuemetrics_log_id',data1='" . mysql_real_escape_string($user) . "$agents',data2='$time_logged_in';";
$stmtB = "INSERT INTO queue_log SET partition='P01',time_id='$now_date_epoch',call_id='NONE',queue='NONE',agent='$agent_logged_in',verb='$QM_LOGOFF',serverid='$queuemetrics_log_id',data1='$phone_logged_in',data2='$time_logged_in';";
if ($DB) {echo "<BR>$stmtB\n";}
$rsltB=mysql_query($stmtB, $linkB);
}
@@ -616,7 +616,7 @@ if ($lead_search > 0)
if (!$rslt) {die('Could not execute: ' . mysql_error());}
#Vtiger no longer use auto increment for vtiger_crmentity crmid, vtiger_crmentity_seq is used instead to list next aviable entity ID
# Get next aviable id to use as crmid in vtiger_crmentity
# Get next available id to use as crmid in vtiger_crmentity
$stmt="SELECT id from vtiger_crmentity_seq ;";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkV);
@@ -624,7 +624,7 @@ if ($lead_search > 0)
$leadid = ($row[0] + 1);
if (!$rslt) {die('Could not execute: ' . mysql_error());}
# Increase next aviable crmid with 1 so next record gets proper id
# Increase next available crmid with 1 so next record gets proper id
$stmt="UPDATE vtiger_crmentity_seq SET id = '$leadid';";
if ($DB) {echo "$stmt\n";}
$rslt=mysql_query($stmt, $linkV);
@@ -644,7 +644,7 @@ if ($lead_search > 0)
if (!$rslt) {die('Could not execute: ' . mysql_error());}
#Insert values into vtiger_leaddetails
$stmt = "INSERT INTO vtiger_leadaddress (leadaddressid,city,code,state,country,phone,mobile,lane) values('$leadid','$city','$postal_code','$province','$country','$phone','$alt_phone','$address1 $address2');";
$stmt = "INSERT INTO vtiger_leadaddress (leadaddressid,city,code,state,country,phone,mobile,lane) values('$leadid','$city','$postal_code','$state','$country','$phone','$alt_phone','$address1 $address2');";
if ($DB) {echo "|$stmt|\n";}
$rslt=mysql_query($stmt, $linkV);
if (!$rslt) {die('Could not execute: ' . mysql_error());}
@@ -3,12 +3,13 @@
# vicidial_users table into the Vtiger system as well as
# the groups from VICIDIAL to Vtiger
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
# CHANGES
# 81231-1307 - First build
# 90228-2152 - Added Groups support
# 90508-0644 - Changed to PHP long tags
# 100127-0616 - Added Vtiger ViciDial user_level role lookup
#
header ("Content-type: text/html; charset=utf-8");
@@ -183,15 +184,25 @@ while ($i < $VD_users_ct)
$roleid = 'H5';
$status = 'Active';
$groupid = '1';
if ($user_level[$i] >= 7) {$roleid = 'H4';}
if ($user_level[$i] >= 8) {$roleid = 'H3';}
if ($user_level[$i] >= 9) {$roleid = 'H2';}
if ($user_level[$i] >= 9) {$is_admin = 'on';}
if (ereg('N',$active[$i])) {$status = 'Inactive';}
if ($user_level[$i] >= 7) {$roleid = 'H4';}
if ($user_level[$i] >= 8) {$roleid = 'H3';}
if ($user_level[$i] >= 9) {$roleid = 'H2';}
if ($user_level[$i] >= 9) {$is_admin = 'on';}
if (ereg('N',$active[$i])) {$status = 'Inactive';}
$salt = substr($user_name, 0, 2);
$salt = '$1$' . $salt . '$';
$encrypted_password = crypt($user_password, $salt);
$i++;
### search for role in ViciDial
$stmt = "SELECT vtiger_role FROM vtiger_vicidial_roles where user_level='$user_level';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$vvr_ct = mysql_num_rows($rslt);
if ($vvr_ct > 0)
{
$row=mysql_fetch_row($rslt);
$roleid = $row[0];
}
$j=0;
$all_VICIDIAL_groups_SQL='';
@@ -2,7 +2,7 @@
# welcome_demo.php - VICIDIAL welcome Demo page
#
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
header ("Content-type: text/html; charset=utf-8");
@@ -56,6 +56,9 @@ echo "<font size=3><b> &nbsp; <a href=\"../agc_nl/vicidial.php?relogin=YES&VD_lo
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_tw/vicidial.php?relogin=YES&VD_login=6666&VD_campaign=TESTCAMP&phone_login=phone&phone_pass=phone&VD_pass=1234\"><IMG SRC=\"../agc/images/tw.gif\" border=0> Chinese(T) Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_se/vicidial.php?relogin=YES&VD_login=6666&VD_campaign=TESTCAMP&phone_login=phone&phone_pass=phone&VD_pass=1234\"><IMG SRC=\"../agc/images/se.gif\" border=0> Swedish Agent Login</a>";
echo "</TD></TR></TABLE>\n";
echo "</TD><TD VALIGN=TOP>\n";
@@ -78,6 +81,9 @@ echo "<font size=3><b> &nbsp; <a href=\"../vicidial_el/admin.php\"><IMG SRC=\"..
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial_fr/admin.php\"><IMG SRC=\"../agc/images/fr.gif\" border=0> French Administration</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial_br/admin.php\"><IMG SRC=\"../agc/images/br.gif\" border=0> Brazilian Portuguese Administration</a>";
echo "</TD></TR></TABLE>\n";
echo "<TR><TD ALIGN=LEFT ><font size=1> &nbsp; </TD></TR>\n";
echo "</TABLE>\n";
@@ -1,8 +1,8 @@
<?php
# welcome_demo.php - VICIDIAL welcome Demo page
# welcome_languages.php - VICIDIAL welcome Languages page
#
#
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: GPLv2
#
header ("Content-type: text/html; charset=utf-8");
@@ -56,6 +56,9 @@ echo "<font size=3><b> &nbsp; <a href=\"../agc_nl/vicidial.php\"><IMG SRC=\"../a
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_tw/vicidial.php\"><IMG SRC=\"../agc/images/tw.gif\" border=0> Chinese(T) Agent Login</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../agc_se/vicidial.php\"><IMG SRC=\"../agc/images/se.gif\" border=0> Swedish Agent Login</a>";
echo "</TD></TR></TABLE>\n";
echo "</TD><TD VALIGN=TOP>\n";
@@ -78,6 +81,9 @@ echo "<font size=3><b> &nbsp; <a href=\"../vicidial_el/admin.php\"><IMG SRC=\"..
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial_fr/admin.php\"><IMG SRC=\"../agc/images/fr.gif\" border=0> French Administration</a>";
echo "</TD></TR>\n";
echo "<TR><TD ALIGN=LEFT >";
echo "<font size=3><b> &nbsp; <a href=\"../vicidial_br/admin.php\"><IMG SRC=\"../agc/images/br.gif\" border=0> Brazilian Portuguese Administration</a>";
echo "</TD></TR></TABLE>\n";
echo "<TR><TD ALIGN=LEFT ><font size=1> &nbsp; </TD></TR>\n";
echo "</TABLE>\n";