Skip to content
Browse files

Better fix for 2479. This time I'm 99.999999% positive it's fixed ;)

  • Loading branch information...
1 parent 835c806 commit ffed6bf316b13164fd5556d6b64352058b578bc7 mjollnir_ committed Feb 7, 2005
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/datalib.php
View
4 lib/datalib.php
@@ -1357,7 +1357,9 @@ function get_courses_notin_metacourse($metacourseid,$count=false) {
$sql = "SELECT c.id,c.shortname,c.fullname";
}
- $sql .= " FROM {$CFG->prefix}course c WHERE c.id NOT IN (".implode(',',array_keys(get_courses_in_metacourse($metacourseid))).") AND c.id !=$metacourseid and c.id != $site->id and c.metacourse != 1";
+ $alreadycourses = get_courses_in_metacourse($metacourseid);
+
+ $sql .= " FROM {$CFG->prefix}course c WHERE ".((!empty($alreadycourses)) ? "c.id NOT IN (".implode(',',array_keys($alreadycourses)).") AND " : "")." c.id !=$metacourseid and c.id != $site->id and c.metacourse != 1";
return get_records_sql($sql);
}

0 comments on commit ffed6bf

Please sign in to comment.
Something went wrong with that request. Please try again.