diff --git a/www/vicidial/AST_timeonVDADall.php b/www/vicidial/AST_timeonVDADall.php index 794cc2b4..1cf227cb 100644 --- a/www/vicidial/AST_timeonVDADall.php +++ b/www/vicidial/AST_timeonVDADall.php @@ -111,10 +111,11 @@ # 190206-1616 - Added mobile device display variable # 190313-0607 - Fix for columns display issue #1141 # 190420-1728 - Added RS_ListenBarge options.php setting +# 190513-1711 - Added ingroup filter # -$version = '2.14-98'; -$build = '190420-1728'; +$version = '2.14-99'; +$build = '190513-1711'; header ("Content-type: text/html; charset=utf-8"); @@ -190,6 +191,8 @@ if (isset($_GET["RTpass"])) {$RTpass=$_GET["RTpass"];} elseif (isset($_POST["RTpass"])) {$RTpass=$_POST["RTpass"];} if (isset($_GET["user_group_filter"])) {$user_group_filter=$_GET["user_group_filter"];} elseif (isset($_POST["user_group_filter"])) {$user_group_filter=$_POST["user_group_filter"];} +if (isset($_GET["ingroup_filter"])) {$ingroup_filter=$_GET["ingroup_filter"];} + elseif (isset($_POST["ingroup_filter"])) {$ingroup_filter=$_POST["ingroup_filter"];} if (isset($_GET["droppedOFtotal"])) {$droppedOFtotal=$_GET["droppedOFtotal"];} elseif (isset($_POST["droppedOFtotal"])) {$droppedOFtotal=$_POST["droppedOFtotal"];} if (isset($_GET["report_display_type"])) {$report_display_type=$_GET["report_display_type"];} @@ -582,6 +585,20 @@ while($i < $user_group_ct) } $user_group_SQL = preg_replace('/,$/i', '',$user_group_SQL); +$i=0; +$ingroup_string='|'; +$ingroup_ct = count($ingroup_filter); +while($i < $ingroup_ct) + { + $ingroup_filter[$i] = preg_replace('/[^-_0-9a-zA-Z]/', '', $ingroup_filter[$i]); + $ingroup_string .= "$ingroup_filter[$i]|"; + $ingroup_SQL .= "'$ingroup_filter[$i]',"; + $ingroupQS .= "&ingroup_filter[]=$ingroup_filter[$i]"; + + $i++; + } +$ingroup_SQL = preg_replace('/,$/i', '',$ingroup_SQL); + ### if no campaigns selected, display all if ( ($group_ct < 1) or (strlen($group_string) < 2) ) { @@ -597,6 +614,15 @@ if ( ($user_group_ct < 1) or (strlen($user_group_string) < 2) ) $user_group_string = '|ALL-GROUPS|'; $usergroupQS .= "&user_group_filter[]=ALL-GROUPS"; } +### if no ingroups selected, display all +$ingroup_none=0; +if ( ($ingroup_ct < 1) or (strlen($ingroup_string) < 2) ) + { + $ingroup_filter[0] = 'ALL-INGROUPS'; + $ingroup_string = '|ALL-INGROUPS|'; + $ingroupQS .= "&ingroup_filter[]=ALL-INGROUPS"; + $ingroup_none=1; + } if ( (preg_match('/\s\-\-NONE\-\-\s/',$group_string) ) or ($group_ct < 1) ) { @@ -641,6 +667,22 @@ else # $user_group_SQLwhere = "where user_group IN($user_group_SQL)"; } +if ( (preg_match('/\s\-\-NONE\-\-\s/',$ingroup_string) ) or ($ingroup_ct < 1) ) + { + $all_active_ingroups = 0; + $ingroup_SQL = "''"; + } +elseif ( preg_match('/ALL\-INGROUPS/i',$ingroup_string) ) + { + $all_active_ingroups = 1; + $ingroup_SQL = "'$rawLOGadmin_viewable_groupsSQL'"; + $ingroup_SQLand = "and campaign_id IN($rawLOGadmin_viewable_groupsSQL)"; + $ingroup_SQLwhere = "where campaign_id IN($rawLOGadmin_viewable_groupsSQL)"; + } +else + { + $all_active_ingroups = 0; + } $stmt="SELECT user_group from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;"; $rslt=mysql_to_mysqli($stmt, $link); @@ -659,6 +701,24 @@ while ($i < $usergroups_to_print) $i++; } +$stmt="select group_id,group_name from vicidial_inbound_groups $whereLOGadmin_viewable_groupsSQL order by group_id;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {$MAIN.="$stmt\n";} +$ingroups_to_print = mysqli_num_rows($rslt); +$i=0; +$LISTingroups[$i]='ALL-INGROUPS'; +$i++; +$ingroups_to_print++; +$ingroups_string='|'; +while ($i < $ingroups_to_print) + { + $row=mysqli_fetch_row($rslt); + $LISTingroups[$i] = $row[0]; + $LISTingroup_names[$i] = $row[1]; + $ingroups_string .= "$LISTingroups[$i]|"; + $i++; + } + if (!isset($RR)) {$RR=4;} $NFB = ''; @@ -692,6 +752,24 @@ while ($o < $usergroups_to_print) } $select_list .= ""; +$select_list .= "

