Fix for bug: when students try to add an entry while no field is defined, the
foreach barfs on the value of $fields, which is false.
This commit is contained in:
+4
-2
@@ -320,9 +320,11 @@
|
||||
|
||||
|
||||
/// Finish the page
|
||||
|
||||
|
||||
// Print the stuff that need to come after the form fields.
|
||||
$fields = get_records('data_fields', 'dataid', $data->id);
|
||||
if (!$fields = get_records('data_fields', 'dataid', $data->id)) {
|
||||
error(get_string('nofieldindatabase'));
|
||||
}
|
||||
foreach ($fields as $eachfield) {
|
||||
$field = data_get_field($eachfield, $data);
|
||||
$field->print_after_form();
|
||||
|
||||
Reference in New Issue
Block a user