Added option.php option to allow user ID click to pause code report from the Agent Time Detail report
Fixed several small bugs Added new optional extras/did_recent_call.php script for use with DID Filter URL git-svn-id: svn://192.168.202.10@2042 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -161,6 +161,8 @@ OTHER CHANGES:
|
||||
|
||||
23. Admin HELP text moved to separate help.php script
|
||||
|
||||
24. Added option.php option to allow user ID click to pause code report from the
|
||||
Agent Time Detail report
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
# did_recent_call.php
|
||||
#
|
||||
# Copyright (C) 2013 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script searches the did log for a matching phone number and returns
|
||||
# the number of matches, it was designed to be used with the ViciDial Inbound
|
||||
# DID Filter Phone Group feature in the URL search type with the following URL:
|
||||
# VARhttp://server/vicidial/did_recent_call.php?phone=--A--phone_number--B--&did=--A--did_pattern--B--&hours=48
|
||||
#
|
||||
# OPTIONS:
|
||||
# did - you can specify the DID, use the did_pattern or leave blank to search all DIDs
|
||||
# hours - number of hours you want to search back to find matches or leave blank for no limit
|
||||
#
|
||||
# CHANGES
|
||||
# 131108-0630 - First Build (based on vtiger_phone_match.php)
|
||||
#
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
|
||||
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
|
||||
if (isset($_GET["did"])) {$did=$_GET["did"];}
|
||||
elseif (isset($_POST["did"])) {$did=$_POST["did"];}
|
||||
if (isset($_GET["hours"])) {$hours=$_GET["hours"];}
|
||||
elseif (isset($_POST["hours"])) {$hours=$_POST["hours"];}
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
|
||||
###############################################################
|
||||
##### START SYSTEM_SETTINGS INFO LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,webroot_writable FROM system_settings;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$ss_conf_ct = mysqli_num_rows($rslt);
|
||||
if ($ss_conf_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$webroot_writable = $row[1];
|
||||
}
|
||||
##### END SYSTEM_SETTINGS INFO LOOKUP #####
|
||||
#############################################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$phone=preg_replace('/[^-_0-9a-zA-Z]/','',$phone);
|
||||
$did=preg_replace('/[^-_0-9a-zA-Z]/','',$did);
|
||||
}
|
||||
else
|
||||
{
|
||||
$phone = preg_replace("/'|\"|\\\\|;/","",$phone);
|
||||
$did = preg_replace("/'|\"|\\\\|;/","",$did);
|
||||
}
|
||||
$hours=preg_replace('/[^0-9]/','',$hours);
|
||||
|
||||
|
||||
$phone_count=0;
|
||||
|
||||
if (strlen($phone) > 6)
|
||||
{
|
||||
if ( ($did == 'ALL') or ($did == '') )
|
||||
{$didSQL='';}
|
||||
else
|
||||
{$didSQL=" and extension='$did'";}
|
||||
if ( ($hours == 'ALL') or ($hours == '') )
|
||||
{$hoursSQL=' and (call_date < (NOW() - INTERVAL 10 SECOND))';}
|
||||
else
|
||||
{$hoursSQL=" and (call_date < (NOW() - INTERVAL 10 SECOND) and call_date > (NOW() - INTERVAL $hours HOUR))";}
|
||||
|
||||
$stmt = "SELECT count(*) FROM vicidial_did_log where caller_id_number='$phone' $didSQL $hoursSQL;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
$did_call_ct = mysqli_num_rows($rslt);
|
||||
if ($did_call_ct > 0)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$phone_count = $row[0];
|
||||
}
|
||||
if ( ($DB > 0) and ($webroot_writable > 0) )
|
||||
{
|
||||
$fp = fopen ("./did_recent_call_log.txt", "a");
|
||||
fwrite ($fp, "$date|$phone_count|$did_call_ct|$stmt\n");
|
||||
fclose($fp);
|
||||
}
|
||||
}
|
||||
|
||||
echo "$phone_count\n";
|
||||
|
||||
?>
|
||||
@@ -33,6 +33,7 @@
|
||||
# 130716-1025 - Added mtemp sounds directory for sox concatenated temp audio
|
||||
# 130805-0818 - Added support for mysqli
|
||||
# 130902-1149 - Small fix for mysqli support
|
||||
# 131121-1643 - Added robots.txt file to all web directories
|
||||
#
|
||||
|
||||
############################################
|
||||
@@ -2523,6 +2524,11 @@ if ($NOWEB < 1)
|
||||
|
||||
print "Copying web files...\n";
|
||||
`cp -f -R ./www/* $PATHweb/`;
|
||||
`cp -f ./www/vicidial/robots.txt $PATHweb/`;
|
||||
`cp -f ./www/vicidial/robots.txt $PATHweb/agc/`;
|
||||
`cp -f ./www/vicidial/robots.txt $PATHweb/vicidial/ploticus/`;
|
||||
`cp -f ./www/vicidial/robots.txt $PATHweb/vicidial/agent_reports/`;
|
||||
`cp -f ./www/vicidial/robots.txt $PATHweb/vicidial/server_reports/`;
|
||||
|
||||
print "setting web scripts to executable...\n";
|
||||
`chmod 0777 $PATHweb/`;
|
||||
|
||||
@@ -10,11 +10,12 @@
|
||||
# 120214-1636 - Added consult_custom_delay option
|
||||
# 130903-2015 - Added window validation options
|
||||
# 131007-1346 - Added mrglock_ig_select_ct
|
||||
# 131121-1719 - Fixed defaults mismatched, HKuser_level and FORM_COLOR
|
||||
#
|
||||
|
||||
$conf_silent_prefix = '5'; # vicidial_conferences prefix to enter silently and muted for recording
|
||||
$dtmf_silent_prefix = '7'; # vicidial_conferences prefix to enter silently
|
||||
$HKuser_level = '5'; # minimum vicidial user_level for HotKeys
|
||||
$HKuser_level = '1'; # minimum vicidial user_level for HotKeys
|
||||
$campaign_login_list = '1'; # show drop-down list of campaigns at login
|
||||
$manual_dial_preview = '1'; # allow preview lead option when manual dial
|
||||
$multi_line_comments = '1'; # set to 1 to allow multi-line comment box
|
||||
@@ -56,6 +57,7 @@ $webphone_pad = 0; # set the table cellpadding for the webphone
|
||||
$webphone_location = 'right'; # set the location on the agent screen 'right' or 'bar'
|
||||
$MAIN_COLOR = '#CCCCCC'; # old default is E0C2D6
|
||||
$SCRIPT_COLOR = '#E6E6E6'; # old default is FFE7D0
|
||||
$FORM_COLOR = '#EFEFEF';
|
||||
$SIDEBAR_COLOR = '#F6F6F6';
|
||||
|
||||
$window_validation = 0; # set to 1 to disallow direct logins to vicidial.php
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
# 130621-0821 - Added filtering of input to prevent SQL injection attacks and new user auth
|
||||
# 130704-0945 - Fixed issue #675
|
||||
# 130829-2012 - Changed to mysqli PHP functions
|
||||
# 131122-0657 - Added options.php atdr_login_logout_user_link option
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -37,6 +38,12 @@ $startMS = microtime();
|
||||
require("dbconnect_mysqli.php");
|
||||
require("functions.php");
|
||||
|
||||
$atdr_login_logout_user_link=0;
|
||||
if (file_exists('options.php'))
|
||||
{
|
||||
require('options.php');
|
||||
}
|
||||
|
||||
$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER'];
|
||||
$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
|
||||
$PHP_SELF=$_SERVER['PHP_SELF'];
|
||||
@@ -430,9 +437,11 @@ else
|
||||
|
||||
if ($file_download < 1)
|
||||
{
|
||||
echo "Agent Time Detail $NOW_TIME\n";
|
||||
$ASCII_text.="\nAgent Time Detail $NOW_TIME\n";
|
||||
$ASCII_text.="Time range: $query_date_BEGIN to $query_date_END\n\n";
|
||||
|
||||
echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
|
||||
$GRAPH.="Agent Time Detail $NOW_TIME\n";
|
||||
$GRAPH.="Time range: $query_date_BEGIN to $query_date_END\n\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -462,7 +471,7 @@ else
|
||||
$max_pause=1;
|
||||
$max_dead=1;
|
||||
$max_customer=1;
|
||||
$GRAPH="<a name='timegraph'/><table border='0' cellpadding='0' cellspacing='2' width='1000'>";
|
||||
$GRAPH.="<a name='timegraph'/><table border='0' cellpadding='0' cellspacing='2' width='1000'>";
|
||||
$GRAPH2="<tr><th class='column_header grey_graph_cell' id='timegraph1'><a href='#' onClick=\"DrawGraph('CALLS', '1'); return false;\">CALLS</a></th><th class='column_header grey_graph_cell' id='timegraph2'><a href='#' onClick=\"DrawGraph('TIMECLOCK', '2'); return false;\">TIME CLOCK</a></th><th class='column_header grey_graph_cell' id='timegraph3'><a href='#' onClick=\"DrawGraph('AGENTTIME', '3'); return false;\">AGENT TIME</a></th>";
|
||||
if ($show_parks) {
|
||||
$GRAPH2.="<th class='column_header grey_graph_cell' id='timegraph15'><a href='#' onClick=\"DrawGraph('PARKS', '15'); return false;\">PARKS</a></th><th class='column_header grey_graph_cell' id='timegraph16'><a href='#' onClick=\"DrawGraph('PARKTIME', '16'); return false;\">PARKTIME</a></th><th class='column_header grey_graph_cell' id='timegraph17'><a href='#' onClick=\"DrawGraph('AVGPARK', '17'); return false;\">AVGPARK</a></th><th class='column_header grey_graph_cell' id='timegraph18'><a href='#' onClick=\"DrawGraph('PARKSCALL', '18'); return false;\">PARKS/CALL</a></th>";
|
||||
@@ -938,9 +947,17 @@ else
|
||||
|
||||
if ($file_download < 1)
|
||||
{
|
||||
$Toutput = "| $Sname[$m] | <a href=\"./user_stats.php?user=$RAWuser\">$Suser[$m]</a> | $Scalls[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $Stime[$m] |$park_AGENT_INFO $Swait[$m] | $Swaitpct[$m] | $Stalk[$m] | $Stalkpct[$m] | $Sdispo[$m] | $Sdispopct[$m] | $Spause[$m] | $Spausepct[$m] | $Sdead[$m] | $Sdeadpct[$m] | $Scustomer[$m] | |$SstatusesHTML\n";
|
||||
if ($atdr_login_logout_user_link > 0)
|
||||
{
|
||||
$Toutput = "| $Sname[$m] | <a href=\"./user_stats.php?pause_code_rpt=1&begin_date=$query_date&end_date=$end_date&user=$RAWuser\">$Suser[$m]</a> | $Scalls[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $Stime[$m] |$park_AGENT_INFO $Swait[$m] | $Swaitpct[$m] | $Stalk[$m] | $Stalkpct[$m] | $Sdispo[$m] | $Sdispopct[$m] | $Spause[$m] | $Spausepct[$m] | $Sdead[$m] | $Sdeadpct[$m] | $Scustomer[$m] | |$SstatusesHTML\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
$Toutput = "| $Sname[$m] | <a href=\"./user_stats.php?user=$RAWuser&begin_date=$query_date&end_date\">$Suser[$m]</a> | $Scalls[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $Stime[$m] |$park_AGENT_INFO $Swait[$m] | $Swaitpct[$m] | $Stalk[$m] | $Stalkpct[$m] | $Sdispo[$m] | $Sdispopct[$m] | $Spause[$m] | $Spausepct[$m] | $Sdead[$m] | $Sdeadpct[$m] | $Scustomer[$m] | |$SstatusesHTML\n";
|
||||
}
|
||||
|
||||
$graph_stats[$m][0]=trim("$Suser[$m] - $Sname[$m]");
|
||||
#CALLS | TIME CLOCK | AGENT TIME | WAIT | TALK | DISPO | PAUSE | DEAD | CUSTOMER | | LOGIN | TRAIN | TOILET | PRECAL | BREAK | | LUNCH | LAGGED
|
||||
$user_IDs[$m]=$Suser[$m];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1143,7 +1160,10 @@ else
|
||||
$ASCII_text.="| TOTALS AGENTS:$hTOT_AGENTS | $hTOTcalls |$hTOTtimeTC |$hTOTALtime |$park_TOTALS$hTOTwait |$hTOTwaitpct |$hTOTtalk |$hTOTtalkpct |$hTOTdispo |$hTOTdispopct |$hTOTpause |$hTOTpausepct |$hTOTdead |$hTOTdeadpct |$hTOTcustomer | |$SUMstatusesHTML\n";
|
||||
$ASCII_text.="+-----------------+----------+----------+------------+------------$park_HEADER_DIV+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
|
||||
if ($AUTOLOGOUTflag > 0)
|
||||
{echo " * denotes AUTOLOGOUT from timeclock\n";}
|
||||
{
|
||||
$ASCII_text.= " * denotes AUTOLOGOUT from timeclock\n";
|
||||
$HTML_text.= " * denotes AUTOLOGOUT from timeclock\n";
|
||||
}
|
||||
$ASCII_text.="\n\n</PRE>";
|
||||
|
||||
for ($e=0; $e<count($sub_statusesARY); $e++) {
|
||||
@@ -1155,7 +1175,14 @@ else
|
||||
|
||||
for ($d=0; $d<count($graph_stats); $d++) {
|
||||
if ($d==0) {$class=" first";} else if (($d+1)==count($graph_stats)) {$class=" last";} else {$class="";}
|
||||
$CALLS_graph.=" <tr><td class='chart_td$class'>".$graph_stats[$d][0]."</td><td nowrap class='chart_td value$class'><img src='images/bar.png' alt='' width='".round(1000*$graph_stats[$d][1]/$max_calls)."' height='16' />".$graph_stats[$d][1]."</td></tr>";
|
||||
if ($atdr_login_logout_user_link > 0)
|
||||
{
|
||||
$CALLS_graph.=" <tr><td class='chart_td$class'><a href=\'./user_stats.php?pause_code_rpt=1&begin_date=$query_date&end_date=$end_date&user=".$user_IDs[$d]."\'>".$graph_stats[$d][0]."</a></td><td nowrap class='chart_td value$class'><img src='images/bar.png' alt='' width='".round(1000*$graph_stats[$d][1]/$max_calls)."' height='16' />".$graph_stats[$d][1]."</td></tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$CALLS_graph.=" <tr><td class='chart_td$class'><a href=\'./user_stats.php?user=".$user_IDs[$d]."&begin_date=$query_date&end_date\'>".$graph_stats[$d][0]."</a></td><td nowrap class='chart_td value$class'><img src='images/bar.png' alt='' width='".round(1000*$graph_stats[$d][1]/$max_calls)."' height='16' />".$graph_stats[$d][1]."</td></tr>";
|
||||
}
|
||||
$TIMECLOCK_graph.=" <tr><td class='chart_td$class'>".$graph_stats[$d][0]."</td><td nowrap class='chart_td value$class'><img src='images/bar.png' alt='' width='".round(1000*$graph_stats[$d][2]/$max_timeclock)."' height='16' />".sec_convert($graph_stats[$d][2], 'HF')."</td></tr>";
|
||||
$AGENTTIME_graph.=" <tr><td class='chart_td$class'>".$graph_stats[$d][0]."</td><td nowrap class='chart_td value$class'><img src='images/bar.png' alt='' width='".round(1000*$graph_stats[$d][3]/$max_agenttime)."' height='16' />".sec_convert($graph_stats[$d][3], 'HF')."</td></tr>";
|
||||
$WAIT_graph.=" <tr><td class='chart_td$class'>".$graph_stats[$d][0]."</td><td nowrap class='chart_td value$class'><img src='images/bar.png' alt='' width='".round(1000*$graph_stats[$d][4]/$max_wait)."' height='16' />".sec_convert($graph_stats[$d][4], 'HF')."</td></tr>";
|
||||
@@ -1243,7 +1270,7 @@ else
|
||||
$JS_text.=" var cellID=\"timegraph\"+th_id;\n";
|
||||
$JS_text.=" document.getElementById(cellID).style.backgroundColor='#999999';\n";
|
||||
$JS_text.="\n";
|
||||
$JS_text.=" var graph_to_display=eval(\"graph_\"+graph);\n";
|
||||
$JS_text.=" var graph_to_display=eval(graph+\"_graph\");\n";
|
||||
$JS_text.=" document.getElementById('agent_time_detail_graph').innerHTML=graph_to_display;\n";
|
||||
$JS_text.="}\n";
|
||||
|
||||
@@ -1315,16 +1342,6 @@ $JS_onload.="}\n";
|
||||
$JS_text.=$JS_onload;
|
||||
$JS_text.="</script>\n";
|
||||
|
||||
if ($report_display_type=="HTML")
|
||||
{
|
||||
echo $JS_text;
|
||||
echo $GRAPH.$GRAPH2.$GRAPH3.$max;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $ASCII_text;
|
||||
}
|
||||
|
||||
echo "<FORM ACTION=\"$PHP_SELF\" METHOD=GET name=vicidial_report id=vicidial_report>\n";
|
||||
echo "<TABLE CELLSPACING=3><TR><TD VALIGN=TOP> Dates:<BR>";
|
||||
echo "<INPUT TYPE=hidden NAME=DB VALUE=\"$DB\">\n";
|
||||
@@ -1420,6 +1437,16 @@ echo "</FORM>\n\n<BR>$db_source";
|
||||
##### END HTML form section
|
||||
############################################################################
|
||||
|
||||
if ($report_display_type=="HTML")
|
||||
{
|
||||
echo $JS_text;
|
||||
echo $GRAPH.$GRAPH2.$GRAPH3.$max;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo $ASCII_text;
|
||||
}
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $STARTtime);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
# 130610-0945 - Finalized changing of all ereg instances to preg
|
||||
# 130619-2307 - Added filtering of input to prevent SQL injection attacks and new user auth
|
||||
# 130901-1928 - Changed to mysqli PHP functions
|
||||
# 131023-1959 - Fixed bug in 'NONE' conditional check
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -268,7 +269,7 @@ if ($run_export > 0)
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if ( (preg_match('/\s\-\-NONE\-\-\s/',$campaign_string) ) or ($campaign_ct < 1) )
|
||||
if ( (preg_match('/\-\-NONE\-\-/',$campaign_string) ) or ($campaign_ct < 1) )
|
||||
{
|
||||
$campaign_SQL = "campaign_id IN('')";
|
||||
$RUNcampaign=0;
|
||||
@@ -287,7 +288,7 @@ if ($run_export > 0)
|
||||
$group_SQL .= "'$group[$i]',";
|
||||
$i++;
|
||||
}
|
||||
if ( (preg_match('/\s\-\-NONE\-\-\s/',$group_string) ) or ($group_ct < 1) )
|
||||
if ( (preg_match('/\-\-NONE\-\-/',$group_string) ) or ($group_ct < 1) )
|
||||
{
|
||||
$group_SQL = "''";
|
||||
$group_SQL = "campaign_id IN('')";
|
||||
@@ -421,7 +422,7 @@ if ($run_export > 0)
|
||||
{
|
||||
$stmtA = "SELECT vl.call_date,vl.phone_number,vi.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,vl.uniqueid,UNIX_TIMESTAMP(vl.call_date)$export_fields_SQL 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 desc limit 500000;";
|
||||
$rslt=mysql_to_mysqli($stmtA, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
if ($DB) {echo "$stmtA\n";}
|
||||
$inbound_to_print = mysqli_num_rows($rslt);
|
||||
if ( ($inbound_to_print < 1) and ($outbound_calls < 1) )
|
||||
{
|
||||
@@ -455,7 +456,6 @@ if ($run_export > 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ($outbound_to_print > 0) or ($inbound_to_print > 0) )
|
||||
{
|
||||
$TXTfilename = "EXPORT_LEAD_REPORT_$FILE_TIME.txt";
|
||||
@@ -1036,4 +1036,4 @@ if ($file_exported > 0)
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -75,4 +75,7 @@ $nonselectable_statuses = 0;
|
||||
# display first and last name in user stats results
|
||||
$firstlastname_display_user_stats = 0;
|
||||
|
||||
# agent time detail report login/logout link for user
|
||||
$atdr_login_logout_user_link = 0;
|
||||
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
User-Agent: *
|
||||
Disallow: /
|
||||
+866
-818
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user