Permalink
Browse files

moodle--eduforge--1.3.3--patch-305 - Postgres SQL bugfix for instance…

…_is_visible()
  • Loading branch information...
martinlanghoff
martinlanghoff committed Nov 18, 2004
1 parent ea9d7e8 commit 7380fc552a097c65624359148fe2b1538b0d6850
Showing with 12 additions and 11 deletions.
  1. +12 −11 lib/datalib.php
View
@@ -2263,19 +2263,20 @@ function instance_is_visible($moduletype, $module) {
global $CFG;
- if ($records = get_records_sql("SELECT cm.instance, cm.visible
- FROM {$CFG->prefix}course_modules cm,
- {$CFG->prefix}modules m
- WHERE cm.course = '$module->course' AND
- cm.module = m.id AND
- m.name = '$moduletype' AND
- cm.instance = '$module->id'")) {
-
- foreach ($records as $record) { // there should only be one - use the first one
- return $record->visible;
+ if (!empty($module->id)) {
+ if ($records = get_records_sql("SELECT cm.instance, cm.visible
+ FROM {$CFG->prefix}course_modules cm,
+ {$CFG->prefix}modules m
+ WHERE cm.course = '$module->course' AND
+ cm.module = m.id AND
+ m.name = '$moduletype' AND
+ cm.instance = '$module->id'")) {
+
+ foreach ($records as $record) { // there should only be one - use the first one
+ return $record->visible;
+ }
}
}
-
return true; // visible by default!
}

0 comments on commit 7380fc5

Please sign in to comment.