From 3e52cc69392512fe2bed1b9b1750a2913bfb7e01 Mon Sep 17 00:00:00 2001 From: mattf Date: Sun, 17 Aug 2014 14:06:54 +0000 Subject: [PATCH] Added User Group viewable report entry for Front Page System Summary Added archive log search and display in modify lead page git-svn-id: svn://192.168.202.10@2165 3d104415-ff17-0410-8863-d5cf3c621b8a --- UPGRADE | 4 + www/vicidial/admin.php | 394 +++++++++++++++-------------- www/vicidial/admin_modify_lead.php | 163 +++++++++++- www/vicidial/admin_search_lead.php | 10 +- 4 files changed, 381 insertions(+), 190 deletions(-) diff --git a/UPGRADE b/UPGRADE index bf3fdca8..3e366a68 100644 --- a/UPGRADE +++ b/UPGRADE @@ -80,6 +80,10 @@ OTHER CHANGES: 9. Added System Setting option to use 24-hour time for callback setting in agent screen. +10. Added User Group viewable report entry for Front Page System Summary + +11. Added archive log search and display in modify lead page + diff --git a/www/vicidial/admin.php b/www/vicidial/admin.php index fcd5fef5..ca1c94f5 100644 --- a/www/vicidial/admin.php +++ b/www/vicidial/admin.php @@ -111,7 +111,7 @@ $QUERY_STRING = getenv("QUERY_STRING"); $Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary , Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report , Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, User Group Login Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report , Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Carrier Log Report, Campaign Debug, Hangup Cause Report, Lists Pass Report, Called Counts List IDs Report'; -$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary , Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound Email Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Campaign Status List Report, Export Calls Report , Export Leads Report , Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, User Group Login Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report , Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report'; +$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary , Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound Email Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Campaign Status List Report, Export Calls Report , Export Leads Report , Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Performance Comparison Report, Single Agent Daily, User Group Login Report, User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report , Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail, Search Leads Logs, Email Log Report, Lists Pass Report, Called Counts List IDs Report, Front Page System Summary'; $Vtables = 'NONE,log_noanswer,did_agent_log,contact_information'; @@ -3352,12 +3352,13 @@ else # 140625-1931 - Added wrapup_after_hotkey campaign option # 140706-0829 - Incorporated QC includes into code # 140706-0927 - Added callback_time_24hour system setting +# 140817-0928 - Added User Group report permission for the Front Page System Summary report # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 9 to access this page the first time -$admin_version = '2.10-448a'; -$build = '140706-0927'; +$admin_version = '2.10-449a'; +$build = '140817-0928'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -32789,203 +32790,228 @@ if ($ADD==999992) ###################### if ($ADD==999990) { - $section_width=640; - echo "
"; - echo "
\n"; - echo ""; - echo ""; - echo ""; - - $stmt="select closer_campaigns from vicidial_campaigns;"; - $rslt=mysql_to_mysqli($stmt, $link); - $row=mysqli_fetch_row($rslt); - $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); - $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); - $closer_campaigns = "'$closer_campaigns'"; - - $stmt="select status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (call_type='OUT') );"; - $rslt=mysql_to_mysqli($stmt, $link); - $active_calls=mysqli_num_rows($rslt); - $ringing_calls=0; - if ($active_calls>0) { - while ($row=mysqli_fetch_row($rslt)) { - if (!preg_match("/LIVE|CLOSER/i",$row[0])) - {$ringing_calls++;} - } - } - - - $active_stmt="select active from vicidial_users"; - $active_rslt=mysql_to_mysqli($active_stmt, $link); - while ($active_row=mysqli_fetch_array($active_rslt)) { - $users[$active_row["active"]]++; - } - - $active_stmt="select active from vicidial_campaigns"; - $active_rslt=mysql_to_mysqli($active_stmt, $link); - while ($active_row=mysqli_fetch_array($active_rslt)) { - $campaigns[$active_row["active"]]++; - } - - $active_stmt="select active from vicidial_lists"; - $active_rslt=mysql_to_mysqli($active_stmt, $link); - while ($active_row=mysqli_fetch_array($active_rslt)) { - $lists[$active_row["active"]]++; - } - - $active_stmt="select did_active from vicidial_inbound_dids"; - $active_rslt=mysql_to_mysqli($active_stmt, $link); - while ($active_row=mysqli_fetch_array($active_rslt)) { - $dids[$active_row["did_active"]]++; - } - - $active_stmt="select active from vicidial_inbound_groups"; - $active_rslt=mysql_to_mysqli($active_stmt, $link); - while ($active_row=mysqli_fetch_array($active_rslt)) { - $ingroups[$active_row["active"]]++; - } - - $stmt="select extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents"; - $rslt=mysql_to_mysqli($stmt, $link); - $agent_incall=0; $agent_total=0; - while($row=mysqli_fetch_array($rslt)) + if ( (preg_match("/Front Page System Summary/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) { - $status=$row[3]; - $agent_total++; - if ( (preg_match("/INCALL/i",$status)) or (preg_match("/QUEUE/i",$status)) ) {$agent_incall++; } - } - if (preg_match("/MXAG/",$SShosted_settings)) + $section_width=640; + echo "
"; + echo "
System Summary:
\n"; + echo ""; + echo ""; + echo ""; + + $stmt="SELECT closer_campaigns from vicidial_campaigns;"; + $rslt=mysql_to_mysqli($stmt, $link); + $row=mysqli_fetch_row($rslt); + $closer_campaigns = preg_replace("/^ | -$/","",$row[0]); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaigns = "'$closer_campaigns'"; + + $stmt="SELECT status from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaigns)) or (call_type='OUT') );"; + $rslt=mysql_to_mysqli($stmt, $link); + $active_calls=mysqli_num_rows($rslt); + $ringing_calls=0; + if ($active_calls>0) { - $vla_set = $SShosted_settings; - $vla_set = preg_replace("/.*MXAG|_BUILD_|DRA| /",'',$vla_set); - $vla_set = preg_replace('/[^0-9]/','',$vla_set); - if (strlen($vla_set)>0) + while ($row=mysqli_fetch_row($rslt)) { - $AAf=''; $AAb=''; - if ($agent_total >= $vla_set) - {$AAf=''; $AAb='';} - $agent_total = "$AAf$agent_total / $vla_set$AAb"; + if (!preg_match("/LIVE|CLOSER/i",$row[0])) + {$ringing_calls++;} } } - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - - echo ""; - echo ""; # Padding - echo ""; - - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - - echo "
System Summary:
  Agents Logged In    Agents In Calls    Active Calls    Calls Ringing  
  $agent_total    $agent_incall    $active_calls    $ringing_calls  
 
    Records    Active    Inactive    Total  