"._QXZ("Select In-Groups").":
"; +$select_list .= ""; + $select_list .= ""; $select_list .= ""._QXZ("Close Panel")."

"; $select_list .= ""; @@ -1161,7 +1239,7 @@ else \n"; - echo"\n"; + echo"\n"; echo "$report_name: $group\n"; $short_header=1; @@ -1214,9 +1292,9 @@ if ($RTajax < 1) echo "\n"; echo "   "; echo "\n"; - echo ""._QXZ("STOP")." | "; - echo ""._QXZ("SLOW")." | "; - echo ""._QXZ("GO").""; + echo ""._QXZ("STOP")." | "; + echo ""._QXZ("SLOW")." | "; + echo ""._QXZ("GO").""; if (preg_match('/ALL\-ACTIVE/i',$group_string)) { echo "       "._QXZ("MODIFY")." | \n"; @@ -1269,6 +1347,18 @@ if ( ( preg_match('/Y/',$with_inbound) or preg_match('/O/',$with_inbound) ) and $closer_campaignsSQL .= "'$closer_campaigns',"; $c++; } + + # Clean up closer campaigns + if (!in_array("ALL-INGROUPS", $ingroup_filter)) { + $filter_closer_campaigns=''; + for ($q=0; $q1) { - $min_link='- min '; + $min_link='- min '; if ($RTajax > 0) {$min_link='';} @@ -2058,61 +2148,61 @@ if ( ($report_display_type!='WALL_1') and ($report_display_type!='WALL_2') and ( { if ($adastats<2) { - echo "+ "._QXZ("VIEW MORE").""; + echo "+ "._QXZ("VIEW MORE").""; } else { - echo "- "._QXZ("VIEW LESS").""; + echo "- "._QXZ("VIEW LESS").""; } } if ($UGdisplay>0) { - echo "       "._QXZ("HIDE USER GROUP").""; + echo "       "._QXZ("HIDE USER GROUP").""; } else { - echo "       "._QXZ("VIEW USER GROUP").""; + echo "       "._QXZ("VIEW USER GROUP").""; } if ($SERVdisplay>0) { - echo "       "._QXZ("HIDE SERVER INFO").""; + echo "       "._QXZ("HIDE SERVER INFO").""; } else { - echo "       "._QXZ("SHOW SERVER INFO").""; + echo "       "._QXZ("SHOW SERVER INFO").""; } if ($CALLSdisplay>0) { - echo "       "._QXZ("HIDE WAITING CALLS").""; + echo "       "._QXZ("HIDE WAITING CALLS").""; } else { - echo "       "._QXZ("SHOW WAITING CALLS").""; + echo "       "._QXZ("SHOW WAITING CALLS").""; } if ($ALLINGROUPstats>0) { - echo "       "._QXZ("HIDE IN-GROUP STATS").""; + echo "       "._QXZ("HIDE IN-GROUP STATS").""; } else { - echo "       "._QXZ("SHOW IN-GROUP STATS").""; + echo "       "._QXZ("SHOW IN-GROUP STATS").""; } if ($PHONEdisplay>0) { - echo "       "._QXZ("HIDE PHONES").""; + echo "       "._QXZ("HIDE PHONES").""; } else { - echo "       "._QXZ("SHOW PHONES").""; + echo "       "._QXZ("SHOW PHONES").""; } if ($CUSTPHONEdisplay>0) { - echo "       "._QXZ("HIDE CUSTPHONES").""; + echo "       "._QXZ("HIDE CUSTPHONES").""; } else { - echo "       "._QXZ("SHOW CUSTPHONES").""; + echo "       "._QXZ("SHOW CUSTPHONES").""; } } @@ -2173,6 +2263,22 @@ if ($campaign_allow_inbound > 0) $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); $closer_campaignsSQL = "'$closer_campaigns'"; } + + # Clean up closer campaigns to only include specifically selected ones + if (!in_array("ALL-INGROUPS", $ingroup_filter)) + { + $filter_closer_campaigns=''; + for ($q=0; $q"._QXZ("PHONE",11)." |"; + $HTphone = " "._QXZ("PHONE",11)." |"; if ($RTajax > 0) {$HTphone = " "._QXZ("PHONE",11)." |";} $HDuser = "------------------------+"; - $HTuser = " "._QXZ("USER",5)." "; + $HTuser = " "._QXZ("USER",5)." "; if ($RTajax > 0) {$HTuser = " "._QXZ("USER",5)." ";} if ($UidORname>0) @@ -2662,7 +2768,7 @@ if ($report_display_type=='TEXT') {$HTuser .= ""._QXZ("SHOW ID",8)." ";} else { - $HTuser .= ""._QXZ("SHOW ID",8)." "; + $HTuser .= ""._QXZ("SHOW ID",8)." "; } } else @@ -2671,13 +2777,13 @@ if ($report_display_type=='TEXT') {$HTuser .= ""._QXZ("SHOW NAME",9)."";} else { - $HTuser .= ""._QXZ("SHOW NAME",9).""; + $HTuser .= ""._QXZ("SHOW NAME",9).""; } } $HTuser .= " "._QXZ("INFO",6)." |"; $HDusergroup = "--------------+"; - $HTusergroup = " "._QXZ("USER GROUP",12)." |"; + $HTusergroup = " "._QXZ("USER GROUP",12)." |"; if ($RTajax > 0) {$HTusergroup = " "._QXZ("USER GROUP",12)." |";} $HDsessionid = "-----------+"; @@ -2697,11 +2803,11 @@ if ($report_display_type=='TEXT') $HDcall_server_ip = "-----------------+"; $HTcall_server_ip = " "._QXZ("CALL SERVER IP",15)." |"; $HDtime = "---------+"; - $HTtime = " MM:SS |"; + $HTtime = " MM:SS |"; if ($RTajax > 0) {$HTtime = " MM:SS |";} $HDcampaign = "------------+"; - $HTcampaign = " "._QXZ("CAMPAIGN",10)." |"; + $HTcampaign = " "._QXZ("CAMPAIGN",10)." |"; if ($RTajax > 0) {$HTcampaign = " "._QXZ("CAMPAIGN",10)." |";} $HDcalls = "-------+"; @@ -2733,12 +2839,12 @@ if ($report_display_type=='HTML') $HDstation = ""; $HTstation = ""; $HDphone = ""; - $HTphone = ""; + $HTphone = ""; if ($RTajax > 0) {$HTphone = "";} $HDuser = ""; - $HTuser = ""; $HDusergroup = ""; - $HTusergroup = ""; + $HTusergroup = ""; if ($RTajax > 0) {$HTusergroup = "";} $HDsessionid = ""; @@ -2782,11 +2888,11 @@ if ($report_display_type=='HTML') $HDcall_server_ip = ""; $HTcall_server_ip = ""; $HDtime = ""; - $HTtime = ""; + $HTtime = ""; if ($RTajax > 0) {$HTtime = "";} $HDcampaign = ""; - $HTcampaign = ""; + $HTcampaign = ""; if ($RTajax > 0) {$HTcampaign = "";} $HDcalls = ""; diff --git a/www/vicidial/realtime_report.php b/www/vicidial/realtime_report.php index 9e657782..c3547c64 100644 --- a/www/vicidial/realtime_report.php +++ b/www/vicidial/realtime_report.php @@ -44,12 +44,13 @@ # 190302-1927 - Added variable-length header icon tables # 190414-1106 - Made admin and summary report links conditional, RS_logoutLINK options.php option # 190420-1729 - Added RS_ListenBarge options.php setting +# 190513-1711 - Added ingroup filter # $startMS = microtime(); -$version = '2.14-31'; -$build = '190420-1729'; +$version = '2.14-32'; +$build = '190513-1711'; header ("Content-type: text/html; charset=utf-8"); @@ -73,6 +74,8 @@ if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} if (isset($_GET["user_group_filter"])) {$user_group_filter=$_GET["user_group_filter"];} elseif (isset($_POST["user_group_filter"])) {$user_group_filter=$_POST["user_group_filter"];} +if (isset($_GET["ingroup_filter"])) {$ingroup_filter=$_GET["ingroup_filter"];} + elseif (isset($_POST["ingroup_filter"])) {$ingroup_filter=$_POST["ingroup_filter"];} if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} @@ -622,6 +625,20 @@ while($i < $user_group_ct) } $user_group_SQL = preg_replace('/,$/i', '',$user_group_SQL); +$i=0; +$ingroup_string='|'; +$ingroup_ct = count($ingroup_filter); +while($i < $ingroup_ct) + { + $ingroup_filter[$i] = preg_replace('/[^-_0-9a-zA-Z]/', '', $ingroup_filter[$i]); + $ingroup_string .= "$ingroup_filter[$i]|"; + $ingroup_SQL .= "'$ingroup_filter[$i]',"; + $usergroupQS .= "&ingroup_filter[]=$ingroup_filter[$i]"; + + $i++; + } +$ingroup_SQL = preg_replace('/,$/i', '',$ingroup_SQL); + ### if no campaigns selected, display all if ( ($group_ct < 1) or (strlen($group_string) < 2) ) { @@ -639,6 +656,15 @@ if ( ($user_group_ct < 1) or (strlen($user_group_string) < 2) ) $usergroupQS .= "&user_group_filter[]=ALL-GROUPS"; $user_group_none=1; } +### if no ingroups selected, display all +$ingroup_none=0; +if ( ($ingroup_ct < 1) or (strlen($ingroup_string) < 2) ) + { + $ingroup_filter[0] = 'ALL-INGROUPS'; + $ingroup_string = '|ALL-INGROUPS|'; + $ingroupQS .= "&ingroup_filter[]=ALL-INGROUPS"; + $ingroup_none=1; + } if ( (preg_match('/\s\-\-NONE\-\-\s/',$group_string) ) or ($group_ct < 1) ) { @@ -683,6 +709,23 @@ else # $user_group_SQLwhere = "where user_group IN($user_group_SQL)"; } + +if ( (preg_match('/\s\-\-NONE\-\-\s/',$ingroup_string) ) or ($ingroup_ct < 1) ) + { + $all_active_ingroups = 0; + $ingroup_SQL = "''"; + } +elseif ( preg_match('/ALL\-INGROUPS/i',$ingroup_string) ) + { + $all_active_ingroups = 1; + $ingroup_SQL = "'$rawLOGadmin_viewable_groupsSQL'"; + } +else + { + $all_active_ingroups = 0; + } + + $stmt="select user_group, group_name from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;"; $rslt=mysql_to_mysqli($stmt, $link); if (!isset($DB)) {$DB=0;} @@ -701,6 +744,25 @@ while ($i < $usergroups_to_print) $i++; } +$stmt="select group_id,group_name from vicidial_inbound_groups $whereLOGadmin_viewable_groupsSQL order by group_id;"; +$rslt=mysql_to_mysqli($stmt, $link); +if ($DB) {$MAIN.="$stmt\n";} +$ingroups_to_print = mysqli_num_rows($rslt); +$i=0; +$LISTingroups[$i]='ALL-INGROUPS'; +$i++; +$ingroups_to_print++; +$ingroups_string='|'; +while ($i < $ingroups_to_print) + { + $row=mysqli_fetch_row($rslt); + $LISTingroups[$i] = $row[0]; + $LISTingroup_names[$i] = $row[1]; + $ingroups_string .= "$LISTingroups[$i]|"; + $i++; + } + + if (!isset($RR)) {$RR=4;} $NFB = ''; @@ -739,6 +801,24 @@ while ($o < $usergroups_to_print) } $select_list .= ""; +$select_list .= "

"._QXZ("Select In-Groups").":
"; +$select_list .= ""; + $select_list .= "
  "._QXZ("STATION")."  "._QXZ("PHONE")."  "._QXZ("PHONE")."  "._QXZ("PHONE")."  "._QXZ("USER")." "; + $HTuser = " "._QXZ("USER")." "; if ($RTajax > 0) {$HTuser = "   "._QXZ("USER")." ";} if ($UidORname>0) @@ -2747,7 +2853,7 @@ if ($report_display_type=='HTML') {$HTuser .= " "._QXZ("SHOW ID")." ";} else { - $HTuser .= " "._QXZ("SHOW ID")." "; + $HTuser .= " "._QXZ("SHOW ID")." "; } } else @@ -2756,13 +2862,13 @@ if ($report_display_type=='HTML') {$HTuser .= " "._QXZ("SHOW NAME")." ";} else { - $HTuser .= "  "._QXZ("SHOW NAME")." "; + $HTuser .= "  "._QXZ("SHOW NAME")." "; } } $HTuser .= " "._QXZ("INFO",6)."  "._QXZ("USER GROUP")."  "._QXZ("USER GROUP")."  "._QXZ("USER GROUP")."   "._QXZ("CALL SERVER IP")."  MM:SS  MM:SS  MM:SS  "._QXZ("CAMPAIGN")."  "._QXZ("CAMPAIGN")."  "._QXZ("CAMPAIGN",10)." "; $select_list .= ""._QXZ("Close Panel")."

"; $select_list .= ""; @@ -1096,6 +1176,7 @@ var pass = ''; var RR = ''; var groupQS = ''; var usergroupQS = ''; +var ingroupQS = ''; var DB = ''; var adastats = ''; var SIPmonitorLINK = ''; @@ -1405,7 +1486,7 @@ function gather_realtime_content() } if (xmlhttp) { - RTupdate_query = "RTajax=1&DB=" + DB + "" + groupQS + usergroupQS + "&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 + "&INGROUPcolorOVERRIDE=" + INGROUPcolorOVERRIDE + "&droppedOFtotal=" + droppedOFtotal + "&report_display_type=" + report_display_type + ""; + RTupdate_query = "RTajax=1&DB=" + DB + "" + groupQS + usergroupQS + ingroupQS + "&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 + "&INGROUPcolorOVERRIDE=" + INGROUPcolorOVERRIDE + "&droppedOFtotal=" + droppedOFtotal + "&report_display_type=" + report_display_type + ""; xmlhttp.open('POST', 'AST_timeonVDADall.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); @@ -1575,13 +1656,30 @@ function update_variables(task_option,task_choice,force_reload) } } usergroupQS = temp_usergroup_choices; + + var temp_ingroup_choices = ''; + var selIngrpObj = document.getElementById('ingroup_filter[]'); + var i; + var count = 0; + var selected_all=0; + for (i=0; i