mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 20:50:21 +01:00
Merge branch 'w19_MDL-32178_m23_dbenrolignore' of git://github.com/skodak/moodle
This commit is contained in:
commit
70ebfcee6f
@ -726,6 +726,19 @@ class enrol_database_plugin extends enrol_plugin {
|
||||
$newcourse->idnumber = $fields->idnumber;
|
||||
$newcourse->category = $fields->category ? $fields->category : $defaultcategory;
|
||||
|
||||
// Detect duplicate data once again, above we can not find duplicates
|
||||
// in external data using DB collation rules...
|
||||
if ($DB->record_exists('course', array('shortname' => $newcourse->shortname))) {
|
||||
if ($verbose) {
|
||||
mtrace(" can not insert new course, duplicate shortname detected: ".$newcourse->shortname);
|
||||
}
|
||||
continue;
|
||||
} else if (!empty($newcourse->idnumber) and $DB->record_exists('course', array('idnumber' => $newcourse->idnumber))) {
|
||||
if ($verbose) {
|
||||
mtrace(" can not insert new course, duplicate idnumber detected: ".$newcourse->idnumber);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$c = create_course($newcourse);
|
||||
if ($verbose) {
|
||||
mtrace(" creating course: $c->id, $c->fullname, $c->shortname, $c->idnumber, $c->category");
|
||||
|
Loading…
x
Reference in New Issue
Block a user