diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index bccc83eb..94a8aeb3 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -125,7 +125,7 @@ OTHER CHANGES: any action or changes to enable since it is a change to the code. We are working on converting the administrative PHP scripts as well. These require MySQL 5.0 minimum to be used, but for several years that - has been the minimmum for Vicidial anyway, so that requirement shouldn't + has been the minimum for Vicidial anyway, so that requirement shouldn't be a problem for existing systems running the newest code. The existing older mysql PHP functions are set to be marked as depricated in PHP for future versions. For more information on mysqli you can visit the below diff --git a/agc_2-X/trunk/bin/nanpa_type_filter.pl b/agc_2-X/trunk/bin/nanpa_type_filter.pl index 3a03bba9..ae11d324 100644 --- a/agc_2-X/trunk/bin/nanpa_type_filter.pl +++ b/agc_2-X/trunk/bin/nanpa_type_filter.pl @@ -12,6 +12,7 @@ # # CHANGES # 130822-1645 - first build +# 131003-1725 - Added exclude filter settings # $secX = time(); @@ -53,6 +54,8 @@ if (length($ARGV[0])>1) print " [--landline-list-id=XXX] = OPTIONAL, list that you want to move landline phones into\n"; print " [--invalid-list-id=XXX] = OPTIONAL, list that you want to move invalid prefix phone numbers into\n"; print " [--vl-field-update=XXX] = OPTIONAL, field that you want to update with the phone type information\n"; + print " [--exclude-field=XXX] = OPTIONAL, field that you want to check in vicidial_list to exclude from processing\n"; + print " [--exclude-value=XXX] = OPTIONAL, value of the above field that you want to check in vicidial_list to exclude from processing\n"; print "\n"; exit; } @@ -152,6 +155,20 @@ if (length($ARGV[0])>1) $vl_field_update =~ s/ .*//gi; if ($DB > 0) {print "\n----- VL FIELD UPDATE: $vl_field_update -----\n\n";} } + if ($args =~ /--exclude-field=/i) + { + @data_in = split(/--exclude-field=/,$args); + $exclude_field = $data_in[1]; + $exclude_field =~ s/ .*//gi; + if ($DB > 0) {print "\n----- EXCLUDE FIELD: $exclude_field -----\n\n";} + } + if ($args =~ /--exclude-value=/i) + { + @data_in = split(/--exclude-value=/,$args); + $exclude_value = $data_in[1]; + $exclude_value =~ s/ .*//gi; + if ($DB > 0) {print "\n----- EXCLUDE VALUE: $exclude_value -----\n\n";} + } } } else @@ -276,14 +293,28 @@ $dbhB = DBI->connect("DBI:mysql:$VARDB_database:$VARDB_server:$VARDB_port", "$VA if ($output_to_db) { - $stmtA = "INSERT INTO vicidial_nanpa_filter_log SET output_code='$db_output_code',user='$TRIGGER_user',status='LAUNCHED',server_ip='$VARserver_ip',list_id='$list_id',start_time=NOW(),update_time=NOW(),status_line='Starting...',script_output=\"Starting...\nCELLPHONE LIST ID: $cellphone_list_id\nLANDLINE LIST ID: $landline_list_id\nINVALID LIST ID: $invalid_list_id\nVL FIELD UPDATE: $vl_field_update\n\" ON DUPLICATE KEY UPDATE status='LAUNCHED',server_ip='$VARserver_ip',list_id='$list_id',update_time=NOW(),status_line=\"Starting...\n\",script_output=CONCAT(script_output,\"Starting...\nCELLPHONE LIST ID: $cellphone_list_id\nLANDLINE LIST ID: $landline_list_id\nINVALID LIST ID: $invalid_list_id\nVL FIELD UPDATE: $vl_field_update\n\");"; + $stmtA = "INSERT INTO vicidial_nanpa_filter_log SET output_code='$db_output_code',user='$TRIGGER_user',status='LAUNCHED',server_ip='$VARserver_ip',list_id='$list_id',start_time=NOW(),update_time=NOW(),status_line='Starting...',script_output=\"Starting...\nCELLPHONE LIST ID: $cellphone_list_id\nLANDLINE LIST ID: $landline_list_id\nINVALID LIST ID: $invalid_list_id\nVL FIELD UPDATE: $vl_field_update\nEXCLUDE FIELD: $exclude_field\nEXCLUDE VALUE: $exclude_value\n\" ON DUPLICATE KEY UPDATE status='LAUNCHED',server_ip='$VARserver_ip',list_id='$list_id',update_time=NOW(),status_line=\"Starting...\n\",script_output=CONCAT(script_output,\"Starting...\nCELLPHONE LIST ID: $cellphone_list_id\nLANDLINE LIST ID: $landline_list_id\nINVALID LIST ID: $invalid_list_id\nVL FIELD UPDATE: $vl_field_update\nEXCLUDE FIELD: $exclude_field\nEXCLUDE VALUE: $exclude_value\n\");"; $affected_rows = $dbhA->do($stmtA); if($DBX){print STDERR "\n|$affected_rows|$stmtA|\n";} } @lead_ids=@MT; @phones=@MT; -$stmtA = "SELECT lead_id,phone_number from vicidial_list $list_idSQL;"; + +$excludeSQL=''; +if ( (length($exclude_field) > 1) && (length($exclude_value) > 1) ) + { + if (length($list_idSQL) > 5) + { + $excludeSQL = "and $exclude_field!='$exclude_value'"; + } + else + { + $excludeSQL = "where $exclude_field!='$exclude_value'"; + } + } + +$stmtA = "SELECT lead_id,phone_number from vicidial_list $list_idSQL $excludeSQL;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; diff --git a/agc_2-X/trunk/bin/nanpa_type_preload.pl b/agc_2-X/trunk/bin/nanpa_type_preload.pl index a4e52bd7..9ae63a7f 100644 --- a/agc_2-X/trunk/bin/nanpa_type_preload.pl +++ b/agc_2-X/trunk/bin/nanpa_type_preload.pl @@ -12,6 +12,7 @@ # # CHANGES # 130914-1710 - first build +# 131003-1743 - Added exclude filter settings # $PATHconf = '/etc/astguiclient.conf'; @@ -118,6 +119,8 @@ if (length($ARGV[0])>1) print " [--landline-list-id=XXX] = OPTIONAL, list that you want to move landline phones into\n"; print " [--invalid-list-id=XXX] = OPTIONAL, list that you want to move invalid prefix phone numbers into\n"; print " [--vl-field-update=XXX] = OPTIONAL, field that you want to update with the phone type information\n"; + print " [--exclude-field=XXX] = OPTIONAL, field that you want to check in vicidial_list to exclude from processing\n"; + print " [--exclude-value=XXX] = OPTIONAL, value of the above field that you want to check in vicidial_list to exclude from processing\n"; print "\n"; exit; } @@ -216,6 +219,20 @@ if (length($ARGV[0])>1) $vl_field_update =~ s/ .*//gi; if ($DB > 0) {print "\n----- VL FIELD UPDATE: $vl_field_update -----\n\n";} } + if ($args =~ /--exclude-field=/i) + { + @data_in = split(/--exclude-field=/,$args); + $exclude_field = $data_in[1]; + $exclude_field =~ s/ .*//gi; + if ($DB > 0) {print "\n----- EXCLUDE FIELD: $exclude_field -----\n\n";} + } + if ($args =~ /--exclude-value=/i) + { + @data_in = split(/--exclude-value=/,$args); + $exclude_value = $data_in[1]; + $exclude_value =~ s/ .*//gi; + if ($DB > 0) {print "\n----- EXCLUDE VALUE: $exclude_value -----\n\n";} + } } } else @@ -252,6 +269,20 @@ if (!%six_digit_wireless_hash) {&CompilePrefixHashes;} @lead_ids=@MT; @phones=@MT; + +$excludeSQL=''; +if ( (length($exclude_field) > 1) && (length($exclude_value) > 1) ) + { + if (length($list_idSQL) > 5) + { + $excludeSQL = "and $exclude_field!='$exclude_value'"; + } + else + { + $excludeSQL = "where $exclude_field!='$exclude_value'"; + } + } + $stmtA = "SELECT lead_id,phone_number from vicidial_list $list_idSQL;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_performance_detail.php b/agc_2-X/trunk/www/vicidial/AST_agent_performance_detail.php index 0f9b21a9..5f98636b 100644 --- a/agc_2-X/trunk/www/vicidial/AST_agent_performance_detail.php +++ b/agc_2-X/trunk/www/vicidial/AST_agent_performance_detail.php @@ -36,6 +36,7 @@ # 130621-0824 - Added filtering of input to prevent SQL injection attacks and new user auth # 130704-0935 - Fixed issue #675 # 130829-2012 - Changed to mysqli PHP functions +# 131002-2015 - Added user group to report output # $startMS = microtime(); @@ -493,7 +494,7 @@ $statusesHEAD=''; $CSV_header="\"Agent Performance Detail $NOW_TIME\"\n"; $CSV_header.="\"Time range: $query_date_BEGIN to $query_date_END\"\n\n"; $CSV_header.="\"---------- AGENTS Details -------------\"\n"; -$CSV_header.='"USER NAME","ID","CALLS","TIME","PAUSE","PAUSAVG","WAIT","WAITAVG","TALK","TALKAVG","DISPO","DISPAVG","DEAD","DEADAVG","CUSTOMER","CUSTAVG"'; +$CSV_header.='"USER NAME","ID","USER GROUP","CALLS","TIME","PAUSE","PAUSAVG","WAIT","WAITAVG","TALK","TALKAVG","DISPO","DISPAVG","DEAD","DEADAVG","CUSTOMER","CUSTAVG"'; $statusesHTML=''; $statusesARY[0]=''; @@ -503,7 +504,7 @@ $usersARY[0]=''; $user_namesARY[0]=''; $k=0; -$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status,sum(dead_sec) from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 $group_SQL $user_group_SQL group by user,full_name,status order by full_name,user,status desc limit 500000;"; +$stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.user,sum(pause_sec),sum(wait_sec),sum(dispo_sec),status,sum(dead_sec), vicidial_users.user_group from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and pause_sec<65000 and wait_sec<65000 and talk_sec<65000 and dispo_sec<65000 $group_SQL $user_group_SQL group by user,full_name,user_group,status order by full_name,user,status desc limit 500000;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$HTML_text.="$stmt\n";} $rows_to_print = mysqli_num_rows($rslt); @@ -556,6 +557,7 @@ while ($i < $rows_to_print) $dispo_sec[$i] = $row[6]; $status[$i] = strtoupper($row[7]); $dead_sec[$i] = $row[8]; + $user_group[$i] = $row[9]; $customer_sec[$i] = ($talk_sec[$i] - $dead_sec[$i]); $max_varname="max_".$status[$i]; @@ -580,6 +582,7 @@ while ($i < $rows_to_print) $users .= "$user[$i]-"; $usersARY[$k] = $user[$i]; $user_namesARY[$k] = $full_name[$i]; + $user_groupsARY[$k] = $user_group[$i]; $k++; } @@ -590,9 +593,9 @@ $CSV_header.="\n"; $CSV_lines=''; $ASCII_text.="CALL STATS BREAKDOWN: (Statistics related to handling of calls only) [DOWNLOAD]\n"; -$ASCII_text.="+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; -$ASCII_text.="| USER NAME | ID | CALLS | TIME | PAUSE |PAUSAVG | WAIT |WAITAVG | TALK |TALKAVG | DISPO |DISPAVG | DEAD |DEADAVG | CUSTOMER |CUSTAVG |$statusesHTML\n"; -$ASCII_text.="+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; +$ASCII_text.="+-----------------+----------+-----------------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; +$ASCII_text.="| USER NAME | ID | USER GROUP | CALLS | TIME | PAUSE |PAUSAVG | WAIT |WAITAVG | TALK |TALKAVG | DISPO |DISPAVG | DEAD |DEADAVG | CUSTOMER |CUSTAVG |$statusesHTML\n"; +$ASCII_text.="+-----------------+----------+-----------------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; ### BEGIN loop through each user ### @@ -601,6 +604,7 @@ while ($m < $k) { $Suser=$usersARY[$m]; $Sfull_name=$user_namesARY[$m]; + $Suser_group=$user_groupsARY[$m]; $Stime=0; $Scalls=0; $Stalk_sec=0; @@ -690,6 +694,8 @@ while ($m < $k) { $Sfull_name= sprintf("%-15s", $Sfull_name); while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);} + $Suser_group= sprintf("%-15s", $Suser_group); + while(strlen($Suser_group)>15) {$Suser_group = substr("$Suser_group", 0, -1);} $Suser = sprintf("%-8s", $Suser); while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);} } @@ -697,6 +703,8 @@ while ($m < $k) { $Sfull_name= sprintf("%-45s", $Sfull_name); while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');} + $Suser_group= sprintf("%-45s", $Suser_group); + while(mb_strlen($Suser_group,'utf-8')>15) {$Suser_group = mb_substr("$Suser_group", 0, -1,'utf-8');} $Suser = sprintf("%-24s", $Suser); while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');} } @@ -760,11 +768,11 @@ while ($m < $k) $pfUSERavgCUSTOMER_MS = sprintf("%6s", $USERavgCUSTOMER_MS); $PAUSEtotal[$m] = $pfUSERtotPAUSE_MS; - $Toutput = "| $Sfull_name | $Suser | $Scalls | $pfUSERtime_MS | $pfUSERtotPAUSE_MS | $pfUSERavgPAUSE_MS | $pfUSERtotWAIT_MS | $pfUSERavgWAIT_MS | $pfUSERtotTALK_MS | $pfUSERavgTALK_MS | $pfUSERtotDISPO_MS | $pfUSERavgDISPO_MS | $pfUSERtotDEAD_MS | $pfUSERavgDEAD_MS | $pfUSERtotCUSTOMER_MS | $pfUSERavgCUSTOMER_MS |$SstatusesHTML\n"; + $Toutput = "| $Sfull_name | $Suser | $Suser_group | $Scalls | $pfUSERtime_MS | $pfUSERtotPAUSE_MS | $pfUSERavgPAUSE_MS | $pfUSERtotWAIT_MS | $pfUSERavgWAIT_MS | $pfUSERtotTALK_MS | $pfUSERavgTALK_MS | $pfUSERtotDISPO_MS | $pfUSERavgDISPO_MS | $pfUSERtotDEAD_MS | $pfUSERavgDEAD_MS | $pfUSERtotCUSTOMER_MS | $pfUSERavgCUSTOMER_MS |$SstatusesHTML\n"; $CSV_lines.="\"$Sfull_nameRAW\","; - $CSV_lines.=preg_replace('/\s/', '', "\"$SuserRAW\",\"$Scalls\",\"$pfUSERtime_MS\",\"$pfUSERtotPAUSE_MS\",\"$pfUSERavgPAUSE_MS\",\"$pfUSERtotWAIT_MS\",\"$pfUSERavgWAIT_MS\",\"$pfUSERtotTALK_MS\",\"$pfUSERavgTALK_MS\",\"$pfUSERtotDISPO_MS\",\"$pfUSERavgDISPO_MS\",\"$pfUSERtotDEAD_MS\",\"$pfUSERavgDEAD_MS\",\"$pfUSERtotCUSTOMER_MS\",\"$pfUSERavgCUSTOMER_MS\"$CSVstatuses"); + $CSV_lines.=preg_replace('/\s/', '', "\"$SuserRAW\",\"$Suser_group\",\"$Scalls\",\"$pfUSERtime_MS\",\"$pfUSERtotPAUSE_MS\",\"$pfUSERavgPAUSE_MS\",\"$pfUSERtotWAIT_MS\",\"$pfUSERavgWAIT_MS\",\"$pfUSERtotTALK_MS\",\"$pfUSERavgTALK_MS\",\"$pfUSERtotDISPO_MS\",\"$pfUSERavgDISPO_MS\",\"$pfUSERtotDEAD_MS\",\"$pfUSERavgDEAD_MS\",\"$pfUSERtotCUSTOMER_MS\",\"$pfUSERavgCUSTOMER_MS\"$CSVstatuses"); $CSV_lines.="\n"; $TOPsorted_output[$m] = $Toutput; @@ -904,9 +912,9 @@ while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1 while(strlen($TOTavgCUSTOMER_MS)>6) {$TOTavgCUSTOMER_MS = substr("$TOTavgCUSTOMER_MS", 0, -1);} -$ASCII_text.="+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; -$ASCII_text.="| TOTALS AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$TOTtotDEAD_MS| $TOTavgDEAD_MS |$TOTtotCUSTOMER_MS| $TOTavgCUSTOMER_MS |$SUMstatusesHTML\n"; -$ASCII_text.="+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; +$ASCII_text.="+-----------------+----------+-----------------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; +$ASCII_text.="| TOTALS AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$TOTtotDEAD_MS| $TOTavgDEAD_MS |$TOTtotCUSTOMER_MS| $TOTavgCUSTOMER_MS |$SUMstatusesHTML\n"; +$ASCII_text.="+-----------------+----------+-----------------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; for ($e=0; $e $GRAPH_text.=$JS_text.$GRAPH.$GRAPH2.$GRAPH3; -$CSV_total=preg_replace('/\s/', '', "\"TOTALS\",\"AGENTS:$TOT_AGENTS\",\"$TOTcalls\",\"$TOTtime_MS\",\"$TOTtotPAUSE_MS\",\"$TOTavgPAUSE_MS\",\"$TOTtotWAIT_MS\",\"$TOTavgWAIT_MS\",\"$TOTtotTALK_MS\",\"$TOTavgTALK_MS\",\"$TOTtotDISPO_MS\",\"$TOTavgDISPO_MS\",\"$TOTtotDEAD_MS\",\"$TOTavgDEAD_MS\",\"$TOTtotCUSTOMER_MS\",\"$TOTavgCUSTOMER_MS\"$CSVSUMstatuses"); +$CSV_total=preg_replace('/\s/', '', "\"\",\"TOTALS\",\"AGENTS:$TOT_AGENTS\",\"$TOTcalls\",\"$TOTtime_MS\",\"$TOTtotPAUSE_MS\",\"$TOTavgPAUSE_MS\",\"$TOTtotWAIT_MS\",\"$TOTavgWAIT_MS\",\"$TOTtotTALK_MS\",\"$TOTavgTALK_MS\",\"$TOTtotDISPO_MS\",\"$TOTavgDISPO_MS\",\"$TOTtotDEAD_MS\",\"$TOTavgDEAD_MS\",\"$TOTtotCUSTOMER_MS\",\"$TOTavgCUSTOMER_MS\"$CSVSUMstatuses"); if ($file_download == 1) { @@ -1081,7 +1089,7 @@ $TOTAL_graph=$graph_header."TOTAL "; $NONPAUSE_graph=$graph_header."NONPAUSE"; $PAUSE_graph=$graph_header."PAUSE"; -$stmt="select full_name,vicidial_users.user,sum(pause_sec),sub_status,sum(wait_sec + talk_sec + dispo_sec) from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and pause_sec<65000 $group_SQL $user_group_SQL group by user,full_name,sub_status order by user,full_name,sub_status desc limit 100000;"; +$stmt="select full_name,vicidial_users.user,sum(pause_sec),sub_status,sum(wait_sec + talk_sec + dispo_sec), vicidial_users.user_group from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and pause_sec<65000 $group_SQL $user_group_SQL group by user,full_name,sub_status order by user,full_name,sub_status desc limit 100000;"; $rslt=mysql_to_mysqli($stmt, $link); if ($DB) {$ASCII_text.="$stmt\n";} $subs_to_print = mysqli_num_rows($rslt); @@ -1094,6 +1102,7 @@ while ($i < $subs_to_print) $PCpause_sec[$i] = $row[2]; $sub_status[$i] = $row[3]; $PCnon_pause_sec[$i] = $row[4]; + $PCuser_group[$i] = $row[5]; $max_varname="max_".$sub_status[$i]; $$max_varname=1; @@ -1114,6 +1123,7 @@ while ($i < $subs_to_print) $PCusers .= "$PCuser[$i]-"; $PCusersARY[$k] = $PCuser[$i]; $PCuser_namesARY[$k] = $PCfull_name[$i]; + $PCuser_groupsARY[$k] = $PCuser_group[$i]; $k++; } @@ -1121,14 +1131,14 @@ while ($i < $subs_to_print) } $ASCII_text.="PAUSE CODE BREAKDOWN: [DOWNLOAD]\n\n"; -$ASCII_text.="+-----------------+----------+----------+----------+----------+ +$sub_statusesHEAD\n"; -$ASCII_text.="| USER NAME | ID | TOTAL | NONPAUSE | PAUSE | |$sub_statusesHTML\n"; -$ASCII_text.="+-----------------+----------+----------+----------+----------+ +$sub_statusesHEAD\n"; +$ASCII_text.="+-----------------+----------+-----------------+----------+----------+----------+ +$sub_statusesHEAD\n"; +$ASCII_text.="| USER NAME | ID | USER GROUP | TOTAL | NONPAUSE | PAUSE | |$sub_statusesHTML\n"; +$ASCII_text.="+-----------------+----------+-----------------+----------+----------+----------+ +$sub_statusesHEAD\n"; $CSV_header="\"Agent Performance Detail $NOW_TIME\"\n"; $CSV_header.="\"Time range: $query_date_BEGIN to $query_date_END\"\n\n"; $CSV_header.="\"PAUSE CODE BREAKDOWN:\"\n"; -$CSV_header.="\"USER NAME\",\"ID\",\"TOTAL\",\"NONPAUSE\",\"PAUSE\",$CSV_statuses\n"; +$CSV_header.="\"USER NAME\",\"ID\",\"USER GROUP\",\"TOTAL\",\"NONPAUSE\",\"PAUSE\",$CSV_statuses\n"; ### BEGIN loop through each user ### $m=0; @@ -1148,6 +1158,7 @@ while ($m < $k) } $Suser=$PCusersARY[$m]; $Sfull_name=$PCuser_namesARY[$m]; + $Suser_group=$PCuser_groupsARY[$m]; $Spause_sec=0; $Snon_pause_sec=0; $Stotal_sec=0; @@ -1206,6 +1217,8 @@ while ($m < $k) { $Sfull_name= sprintf("%-15s", $Sfull_name); while(strlen($Sfull_name)>15) {$Sfull_name = substr("$Sfull_name", 0, -1);} + $Suser_group= sprintf("%-15s", $Suser_group); + while(strlen($Suser_group)>15) {$Suser_group = substr("$Suser_group", 0, -1);} $Suser = sprintf("%-8s", $Suser); while(strlen($Suser)>8) {$Suser = substr("$Suser", 0, -1);} } @@ -1213,6 +1226,8 @@ while ($m < $k) { $Sfull_name= sprintf("%-45s", $Sfull_name); while(mb_strlen($Sfull_name,'utf-8')>15) {$Sfull_name = mb_substr("$Sfull_name", 0, -1,'utf-8');} + $Suser_group= sprintf("%-45s", $Suser_group); + while(mb_strlen($Suser_group,'utf-8')>15) {$Suser_group = mb_substr("$Suser_group", 0, -1,'utf-8');} $Suser = sprintf("%-24s", $Suser); while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');} } @@ -1235,12 +1250,12 @@ while ($m < $k) $pfUSERtotNONPAUSE_MS = sprintf("%8s", $USERtotNONPAUSE_MS); $pfUSERtotTOTAL_MS = sprintf("%8s", $USERtotTOTAL_MS); - $BOTTOMoutput = "| $Sfull_name | $Suser | $pfUSERtotTOTAL_MS | $pfUSERtotNONPAUSE_MS | $pfUSERtotPAUSE_MS | |$SstatusesHTML\n"; + $BOTTOMoutput = "| $Sfull_name | $Suser | $Suser_group | $pfUSERtotTOTAL_MS | $pfUSERtotNONPAUSE_MS | $pfUSERtotPAUSE_MS | |$SstatusesHTML\n"; $BOTTOMsorted_output[$m] = $BOTTOMoutput; $ASCII_text.="$BOTTOMoutput"; - $CSV_lines.="\"$Sfull_nameRAW\"".preg_replace('/\s/', '', ",\"$SuserRAW\",\"$pfUSERtotTOTAL_MS\",\"$pfUSERtotNONPAUSE_MS\",\"$pfUSERtotPAUSE_MS\",$CSV_statuses"); + $CSV_lines.="\"$Sfull_nameRAW\"".preg_replace('/\s/', '', ",\"$SuserRAW\",\"$Suser_group\",\"$pfUSERtotTOTAL_MS\",\"$pfUSERtotNONPAUSE_MS\",\"$pfUSERtotPAUSE_MS\",$CSV_statuses"); $CSV_lines.="\n"; $m++; } @@ -1323,9 +1338,9 @@ while ($n < $j) while(strlen($TOTtotTOTAL_MS)>10) {$TOTtotTOTAL_MS = substr("$TOTtotTOTAL_MS", 0, -1);} -$ASCII_text.="+-----------------+----------+----------+----------+----------+ +$sub_statusesHEAD\n"; -$ASCII_text.="| TOTALS AGENTS:$TOT_AGENTS |$TOTtotTOTAL_MS|$TOTtotNONPAUSE_MS|$TOTtotPAUSE_MS| |$SUMstatusesHTML\n"; -$ASCII_text.="+----------------------------+----------+----------+----------+ +$sub_statusesHEAD\n"; +$ASCII_text.="+-----------------+----------+-----------------+----------+----------+----------+ +$sub_statusesHEAD\n"; +$ASCII_text.="| TOTALS AGENTS:$TOT_AGENTS |$TOTtotTOTAL_MS|$TOTtotNONPAUSE_MS|$TOTtotPAUSE_MS| |$SUMstatusesHTML\n"; +$ASCII_text.="+----------------------------------------------+----------+----------+----------+ +$sub_statusesHEAD\n"; for ($e=0; $eGroup Handling: $NWB#inbound_groups-group_handling$NWE\n"; } else - {echo "\n";} + {echo "\n";} echo "\n"; echo "\n"; } @@ -18206,24 +18207,32 @@ if ($ADD==41111111111) {echo "
PHONE NOT MODIFIED - Please go back and look at the data you entered\n";} else { - echo "
PHONE MODIFIED: $extension\n"; - - $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='" . mysqli_real_escape_string($link, $local_web_callerID_URL) . "', VICIDIAL_web_URL='" . mysqli_real_escape_string($link, $VICIDIAL_web_URL) . "', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid', enable_sipsak_messages='$enable_sipsak_messages', email='$email', template_id='$template_id', conf_override='$conf_override',phone_context='$phone_context',phone_ring_timeout='$phone_ring_timeout',conf_secret='$conf_secret', delete_vm_after_email='$delete_vm_after_email',is_webphone='$is_webphone',use_external_server_ip='$use_external_server_ip',codecs_list='$codecs_list',codecs_with_template='$codecs_with_template',webphone_dialpad='$webphone_dialpad',on_hook_agent='$on_hook_agent',webphone_auto_answer='$webphone_auto_answer',voicemail_timezone='$voicemail_timezone',voicemail_options='$voicemail_options',user_group='$user_group',voicemail_greeting='$voicemail_greeting' where extension='$old_extension' and server_ip='$old_server_ip';"; + $stmt="SELECT count(*) from vicidial_voicemail where voicemail_id='$voicemail_id';"; $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + if ($row[0] > 0) + {echo "
PHONE NOT MODIFIED - there is already a Voicemail ID in the system with this ID\n";} + else + { + echo "
PHONE MODIFIED: $extension\n"; - $stmtA="UPDATE servers SET rebuild_conf_files='Y' where generate_vicidial_conf='Y' and active_asterisk_server='Y' and server_ip='$server_ip';"; - $rslt=mysql_to_mysqli($stmtA, $link); + $stmt="UPDATE phones set extension='$extension', dialplan_number='$dialplan_number', voicemail_id='$voicemail_id', phone_ip='$phone_ip', computer_ip='$computer_ip', server_ip='$server_ip', login='$login', pass='$pass', status='$status', active='$active', phone_type='$phone_type', fullname='$fullname', company='$company', picture='$picture', protocol='$protocol', local_gmt='$local_gmt', ASTmgrUSERNAME='$ASTmgrUSERNAME', ASTmgrSECRET='$ASTmgrSECRET', login_user='$login_user', login_pass='$login_pass', login_campaign='$login_campaign', park_on_extension='$park_on_extension', conf_on_extension='$conf_on_extension', VICIDIAL_park_on_extension='$VICIDIAL_park_on_extension', VICIDIAL_park_on_filename='$VICIDIAL_park_on_filename', monitor_prefix='$monitor_prefix', recording_exten='$recording_exten', voicemail_exten='$voicemail_exten', voicemail_dump_exten='$voicemail_dump_exten', ext_context='$ext_context', dtmf_send_extension='$dtmf_send_extension', call_out_number_group='$call_out_number_group', client_browser='$client_browser', install_directory='$install_directory', local_web_callerID_URL='" . mysqli_real_escape_string($link, $local_web_callerID_URL) . "', VICIDIAL_web_URL='" . mysqli_real_escape_string($link, $VICIDIAL_web_URL) . "', AGI_call_logging_enabled='$AGI_call_logging_enabled', user_switching_enabled='$user_switching_enabled', conferencing_enabled='$conferencing_enabled', admin_hangup_enabled='$admin_hangup_enabled', admin_hijack_enabled='$admin_hijack_enabled', admin_monitor_enabled='$admin_monitor_enabled', call_parking_enabled='$call_parking_enabled', updater_check_enabled='$updater_check_enabled', AFLogging_enabled='$AFLogging_enabled', QUEUE_ACTION_enabled='$QUEUE_ACTION_enabled', CallerID_popup_enabled='$CallerID_popup_enabled', voicemail_button_enabled='$voicemail_button_enabled', enable_fast_refresh='$enable_fast_refresh', fast_refresh_rate='$fast_refresh_rate', enable_persistant_mysql='$enable_persistant_mysql', auto_dial_next_number='$auto_dial_next_number', VDstop_rec_after_each_call='$VDstop_rec_after_each_call', DBX_server='$DBX_server', DBX_database='$DBX_database', DBX_user='$DBX_user', DBX_pass='$DBX_pass', DBX_port='$DBX_port', DBY_server='$DBY_server', DBY_database='$DBY_database', DBY_user='$DBY_user', DBY_pass='$DBY_pass', DBY_port='$DBY_port', outbound_cid='$outbound_cid', enable_sipsak_messages='$enable_sipsak_messages', email='$email', template_id='$template_id', conf_override='$conf_override',phone_context='$phone_context',phone_ring_timeout='$phone_ring_timeout',conf_secret='$conf_secret', delete_vm_after_email='$delete_vm_after_email',is_webphone='$is_webphone',use_external_server_ip='$use_external_server_ip',codecs_list='$codecs_list',codecs_with_template='$codecs_with_template',webphone_dialpad='$webphone_dialpad',on_hook_agent='$on_hook_agent',webphone_auto_answer='$webphone_auto_answer',voicemail_timezone='$voicemail_timezone',voicemail_options='$voicemail_options',user_group='$user_group',voicemail_greeting='$voicemail_greeting' where extension='$old_extension' and server_ip='$old_server_ip';"; + $rslt=mysql_to_mysqli($stmt, $link); - $stmtB="UPDATE servers SET rebuild_conf_files='Y' where generate_vicidial_conf='Y' and active_asterisk_server='Y' and server_ip='$SSactive_voicemail_server';"; - $rslt=mysql_to_mysqli($stmtB, $link); + $stmtA="UPDATE servers SET rebuild_conf_files='Y' where generate_vicidial_conf='Y' and active_asterisk_server='Y' and server_ip='$server_ip';"; + $rslt=mysql_to_mysqli($stmtA, $link); - ### LOG INSERTION Admin Log Table ### - $SQL_log = "$stmt|"; - $SQL_log = preg_replace('/;/', '', $SQL_log); - $SQL_log = addslashes($SQL_log); - $stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='PHONES', event_type='MODIFY', record_id='$extension', event_code='ADMIN MODIFY PHONE', event_sql=\"$SQL_log\", event_notes='Server IP: $server_ip';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_to_mysqli($stmt, $link); + $stmtB="UPDATE servers SET rebuild_conf_files='Y' where generate_vicidial_conf='Y' and active_asterisk_server='Y' and server_ip='$SSactive_voicemail_server';"; + $rslt=mysql_to_mysqli($stmtB, $link); + + ### LOG INSERTION Admin Log Table ### + $SQL_log = "$stmt|"; + $SQL_log = preg_replace('/;/', '', $SQL_log); + $SQL_log = addslashes($SQL_log); + $stmt="INSERT INTO vicidial_admin_log set event_date='$SQLdate', user='$PHP_AUTH_USER', ip_address='$ip', event_section='PHONES', event_type='MODIFY', record_id='$extension', event_code='ADMIN MODIFY PHONE', event_sql=\"$SQL_log\", event_notes='Server IP: $server_ip';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_to_mysqli($stmt, $link); + } } } } diff --git a/agc_2-X/trunk/www/vicidial/admin_NANPA_updater.php b/agc_2-X/trunk/www/vicidial/admin_NANPA_updater.php index cd4d1077..39dd9aca 100644 --- a/agc_2-X/trunk/www/vicidial/admin_NANPA_updater.php +++ b/agc_2-X/trunk/www/vicidial/admin_NANPA_updater.php @@ -8,10 +8,11 @@ # # CHANGELOG: # 130919-1503 - First build of script +# 131005-2035 - Added exclusion options # -$version = '2.8-1'; -$build = '130919-1503'; +$version = '2.8-2'; +$build = '131005-2035'; $startMS = microtime(); require("dbconnect_mysqli.php"); @@ -31,6 +32,10 @@ if (isset($_GET["fields_to_update"])) {$fields_to_update=$_GET["fields_to_upda elseif (isset($_POST["fields_to_update"])) {$fields_to_update=$_POST["fields_to_update"];} if (isset($_GET["vl_field_update"])) {$vl_field_update=$_GET["vl_field_update"];} elseif (isset($_POST["vl_field_update"])) {$vl_field_update=$_POST["vl_field_update"];} +if (isset($_GET["vl_field_exclude"])) {$vl_field_exclude=$_GET["vl_field_exclude"];} + elseif (isset($_POST["vl_field_exclude"])) {$vl_field_exclude=$_POST["vl_field_exclude"];} +if (isset($_GET["exclusion_value"])) {$exclusion_value=$_GET["exclusion_value"];} + elseif (isset($_POST["exclusion_value"])) {$exclusion_value=$_POST["exclusion_value"];} if (isset($_GET["cellphone_list_id"])) {$cellphone_list_id=$_GET["cellphone_list_id"];} elseif (isset($_POST["cellphone_list_id"])) {$cellphone_list_id=$_POST["cellphone_list_id"];} if (isset($_GET["landline_list_id"])) {$landline_list_id=$_GET["landline_list_id"];} @@ -182,6 +187,9 @@ if ($submit_form=="SUBMIT" && $list_ct>0 && (strlen($vl_field_update)>0 || strle $cellphone_list_id=preg_replace('/[^0-9]/', '', $cellphone_list_id); $landline_list_id=preg_replace('/[^0-9]/', '', $landline_list_id); $invalid_list_id=preg_replace('/[^0-9]/', '', $invalid_list_id); + $exclusion_value=preg_replace('/[\'\"\\\\]/', '', $exclusion_value); + $exclusion_value=preg_replace('/\s/', '\\\\\ ', $exclusion_value); + $options="--user=$PHP_AUTH_USER --pass=$PHP_AUTH_PW "; @@ -197,6 +205,7 @@ if ($submit_form=="SUBMIT" && $list_ct>0 && (strlen($vl_field_update)>0 || strle if (strlen($landline_list_id)>0) {$options.="--landline-list-id=$landline_list_id ";} if (strlen($invalid_list_id)>0) {$options.="--invalid-list-id=$invalid_list_id ";} if (strlen($vl_field_update)>0) {$options.="--vl-field-update=$vl_field_update ";} + if (strlen($vl_field_exclude)>0 && strlen($exclusion_value)>0) {$options.="--exclude-field=$vl_field_exclude --exclude-value=$exclusion_value ";} $options=trim($options); $uniqueid=date("U").".".rand(1, 9999); @@ -426,7 +435,7 @@ else echo ""; echo ""; - echo "Field to update (optional):
\n"; + echo "Field to update (optional):
\n"; echo ""; - echo "Landline:"; - echo "Invalid:"; + echo "Cellphone:"; echo ""; + echo ""; + + + echo "Exclusion field (optional):
\n"; + echo "

Exclusion value:
"; + + + + echo "Landline:"; + echo ""; + echo "Invalid:"; + echo ""; echo ""; echo "";