From: vyshane Date: Thu, 25 May 2006 05:19:24 +0000 (+0000) Subject: Merged fix for bug: when a student tries to add an entry and no fields are X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=fafbcc51b52e0fc373b2c2621078d770b5b6d66c;p=moodle.git Merged fix for bug: when a student tries to add an entry and no fields are defined, the foreach barfs since the value of $fields is false. --- diff --git a/mod/data/edit.php b/mod/data/edit.php index 81126d9228..d4126307f4 100755 --- a/mod/data/edit.php +++ b/mod/data/edit.php @@ -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();