Merge branch 'MDL-29048-master' of git://github.com/ankitagarwal/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 20 Dec 2011 17:55:31 +0000 (18:55 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 20 Dec 2011 17:55:31 +0000 (18:55 +0100)
mod/glossary/backup/moodle2/restore_glossary_stepslib.php

index 719cfa0..274dfa7 100644 (file)
@@ -66,6 +66,11 @@ class restore_glossary_activity_structure_step extends restore_activity_structur
         if (!in_array($data->displayformat, $formats)) {
             $data->displayformat = 'dictionary';
         }
+        if (!empty($data->mainglossary) and $data->mainglossary == 1 and
+            $DB->record_exists('glossary', array('mainglossary' => 1, 'course' => $this->get_courseid()))) {
+            // Only allow one main glossary in the course
+            $data->mainglossary = 0;
+        }
 
         // insert the glossary record
         $newitemid = $DB->insert_record('glossary', $data);