Merge branch 'MDL-37114_23' of git://github.com/timhunt/moodle into MOODLE_23_STABLE
authorDan Poltawski <dan@moodle.com>
Mon, 17 Dec 2012 07:25:30 +0000 (15:25 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 17 Dec 2012 07:25:30 +0000 (15:25 +0800)
mod/quiz/mod_form.php

index a074514..87af317 100644 (file)
@@ -515,11 +515,16 @@ class mod_quiz_mod_form extends moodleform_mod {
         $i = 0;
         while (!empty($data['feedbackboundaries'][$i] )) {
             $boundary = trim($data['feedbackboundaries'][$i]);
-            if (strlen($boundary) > 0 && $boundary[strlen($boundary) - 1] == '%') {
-                $boundary = trim(substr($boundary, 0, -1));
-                if (is_numeric($boundary)) {
-                    $boundary = $boundary * $data['grade'] / 100.0;
-                } else {
+            if (strlen($boundary) > 0) {
+                if ($boundary[strlen($boundary) - 1] == '%') {
+                    $boundary = trim(substr($boundary, 0, -1));
+                    if (is_numeric($boundary)) {
+                        $boundary = $boundary * $data['grade'] / 100.0;
+                    } else {
+                        $errors["feedbackboundaries[$i]"] =
+                                get_string('feedbackerrorboundaryformat', 'quiz', $i + 1);
+                    }
+                } else if (!is_numeric($boundary)) {
                     $errors["feedbackboundaries[$i]"] =
                             get_string('feedbackerrorboundaryformat', 'quiz', $i + 1);
                 }