Users: ".($users["Y"]+0)."".($users["N"]+0)."".($users["Y"]+$users["N"]+0)."
Campaigns: ".($campaigns["Y"]+0)."".($campaigns["N"]+0)."".($campaigns["Y"]+$campaigns["N"]+0)."
Lists: ".($lists["Y"]+0)."".($lists["N"]+0)."".($lists["Y"]+$lists["N"]+0)."
In-Groups: ".($ingroups["Y"]+0)."".($ingroups["N"]+0)."".($ingroups["Y"]+$ingroups["N"]+0)."
DIDs: ".($dids["Y"]+0)."".($dids["N"]+0)."".($dids["Y"]+$dids["N"]+0)."
\n"; - - echo "
\n"; - - - $today=date("Y-m-d"); - $yesterday=date("Y-m-d", mktime(0,0,0,date("m"),date("d")-1,date("Y"))); - $thirtydays=date("Y-m-d", mktime(0,0,0,date("m"),date("d")-29,date("Y"))); - - $total_calls=0; - $total_inbound=0; - $total_outbound=0; - $stmt="SELECT stats_type,sum(total_calls) from vicidial_daily_max_stats where campaign_id!='' and stats_flag='OPEN' and stats_date='$today' group by stats_type;"; - $rslt=mysql_to_mysqli($stmt, $link); - $rows_to_print = mysqli_num_rows($rslt); - if ($rows_to_print > 0) - { - while ($rowx=mysqli_fetch_row($rslt)) + $active_stmt="select active from vicidial_users"; + $active_rslt=mysql_to_mysqli($active_stmt, $link); + while ($active_row=mysqli_fetch_array($active_rslt)) { - $total_calls += $rowx[1]; - if (preg_match('/INGROUP/', $rowx[0])) {$total_inbound+=$rowx[1];} - if (preg_match('/CAMPAIGN/', $rowx[0])) {$total_outbound+=$rowx[1];} + $users[$active_row["active"]]++; } - } + $active_stmt="select active from vicidial_campaigns"; + $active_rslt=mysql_to_mysqli($active_stmt, $link); + while ($active_row=mysqli_fetch_array($active_rslt)) + { + $campaigns[$active_row["active"]]++; + } - $stmt="select * from vicidial_daily_max_stats where stats_date='$today' and stats_flag='OPEN' and stats_type='TOTAL' order by stats_date, campaign_id asc"; - $rslt=mysql_to_mysqli($stmt, $link); - echo "
\n"; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - # echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + $active_stmt="select active from vicidial_lists"; + $active_rslt=mysql_to_mysqli($active_stmt, $link); + while ($active_row=mysqli_fetch_array($active_rslt)) + { + $lists[$active_row["active"]]++; + } - if (mysqli_num_rows($rslt)>0) { - while ($row=mysqli_fetch_array($rslt)) { - echo ""; - # echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - } - } else { - echo ""; - echo ""; + $active_stmt="select did_active from vicidial_inbound_dids"; + $active_rslt=mysql_to_mysqli($active_stmt, $link); + while ($active_row=mysqli_fetch_array($active_rslt)) + { + $dids[$active_row["did_active"]]++; + } + + $active_stmt="select active from vicidial_inbound_groups"; + $active_rslt=mysql_to_mysqli($active_stmt, $link); + while ($active_row=mysqli_fetch_array($active_rslt)) + { + $ingroups[$active_row["active"]]++; + } + + $stmt="SELECT extension,user,conf_exten,status,server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,campaign_id from vicidial_live_agents"; + $rslt=mysql_to_mysqli($stmt, $link); + $agent_incall=0; $agent_total=0; + while($row=mysqli_fetch_array($rslt)) + { + $status=$row[3]; + $agent_total++; + if ( (preg_match("/INCALL/i",$status)) or (preg_match("/QUEUE/i",$status)) ) {$agent_incall++; } + } + if (preg_match("/MXAG/",$SShosted_settings)) + { + $vla_set = $SShosted_settings; + $vla_set = preg_replace("/.*MXAG|_BUILD_|DRA| /",'',$vla_set); + $vla_set = preg_replace('/[^0-9]/','',$vla_set); + if (strlen($vla_set)>0) + { + $AAf=''; $AAb=''; + if ($agent_total >= $vla_set) + {$AAf=''; $AAb='';} + $agent_total = "$AAf$agent_total / $vla_set$AAb"; + } + } + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; - } - echo "
Total Stats for Today:[view max stats]
CAMPAIGN ID  Total Calls    Total Inbound Calls    Total Outbound Calls    Maximum Agents  
".$row["campaign_id"]."".($total_calls+0)."".($total_inbound+0)."".($total_outbound+0)."".($row["max_agents"]+0)."
*** NO ACTIVITY FOR $today ***
  Agents Logged In    Agents In Calls    Active Calls    Calls Ringing  
