From fafbcc51b52e0fc373b2c2621078d770b5b6d66c Mon Sep 17 00:00:00 2001 From: vyshane Date: Thu, 25 May 2006 05:19:24 +0000 Subject: [PATCH] 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. --- mod/data/edit.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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(); -- 2.39.5