From b62695ade4ed113311f5a85d2174a2ca2909031e Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 13 Mar 2014 13:25:04 +0000 Subject: [PATCH] Added CALLID as a recording filename variable Added IMAP and POP3 debug flag option when --debugX used Added Called Counts List IDs Report git-svn-id: svn://192.168.202.10@2086 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 2 + agc_2-X/trunk/agi/VD_amd.agi | 6 +- agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi | 2 + agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi | 9 +- agc_2-X/trunk/bin/AST_inbound_email_parser.pl | 6 +- agc_2-X/trunk/www/agc/vicidial.php | 7 +- agc_2-X/trunk/www/vicidial/admin.php | 14 +- .../called_counts_multilist_report.php | 790 ++++++++++++++++++ agc_2-X/trunk/www/vicidial/help.php | 4 +- 9 files changed, 825 insertions(+), 15 deletions(-) create mode 100644 agc_2-X/trunk/www/vicidial/called_counts_multilist_report.php diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index 6ba3756f..9171e5bd 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -191,6 +191,8 @@ OTHER CHANGES: 34. Added Agent API functions for preview_dial_action while previewing or manual alt dialing a lead +35. Added Called Counts List IDs Report + diff --git a/agc_2-X/trunk/agi/VD_amd.agi b/agc_2-X/trunk/agi/VD_amd.agi index d588dc8d..d72e1c2d 100644 --- a/agc_2-X/trunk/agi/VD_amd.agi +++ b/agc_2-X/trunk/agi/VD_amd.agi @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# VD_amd.agi version 2.6 +# VD_amd.agi version 2.8 # # runs after a call goes through AMD in extensions.conf to send the call on to # it's proper destination, or when agent sends to VM message @@ -21,7 +21,7 @@ # exten => _8320*.,1,AGI(VD_amd.agi,${EXTEN}-----YES) # exten => _8320*.,2,Hangup # -# Copyright (C) 2013 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2014 Matt Florell LICENSE: AGPLv2 # # changes: # 60206-1434 - first build @@ -45,6 +45,7 @@ # 120430-2214 - Converted call to Monitor app to be asterisk 1.8 compatible # 130108-1808 - Changes for Asterisk 1.8 compatibility # 130210-1113 - Added options for CALLMENU|INGROUP cpd_amd_actions +# 140312-2110 - Added CALLID as recording filename variable # $script = 'VD_amd.agi'; @@ -507,6 +508,7 @@ else $campaign_rec_filename =~ s/AGENT/VDAD/gi; $campaign_rec_filename =~ s/VENDORLEADCODE/$vendor_lead_code/gi; $campaign_rec_filename =~ s/LEADID/$VD_lead_id/gi; + $campaign_rec_filename =~ s/CALLID/$callerid/gi; $campaign_rec_filename =~ s/\"|\'//gi; $campaign_rec_filename =~ s/ //gi; diff --git a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi index b100b8e6..585ac8cf 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_ALL_inbound.agi @@ -189,6 +189,7 @@ # 131209-1539 - Added called_count logging # 140126-1129 - Added VMAIL_NO_INST options # 140215-2133 - Added several variable options for QM socket URL +# 140312-2111 - Added CALLID as recording filename variable # $script = 'agi-VDAD_ALL_inbound.agi'; @@ -3299,6 +3300,7 @@ while ( ($drop_timer <= $DROP_TIME) && ($wait_in_queue > 0) && ($MCdrop_override $campaign_rec_filename =~ s/AGENT/$VDADuser/gi; $campaign_rec_filename =~ s/VENDORLEADCODE/$vendor_lead_code/gi; $campaign_rec_filename =~ s/LEADID/$insert_lead_id/gi; + $campaign_rec_filename =~ s/CALLID/$callerid/gi; $campaign_rec_filename =~ s/\"|\'//gi; %ast_ver_str = parse_asterisk_version($asterisk_version); diff --git a/agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi b/agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi index 842e59b8..45b5470f 100644 --- a/agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi +++ b/agc_2-X/trunk/agi/agi-VDAD_RINGALL.agi @@ -1,6 +1,6 @@ #!/usr/bin/perl # -# agi-VDAD_RINGALL.agi version 2.6 +# agi-VDAD_RINGALL.agi version 2.8 # # NOTE: this script is used for on-hook agents to be connected to customer calls # when they answer their ringing phones @@ -12,7 +12,7 @@ # exten => _8331*.,n,AGI(agi-VDAD_RINGALL.agi,${EXTEN}) # exten => _8331*.,n,Hangup # -# Copyright (C) 2013 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2014 Matt Florell LICENSE: AGPLv2 # # changes: # 110303-2325 - First build @@ -20,6 +20,7 @@ # 110325-1411 - Added user recording override settings checking for remote agent recording # 121114-1935 - Added INGROUP recording option # 130108-1808 - Changes for Asterisk 1.8 compatibility +# 140312-2112 - Added CALLID as recording filename variable # $script = 'agi-VDAD_RINGALL.agi'; @@ -172,7 +173,7 @@ if ($channel =~ /^Local/) ### Check that the call exists, if not then buzz and hangup ### -$stmtA = "SELECT campaign_id,call_type,extension,phone_number,lead_id FROM vicidial_auto_calls where auto_call_id='$auto_call_id';"; +$stmtA = "SELECT campaign_id,call_type,extension,phone_number,lead_id,callerid FROM vicidial_auto_calls where auto_call_id='$auto_call_id';"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $VACcount=$sthA->rows; @@ -184,6 +185,7 @@ if ($VACcount > 0) $VAC_extension = $aryA[2]; $VAC_phone_number = $aryA[3]; $VAC_lead_id = $aryA[4]; + $VAC_call_id = $aryA[5]; if ($AGILOG) {$agi_string = "-- VAC Call Found: |$callerid|$VAC_campaign_id|$VAC_call_type|$VAC_extension|$VAC_phone_number|$VAC_lead_id|$auto_call_id|"; &agi_output;} $sthA->finish(); } @@ -336,6 +338,7 @@ if ($NAGcount > 0) $campaign_rec_filename =~ s/AGENT/$dial_user/gi; $campaign_rec_filename =~ s/VENDORLEADCODE/$vendor_lead_code/gi; $campaign_rec_filename =~ s/LEADID/$VAC_lead_id/gi; + $campaign_rec_filename =~ s/CALLID/$VAC_call_id/gi; $campaign_rec_filename =~ s/\"|\'//gi; %ast_ver_str = parse_asterisk_version($asterisk_version); diff --git a/agc_2-X/trunk/bin/AST_inbound_email_parser.pl b/agc_2-X/trunk/bin/AST_inbound_email_parser.pl index 0a73b413..e486e613 100644 --- a/agc_2-X/trunk/bin/AST_inbound_email_parser.pl +++ b/agc_2-X/trunk/bin/AST_inbound_email_parser.pl @@ -57,6 +57,7 @@ use MIME::QuotedPrint; # 130607-0155 - Encoding fix # 140212-0719 - Added ignoresizeerrors option, changed debug and added --force-check option # 140225-1241 - Added option for SSL no-cert-verify (--ssl-no-cert) +# 140313-0905 - Added Debug options when --debugX for both IMAP and POP3 # # default path to astguiclient configuration file: @@ -247,6 +248,7 @@ while (@row=$rslt->fetchrow_array) { User => "$VARemail_user", Password => "$VARemail_pwd", Ignoresizeerrors => 1, + Debug => "$DBX", Socket => IO::Socket::SSL->new ( Proto => 'tcp', PeerAddr => "$VARemail_server", @@ -264,6 +266,7 @@ while (@row=$rslt->fetchrow_array) { Port => 993, Ssl => 1, Ignoresizeerrors => 1, + Debug => "$DBX", ); } @@ -617,6 +620,7 @@ while (@row=$rslt->fetchrow_array) { HOST => "$VARemail_server", PORT => 995, USESSL => true, + DEBUG => "$DBX", ) or die "Cannot connect through POP3Client: $!"; @@ -947,7 +951,7 @@ while (@row=$rslt->fetchrow_array) { HOST => "$VARemail_server", PORT => 995, USESSL => true, - #DEBUG => true, + DEBUG => "$DBX", ) or die "Cannot connect through POP3Client: $!"; $pop->Close(); diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index 974418a9..ae65385d 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -422,10 +422,11 @@ # 140214-1851 - Added preview_dial_action API function # 140301-2059 - Added API functions options for SEARCH for phone within lead_id and Dial Next Number # 140302-1018 - Changes to allow for & and + in standard fields +# 140312-2109 - Added CALLID as recording filename variable # -$version = '2.8-391c'; -$build = '140302-1018'; +$version = '2.8-392c'; +$build = '140312-2109'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=79; $one_mysql_log=0; @@ -5250,6 +5251,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) var REGrecAGENT = new RegExp("AGENT","g"); var REGrecVENDORLEADCODE = new RegExp("VENDORLEADCODE","g"); var REGrecLEADID = new RegExp("LEADID","g"); + var REGrecCALLID = new RegExp("CALLID","g"); filename = LIVE_campaign_rec_filename; filename = filename.replace(REGrecCAMPAIGN, campaign); filename = filename.replace(REGrecINGROUP, VDCL_group_id); @@ -5260,6 +5262,7 @@ function set_length(SLnumber,SLlength_goal,SLdirection) filename = filename.replace(REGrecAGENT, user); filename = filename.replace(REGrecVENDORLEADCODE, recVendorLeadCode); filename = filename.replace(REGrecLEADID, recLeadID); + filename = filename.replace(REGrecCALLID, LasTCID); // filename = filedate + "_" + user_abb; var query_recording_exten = recording_exten; var channelrec = "Local/" + conf_silent_prefix + '' + taskconfrec + "@" + ext_context; diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 48650b3f..ccb741ae 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -109,9 +109,9 @@ $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; $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, 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'; +$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, 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, 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'; +$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, 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'; $Vtables = 'NONE,log_noanswer,did_agent_log,contact_information'; @@ -3276,12 +3276,13 @@ else # 140214-1643 - Added system settings dialplan reload timestamp # 140302-0958 - Added Webserver-URL Report # 140305-0846 - Bug fix for list modify admin logging issue +# 140313-0727 - Added links to Called Counts List IDs Report # # make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time -$admin_version = '2.8-428a'; -$build = '140305-0846'; +$admin_version = '2.8-429a'; +$build = '140313-0727'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -31413,7 +31414,10 @@ if ($ADD==999999) if ( (preg_match("/Lists Pass Report/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) {echo "
  • Lists Pass Report\n";} if ( (preg_match("/Lists Campaign Statuses Report/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) - {echo "
  • Lists Campaign Statuses Report\n";} + {echo "
  • Lists Campaign Statuses Report\n";} + if ( (preg_match("/Called Counts List IDs Report/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) + {echo "
  • Called Counts List IDs Report\n";} + if ( (preg_match("/Campaign Status List Report/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) {echo "
  • Campaign Status List Report\n";} # echo "
  • AGENT SPREADSHEET PERFORMANCE\n"; diff --git a/agc_2-X/trunk/www/vicidial/called_counts_multilist_report.php b/agc_2-X/trunk/www/vicidial/called_counts_multilist_report.php new file mode 100644 index 00000000..9c8eea1e --- /dev/null +++ b/agc_2-X/trunk/www/vicidial/called_counts_multilist_report.php @@ -0,0 +1,790 @@ +, Matt Florell LICENSE: AGPLv2 +# +# This is a report designed for showing called counts similar to the results +# at the bottom of each list detail screen, but for multiple lists and using +# a date range, if necessary. The date range will restrict the results returned +# to leads called at least once within the given range (the count will still +# be cumulative for the entire existence of the leads, however). +# +# CHANGES +# 140311-1940 - First build based upon admin.php & AST_VDADstats.php +# + +$startMS = microtime(); + +header ("Content-type: text/html; charset=utf-8"); + +require("dbconnect_mysqli.php"); +require("functions.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +$QUERY_STRING=$_SERVER['QUERY_STRING']; + +if (isset($_GET["list_ids"])) {$list_ids=$_GET["list_ids"];} + elseif (isset($_POST["list_ids"])) {$list_ids=$_POST["list_ids"];} +if (isset($_GET["override_date"])) {$override_date=$_GET["override_date"];} + elseif (isset($_POST["override_date"])) {$override_date=$_POST["override_date"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["query_date"])) {$query_date=$_GET["query_date"];} + elseif (isset($_POST["query_date"])) {$query_date=$_POST["query_date"];} +if (isset($_GET["end_date"])) {$end_date=$_GET["end_date"];} + elseif (isset($_POST["end_date"])) {$end_date=$_POST["end_date"];} +if (isset($_GET["shift"])) {$shift=$_GET["shift"];} + elseif (isset($_POST["shift"])) {$shift=$_POST["shift"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["submit"])) {$submit=$_GET["submit"];} + elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} +if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} + elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["report_display_type"])) {$report_display_type=$_GET["report_display_type"];} + elseif (isset($_POST["report_display_type"])) {$report_display_type=$_POST["report_display_type"];} + +if (strlen($shift)<2) {$shift='ALL';} +if (strlen($bottom_graph)<2) {$bottom_graph='NO';} +if (strlen($carrier_stats)<2) {$carrier_stats='NO';} +if (strlen($include_rollover)<2) {$include_rollover='NO';} + +$report_name = 'Called Counts List IDs Report'; +$db_source = 'M'; +$JS_text="\n"; +$HEADER.="\n"; +$HEADER.="\n"; + + +$HEADER.="\n"; + +$HEADER.="\n"; +$HEADER.="$report_name\n"; + +$short_header=1; +$draw_graph=1; + +#require("admin_header.php"); + +$MAIN.="
    "; + +$MAIN.="
    \n"; +$MAIN.="
    All dates

    Dates:
    "; +$MAIN.="\n"; +$MAIN.="\n"; +$MAIN.=""; + +$MAIN.="\n"; + +$MAIN.="
    to
    "; + +$MAIN.="\n"; + +if (preg_match('/MSIE/i', $_SERVER['HTTP_USER_AGENT'])) { + $JS_events="onBlur='LoadLists(this.form.group)' onKeyUp='LoadLists(this.form.group)'"; +} else { + $JS_events="onMouseUp='LoadLists(this.form.group)' onBlur='LoadLists(this.form.group)' onKeyUp='LoadLists(this.form.group)'"; +} +$MAIN.="
    Campaigns:
    "; +$MAIN.="\n"; +$MAIN.="
    "; +$MAIN.="Lists: (optional, possibly slow)
    \n"; +$MAIN.=$list_options; +$MAIN.="
    "; + +$MAIN.="\n"; +$MAIN.="

    reset"; +$MAIN.="
            "; +$MAIN.=""; +if (strlen($group[0]) > 1) + { + $MAIN.=" MODIFY | \n"; + $MAIN.=" REPORTS \n"; + } +else + { + $MAIN.=" CAMPAIGNS | \n"; + $MAIN.=" REPORTS \n"; + } +$MAIN.="
    "; +$MAIN.="
    \n\n"; + + +if (strlen($QUERY_STRING) > 5) + { + $leads_in_list = 0; + $leads_in_list_N = 0; + $leads_in_list_Y = 0; + + if (!$override_date) { + $date_range_title=" FOR LEADS CALLED $query_date THROUGH $end_date"; + $stmt="select distinct vicidial_list.lead_id from vicidial_list, vicidial_log where vicidial_log.call_date>='$query_date 00:00:00' and vicidial_log.call_date<='$end_date 23:59:59' $list_id_SQLandVLJOIN UNION select distinct vicidial_list.lead_id from vicidial_list, vicidial_closer_log where vicidial_closer_log.call_date>='$query_date 00:00:00' and vicidial_closer_log.call_date<='$end_date 23:59:59' $list_id_SQLandVCLJOIN;"; + $rslt=mysql_to_mysqli($stmt, $link); + if (!$rslt) {$MAIN.="
    **".mysqli_error($link)."
    $stmt";} + if ($DB) {$MAIN.="$stmt

    ";} + $lead_id_str=""; + if (mysqli_num_rows($rslt)>200000) { + $MAIN.="WARNING: Query resulting from report parameters is too large. Running report by list ID selection only."; + } else if (mysqli_num_rows($rslt)>0) { + while ($rowx=mysqli_fetch_row($rslt)) { + $lead_id_str.="$rowx[0],"; + } + $lead_id_str=preg_replace('/,$/', '', $lead_id_str); + if (!$list_id_SQL) { + $lead_id_str=" where lead_id in ($lead_id_str) "; + } else { + $lead_id_str=" and lead_id in ($lead_id_str) "; + } + } + } + + $stmt="select status, if(called_count >= 100, 100, called_count), count(*) from vicidial_list $list_id_SQL $lead_id_str group by status, if(called_count >= 100, 100, called_count) order by status,called_count;"; + $rslt=mysql_to_mysqli($stmt, $link); + if (!$rslt) {$MAIN.="
    **".mysqli_error($link)."
    $stmt";} + if ($DB) {$MAIN.="$stmt

    ";} + + $status_called_to_print = mysqli_num_rows($rslt); + + $CSV_text=""; + + $o=0; + $sts=0; + $first_row=1; + $all_called_first=1000; + $all_called_last=0; + while ($status_called_to_print > $o) + { + $rowx=mysqli_fetch_row($rslt); + $leads_in_list = ($leads_in_list + $rowx[2]); + $count_statuses[$o] = $rowx[0]; + $count_called[$o] = $rowx[1]; + $count_count[$o] = $rowx[2]; + $all_called_count[$rowx[1]] = ($all_called_count[$rowx[1]] + $rowx[2]); + + if ( (strlen($status[$sts]) < 1) or ($status[$sts] != "$rowx[0]") ) + { + if ($first_row) {$first_row=0;} + else {$sts++;} + $status[$sts] = "$rowx[0]"; + $status_called_first[$sts] = "$rowx[1]"; + if ($status_called_first[$sts] < $all_called_first) {$all_called_first = $status_called_first[$sts];} + } + $leads_in_sts[$sts] = ($leads_in_sts[$sts] + $rowx[2]); + $status_called_last[$sts] = "$rowx[1]"; + if ($status_called_last[$sts] > $all_called_last) {$all_called_last = $status_called_last[$sts];} + + $o++; + } + + $CSV_text=""; + $MAIN.="
    \n"; + $MAIN.="
    CALLED COUNTS WITHIN LIST(S) $list_id_title_str$date_range_title:           [DOWNLOAD]
    \n"; + $CSV_text.="CALLED COUNTS WITHIN LIST(S) $list_id_title_str$date_range_title:\n"; + $MAIN.="\n"; + $MAIN.=""; + $CSV_text.="\"STATUS\",\"STATUS NAME\","; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (preg_match('/1$|3$|5$|7$|9$/i', $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + if ($first >= 100) {$Fplus='+';} + else {$Fplus='';} + $MAIN.=""; + $CSV_text.="\"$first$Fplus\","; + $first++; + } + $MAIN.="\n"; + $CSV_text.="\"SUBTOTAL\"\n"; + + $sts=0; + $statuses_called_to_print = count($status); + while ($statuses_called_to_print > $sts) + { + $Pstatus = $status[$sts]; + if (preg_match("/1$|3$|5$|7$|9$/i", $sts)) + {$bgcolor='bgcolor="#B9CBFD"'; $AB='bgcolor="#9BB9FB"';} + else + {$bgcolor='bgcolor="#9BB9FB"'; $AB='bgcolor="#B9CBFD"';} + # $MAIN.="$status[$sts]|$status_called_first[$sts]|$status_called_last[$sts]|$leads_in_sts[$sts]|\n"; + # $MAIN.="$status[$sts]|"; + $MAIN.=""; + $CSV_text.="\"$Pstatus\",\"$statuses_list[$Pstatus]\","; + + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (preg_match("/1$|3$|5$|7$|9$/i", $sts)) + { + if (preg_match('/1$|3$|5$|7$|9$/i', $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + else + { + if (preg_match("/0$|2$|4$|6$|8$/i", $first)) {$AB='bgcolor="#9BB9FB"';} + else{$AB='bgcolor="#B9CBFD"';} + } + + $called_printed=0; + $o=0; + while ($status_called_to_print > $o) + { + if ( ($count_statuses[$o] == "$Pstatus") and ($count_called[$o] == "$first") ) + { + $called_printed++; + $MAIN.=""; + $CSV_text.="\"$count_count[$o]\","; + } + + $o++; + } + if (!$called_printed) + { + $MAIN.=""; + $CSV_text.="\"\","; + } + $first++; + } + $MAIN.="\n\n"; + $CSV_text.="\"$leads_in_sts[$sts]\"\n"; + + $sts++; + } + + $MAIN.=""; + $CSV_text.="\"\",\"TOTAL\","; + $first = $all_called_first; + while ($first <= $all_called_last) + { + if (preg_match('/1$|3$|5$|7$|9$/i', $first)) {$AB='bgcolor="#AFEEEE"';} + else{$AB='bgcolor="#E0FFFF"';} + $MAIN.=""; + $CSV_text.="\"$all_called_count[$first]\","; + $first++; + } + $MAIN.="\n"; + $CSV_text.="\"$leads_in_list\","; + + $MAIN.="
    STATUSSTATUS NAME$first$FplusSUBTOTAL
    $Pstatus$statuses_list[$Pstatus] $count_count[$o]  $leads_in_sts[$sts]
    TOTAL$all_called_count[$first]$leads_in_list

    \n"; + $MAIN.="\n"; + + if ($file_download>0) + { + $FILE_TIME = date("Ymd-His"); + $CSVfilename = "CALLED_COUNTS_MULTILIST_report_$US$FILE_TIME.csv"; + $CSV_text=preg_replace('/\n +,/', ',', $CSV_text); + $CSV_text=preg_replace('/ +\"/', '"', $CSV_text); + $CSV_text=preg_replace('/\" +/', '"', $CSV_text); + // We'll be outputting a TXT file + header('Content-type: application/octet-stream'); + + // It will be called LIST_101_20090209-121212.txt + header("Content-Disposition: attachment; filename=\"$CSVfilename\""); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + ob_clean(); + flush(); + + echo "$CSV_text"; + } + else + { + echo $HEADER; + require("admin_header.php"); + echo $MAIN; + } + } +else + { + echo $HEADER; + require("admin_header.php"); + echo $MAIN; + } + +if ($db_source == 'S') + { + mysqli_close($link); + $use_slave_server=0; + $db_source = 'M'; + require("dbconnect_mysqli.php"); + } + +$endMS = microtime(); +$startMSary = explode(" ",$startMS); +$endMSary = explode(" ",$endMS); +$runS = ($endMSary[0] - $startMSary[0]); +$runM = ($endMSary[1] - $startMSary[1]); +$TOTALrun = ($runS + $runM); + +$stmt="UPDATE vicidial_report_log set run_time='$TOTALrun' where report_log_id='$report_log_id';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_to_mysqli($stmt, $link); + +exit; +?> \ No newline at end of file diff --git a/agc_2-X/trunk/www/vicidial/help.php b/agc_2-X/trunk/www/vicidial/help.php index 41159993..49a4c7d5 100644 --- a/agc_2-X/trunk/www/vicidial/help.php +++ b/agc_2-X/trunk/www/vicidial/help.php @@ -1170,7 +1170,7 @@ if ($SSoutbound_autodial_active > 0)

    -Campaign Rec Filename - This field allows you to customize the name of the recording when Campaign recording is ONDEMAND or ALLCALLS. The allowed variables are CAMPAIGN INGROUP CUSTPHONE FULLDATE TINYDATE EPOCH AGENT VENDORLEADCODE LEADID. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. Te resulting filename must be less than 90 characters in length. +Campaign Rec Filename - This field allows you to customize the name of the recording when Campaign recording is ONDEMAND or ALLCALLS. The allowed variables are CAMPAIGN INGROUP CUSTPHONE FULLDATE TINYDATE EPOCH AGENT VENDORLEADCODE LEADID CALLID. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. Te resulting filename must be less than 90 characters in length.
    @@ -2227,7 +2227,7 @@ if ($SSqc_features_active > 0)

    -In-Group Recording Filename - This field will override the Campaign Recording Filenaming Scheme unless it is set to NONE. The allowed variables are CAMPAIGN INGROUP CUSTPHONE FULLDATE TINYDATE EPOCH AGENT VENDORLEADCODE LEADID. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. Te resulting filename must be less than 90 characters in length. Default is NONE. +In-Group Recording Filename - This field will override the Campaign Recording Filenaming Scheme unless it is set to NONE. The allowed variables are CAMPAIGN INGROUP CUSTPHONE FULLDATE TINYDATE EPOCH AGENT VENDORLEADCODE LEADID CALLID. The default is FULLDATE_AGENT and would look like this 20051020-103108_6666. Another example is CAMPAIGN_TINYDATE_CUSTPHONE which would look like this TESTCAMP_51020103108_3125551212. Te resulting filename must be less than 90 characters in length. Default is NONE. 0)