MDL-44501 mod_data: Only attempt to export files when a file exists.

The error only occurs when portfolios are enabled and there is only one field which is
a file field.
This commit is contained in:
Adrian Greeve
2014-06-04 15:31:34 +08:00
parent 1132d30d1f
commit 7de5920dd8
+3 -1
View File
@@ -348,7 +348,9 @@ class data_portfolio_caller extends portfolio_module_caller_base {
$includedfiles = array();
foreach ($fields as $singlefield) {
if (is_callable(array($singlefield, 'get_file'))) {
$includedfiles[] = $singlefield->get_file($record->id);
if ($file = $singlefield->get_file($record->id)) {
$includedfiles[] = $file;
}
}
}
if (count($includedfiles) == 1 && count($fields) == 1) {