From fa5272bc9ad3be67c5691fac825f034fdf2846e6 Mon Sep 17 00:00:00 2001 From: mattf Date: Sat, 31 Jan 2009 16:31:16 +0000 Subject: [PATCH] changed timeonVDADall report to allow for multiple campaign selections added purge-table option to area_code populate script git-svn-id: svn://192.168.202.10@1043 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/bin/ADMIN_area_code_populate.pl | 40 +++ .../trunk/www/vicidial/AST_timeonVDADall.php | 281 ++++++++++++------ 2 files changed, 223 insertions(+), 98 deletions(-) diff --git a/agc_2-X/trunk/bin/ADMIN_area_code_populate.pl b/agc_2-X/trunk/bin/ADMIN_area_code_populate.pl index d42a1832..26ac7d94 100644 --- a/agc_2-X/trunk/bin/ADMIN_area_code_populate.pl +++ b/agc_2-X/trunk/bin/ADMIN_area_code_populate.pl @@ -14,6 +14,7 @@ # 61122-1902 - Added GMT_USA_zip.txt data import for USA postal GMT data # 80416-1017 - Added download of phone codes from remote host # 90129-0932 - Added optional NANP prefix/time date import "--load-NANPA-prefix" flag +# 90131-0933 - Added purge-table option to clear out old records before adding new ones # @@ -42,6 +43,7 @@ if (length($ARGV[0])>1) print " [--debug] = debug output\n"; print " [--use-local-files] = Do not download files, use local copies\n"; print " [--load-NANPA-prefix] = Only loads the special NANPA list into the database\n"; + print " [--purge-table] = Purges the table to be inserted before inserting\n"; print "\n files used by this script are:\n"; print " phone_codes_GMT-latest.txt - Phone codes and country codes with time zone data\n"; print " GMT_USA_zip-latest.txt - USA zip code and time zone data\n"; @@ -83,6 +85,11 @@ if (length($ARGV[0])>1) $nanpa_load=1; print "\n----- NANPA PHONE PREFIX DATA LOAD -----\n\n"; } + if ($args =~ /--purge-table/i) + { + $purge_table=1; + print "\n----- PURGE TABLE BEFORE DATA LOAD -----\n\n"; + } } } else @@ -157,6 +164,17 @@ if ($nanpa_load > 0) open(prefixfile, "$PATHhome/NANPA_prefix-latest.txt") || die "can't open $PATHhome/NANPA_prefix-latest.txt: $!\n"; @prefixfile = ; close(prefixfile); + if ( ($purge_table > 0) && ($#prefixfile > 10) ) + { + print "\n----- PURGING DATA IN vicidial_nanpa_prefix_codes TABLE -----\n\n"; + + $stmtA = "DELETE from vicidial_nanpa_prefix_codes;"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + $stmtA = "OPTIMIZE table vicidial_nanpa_prefix_codes;"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + } $pc=0; $full_file=0; $ins_stmt="insert into vicidial_nanpa_prefix_codes VALUES "; foreach (@prefixfile) @@ -234,6 +252,17 @@ else open(codefile, "$PATHhome/phone_codes_GMT-latest.txt") || die "can't open $PATHhome/phone_codes_GMT-latest.txt: $!\n"; @codefile = ; close(codefile); + if ( ($purge_table > 0) && ($#codefile > 10) ) + { + print "\n----- PURGING DATA IN vicidial_phone_codes TABLE -----\n\n"; + + $stmtA = "DELETE from vicidial_phone_codes;"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + $stmtA = "OPTIMIZE table vicidial_phone_codes;"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + } $pc=0; $ins_stmt="insert into vicidial_phone_codes VALUES "; foreach (@codefile) @@ -275,6 +304,17 @@ else open(zipfile, "$PATHhome/GMT_USA_zip-latest.txt") || die "can't open $PATHhome/GMT_USA_zip-latest.txt: $!\n"; @zipfile = ; close(zipfile); + if ( ($purge_table > 0) && ($#zipfile > 10) ) + { + print "\n----- PURGING DATA IN vicidial_postal_codes TABLE -----\n\n"; + + $stmtA = "DELETE from vicidial_postal_codes;"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + $stmtA = "OPTIMIZE table vicidial_postal_codes;"; + if($DB){print STDERR "\n|$stmtA|\n";} + $affected_rows = $dbhA->do($stmtA); + } $pc=0; $ins_stmt="insert into vicidial_postal_codes VALUES "; foreach (@zipfile) diff --git a/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php b/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php index 7bab36ee..7f54268d 100644 --- a/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php +++ b/agc_2-X/trunk/www/vicidial/AST_timeonVDADall.php @@ -56,10 +56,12 @@ if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];} elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];} if (isset($_GET["RR"])) {$RR=$_GET["RR"];} elseif (isset($_POST["RR"])) {$RR=$_POST["RR"];} -if (isset($_GET["inbound"])) {$inbound=$_GET["inbound"];} - elseif (isset($_POST["inbound"])) {$inbound=$_POST["inbound"];} +if (isset($_GET["inbound"])) {$inbound=$_GET["inbound"];} + elseif (isset($_POST["inbound"])) {$inbound=$_POST["inbound"];} if (isset($_GET["group"])) {$group=$_GET["group"];} elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["groups"])) {$groups=$_GET["groups"];} + elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} if (isset($_GET["DB"])) {$DB=$_GET["DB"];} @@ -108,7 +110,7 @@ while ($i < $qm_conf_ct) ########################################### if (!isset($RR)) {$RR=40;} -if (!isset($group)) {$group=''; $RR=40;} +if (!isset($group)) {$group='';} if (!isset($usergroup)) {$usergroup='';} if (!isset($UGdisplay)) {$UGdisplay=0;} # 0=no, 1=yes if (!isset($UidORname)) {$UidORname=0;} # 0=id, 1=name @@ -121,6 +123,9 @@ if (!isset($with_inbound)) {$with_inbound='N';} # N=no, Y=yes, O=only if (!isset($PAUSEcodes)) {$PAUSEcodes='N';} # 0=no, 1=yes $ingroup_detail=''; +if (strlen($group)>1) {$groups[0] = $group; $RR=40;} +else {$group = $groups[0];} + function get_server_load($windows = false) { $os = strtolower(PHP_OS); if(strpos($os, "win") === false) { @@ -186,19 +191,47 @@ $STARTtime = date("U"); $epochSIXhoursAGO = ($STARTtime - 21600); $timeSIXhoursAGO = date("Y-m-d H:i:s",$epochSIXhoursAGO); -$stmt="select campaign_id from vicidial_campaigns where active='Y';"; +$stmt="select campaign_id,campaign_name from vicidial_campaigns where active='Y';"; $rslt=mysql_query($stmt, $link); if (!isset($DB)) {$DB=0;} if ($DB) {echo "$stmt\n";} $groups_to_print = mysql_num_rows($rslt); $i=0; + $LISTgroups[$i]='ALL-ACTIVE'; + $i++; + $groups_to_print++; while ($i < $groups_to_print) { $row=mysql_fetch_row($rslt); - $groups[$i] =$row[0]; + $LISTgroups[$i] =$row[0]; + $LISTnames[$i] =$row[1]; $i++; } +$i=0; +$group_string='|'; +$group_ct = count($groups); +while($i < $group_ct) + { + $group_string .= "$groups[$i]|"; + $group_SQL .= "'$groups[$i]',"; + $groupQS .= "&groups[]=$groups[$i]"; + $i++; + } +if ( (ereg("--NONE--",$group_string) ) or ($group_ct < 1) ) + { + $group_SQL = "''"; +# $group_SQL = "group_id IN('')"; + } +else + { + $group_SQL = eregi_replace(",$",'',$group_SQL); +# $group_SQL = "group_id IN($group_SQL)"; + } + +if ( (eregi('ALL-ACTIVE',$group_string)) and ($with_inbound=='O') ) + {$with_inbound='N';} + $stmt="select * from vicidial_user_groups;"; $rslt=mysql_query($stmt, $link); if (!isset($DB)) {$DB=0;} @@ -218,10 +251,73 @@ $NFB = ''; $NFE = ''; $F=''; $FG=''; $B=''; $BG=''; +$select_list = "
Select Campaigns:
"; +$select_list .= ""; +$select_list .= "
CLOSE PANEL"; +$select_list .= "
"; + +if ($UGdisplay > 0) + { + $select_list .= "

