From: tjhunt <tjhunt>
Date: Thu, 29 Mar 2007 23:12:08 +0000 (+0000)
Subject: MDL-9107 (regression from) MDL-8994 - adding random questions to a quiz was broken... 
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=77b2b1fa4333b782a70188badb4ef38226e51205;p=moodle.git

MDL-9107 (regression from) MDL-8994 - adding random questions to a quiz was broken. Merged from MOODLE_18_STABLE.
---

diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php
index a170da2932..7cd6a1e22e 100644
--- a/mod/quiz/edit.php
+++ b/mod/quiz/edit.php
@@ -183,6 +183,7 @@
         if ($randomcreate > 0) {
 
             $form->name = get_string('random', 'quiz') .' ('. $category->name .')';
+            $form->category = $category->id;
             $form->questiontext = $recurse; // we use the questiontext field to store the info
                                             // on whether to include questions in subcategories
             $form->questiontextformat = 0;
@@ -192,7 +193,6 @@
             for ($i=0; $i<$randomcreate; $i++) {
                 $form->stamp = make_unique_id_code();  // Set the unique code (not to be changed)
                 $question = new stdClass;
-                $question->category = $category->id;
                 $question->qtype = RANDOM;
                 $question = $QTYPES[RANDOM]->save_question($question, $form, $course);
                 if(!isset($question->id)) {