From 5c17c4f9176ae1790cbb8516325557d340882277 Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 6 Mar 2017 14:17:08 +0000 Subject: [PATCH] Fixed proper file extensions for different download report types for automated reports git-svn-id: svn://192.168.202.10@2696 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/AST_email_web_report.pl | 14 ++++++++++++-- www/vicidial/list_download.php | 6 +++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bin/AST_email_web_report.pl b/bin/AST_email_web_report.pl index 7db707d3..597d1bfd 100644 --- a/bin/AST_email_web_report.pl +++ b/bin/AST_email_web_report.pl @@ -18,6 +18,7 @@ # 111214-0922 - Added remove images and links options as well as email subject option # 160415-1421 - Fixed minor bug in file to attach to email # 170304-1400 - Added options for running a defined Automated Report, and admin logging +# 170306-0915 - Fixed proper file extensions for different download report types # $txt = '.txt'; @@ -529,7 +530,15 @@ if (length($report_id) > 1) } $sthA->finish(); - $HTMLfile = $report_id . "_" . $start_date . "_" . $hms . '' . $html; + $file_extension = $html; + if ($location =~ /call_report_export|lead_report_export|call_report_export_carrier|list_download/) + {$file_extension = '.txt'} + else + { + if ($location =~ /&file_download=\d/) + {$file_extension = '.csv'} + } + $HTMLfile = $report_id . "_" . $start_date . "_" . $hms . '' . $file_extension; $HTMLfileLOG = $report_id . "_" . $start_date . "_" . $hms . '' . $txt; $shipdate=''; } @@ -538,8 +547,9 @@ else ###################################################### ##### CHANGE REPORT NAME AND URL HERE!!!!!!!!! ###################################################### + $file_extension = $html; #$HTMLfile = "Outbound_Report_ALL_$shipdate$html"; - $HTMLfile = "DISCH_SURVEY_$start_date$html"; + $HTMLfile = "DISCH_SURVEY_$start_date$file_extension"; $HTMLfileLOG = "DISCH_SURVEY_$start_date$txt"; #$location = "http://6666:1234\@127.0.0.1/vicidial/fcstats.php?db_log=1\\&query_date=$shipdate\\&group=$group\\&shift=$shift\\&archive=1"; diff --git a/www/vicidial/list_download.php b/www/vicidial/list_download.php index 61747faf..8e5aa6f5 100644 --- a/www/vicidial/list_download.php +++ b/www/vicidial/list_download.php @@ -4,7 +4,7 @@ # downloads the entire contents of a vicidial list ID to a flat text file # that is tab delimited # -# Copyright (C) 2015 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2017 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -32,6 +32,7 @@ # 141229-1840 - Added code for on-the-fly language translations display # 150727-2158 - Enabled user features for hiding phone numbers and lead data # 150903-1538 - Added compatibility for custom fields data options +# 170306-0858 - Added proper report URL logging # $startMS = microtime(); @@ -177,6 +178,9 @@ else $webserver_id = mysqli_insert_id($link); } +if (!preg_match("/\?/",$LOGfull_url)) + {$LOGfull_url .= "?download_type=$download_type&group_id=$group_id&list_id=$list_id";} + $stmt="INSERT INTO vicidial_report_log set event_date=NOW(), user='$PHP_AUTH_USER', ip_address='$LOGip', report_name='$report_name', browser='$LOGbrowser', referer='$LOGhttp_referer', notes='$LOGserver_name:$LOGserver_port $LOGscript_name |$list_id, $group_id, $download_type|', url='$LOGfull_url', webserver='$webserver_id';"; if ($DB) {echo "|$stmt|\n";} $rslt=mysql_to_mysqli($stmt, $link);