From 2d0602b4ffde695ac95c5d7d6948c814ddd3fe5a Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 22 Nov 2013 12:16:22 +0000 Subject: [PATCH] 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 --- agc_2-X/trunk/UPGRADE | 2 + agc_2-X/trunk/extras/did_recent_call.php | 91 + agc_2-X/trunk/install.pl | 6 + agc_2-X/trunk/www/agc/options-example.php | 4 +- .../www/vicidial/AST_agent_time_detail.php | 63 +- .../trunk/www/vicidial/lead_report_export.php | 10 +- .../trunk/www/vicidial/options-example.php | 3 + agc_2-X/trunk/www/vicidial/robots.txt | 2 + agc_2-X/trunk/www/vicidial/user_stats.php | 1684 +++++++++-------- 9 files changed, 1023 insertions(+), 842 deletions(-) create mode 100644 agc_2-X/trunk/extras/did_recent_call.php create mode 100644 agc_2-X/trunk/www/vicidial/robots.txt diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index c1140ea2..adf03794 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -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 diff --git a/agc_2-X/trunk/extras/did_recent_call.php b/agc_2-X/trunk/extras/did_recent_call.php new file mode 100644 index 00000000..d4db7396 --- /dev/null +++ b/agc_2-X/trunk/extras/did_recent_call.php @@ -0,0 +1,91 @@ + 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"; + +?> diff --git a/agc_2-X/trunk/install.pl b/agc_2-X/trunk/install.pl index 3f348dcf..ec97e260 100644 --- a/agc_2-X/trunk/install.pl +++ b/agc_2-X/trunk/install.pl @@ -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/`; diff --git a/agc_2-X/trunk/www/agc/options-example.php b/agc_2-X/trunk/www/agc/options-example.php index d065687a..a6ff9293 100644 --- a/agc_2-X/trunk/www/agc/options-example.php +++ b/agc_2-X/trunk/www/agc/options-example.php @@ -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 diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php b/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php index 93dbcf29..56959d7f 100644 --- a/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php +++ b/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.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=""; + $GRAPH.="
"; $GRAPH2=""; if ($show_parks) { $GRAPH2.=""; @@ -938,9 +947,17 @@ else if ($file_download < 1) { - $Toutput = "| $Sname[$m] | $Suser[$m] | $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] | $Suser[$m] | $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] | $Suser[$m] | $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"; for ($e=0; $e"; + if ($atdr_login_logout_user_link > 0) + { + $CALLS_graph.=" "; + } + else + { + $CALLS_graph.=" "; + } $TIMECLOCK_graph.=" "; $AGENTTIME_graph.=" "; $WAIT_graph.=" "; @@ -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.="\n"; -if ($report_display_type=="HTML") - { - echo $JS_text; - echo $GRAPH.$GRAPH2.$GRAPH3.$max; - } -else - { - echo $ASCII_text; - } - echo "\n"; echo "
CALLSTIME CLOCKAGENT TIMEPARKSPARKTIMEAVGPARKPARKS/CALL".$graph_stats[$d][1]."
".$graph_stats[$d][0]."".$graph_stats[$d][1]."
".$graph_stats[$d][0]."".$graph_stats[$d][1]."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][2], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][3], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][4], 'HF')."
$MAIN.="
Dates:
"; echo "\n"; @@ -1420,6 +1437,16 @@ echo "\n\n
$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); diff --git a/agc_2-X/trunk/www/vicidial/lead_report_export.php b/agc_2-X/trunk/www/vicidial/lead_report_export.php index f726f257..8d3e7b7d 100644 --- a/agc_2-X/trunk/www/vicidial/lead_report_export.php +++ b/agc_2-X/trunk/www/vicidial/lead_report_export.php @@ -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; -?> \ No newline at end of file +?> diff --git a/agc_2-X/trunk/www/vicidial/options-example.php b/agc_2-X/trunk/www/vicidial/options-example.php index 3c4d4dc6..3740a43a 100644 --- a/agc_2-X/trunk/www/vicidial/options-example.php +++ b/agc_2-X/trunk/www/vicidial/options-example.php @@ -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; + ?> diff --git a/agc_2-X/trunk/www/vicidial/robots.txt b/agc_2-X/trunk/www/vicidial/robots.txt new file mode 100644 index 00000000..c6742d8a --- /dev/null +++ b/agc_2-X/trunk/www/vicidial/robots.txt @@ -0,0 +1,2 @@ +User-Agent: * +Disallow: / diff --git a/agc_2-X/trunk/www/vicidial/user_stats.php b/agc_2-X/trunk/www/vicidial/user_stats.php index d7969ffc..73463b3d 100644 --- a/agc_2-X/trunk/www/vicidial/user_stats.php +++ b/agc_2-X/trunk/www/vicidial/user_stats.php @@ -42,6 +42,7 @@ # 130625-1341 - Added phone login and phone_ip display to login/logout section # 130901-0836 - Changed to mysqli PHP functions # 131016-2102 - Added checking for level 8 add-copy restriction +# 131122-0705 - Added pause_code_rpt option coming from Agent Time Detail report # $startMS = microtime(); @@ -80,6 +81,8 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +if (isset($_GET["pause_code_rpt"])) {$pause_code_rpt=$_GET["pause_code_rpt"];} + elseif (isset($_POST["pause_code_rpt"])) {$pause_code_rpt=$_POST["pause_code_rpt"];} ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### @@ -347,12 +350,13 @@ $MAIN.="
 
  \n"; -$download_link="$PHP_SELF?DB=$DB&did_id=$did_id&did=$did&begin_date=$begin_date&end_date=$end_date&user=$user&submit=$submit\n"; +$download_link="$PHP_SELF?DB=$DB&pause_code_rpt=$pause_code_rpt&did_id=$did_id&did=$did&begin_date=$begin_date&end_date=$end_date&user=$user&submit=$submit\n"; $MAIN.="
\n"; $MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; +$MAIN.="\n"; $MAIN.=""; $MAIN.="