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-03 10:15:09 +08:00
parent 8e478c99d3
commit f3998ce41e

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) {