\n"; - - $stmt="select * from vicidial_daily_max_stats where stats_date='$yesterday' and stats_type='TOTAL' order by stats_date, campaign_id asc"; - $rslt=mysql_to_mysqli($stmt, $link); - echo "
\n"; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; -# echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - - if (mysqli_num_rows($rslt)>0) { - while ($row=mysqli_fetch_array($rslt)) { - echo ""; - #echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; - } - } else { echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; - } - echo "

"; + echo ""; + echo ""; # Padding + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "
Total Stats for Yesterday:[view max stats]
CAMPAIGN ID  Total Calls    Total Inbound Calls    Total Outbound Calls    Maximum Agents  
".$row["campaign_id"]."".($row["total_calls"]+0)."".($row["max_inbound"]+0)."".($row["max_outbound"]+0)."".($row["max_agents"]+0)."
*** NO ACTIVITY FOR $today ***  $agent_total    $agent_incall    $active_calls    $ringing_calls  
 
    Records    Active    Inactive    Total  
Users: ".($users["Y"]+0)."".($users["N"]+0)."".($users["Y"]+$users["N"]+0)."
Campaigns: ".($campaigns["Y"]+0)."".($campaigns["N"]+0)."".($campaigns["Y"]+$campaigns["N"]+0)."
Lists: ".($lists["Y"]+0)."".($lists["N"]+0)."".($lists["Y"]+$lists["N"]+0)."
In-Groups: ".($ingroups["Y"]+0)."".($ingroups["N"]+0)."".($ingroups["Y"]+$ingroups["N"]+0)."
DIDs: ".($dids["Y"]+0)."".($dids["N"]+0)."".($dids["Y"]+$dids["N"]+0)."
\n"; + + echo "
\n"; + + $today=date("Y-m-d"); + $yesterday=date("Y-m-d", mktime(0,0,0,date("m"),date("d")-1,date("Y"))); + $thirtydays=date("Y-m-d", mktime(0,0,0,date("m"),date("d")-29,date("Y"))); + + $total_calls=0; + $total_inbound=0; + $total_outbound=0; + $stmt="SELECT stats_type,sum(total_calls) from vicidial_daily_max_stats where campaign_id!='' and stats_flag='OPEN' and stats_date='$today' group by stats_type;"; + $rslt=mysql_to_mysqli($stmt, $link); + $rows_to_print = mysqli_num_rows($rslt); + if ($rows_to_print > 0) + { + while ($rowx=mysqli_fetch_row($rslt)) + { + $total_calls += $rowx[1]; + if (preg_match('/INGROUP/', $rowx[0])) {$total_inbound+=$rowx[1];} + if (preg_match('/CAMPAIGN/', $rowx[0])) {$total_outbound+=$rowx[1];} + } + } + + $stmt="SELECT * from vicidial_daily_max_stats where stats_date='$today' and stats_flag='OPEN' and stats_type='TOTAL' order by stats_date, campaign_id asc"; + $rslt=mysql_to_mysqli($stmt, $link); + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + # echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if (mysqli_num_rows($rslt)>0) + { + while ($row=mysqli_fetch_array($rslt)) + { + echo ""; + # echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + } + else + { + echo ""; + echo ""; + echo ""; + } + echo "
Total Stats for Today:[view max stats]
CAMPAIGN ID  Total Calls    Total Inbound Calls    Total Outbound Calls    Maximum Agents  
".$row["campaign_id"]."".($total_calls+0)."".($total_inbound+0)."".($total_outbound+0)."".($row["max_agents"]+0)."
*** NO ACTIVITY FOR $today ***
\n"; + + $stmt="SELECT * from vicidial_daily_max_stats where stats_date='$yesterday' and stats_type='TOTAL' order by stats_date, campaign_id asc"; + $rslt=mysql_to_mysqli($stmt, $link); + echo "
\n"; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + # echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + if (mysqli_num_rows($rslt)>0) + { + while ($row=mysqli_fetch_array($rslt)) + { + echo ""; + #echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + } + } + else + { + echo ""; + echo ""; + echo ""; + } + + echo "

