diff --git a/lang/en/block_configurable_reports.php b/lang/en/block_configurable_reports.php index 6ea212a4..3e402ec6 100644 --- a/lang/en/block_configurable_reports.php +++ b/lang/en/block_configurable_reports.php @@ -54,6 +54,7 @@ $string['field'] = "Field"; // Report form +$string['applyfilters'] = "Apply filters to run the report"; $string['typeofreport'] = "Type of report"; $string['enablejsordering'] = "Enable JavaScript ordering"; $string['enablejspagination'] = "Enable JavaScript Pagination"; diff --git a/report.class.php b/report.class.php index 5b0323f7..fd5687c6 100755 --- a/report.class.php +++ b/report.class.php @@ -779,7 +779,11 @@ public function print_report_page(\moodle_page $moodlepage) { $this->print_export_options(); } else { - echo '
'.get_string('norecordsfound', 'block_configurable_reports').'
'; + if (isset($this->filterform) && !$this->filterform->get_data()) { + echo '
'.get_string('applyfilters', 'block_configurable_reports').'
'; + } else { + echo '
'.get_string('norecordsfound', 'block_configurable_reports').'
'; + } } echo '

'; diff --git a/reports/sql/report.class.php b/reports/sql/report.class.php index 8de6ea1e..dfb665d8 100644 --- a/reports/sql/report.class.php +++ b/reports/sql/report.class.php @@ -129,7 +129,7 @@ public function create_report() { $sql = $this->prepare_sql($sql); - if ($rs = $this->execute_query($sql)) { + if (isset($this->filterform) && $this->filterform->get_data() && $rs = $this->execute_query($sql)) { foreach ($rs as $row) { if (empty($finaltable)) { foreach ($row as $colname => $value) { diff --git a/viewreport.php b/viewreport.php index e4f1a665..0492fa2a 100755 --- a/viewreport.php +++ b/viewreport.php @@ -71,6 +71,7 @@ $download = ($download && $format && strpos($report->export, $format.',') !== false) ? true : false; if ($download && $report->type == "sql") $reportclass->setForExport(true); +$reportclass->check_filters_request(); $reportclass->create_report(); $action = (!empty($download)) ? 'download' : 'view'; @@ -78,7 +79,6 @@ // No download, build navigation header etc.. if (!$download) { - $reportclass->check_filters_request(); $reportname = format_string($report->name); $navlinks = array();