]> git.mjollnir.org Git - moodle.git/commitdiff
Merged fix for bug: when a student tries to add an entry and no fields are
authorvyshane <vyshane>
Thu, 25 May 2006 05:19:24 +0000 (05:19 +0000)
committervyshane <vyshane>
Thu, 25 May 2006 05:19:24 +0000 (05:19 +0000)
defined, the foreach barfs since the value of $fields is false.

mod/data/edit.php

index 81126d9228e33a35cf3d322e3e80dceb7bb23ff6..d4126307f4967d4aa31f0d7725dc49eef4f3604f 100755 (executable)
 
 
 /// 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();