MDL-29048 Glossary Force glossary type to secondary while trying to duplicate a mail glossary

This commit is contained in:
Mark Nielsen
2011-12-12 12:33:56 +05:30
committed by Ankit Kumar Agarwal
parent f89a83b87b
commit 8fbb55ac8b
@@ -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);