]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12286 - 'Save as new question' button ignores the setting in the 'Save in categor...
authortjhunt <tjhunt>
Tue, 20 Nov 2007 17:52:16 +0000 (17:52 +0000)
committertjhunt <tjhunt>
Tue, 20 Nov 2007 17:52:16 +0000 (17:52 +0000)
question/type/questiontype.php

index 17fd4db3fea3745345748ebc7d7541e087057004..3ff567597d6f192041c37da54d6bedf07dc32f24 100644 (file)
@@ -285,8 +285,17 @@ class default_questiontype {
                 error('Could not update question!');
             }
         } else {         // Question is a new one
+            if (isset($form->categorymoveto)){
+                // Doing save as new question, and we have move rights.
+                list($question->category, $notused) = explode(',', $form->categorymoveto);
+                //don't need to test add permission of category we are moving question to.
+                //Only categories that we have permission to add
+                //a question to will get through the form cleaning code for the select box.
+            } else {
+                // Really a new question.
+                list($question->category, $notused) = explode(',', $form->category);
+            }
             // Set the unique code
-            list($question->category,$notused) = explode(',', $form->category);
             $question->stamp = make_unique_id_code();
             $question->createdby = $USER->id;
             $question->modifiedby = $USER->id;