"; + } + else + { + $section_width=640; + echo "
"; + echo "
Total Stats for Yesterday:[view max stats]
CAMPAIGN ID  Total Calls    Total Inbound Calls    Total Outbound Calls    Maximum Agents  
".$row["campaign_id"]."".($row["total_calls"]+0)."".($row["max_inbound"]+0)."".($row["max_outbound"]+0)."".($row["max_agents"]+0)."
*** NO ACTIVITY FOR $today ***
\n"; + echo ""; + echo ""; + echo ""; + + echo "

"; + } } ##### If report run, update the time in the vicidial_report_log table ##### diff --git a/www/vicidial/admin_modify_lead.php b/www/vicidial/admin_modify_lead.php index b5f00f50..c6f6f6a3 100644 --- a/www/vicidial/admin_modify_lead.php +++ b/www/vicidial/admin_modify_lead.php @@ -60,6 +60,7 @@ # 140125-1100 - Fixed issue with Callback records having no campaign_id # 140304-2034 - Fixed issue with special characters in standard data fields # 140706-0827 - Incorporated QC includes into code +# 140817-0937 - Added Archive Log search option # require("dbconnect_mysqli.php"); @@ -172,6 +173,8 @@ if (isset($_GET["CBstatus"])) {$CBstatus=$_GET["CBstatus"];} elseif (isset($_POST["CBstatus"])) {$CBstatus=$_POST["CBstatus"];} if (isset($_GET["archive_search"])) {$archive_search=$_GET["archive_search"];} elseif (isset($_POST["archive_search"])) {$archive_search=$_POST["archive_search"];} +if (isset($_GET["archive_log"])) {$archive_log=$_GET["archive_log"];} + elseif (isset($_POST["archive_log"])) {$archive_log=$_POST["archive_log"];} if ($archive_search=="Yes") {$vl_table="vicidial_list_archive";} else {$vl_table="vicidial_list"; $archive_search="No";} @@ -429,7 +432,7 @@ if ($end_call > 0) $rslt=mysql_to_mysqli($stmt, $link); echo "information modified

