From 516a3ddc76cab540ca7b185fd6475bc00639156f Mon Sep 17 00:00:00 2001 From: Eric Merrill Date: Tue, 10 Jun 2014 05:57:19 -0400 Subject: [PATCH] MDL-45763 question: Correct random question text if set to true or false --- question/type/random/questiontype.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/question/type/random/questiontype.php b/question/type/random/questiontype.php index fbb85a75578..97ea6e2ada6 100644 --- a/question/type/random/questiontype.php +++ b/question/type/random/questiontype.php @@ -151,12 +151,13 @@ class qtype_random extends question_type { public function save_question($question, $form) { $form->name = ''; - if ($form->questiontext) { - $form->questiontext = '1'; + + // In case someone set the question text to true/false in the old style, set it properly. + if ($form->questiontext['text']) { + $form->questiontext['text'] = '1'; } else { - $form->questiontext = '0'; + $form->questiontext['text'] = '0'; } - $form->questiontextformat = FORMAT_MOODLE; $form->tags = array(); // Name is not a required field for random questions, but