-
Bug
-
Resolution: Fixed
-
Critical
-
1.9.1
-
None
-
RESOLVED Cleo MIS Upload Tool : SQL statement needs amending in order for the module to work with PostgreSQL
-
PostgreSQL
-
MOODLE_19_STABLE
-
MOODLE_19_STABLE
I have installed the Cleo MIS Upload tool on a Moodle 1.9.1, running on a PostgreSQL database. I can upload users and classes successfully. However, every time I go into "list classes", the module doesn't seem to list the classes and users. The database tables include the necessary data but the module doesn't seem to work correctly.
I have managed to fix the issue, the error was within the SQL statement that retrieves classes and users. The file that needs amending is called cleo_mis_lib.php (inside the cleo_mis dir):
// Fix by Majid
// we do a right join to get the count of users in the other table
// even if there are no members
$sql = "SELECT c.id as id, count(m.id) as membercount, c.subject, c.code
FROM
{$CFG->prefix}cleo_mis_class_members m
RIGHT JOIN
{$CFG->prefix}cleo_mis_class c
ON c.id = m.classid
WHERE c.subject = '{$subject}'
GROUP BY c.id, c.subject, c.code;";