\n"; - echo "Go back to the lead modification page

\n"; + echo "Go back to the lead modification page

\n"; echo "\n"; ### LOG INSERTION Admin Log Table ### @@ -599,6 +602,7 @@ else ##### grab vicidial_list_alt_phones records ##### $stmt="SELECT phone_code,phone_number,alt_phone_note,alt_phone_count,active from vicidial_list_alt_phones where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by alt_phone_count limit 500;"; $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {echo "$stmt\n";} $alts_to_print = mysqli_num_rows($rslt); $c=0; @@ -631,6 +635,7 @@ else $stmt="SELECT uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,user_group,term_reason,alt_dial from vicidial_log where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by uniqueid desc limit 500;"; $rslt=mysql_to_mysqli($stmt, $link); $logs_to_print = mysqli_num_rows($rslt); + if ($DB) {echo "$logs_to_print|$stmt\n";} $u=0; $call_log = ''; @@ -679,6 +684,7 @@ else $stmt="SELECT agent_log_id,user,server_ip,event_time,lead_id,campaign_id,pause_epoch,pause_sec,wait_epoch,wait_sec,talk_epoch,talk_sec,dispo_epoch,dispo_sec,status,user_group,comments,sub_status from vicidial_agent_log where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by agent_log_id desc limit 500;"; $rslt=mysql_to_mysqli($stmt, $link); $Alogs_to_print = mysqli_num_rows($rslt); + if ($DB) {echo "$Alogs_to_print|$stmt\n";} $y=0; $agent_log = ''; @@ -713,6 +719,7 @@ else $stmt="SELECT closecallid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,queue_seconds,user_group,xfercallid,term_reason,uniqueid,agent_only from vicidial_closer_log where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by closecallid desc limit 500;"; $rslt=mysql_to_mysqli($stmt, $link); $Clogs_to_print = mysqli_num_rows($rslt); + if ($DB) {echo "$Clogs_to_print|$stmt\n";} $y=0; $closer_log = ''; @@ -757,6 +764,146 @@ else $campaign_id = $row[3]; } + + ########## BEGIN ARCHIVE LOG SEARCH ########## + if ($archive_log == 'Yes') + { + ##### grab vicidial_log_archive records ##### + $stmt="SELECT uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,user_group,term_reason,alt_dial from vicidial_log_archive where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by uniqueid desc limit 500;"; + $rslt=mysql_to_mysqli($stmt, $link); + $logs_to_print = mysqli_num_rows($rslt); + if ($DB) {echo "$logs_to_print|$stmt\n";} + + $u=0; + # $call_log = ''; + # $log_campaign = ''; + while ($logs_to_print > $u) + { + $row=mysqli_fetch_row($rslt); + if (strlen($log_campaign)<1) {$log_campaign = $row[3];} + if (preg_match("/1$|3$|5$|7$|9$/i", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $u++; + $call_log .= ""; + $call_log .= ""; + $call_log .= ""; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + $call_log .= "\n"; + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' and vicidial_id='$row[0]';"; + $rsltA=mysql_to_mysqli($stmtA, $link); + $out_notes_to_print = mysqli_num_rows($rslt); + if ($out_notes_to_print > 0) + { + $rowA=mysqli_fetch_row($rsltA); + if (strlen($rowA[0]) > 0) + { + $call_log .= ""; + $call_log .= ""; + $call_log .= ""; + $call_log .= ""; + } + } + + $campaign_id = $row[3]; + } + + ##### grab vicidial_agent_log_archive records ##### + $stmt="SELECT agent_log_id,user,server_ip,event_time,lead_id,campaign_id,pause_epoch,pause_sec,wait_epoch,wait_sec,talk_epoch,talk_sec,dispo_epoch,dispo_sec,status,user_group,comments,sub_status from vicidial_agent_log_archive where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by agent_log_id desc limit 500;"; + $rslt=mysql_to_mysqli($stmt, $link); + $Alogs_to_print = mysqli_num_rows($rslt); + if ($DB) {echo "$Alogs_to_print|$stmt\n";} + + $y=0; + # $agent_log = ''; + # $Alog_campaign = ''; + while ($Alogs_to_print > $y) + { + $row=mysqli_fetch_row($rslt); + if (strlen($Alog_campaign)<1) {$Alog_campaign = $row[5];} + if (preg_match("/1$|3$|5$|7$|9$/i", $y)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $y++; + $agent_log .= ""; + $agent_log .= ""; + $agent_log .= ""; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + $agent_log .= "\n"; + + $campaign_id = $row[5]; + } + + ##### grab vicidial_closer_log_archive records ##### + $stmt="SELECT closecallid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,queue_seconds,user_group,xfercallid,term_reason,uniqueid,agent_only from vicidial_closer_log_archive where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' order by closecallid desc limit 500;"; + $rslt=mysql_to_mysqli($stmt, $link); + $Clogs_to_print = mysqli_num_rows($rslt); + if ($DB) {echo "$Clogs_to_print|$stmt\n";} + + $y=0; + # $closer_log = ''; + # $Clog_campaign = ''; + while ($Clogs_to_print > $y) + { + $row=mysqli_fetch_row($rslt); + if (strlen($Clog_campaign)<1) {$Clog_campaign = $row[3];} + if (preg_match("/1$|3$|5$|7$|9$/i", $y)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $y++; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + $closer_log .= "\n"; + + $stmtA="SELECT call_notes FROM vicidial_call_notes WHERE lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' and vicidial_id='$row[0]';"; + $rsltA=mysql_to_mysqli($stmtA, $link); + $in_notes_to_print = mysqli_num_rows($rslt); + if ($in_notes_to_print > 0) + { + $rowA=mysqli_fetch_row($rsltA); + if (strlen($rowA[0]) > 0) + { + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= ""; + $closer_log .= ""; + } + } + + $campaign_id = $row[3]; + } + } + ########## END ARCHIVE LOG SEARCH ########## + + ##### grab vicidial_list data for lead ##### $stmt="SELECT lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id from $vl_table where lead_id='" . mysqli_real_escape_string($link, $lead_id) . "' $LOGallowed_listsSQL"; $rslt=mysql_to_mysqli($stmt, $link); @@ -894,12 +1041,22 @@ else echo "
Welcome
$u$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1] $row[15]   $row[10]
NOTES:   $rowA[0]
$y$row[3] $row[5] $row[1] $row[7] $row[9] $row[11] $row[13]   $row[14]   $row[15]   $row[17]
$y$row[4] $row[7] $row[8] $row[11] $row[3] $row[2] $row[1]   $row[14]   $row[17]
NOTES:   $rowA[0]
\n"; echo "\n"; echo "\n"; - if ($archive_search=="Yes") { + if ($archive_search=="Yes") + { echo "\n"; - } + } + if ($archive_log=="Yes") + { + echo "\n"; + } + if ($lead_id == 'NEW') {$list_id='';} if ($LOGadmin_hide_lead_data != '0') diff --git a/www/vicidial/admin_search_lead.php b/www/vicidial/admin_search_lead.php index 585e2eaf..27107a13 100644 --- a/www/vicidial/admin_search_lead.php +++ b/www/vicidial/admin_search_lead.php @@ -36,6 +36,7 @@ # 130926-2048 - Added option to search vicidial_list_archive table # 140724-1240 - Added the abilty to search the log archive tables # 140808-1117 - Added more admin logging +# 140817-0941 - Added archive_log variable to modify page link # require("dbconnect_mysqli.php"); @@ -113,6 +114,7 @@ $NOW_TIME = date("Y-m-d H:i:s"); $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); +$log_archive_link=0; if (strlen($alt_phone_search) < 2) {$alt_phone_search='No';} @@ -637,12 +639,14 @@ else { $stmtA="SELECT lead_id,phone_number,campaign_id,call_date,status,user,list_id,length_in_sec,alt_dial from vicidial_log_archive where lead_id='" . mysqli_real_escape_string($link, $log_lead_id_archive) . "' $LOGallowed_listsSQL"; $stmtB="SELECT lead_id,phone_number,campaign_id,call_date,status,user,list_id,length_in_sec from vicidial_closer_log_archive where lead_id='" . mysqli_real_escape_string($link, $log_lead_id_archive) . "' $LOGallowed_listsSQL"; + $log_archive_link='Yes'; } if (strlen($log_phone_archive)>0) { $stmtA="SELECT lead_id,phone_number,campaign_id,call_date,status,user,list_id,length_in_sec,alt_dial from vicidial_log_archive where phone_number='" . mysqli_real_escape_string($link, $log_phone_archive) . "' $LOGallowed_listsSQL"; $stmtB="SELECT lead_id,phone_number,campaign_id,call_date,status,user,list_id,length_in_sec from vicidial_closer_log_archive where phone_number='" . mysqli_real_escape_string($link, $log_phone_archive) . "' $LOGallowed_listsSQL"; $stmtC="SELECT extension,caller_id_number,did_id,call_date from vicidial_did_log where caller_id_number='" . mysqli_real_escape_string($link, $log_phone_archive) . "'"; + $log_archive_link='Yes'; } if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) @@ -706,7 +710,7 @@ else {$bgcolor='bgcolor="#9BB9FB"';} echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -771,7 +775,7 @@ else {$bgcolor='bgcolor="#9BB9FB"';} echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -1078,7 +1082,7 @@ else {$bgcolor='bgcolor="#9BB9FB"';} echo "\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n";
Lead ID: $lead_id     List ID: $list_id
Fronter: $tsr     Called Count: $called_count
"; echo "*** ARCHIVED LEAD ***"; echo ""; echo "
"; + echo "*** ARCHIVED LOG SEARCH ENABLED ***
"; + echo "*** ARCHIVED LOGS SHOWN IN RED, THERE MAY BE DUPLICATES WITH NON-ARCHIVED LOG ENTRIES ***"; + echo ""; + echo "
$o$row[0]$row[0]$row[1]$row[2]$row[3]
$o$row[0]$row[0]$row[1]$row[2]$row[3]
$o$row[0]$row[0]$row[3]$row[5]$row[4]