Patch for user_group bug in several reports, related to Issue #1346
git-svn-id: svn://192.168.202.10@3736 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# AST_CLOSERsummary_hourly.php
|
||||
#
|
||||
# Copyright (C) 2022 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
@@ -34,6 +34,7 @@
|
||||
# 191013-0831 - Fixes for PHP7
|
||||
# 200605-1100 - user_group bug fix
|
||||
# 220303-0829 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -325,8 +326,8 @@ if ( (!preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) and (strlen($LOGa
|
||||
{
|
||||
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ -/",'',$LOGadmin_viewable_groups);
|
||||
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL);
|
||||
$LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||
$whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||
$LOGadmin_viewable_groupsSQL = "and (user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL') OR user_group is null)";
|
||||
$whereLOGadmin_viewable_groupsSQL = "where (user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL') OR user_group is null)";
|
||||
}
|
||||
|
||||
$LOGadmin_viewable_call_timesSQL='';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# AST_agentDIDstats.php
|
||||
#
|
||||
# Copyright (C) 2022 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
@@ -10,6 +10,7 @@
|
||||
# 170829-0040 - Added screen color settings
|
||||
# 191013-0836 - Fixes for PHP7
|
||||
# 220303-1422 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -217,6 +218,7 @@ if ( (!preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) and (strlen($LOGa
|
||||
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ -/",'',$LOGadmin_viewable_groups);
|
||||
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL);
|
||||
$LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||
$LOGadmin_viewable_and_null_groupsSQL = "and ( ".$vicidial_closer_log_table.".user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL') OR (".$vicidial_closer_log_table.".user_group is null AND ".$vicidial_closer_log_table.".user='VDCL') )";
|
||||
$whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||
}
|
||||
|
||||
@@ -640,7 +642,7 @@ else
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if (mysqli_num_rows($rslt)>0) {
|
||||
while ($row=mysqli_fetch_array($rslt)) {
|
||||
$agent_stmt="select vicidial_users.user, vicidial_users.full_name from ".$vicidial_closer_log_table.", vicidial_users where uniqueid='$row[uniqueid]' and ".$vicidial_closer_log_table.".user=vicidial_users.user";
|
||||
$agent_stmt="select vicidial_users.user, vicidial_users.full_name from ".$vicidial_closer_log_table.", vicidial_users where uniqueid='$row[uniqueid]' and ".$vicidial_closer_log_table.".user=vicidial_users.user $LOGadmin_viewable_and_null_groupsSQL";
|
||||
if ($DB) {echo "$agent_stmt\n";}
|
||||
$agent_rslt=mysql_to_mysqli($agent_stmt, $link);
|
||||
while($agent_row=mysqli_fetch_array($agent_rslt)) {
|
||||
@@ -648,11 +650,16 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
$ASCII_text.=" $current_date\n";
|
||||
$ASCII_text.=$ASCII_headerA.$ASCII_headerB.$ASCII_headerA;
|
||||
# Added 5/23/23, as with new user_group filter we don't want to print a date entry that has no viewable users
|
||||
if (count($user_array)>0)
|
||||
{
|
||||
$ASCII_text.=" $current_date\n";
|
||||
$ASCII_text.=$ASCII_headerA.$ASCII_headerB.$ASCII_headerA;
|
||||
|
||||
$CSV_text.="\"$current_date\"\n";
|
||||
$CSV_text.=$CSV_header;
|
||||
}
|
||||
|
||||
$CSV_text.="\"$current_date\"\n";
|
||||
$CSV_text.=$CSV_header;
|
||||
#while (list($key, $val)=each($user_array)) {
|
||||
foreach($user_array as $key => $val) {
|
||||
$agent_total=0;
|
||||
@@ -671,8 +678,12 @@ else
|
||||
$CSV_text.="\"$agent_total\"\n";
|
||||
$date_total+=$agent_total;
|
||||
}
|
||||
$ASCII_text.=$ASCII_headerA."\n\n";
|
||||
$CSV_text.="\n\n";
|
||||
# Added 5/23/23, as with new user_group filter we don't want to print a date entry that has no viewable users
|
||||
if (count($user_array)>0)
|
||||
{
|
||||
$ASCII_text.=$ASCII_headerA."\n\n";
|
||||
$CSV_text.="\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
$q++;
|
||||
@@ -689,7 +700,7 @@ else
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if (mysqli_num_rows($rslt)>0) {
|
||||
while ($row=mysqli_fetch_array($rslt)) {
|
||||
$agent_stmt="select vicidial_users.user, vicidial_users.full_name from ".$vicidial_closer_log_table.", vicidial_users where uniqueid='$row[uniqueid]' and ".$vicidial_closer_log_table.".user=vicidial_users.user";
|
||||
$agent_stmt="select vicidial_users.user, vicidial_users.full_name from ".$vicidial_closer_log_table.", vicidial_users where uniqueid='$row[uniqueid]' and ".$vicidial_closer_log_table.".user=vicidial_users.user $LOGadmin_viewable_and_null_groupsSQL";
|
||||
if ($DB) {echo "$agent_stmt\n";}
|
||||
$agent_rslt=mysql_to_mysqli($agent_stmt, $link);
|
||||
while($agent_row=mysqli_fetch_array($agent_rslt)) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# AST_agent_days_detail.php
|
||||
#
|
||||
# Copyright (C) 2022 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
@@ -35,6 +35,7 @@
|
||||
# 171204-2300 - Fixed minor reporting bug
|
||||
# 191013-0848 - Fixes for PHP7
|
||||
# 220221-0946 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -335,16 +336,34 @@ if ( (!preg_match('/\-\-ALL\-\-/i', $LOGadmin_viewable_call_times)) and (strlen(
|
||||
$whereLOGadmin_viewable_call_timesSQL = "where call_time_id IN('---ALL---','$rawLOGadmin_viewable_call_timesSQL')";
|
||||
}
|
||||
|
||||
|
||||
$stmt="select user_group from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$user_groups_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
$group_string='|';
|
||||
$group_ct = count($group);
|
||||
while($i < $group_ct)
|
||||
$user_groups=array();
|
||||
while ($i < $user_groups_to_print)
|
||||
{
|
||||
$group_string .= "$group[$i]|";
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$user_groups[$i] =$row[0];
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
#if ( (preg_match("/--ALL--/",$group_string) ) or ($group_ct < 1) )
|
||||
# {
|
||||
$user_group_SQL = "and user_group IN('".implode("', '", $user_groups)."')";
|
||||
$user_group_SQL_val = "and vicidial_agent_log.user_group IN('".implode("', '", $user_groups)."')";
|
||||
$user_group_IN_clause="user_group in ('".implode("', '", $user_groups)."')";
|
||||
# }
|
||||
#else
|
||||
# {
|
||||
# $user_group_SQL = preg_replace("/,\$/",'',$user_group_SQL);
|
||||
# $user_group_SQL_str=$user_group_SQL;
|
||||
# $user_group_IN_clause="user_group in ($user_group_SQL)";
|
||||
# $user_group_SQL = "and user_group IN($user_group_SQL)";
|
||||
# }
|
||||
|
||||
$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
@@ -516,40 +535,58 @@ else
|
||||
$date_namesARY[0]='';
|
||||
$k=0;
|
||||
|
||||
$stmt="select date_format(event_time, '%Y-%m-%d') as date,count(*) as calls,status from vicidial_users,".$vicidial_agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=".$vicidial_agent_log_table.".user and ".$vicidial_agent_log_table.".user='$user' $group_SQL $user_group_SQL $vuLOGadmin_viewable_groupsSQL group by date,status order by date,status desc limit 500000;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rows_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $rows_to_print)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$ustmt="select count(*), if($user_group_IN_clause, 1, 0) as accessible_user From vicidial_users where user='$user'";
|
||||
if ($DB) {echo "$ustmt\n";}
|
||||
$urslt=mysql_to_mysqli($ustmt, $link);
|
||||
$urow=mysqli_fetch_row($urslt);
|
||||
$rows_to_print=0;
|
||||
|
||||
if ( ($row[1] > 0) and (strlen($row[2]) > 0) )
|
||||
if ($urow[0]>0 && $urow[1]>0)
|
||||
{
|
||||
$stmt="select date_format(event_time, '%Y-%m-%d') as date,count(*) as calls,status from vicidial_users,".$vicidial_agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=".$vicidial_agent_log_table.".user and ".$vicidial_agent_log_table.".user='$user' $group_SQL $user_group_SQL_val $vuLOGadmin_viewable_groupsSQL group by date,status order by date,status desc limit 500000;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rows_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $rows_to_print)
|
||||
{
|
||||
$date[$i] = $row[0];
|
||||
$calls[$i] = $row[1];
|
||||
$status[$i] = $row[2];
|
||||
if ( (!preg_match("/\-$status[$i]\-/i", $statuses)) and (strlen($status[$i])>0) )
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
|
||||
if ( ($row[1] > 0) and (strlen($row[2]) > 0) )
|
||||
{
|
||||
$statusesTXT = sprintf("%8s", $status[$i]);
|
||||
$statusesHEAD .= "----------+";
|
||||
$statusesHTML .= " $statusesTXT |";
|
||||
$statusesFILE .= "$status[$i],";
|
||||
$statuses .= "$status[$i]-";
|
||||
$statusesARY[$j] = $status[$i];
|
||||
$j++;
|
||||
}
|
||||
if (!preg_match("/\-$date[$i]\-/i", $dates))
|
||||
{
|
||||
$dates .= "$date[$i]-";
|
||||
$datesARY[$k] = $date[$i];
|
||||
$k++;
|
||||
$date[$i] = $row[0];
|
||||
$calls[$i] = $row[1];
|
||||
$status[$i] = $row[2];
|
||||
if ( (!preg_match("/\-$status[$i]\-/i", $statuses)) and (strlen($status[$i])>0) )
|
||||
{
|
||||
$statusesTXT = sprintf("%8s", $status[$i]);
|
||||
$statusesHEAD .= "----------+";
|
||||
$statusesHTML .= " $statusesTXT |";
|
||||
$statusesFILE .= "$status[$i],";
|
||||
$statuses .= "$status[$i]-";
|
||||
$statusesARY[$j] = $status[$i];
|
||||
$j++;
|
||||
}
|
||||
if (!preg_match("/\-$date[$i]\-/i", $dates))
|
||||
{
|
||||
$dates .= "$date[$i]-";
|
||||
$datesARY[$k] = $date[$i];
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
if ($urow[0]==0 || $urow[1]==0 || $rows_to_print==0)
|
||||
{
|
||||
$ASCII_text.=($urow[0]==0 ? "*** "._QXZ("USER ID NOT FOUND")." ***" : ($urow[1]==0 ? "*** "._QXZ("YOU DO NOT HAVE PRIVILEGES TO VIEW THIS USER")." ***" : "*** "._QXZ("NO RECORDS FOUND")." ***"))."\n";
|
||||
$GRAPH_text.="<BR><font class='standard_bold' color='red'>".($urow[0]==0 ? "*** "._QXZ("USER ID NOT FOUND")." ***" : ($urow[1]==0 ? "*** "._QXZ("YOU DO NOT HAVE PRIVILEGES TO VIEW THIS USER")." ***" : "*** "._QXZ("NO RECORDS FOUND")." ***"))."</font>";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($file_download < 1)
|
||||
{
|
||||
$ASCII_text.=_QXZ("LEAD STATS BREAKDOWN").":\n";
|
||||
@@ -903,6 +940,8 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
} // END USER CHECK
|
||||
|
||||
|
||||
if ($file_download > 0)
|
||||
{
|
||||
@@ -945,6 +984,7 @@ if ($file_download > 0)
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$JS_onload.="}\n";
|
||||
if ($report_display_type=='HTML') {$JS_text.=$JS_onload;}
|
||||
$JS_text.="</script>\n";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# AST_agent_days_time.php
|
||||
#
|
||||
# Copyright (C) 2022 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
@@ -12,6 +12,7 @@
|
||||
# 170829-0040 - Added screen color settings
|
||||
# 191013-0812 - Fixes for PHP7
|
||||
# 220303-1510 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -493,27 +494,35 @@ else
|
||||
$date_namesARY[0]='';
|
||||
$k=0;
|
||||
|
||||
$stmt="select date_format(event_time, '%Y-%m-%d') as date,count(*) as calls from vicidial_users,".$vicidial_agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=".$vicidial_agent_log_table.".user and ".$vicidial_agent_log_table.".user='$user' $group_SQL $user_group_SQL $vuLOGadmin_viewable_groupsSQL group by date order by date desc limit 500000;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rows_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $rows_to_print)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$ustmt="select count(*), if(user_group in ('$rawLOGadmin_viewable_groupsSQL'), 1, 0) as accessible_user From vicidial_users where user='$user'";
|
||||
$urslt=mysql_to_mysqli($ustmt, $link);
|
||||
$urow=mysqli_fetch_row($urslt);
|
||||
$rows_to_print=0;
|
||||
|
||||
if ( ($row[1] > 0) and (strlen($row[0]) > 0) )
|
||||
if ($urow[0]>0 && $urow[1]>0)
|
||||
{
|
||||
$stmt="select date_format(event_time, '%Y-%m-%d') as date,count(*) as calls from vicidial_users,".$vicidial_agent_log_table." where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=".$vicidial_agent_log_table.".user and ".$vicidial_agent_log_table.".user='$user' $group_SQL $user_group_SQL $vuLOGadmin_viewable_groupsSQL group by date order by date desc limit 500000;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rows_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $rows_to_print)
|
||||
{
|
||||
$date[$i] = $row[0];
|
||||
$calls[$i] = $row[1];
|
||||
if (!preg_match("/\-$date[$i]\-/i", $dates))
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
|
||||
if ( ($row[1] > 0) and (strlen($row[0]) > 0) )
|
||||
{
|
||||
$dates .= "$date[$i]-";
|
||||
$datesARY[$k] = $date[$i];
|
||||
$k++;
|
||||
$date[$i] = $row[0];
|
||||
$calls[$i] = $row[1];
|
||||
if (!preg_match("/\-$date[$i]\-/i", $dates))
|
||||
{
|
||||
$dates .= "$date[$i]-";
|
||||
$datesARY[$k] = $date[$i];
|
||||
$k++;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
@@ -521,7 +530,8 @@ else
|
||||
$MAIN.="<TABLE width=750 cellspacing=0 cellpadding=1>\n";
|
||||
$MAIN.="<tr><td><font size=2>"._QXZ("DATE")." </td><td align=left><font size=2>"._QXZ("PAUSE")."</td><td align=left><font size=2> "._QXZ("WAIT")."</td><td align=left><font size=2> "._QXZ("TALK")."</td><td align=right><font size=2> "._QXZ("DISPO")."</td><td align=right><font size=2> "._QXZ("DEAD")."</td><td align=right><font size=2> "._QXZ("CUSTOMER")."</td><td align=right><font size=2> "._QXZ("TOTAL")."</td></tr>\n";
|
||||
$MAINprintALL .= $MAIN;
|
||||
|
||||
$MAIN='';
|
||||
|
||||
$i=0;
|
||||
while ($i < $rows_to_print)
|
||||
{
|
||||
@@ -653,6 +663,11 @@ else
|
||||
$i++;
|
||||
}
|
||||
|
||||
if ($i==0)
|
||||
{
|
||||
$MAIN.="<tr><td colspan='8' align='center'><font size=2>".($urow[0]==0 ? "*** "._QXZ("USER ID NOT FOUND")." ***" : ($urow[1]==0 ? "*** ._QXZ("YOU DO NOT HAVE PRIVILEGES TO VIEW THIS USER")." ***" : "*** ._QXZ("NO RECORDS FOUND")." ***"))."</font></td></tr>";
|
||||
}
|
||||
|
||||
$MAIN.="</TABLE></center><BR><BR>\n";
|
||||
}
|
||||
|
||||
@@ -749,6 +764,7 @@ echo $MAINprintALL;
|
||||
|
||||
echo "</span>\n";
|
||||
|
||||
/*
|
||||
if ($report_display_type=="TEXT" || !$report_display_type)
|
||||
{
|
||||
echo "<span style=\"position:absolute;left:3px;top:3px;z-index:18;\" id=agent_status_bars>\n";
|
||||
@@ -781,6 +797,7 @@ if ($report_display_type=="TEXT" || !$report_display_type)
|
||||
|
||||
echo "</span>\n";
|
||||
}
|
||||
*/
|
||||
|
||||
if ($db_source == 'S')
|
||||
{
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
<?php
|
||||
# AST_agent_inbound_status.php
|
||||
#
|
||||
# Copyright (C) 2022 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
# 170913-0853 - First build based upon AST_agent_status_detail.php
|
||||
# 191013-0841 - Fixes for PHP7
|
||||
# 220303-1503 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -268,6 +269,7 @@ if ( (!preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) and (strlen($LOGa
|
||||
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL);
|
||||
$LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||
$whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||
$LOGadminVCL_viewable_groupsSQL = "and (".$closer_log_table.".user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL') OR (".$closer_log_table.".user_group IS NULL and ".$closer_log_table.".user='VDCL'))";
|
||||
}
|
||||
|
||||
$LOGadmin_viewable_call_timesSQL='';
|
||||
@@ -355,11 +357,11 @@ while($i < $user_group_ct)
|
||||
$i++;
|
||||
}
|
||||
if ( (preg_match('/\-\-ALL\-\-/',$user_group_string) ) or ($user_group_ct < 1) )
|
||||
{$user_group_SQL = "";}
|
||||
{$user_group_SQL = "$LOGadminVCL_viewable_groupsSQL";}
|
||||
else
|
||||
{
|
||||
$user_group_SQL = preg_replace('/,$/i', '',$user_group_SQL);
|
||||
$user_group_SQL = "and ".$closer_log_table.".user_group IN($user_group_SQL)";
|
||||
$user_group_SQL = "$LOGadminVCL_viewable_groupsSQL and ".$closer_log_table.".user_group IN($user_group_SQL)";
|
||||
}
|
||||
|
||||
if ($DB) {echo "$user_group_string|$user_group_ct|$user_groupQS|$i<BR>";}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Pulls time stats per agent selectable by campaign or user group
|
||||
# should be most accurate agent stats of all of the reports
|
||||
#
|
||||
# Copyright (C) 2022 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
# 90522-0723 - First build
|
||||
@@ -59,6 +59,7 @@
|
||||
# 210324-2010 - Added agent visibility stats to HTML graphs
|
||||
# 211115-1513 - Fix for case-mismatch on pause code statuses for multi-campaign selects
|
||||
# 220303-1427 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -481,7 +482,11 @@ while($i < $user_group_ct)
|
||||
$i++;
|
||||
}
|
||||
if ( (preg_match('/\-\-ALL\-\-/',$user_group_string) ) or ($user_group_ct < 1) )
|
||||
{$user_group_SQL = "";}
|
||||
{
|
||||
# $user_group_SQL = "";
|
||||
$user_group_SQL = " $LOGadmin_viewable_groupsSQL";
|
||||
$TCuser_group_SQL = " $LOGadmin_viewable_groupsSQL";
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_group_SQL = preg_replace('/,$/i', '',$user_group_SQL);
|
||||
@@ -622,7 +627,8 @@ else
|
||||
############################################################################
|
||||
|
||||
### BEGIN gather user IDs and names for matching up later
|
||||
$stmt="select full_name,$userSQL from vicidial_users $whereLOGadmin_viewable_groupsSQL order by user limit 100000;";
|
||||
# user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')
|
||||
$stmt="select full_name,$userSQL,if(user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL'), 1, 0) from vicidial_users $whereLOGadmin_viewable_groupsSQL order by user limit 100000;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {echo "|$stmt\n";}
|
||||
$users_to_print = mysqli_num_rows($rslt);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# AST_inbound_daily_report.php
|
||||
#
|
||||
# Copyright (C) 2022 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
@@ -35,6 +35,7 @@
|
||||
# 191013-0902 - Fixes for PHP7
|
||||
# 200701-1500 - Added option to exclude after-hours from abandons, list ID filtering
|
||||
# 220302-1803 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# AST_inbound_forecasting.php
|
||||
#
|
||||
# Copyright (C) 2022 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
@@ -14,6 +14,7 @@
|
||||
# 191013-0856 - Fixes for PHP7
|
||||
# 210823-0948 - Fix for security issue, added NONE option for campaigns
|
||||
# 220301-2219 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -299,6 +300,7 @@ if ( (!preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) and (strlen($LOGa
|
||||
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ -/",'',$LOGadmin_viewable_groups);
|
||||
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL);
|
||||
$LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||
$LOGadmin_viewable_and_null_groupsSQL = "and ( user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL') OR (user_group is null AND user='VDCL')) )";
|
||||
$whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||
}
|
||||
|
||||
@@ -725,17 +727,17 @@ else
|
||||
}
|
||||
|
||||
if ($erlang_type=="B") {
|
||||
$hour_stmt="select closecallid, substr(call_date, 1, 13) as start_hour, length_in_sec, substr(call_date+INTERVAL length_in_sec second, 1, 13) as end_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'))-UNIX_TIMESTAMP(call_date), length_in_sec) as length_up_to_next_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(call_date+INTERVAL length_in_sec second)-UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00')), 0) as length_running_into_next_hour, status, uniqueid from vicidial_closer_log where length_in_sec is not null and campaign_id in ($campaign_group_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59' and status!='AFTHRS'"; # *
|
||||
$hour_stmt="select closecallid, substr(call_date, 1, 13) as start_hour, length_in_sec, substr(call_date+INTERVAL length_in_sec second, 1, 13) as end_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'))-UNIX_TIMESTAMP(call_date), length_in_sec) as length_up_to_next_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(call_date+INTERVAL length_in_sec second)-UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00')), 0) as length_running_into_next_hour, status, uniqueid from vicidial_closer_log where length_in_sec is not null and campaign_id in ($campaign_group_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59' and status!='AFTHRS' $LOGadmin_viewable_and_null_groupsSQL"; # *
|
||||
|
||||
$avg_stmt="select avg(length_in_sec) as avg_length from vicidial_closer_log where length_in_sec is not null and campaign_id in ($campaign_group_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59'"; # **
|
||||
$avg_stmt="select avg(length_in_sec) as avg_length from vicidial_closer_log where length_in_sec is not null and campaign_id in ($campaign_group_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59' $LOGadmin_viewable_and_null_groupsSQL"; # **
|
||||
|
||||
$wrapup_stmt="select uniqueid from vicidial_closer_log where length_in_sec is not null and user!='VDCL' and campaign_id in ($campaign_group_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59'"; # ***
|
||||
$wrapup_stmt="select uniqueid from vicidial_closer_log where length_in_sec is not null and user!='VDCL' and campaign_id in ($campaign_group_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59' $LOGadmin_viewable_groupsSQL"; # ***
|
||||
} else {
|
||||
$hour_stmt="select uniqueid, substr(call_date, 1, 13) as start_hour, length_in_sec, substr(call_date+INTERVAL length_in_sec second, 1, 13) as end_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'))-UNIX_TIMESTAMP(call_date), length_in_sec) as length_up_to_next_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(call_date+INTERVAL length_in_sec second)-UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00')), 0) as length_running_into_next_hour, status, uniqueid from vicidial_log where length_in_sec is not null and campaign_id in ($campaign_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59' and status!='AFTHRS'"; # *
|
||||
$hour_stmt="select uniqueid, substr(call_date, 1, 13) as start_hour, length_in_sec, substr(call_date+INTERVAL length_in_sec second, 1, 13) as end_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'))-UNIX_TIMESTAMP(call_date), length_in_sec) as length_up_to_next_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(call_date+INTERVAL length_in_sec second)-UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00')), 0) as length_running_into_next_hour, status, uniqueid from vicidial_log where length_in_sec is not null and campaign_id in ($campaign_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59' and status!='AFTHRS' $LOGadmin_viewable_and_null_groupsSQL"; # *
|
||||
|
||||
$avg_stmt="select avg(length_in_sec) as avg_length from vicidial_log where length_in_sec is not null and campaign_id in ($campaign_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59'"; # **
|
||||
|
||||
$wrapup_stmt="select uniqueid from vicidial_log where length_in_sec is not null and user!='VDCL' and campaign_id in ($campaign_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59'"; # ***
|
||||
$wrapup_stmt="select uniqueid from vicidial_log where length_in_sec is not null and user!='VDAD' and campaign_id in ($campaign_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59'"; # ***
|
||||
}
|
||||
if ($DB) {echo "|$hour_stmt|\n";}
|
||||
if ($DB) {echo "|$avg_stmt|\n";}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# AST_performance_comparison_report.php
|
||||
#
|
||||
# Copyright (C) 2022 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
@@ -21,6 +21,7 @@
|
||||
# 180507-2315 - Added new help display
|
||||
# 191013-0900 - Fixes for PHP7
|
||||
# 220302-0957 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -446,11 +447,14 @@ while($i < $user_group_ct)
|
||||
$i++;
|
||||
}
|
||||
if ( (preg_match('/\-\-ALL\-\-/',$user_group_string) ) or ($user_group_ct < 1) )
|
||||
{$user_group_SQL = "";}
|
||||
{
|
||||
# $user_group_SQL = "";
|
||||
$user_group_SQL = "and vicidial_users.user_group IN('".implode("', '", $user_groups)."')";
|
||||
}
|
||||
else
|
||||
{
|
||||
$user_group_SQL = preg_replace('/,$/i', '',$user_group_SQL);
|
||||
$user_group_agent_log_SQL = "and ".$vicidial_agent_log_table.".user_group IN($user_group_SQL)";
|
||||
# $user_group_agent_log_SQL = "and ".$vicidial_agent_log_table.".user_group IN($user_group_SQL)";
|
||||
$user_group_SQL = "and vicidial_users.user_group IN($user_group_SQL)";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# AST_user_group_hourly_detail.php
|
||||
#
|
||||
# Copyright (C) 2022 Joseph Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Joseph Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# Gives hourly count of distinct agents per user group, with totals.
|
||||
# For single days only
|
||||
@@ -14,6 +14,7 @@
|
||||
# 180507-2315 - Added new help display
|
||||
# 191013-0855 - Fixes for PHP7
|
||||
# 220221-0932 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -327,7 +328,7 @@ if ( (!preg_match('/\-\-ALL\-\-/i', $LOGadmin_viewable_call_times)) and (strlen(
|
||||
|
||||
$stmt="select user_group from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$HTML_text.="$stmt\n";}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$user_groups_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
$user_groups=array();
|
||||
@@ -349,7 +350,7 @@ while($i < $user_group_ct)
|
||||
$i++;
|
||||
}
|
||||
if ( (preg_match("/--ALL--/",$user_group_string) ) or ($user_group_ct < 1) )
|
||||
{$user_group_SQL = "";}
|
||||
{$user_group_SQL = "and user_group IN('".implode("', '", $user_groups)."')";}
|
||||
else
|
||||
{
|
||||
$user_group_SQL = preg_replace("/,\$/",'',$user_group_SQL);
|
||||
@@ -361,14 +362,23 @@ else
|
||||
|
||||
$stmt="SELECT campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$HTML_text.="$stmt\n";}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$campaigns_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
$groups=array();
|
||||
if (in_array("--ALL--", $group))
|
||||
{
|
||||
$ALL_campaigns_selected=1;
|
||||
$group=array();
|
||||
}
|
||||
while ($i < $campaigns_to_print)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$groups[$i] =$row[0];
|
||||
if ($ALL_campaigns_selected)
|
||||
{
|
||||
$group[$i]=$row[0];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# AST_user_group_hourly_detail.php
|
||||
#
|
||||
# Copyright (C) 2022 Liz Tejada <liz@softkyrios.com>
|
||||
# Copyright (C) 2023 Liz Tejada <liz@softkyrios.com>
|
||||
# Joseph Johnson <freewermadmin@gmail.com>
|
||||
# Matt Florell <vicidial@gmail.com>
|
||||
#
|
||||
@@ -19,6 +19,7 @@
|
||||
# 180507-2315 - Added new help display
|
||||
# 191013-0816 - Fixes for PHP7
|
||||
# 220301-1940 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -204,6 +205,13 @@ else
|
||||
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
|
||||
exit;
|
||||
}
|
||||
if ($auth_message == 'IPBLOCK')
|
||||
{
|
||||
$VDdisplayMESSAGE = _QXZ("Your IP Address is not allowed") . ": $ip";
|
||||
Header ("Content-type: text/html; charset=utf-8");
|
||||
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$auth_message|\n";
|
||||
exit;
|
||||
}
|
||||
Header("WWW-Authenticate: Basic realm=\"CONTACT-CENTER-ADMIN\"");
|
||||
Header("HTTP/1.0 401 Unauthorized");
|
||||
echo "$VDdisplayMESSAGE: |$PHP_AUTH_USER|$PHP_AUTH_PW|$auth_message|\n";
|
||||
@@ -218,6 +226,9 @@ $LOGserver_name = getenv("SERVER_NAME");
|
||||
$LOGserver_port = getenv("SERVER_PORT");
|
||||
$LOGrequest_uri = getenv("REQUEST_URI");
|
||||
$LOGhttp_referer = getenv("HTTP_REFERER");
|
||||
$LOGbrowser=preg_replace("/\'|\"|\\\\/","",$LOGbrowser);
|
||||
$LOGrequest_uri=preg_replace("/\'|\"|\\\\/","",$LOGrequest_uri);
|
||||
$LOGhttp_referer=preg_replace("/\'|\"|\\\\/","",$LOGhttp_referer);
|
||||
if (preg_match("/443/i",$LOGserver_port)) {$HTTPprotocol = 'https://';}
|
||||
else {$HTTPprotocol = 'http://';}
|
||||
if (($LOGserver_port == '80') or ($LOGserver_port == '443') ) {$LOGserver_port='';}
|
||||
@@ -321,7 +332,7 @@ if ( (!preg_match('/\-\-ALL\-\-/i', $LOGadmin_viewable_call_times)) and (strlen(
|
||||
|
||||
$stmt="select user_group from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;";
|
||||
$rslt=mysql_to_mysqli($stmt, $link);
|
||||
if ($DB) {$HTML_text.="$stmt\n";}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$user_groups_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
$user_groups=array();
|
||||
@@ -344,7 +355,7 @@ while($i < $user_group_ct)
|
||||
$i++;
|
||||
}
|
||||
if ( (preg_match("/--ALL--/",$user_group_string) ) or ($user_group_ct < 1) )
|
||||
{$user_group_SQL = "";}
|
||||
{$user_group_SQL = "and log.user_group IN('".implode("', '", $user_groups)."')";}
|
||||
else
|
||||
{
|
||||
$user_group_SQL = preg_replace("/,\$/",'',$user_group_SQL);
|
||||
@@ -360,10 +371,19 @@ if ($DB) {$HTML_text.="$stmt\n";}
|
||||
$campaigns_to_print = mysqli_num_rows($rslt);
|
||||
$i=0;
|
||||
$groups=array();
|
||||
if (in_array("--ALL--", $group))
|
||||
{
|
||||
$ALL_campaigns_selected=1;
|
||||
$group=array();
|
||||
}
|
||||
while ($i < $campaigns_to_print)
|
||||
{
|
||||
$row=mysqli_fetch_row($rslt);
|
||||
$groups[$i] =$row[0];
|
||||
if ($ALL_campaigns_selected)
|
||||
{
|
||||
$group[$i]=$row[0];
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# This User-Group based report runs some very intensive SQL queries, so it is
|
||||
# not recommended to run this on long time periods.
|
||||
#
|
||||
# Copyright (C) 2022 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Joe Johnson, Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
@@ -25,6 +25,7 @@
|
||||
# 180507-2315 - Added new help display
|
||||
# 191013-0822 - Fixes for PHP7
|
||||
# 220301-1656 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -314,11 +315,11 @@ while($i < $user_group_ct)
|
||||
}
|
||||
|
||||
if ( (preg_match('/\-\-ALL\-\-/',$user_group_string) ) or ($user_group_ct < 1) )
|
||||
{$user_group_SQL = "";}
|
||||
{$user_group_SQL = "where USER_group in ('".implode("', '", $user_groups)."')";}
|
||||
else
|
||||
{
|
||||
$user_group_SQL = preg_replace('/,$/i', '',$user_group_SQL);
|
||||
$user_group_SQL = "where user_group in ($user_group_SQL)";
|
||||
$user_group_SQL = "where user_GROUP in ($user_group_SQL)";
|
||||
#$user_group_SQL = "and vicidial_agent_log.user_group IN($user_group_SQL)";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
# Erlang_report.php
|
||||
#
|
||||
# Copyright (C) 2022 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2023 Matt Florell <vicidial@gmail.com>, Joe Johnson <freewermadmin@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
@@ -14,6 +14,7 @@
|
||||
# 180712-1508 - Fix for rare allowed reports issue
|
||||
# 191013-0820 - Fixes for PHP7
|
||||
# 220301-0937 - Added allow_web_debug system setting
|
||||
# 230526-1740 - Patch for user_group bug, related to Issue #1346
|
||||
#
|
||||
|
||||
$startMS = microtime();
|
||||
@@ -290,6 +291,7 @@ if ( (!preg_match('/\-\-ALL\-\-/i',$LOGadmin_viewable_groups)) and (strlen($LOGa
|
||||
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ -/",'',$LOGadmin_viewable_groups);
|
||||
$rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL);
|
||||
$LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||
$LOGadmin_viewable_and_null_groupsSQL = "and ( user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL') OR (user_group is null AND user='VDCL') )";
|
||||
$whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')";
|
||||
}
|
||||
|
||||
@@ -707,12 +709,13 @@ else
|
||||
}
|
||||
|
||||
if ($erlang_type=="B") {
|
||||
$hour_stmt="select closecallid, substr(call_date, 1, 13) as start_hour, length_in_sec, substr(call_date+INTERVAL length_in_sec second, 1, 13) as end_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'))-UNIX_TIMESTAMP(call_date), length_in_sec) as length_up_to_next_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(call_date+INTERVAL length_in_sec second)-UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00')), 0) as length_running_into_next_hour, status, uniqueid from vicidial_closer_log where length_in_sec is not null and campaign_id in ($campaign_group_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59' and status!='AFTHRS'"; # *
|
||||
$hour_stmt="select closecallid, substr(call_date, 1, 13) as start_hour, length_in_sec, substr(call_date+INTERVAL length_in_sec second, 1, 13) as end_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'))-UNIX_TIMESTAMP(call_date), length_in_sec) as length_up_to_next_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(call_date+INTERVAL length_in_sec second)-UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00')), 0) as length_running_into_next_hour, status, uniqueid from vicidial_closer_log where length_in_sec is not null and campaign_id in ($campaign_group_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59' and status!='AFTHRS' $LOGadmin_viewable_and_null_groupsSQL"; # *
|
||||
|
||||
$avg_stmt="select avg(length_in_sec) as avg_length from vicidial_closer_log where length_in_sec is not null and campaign_id in ($campaign_group_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59'"; # **
|
||||
$avg_stmt="select avg(length_in_sec) as avg_length from vicidial_closer_log where length_in_sec is not null and campaign_id in ($campaign_group_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59' $LOGadmin_viewable_and_null_groupsSQL"; # **
|
||||
|
||||
$wrapup_stmt="select uniqueid from vicidial_closer_log where length_in_sec is not null and user!='VDCL' and campaign_id in ($campaign_group_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59'"; # ***
|
||||
$wrapup_stmt="select uniqueid from vicidial_closer_log where length_in_sec is not null and user!='VDCL' and campaign_id in ($campaign_group_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59' $LOGadmin_viewable_groupsSQL"; # ***
|
||||
} else {
|
||||
# There are no filters for user groups in "C" reports because outbound calls don't reliably log user groups.
|
||||
$hour_stmt="select uniqueid, substr(call_date, 1, 13) as start_hour, length_in_sec, substr(call_date+INTERVAL length_in_sec second, 1, 13) as end_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'))-UNIX_TIMESTAMP(call_date), length_in_sec) as length_up_to_next_hour, if(DATE_FORMAT(call_date, '%Y-%m-%d %H:00:00')!=DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00'), UNIX_TIMESTAMP(call_date+INTERVAL length_in_sec second)-UNIX_TIMESTAMP(DATE_FORMAT(call_date+INTERVAL length_in_sec second, '%Y-%m-%d %H:00:00')), 0) as length_running_into_next_hour, status, uniqueid from vicidial_log where length_in_sec is not null and campaign_id in ($campaign_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59' and status!='AFTHRS'"; # *
|
||||
|
||||
$avg_stmt="select avg(length_in_sec) as avg_length from vicidial_log where length_in_sec is not null and campaign_id in ($campaign_SQL) and call_date>='$query_date 00:00:00' and call_date<='$end_date 23:59:59'"; # **
|
||||
|
||||
Reference in New Issue
Block a user