From cca0bc9ec59b951b3f8ca74541ddcf009b68a9ba Mon Sep 17 00:00:00 2001 From: Huong Nguyen Date: Tue, 22 Nov 2022 12:05:02 +0700 Subject: [PATCH] MDL-76365 mod_data: Fix export with empty template If the template is not created, we need to use the default template for the export --- mod/data/locallib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mod/data/locallib.php b/mod/data/locallib.php index 0b52a9fb5c8..53e7a48997c 100644 --- a/mod/data/locallib.php +++ b/mod/data/locallib.php @@ -333,6 +333,11 @@ class data_portfolio_caller extends portfolio_module_caller_base { $replacement[] = userdate($record->timecreated); $replacement[] = userdate($record->timemodified); + if (empty($this->data->singletemplate)) { + // Use default template if the template is not created. + $this->data->singletemplate = data_generate_default_template($this->data, 'singletemplate', 0, false, false); + } + // actual replacement of the tags return array(str_ireplace($patterns, $replacement, $this->data->singletemplate), $files); }