Fixing bug 2480 - meta course enrolment

This commit is contained in:
mjollnir_ 2005-02-05 05:15:16 +00:00
parent 6573a08f63
commit ee1bef900a

View File

@ -1174,10 +1174,11 @@ function sync_metacourse($metacourseid) {
FROM {$CFG->prefix}course_meta meta
JOIN {$CFG->prefix}user_students parent
ON meta.parent_course = parent.course
AND meta.parent_course = $metacourseid
LEFT JOIN {$CFG->prefix}user_students child
LEFT OUTER JOIN {$CFG->prefix}user_students child
ON meta.child_course = child.course
WHERE child.course IS NULL";
AND child.userid = parent.userid
WHERE child.course IS NULL
AND meta.parent_course = $metacourseid";
if ($enrolmentstodelete = get_records_sql($sql)) {
foreach ($enrolmentstodelete as $enrolment) {
@ -1191,10 +1192,11 @@ function sync_metacourse($metacourseid) {
FROM {$CFG->prefix}course_meta meta
JOIN {$CFG->prefix}user_students child
ON meta.child_course = child.course
AND meta.parent_course = $metacourseid
LEFT JOIN {$CFG->prefix}user_students parent
LEFT OUTER JOIN {$CFG->prefix}user_students parent
ON meta.parent_course = parent.course
WHERE parent.course IS NULL";
AND parent.userid = child.userid
WHERE parent.course IS NULL
AND meta.parent_course = $metacourseid";
if ($userstoadd = get_records_sql($sql)) {
foreach ($userstoadd as $user) {