From: mark-nielsen Date: Sun, 19 Mar 2006 02:16:00 +0000 (+0000) Subject: [Fixed] this page was shooting of warnings for unset variable score. Now checks... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8bd7bacd1479eb68009e38ea816b1b30bd7b748a;p=moodle.git [Fixed] this page was shooting of warnings for unset variable score. Now checks to make sure score is set before using it. --- diff --git a/mod/lesson/action/updatepage.php b/mod/lesson/action/updatepage.php index 67759217fd..c4f053ad24 100644 --- a/mod/lesson/action/updatepage.php +++ b/mod/lesson/action/updatepage.php @@ -103,7 +103,7 @@ $oldanswer->response = ''; } $oldanswer->jumpto = clean_param($form->jumpto[$i], PARAM_INT); - if ($lesson->custom) { + if (isset($form->score[$i])) { $oldanswer->score = clean_param($form->score[$i], PARAM_INT); } if (!update_record("lesson_answers", $oldanswer)) { @@ -128,7 +128,9 @@ $newanswer->response = trim($form->response[$i]); } $newanswer->jumpto = clean_param($form->jumpto[$i], PARAM_INT); - $newanswer->score = clean_param($form->score[$i], PARAM_INT); + if (isset($form->score[$i])) { + $newanswer->score = clean_param($form->score[$i], PARAM_INT); + } $newanswerid = insert_record("lesson_answers", $newanswer); if (!$newanswerid) { error("Update page: answer record not inserted");