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
This commit is contained in:
Huong Nguyen
2022-11-22 12:08:45 +07:00
parent 2da8a31849
commit cca0bc9ec5
+5
View File
@@ -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);
}