From b951032cc98121badf32466dfa2ad8cc65803796 Mon Sep 17 00:00:00 2001 From: JediKev <kevin@enhancesoft.com> Date: Wed, 2 Jan 2019 10:08:35 -0600 Subject: [PATCH] issue: Dashboard Export Period This addresses an issue where exporting statistics via the dashboard within a certain timeframe (eg. 07/01/2018 -> One Quarter) will always export the statistics from the selected date up to today. This is due to the Period option always being set to "Up to today" when the Export button is clicked which in return exports the stats from the selected start date to today. This adds JS to set the period the Agent selects so the Export will return the stats from the selected date to the selected period. --- include/staff/dashboard.inc.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/staff/dashboard.inc.php b/include/staff/dashboard.inc.php index d7b35af5e..c79094d68 100644 --- a/include/staff/dashboard.inc.php +++ b/include/staff/dashboard.inc.php @@ -122,4 +122,16 @@ foreach ($groups as $g=>$desc) { </form> <script> $.drawPlots(<?php echo JsonDataEncoder::encode($report->getPlotData()); ?>); + // Set Selected Period For Dashboard Stats and Export + <?php if ($report && $report->end) { ?> + $("div#basic_search select option").each(function(){ + // Remove default selection + if ($(this)[0].selected) + $(this).removeAttr('selected'); + // Set the selected period by the option's value (periods equal + // option's values) + if ($(this).val() == "<?php echo $report->end; ?>") + $(this).attr("selected","selected"); + }); + <?php } ?> </script> -- GitLab