"; + } +if (!eregi('ALL-ACTIVE',$group_string)) + { + $select_list .= "   Inbound:
"; + +$open_list = "
Choose Real-Time Display Options
"; + ?> + + + \n"; -$stmt = "select count(*) from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "' and campaign_allow_inbound='Y';"; +$stmt = "select count(*) from vicidial_campaigns where campaign_id IN($group_SQL) and campaign_allow_inbound='Y';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $campaign_allow_inbound = $row[0]; echo "\n"; -echo"\n"; +echo"\n"; echo "VICIDIAL: Time On VDAD Campaign: $group\n"; echo "
\n"; -echo "VICIDIAL Campaign: \n"; echo "\n"; echo "\n"; echo "\n"; @@ -290,47 +385,16 @@ echo "\n"; echo "\n"; echo "\n"; echo "\n"; -echo "\n"; -if ($UGdisplay > 0) - { - echo "\n"; - } -if (!eregi('XXXX-ALL-ACTIVE-XXXX', $group)) - { - echo "   Inbound:         \n"; -echo "STOP | "; -echo "SLOW | "; -echo "GO"; -if ($group == 'XXXX-ALL-ACTIVE-XXXX') +echo "VICIDIAL                                                                                                             \n"; +echo "\n"; +echo "
\n"; +echo "Choose Real-Time Display Options"; +echo "
\n"; +echo "
\n"; +echo "STOP | "; +echo "SLOW | "; +echo "GO"; +if (eregi('ALL-ACTIVE',$group_string)) { echo "       MODIFY | \n"; } @@ -338,7 +402,7 @@ else { echo "       MODIFY | \n"; } -echo "SUMMARY | \n"; +echo "SUMMARY | \n"; echo "REPORTS
\n"; echo "\n\n"; @@ -352,13 +416,19 @@ $multi_drop=0; if (ereg('O',$with_inbound)) { $multi_drop++; - $stmt = "select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $stmt = "select closer_campaigns from vicidial_campaigns where campaign_id IN($group_SQL);"; $rslt=mysql_query($stmt, $link); + $ccamps_to_print = mysql_num_rows($rslt); + while ($ccamps_to_print > $c) + { $row=mysql_fetch_row($rslt); $closer_campaigns = $row[0]; $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); - $closer_campaignsSQL = "'$closer_campaigns'"; + $closer_campaignsSQL .= "'$closer_campaigns',"; + $c++; + } + $closer_campaignsSQL = eregi_replace(",$",'',$closer_campaignsSQL); if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";} if ($adastats>1) @@ -474,11 +544,11 @@ if (ereg('O',$with_inbound)) } - $stmt="select agent_pause_codes_active from vicidial_campaigns where campaign_id IN ('" . mysql_real_escape_string($group) . "',$closer_campaignsSQL);"; + $stmt="select agent_pause_codes_active from vicidial_campaigns where campaign_id IN($group_SQL);"; $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 where campaign_id IN ($closer_campaignsSQL);"; - $stmtC="select agent_non_pause_sec from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; + $stmtC="select agent_non_pause_sec from vicidial_campaign_stats where campaign_id IN($group_SQL);"; if ($DB > 0) {echo "\n|$stmt|$stmtB|$stmtC|\n";} @@ -594,7 +664,7 @@ if (ereg('O',$with_inbound)) ##### NOT INBOUND ONLY ### else { - if ($group=='XXXX-ALL-ACTIVE-XXXX') + if (eregi('ALL-ACTIVE',$group_string)) { $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) from vicidial_campaigns;"; @@ -608,24 +678,31 @@ else if ( (ereg('Y',$with_inbound)) and ($campaign_allow_inbound > 0) ) { $multi_drop++; - $stmt = "select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $stmt = "select distinct closer_campaigns from vicidial_campaigns where campaign_id IN($group_SQL);"; $rslt=mysql_query($stmt, $link); + $ccamps_to_print = mysql_num_rows($rslt); + $c=0; + while ($ccamps_to_print > $c) + { $row=mysql_fetch_row($rslt); $closer_campaigns = $row[0]; $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); - $closer_campaignsSQL = "'$closer_campaigns'"; + $closer_campaignsSQL .= "'$closer_campaigns',"; + $c++; + } + $closer_campaignsSQL = eregi_replace(",$",'',$closer_campaignsSQL); if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";} - $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 from vicidial_campaigns where campaign_id IN ('" . mysql_real_escape_string($group) . "',$closer_campaignsSQL);"; + $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 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 ('" . mysql_real_escape_string($group) . "',$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);"; } 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 from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $stmt="select avg(auto_dial_level),dial_status_a,dial_status_b,dial_status_c,dial_status_d,dial_status_e,lead_order,lead_filter_id,max(hopper_level),dial_method,max(adaptive_maximum_level),avg(adaptive_dropped_percentage),avg(adaptive_dl_diff_target),avg(adaptive_intensity),available_only_ratio_tally,max(adaptive_latest_server_time),local_call_time,max(dial_timeout),dial_statuses,agent_pause_codes_active from vicidial_campaigns where campaign_id IN($group_SQL);"; - $stmtB="select dialable_leads,calls_today,drops_today,drops_answers_today_pct,differential_onemin,agents_average_onemin,balance_trunk_fill,answers_today,status_category_1,status_category_count_1,status_category_2,status_category_count_2,status_category_3,status_category_count_3,status_category_4,status_category_count_4 from vicidial_campaign_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; + $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),status_category_1,sum(status_category_count_1),status_category_2,sum(status_category_count_2),status_category_3,sum(status_category_count_3),status_category_4,sum(status_category_count_4) from vicidial_campaign_stats where campaign_id IN($group_SQL);"; } } if ($DB > 0) {echo "\n|$stmt|$stmtB|\n";} @@ -656,8 +733,8 @@ else $agent_pause_codes_active = $row[19]; - $stmt="select count(*) from vicidial_hopper where campaign_id='" . mysql_real_escape_string($group) . "';"; - if ($group=='XXXX-ALL-ACTIVE-XXXX') + $stmt="select count(*) from vicidial_hopper where campaign_id IN($group_SQL);"; + if (eregi('ALL-ACTIVE',$group_string)) { $stmt="select count(*) from vicidial_hopper;"; } @@ -702,8 +779,8 @@ else } else {$diffpctONEMIN = '0.00';} - $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id='" . mysql_real_escape_string($group) . "';"; - if ($group=='XXXX-ALL-ACTIVE-XXXX') + $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats where campaign_id IN($group_SQL);"; + if (eregi('ALL-ACTIVE',$group_string)) { $stmt="select sum(local_trunk_shortage) from vicidial_campaign_server_stats;"; } @@ -722,7 +799,7 @@ else if ($adastats>1) { echo ""; - echo "- min   MAX LEVEL:  $maxDIALlev   "; + echo "- min   MAX LEVEL:  $maxDIALlev   "; echo "DROPPED MAX:  $DROPmax%    "; echo "TARGET DIFF:  $targetDIFF     "; echo "INTENSITY:  $ADAintense     "; @@ -783,59 +860,59 @@ echo "$ingroup_detail"; if ($adastats<2) { - echo "+ VIEW MORE"; + echo "+ VIEW MORE"; } else { - echo "+ VIEW LESS"; + echo "+ VIEW LESS"; } if ($UGdisplay>0) { - echo "       HIDE USER GROUP"; + echo "       HIDE USER GROUP"; } else { - echo "       VIEW USER GROUP"; + echo "       VIEW USER GROUP"; } if ($UidORname>0) { - echo "       SHOW AGENT ID"; + echo "       SHOW AGENT ID"; } else { - echo "       SHOW AGENT NAME"; + echo "       SHOW AGENT NAME"; } if ($SERVdisplay>0) { - echo "       HIDE SERVER INFO"; + echo "       HIDE SERVER INFO"; } else { - echo "       SHOW SERVER INFO"; + echo "       SHOW SERVER INFO"; } if ($CALLSdisplay>0) { - echo "       HIDE WAITING CALLS"; + echo "       HIDE WAITING CALLS"; } else { - echo "       SHOW WAITING CALLS"; + echo "       SHOW WAITING CALLS"; } if ($PHONEdisplay>0) { - echo "       HIDE PHONES"; + echo "       HIDE PHONES"; } else { - echo "       SHOW PHONES"; + echo "       SHOW PHONES"; } if ($CUSTPHONEdisplay>0) { - echo "       HIDE CUSTPHONES"; + echo "       HIDE CUSTPHONES"; } else { - echo "       SHOW CUSTPHONES"; + echo "       SHOW CUSTPHONES"; } echo ""; echo ""; @@ -848,21 +925,29 @@ echo "\n\n"; ################################################################################### if ($campaign_allow_inbound > 0) { - $stmt="select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; + $stmt="select closer_campaigns from vicidial_campaigns where campaign_id IN($group_SQL);"; $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); - $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); - $closer_campaigns = "'$closer_campaigns'"; + $ccamps_to_print = mysql_num_rows($rslt); + $c=0; + while ($ccamps_to_print > $c) + { + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaignsSQL .= "'$closer_campaigns',"; + $c++; + } + $closer_campaignsSQL = eregi_replace(",$",'',$closer_campaignsSQL); - $stmtB="from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (campaign_id='" . mysql_real_escape_string($group) . "' and call_type IN('OUT','OUTBALANCE')) ) order by queue_priority desc,campaign_id,call_time;"; + $stmtB="from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaignsSQL)) or (campaign_id IN($group_SQL) and call_type IN('OUT','OUTBALANCE')) ) order by queue_priority desc,campaign_id,call_time;"; } else { - if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} - else {$groupSQL = " and campaign_id='" . mysql_real_escape_string($group) . "'";} + if (eregi('ALL-ACTIVE',$group_string)) {$UgroupSQL = '';} + else {$UgroupSQL = " and campaign_id IN($group_SQL)";} - $stmtB="from vicidial_auto_calls where status NOT IN('XFER') $groupSQL order by queue_priority desc,campaign_id,call_time;"; + $stmtB="from vicidial_auto_calls where status NOT IN('XFER') $UgroupSQL order by queue_priority desc,campaign_id,call_time;"; } if ($CALLSdisplay > 0) { @@ -1028,7 +1113,7 @@ if ($campaignord=='campaignup') {$campaignord='campaigndown';} else {$campaignord='campaignup';} $Aecho = ''; -$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group $NOW_TIME\n"; +$Aecho .= "VICIDIAL: Agents Time On Calls Campaign: $group_string $NOW_TIME\n"; $HDbegin = "+"; @@ -1036,11 +1121,11 @@ $HTbegin = "|"; $HDstation = "------------+"; $HTstation = " STATION |"; $HDphone = "------------+"; -$HTphone = " PHONE |"; +$HTphone = " PHONE |"; $HDuser = "--------------------+"; -$HTuser = " USER |"; +$HTuser = " USER |"; $HDusergroup = "--------------+"; -$HTusergroup = " USER GROUP |"; +$HTusergroup = " USER GROUP |"; $HDsessionid = "------------------+"; $HTsessionid = " SESSIONID |"; $HDbarge = "-------+"; @@ -1054,9 +1139,9 @@ $HTserver_ip = " SERVER IP |"; $HDcall_server_ip = "-----------------+"; $HTcall_server_ip = " CALL SERVER IP |"; $HDtime = "---------+"; -$HTtime = " MM:SS |"; +$HTtime = " MM:SS |"; $HDcampaign = "------------+"; -$HTcampaign = " CAMPAIGN |"; +$HTcampaign = " CAMPAIGN |"; $HDcalls = "-------+"; $HTcalls = " CALLS |"; $HDpause = ''; @@ -1129,12 +1214,12 @@ else if ($orderby=='userdown') {$orderSQL='vicidial_live_agents.user desc';} } -if ($group=='XXXX-ALL-ACTIVE-XXXX') {$groupSQL = '';} -else {$groupSQL = " and vicidial_live_agents.campaign_id='" . mysql_real_escape_string($group) . "'";} +if (eregi('ALL-ACTIVE',$group_string)) {$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) . "'";} -$stmt="select extension,vicidial_live_agents.user,conf_exten,vicidial_live_agents.status,vicidial_live_agents.server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,vicidial_live_agents.campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments,vicidial_live_agents.calls_today,vicidial_live_agents.callerid,lead_id from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $groupSQL $usergroupSQL order by $orderSQL;"; +$stmt="select extension,vicidial_live_agents.user,conf_exten,vicidial_live_agents.status,vicidial_live_agents.server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,vicidial_live_agents.campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments,vicidial_live_agents.calls_today,vicidial_live_agents.callerid,lead_id from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $UgroupSQL $usergroupSQL order by $orderSQL;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $talking_to_print = mysql_num_rows($rslt);