From fd6358feaaeaba14249ec489fa09771ed50c1dc2 Mon Sep 17 00:00:00 2001 From: Adrian Greeve Date: Fri, 17 Apr 2015 11:30:18 +0800 Subject: [PATCH] MDL-49880 mod_lesson: Fixed notice while importing questions. Cloze questions (not supported by lesson) threw up a notice saying that the course wasn't set. --- question/format/xml/format.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/question/format/xml/format.php b/question/format/xml/format.php index 722fd872c71..d1aececca06 100644 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -454,7 +454,11 @@ class qformat_xml extends qformat_default { // Header parts particular to multianswer. $qo->qtype = 'multianswer'; - $qo->course = $this->course; + + // Only set the course if the data is available. + if (isset($this->course)) { + $qo->course = $this->course; + } $qo->name = $this->clean_question_name($this->import_text($question['#']['name'][0]['#']['text'])); $qo->questiontextformat = $questiontext['format'];