Dear Anybody
I'm new to moodle & have been setting up a new installation for my college using moodle 1.9.2. The DB enrolment plugin the comes by default with dosen't support categories in the enrolment DB for courses, so I downloaded Iñaki Arenaza's enrolment plugin from: http://orodruin.escomposlinux.org/~iarenaza/moodle/enrol_db/enrol_db_files_for_19/
Things seemed to be working great until on of my lecturers told me they were not getting all their courses. I checked on here for similar experiences, but didn't see any so I had a look myself & think I have found the problem.
In my event log, the following messages were constantly being displayed:
User enrolled to course 08/09|33429|NSE1A, but there is more than one course with that value in the enrolment database (in field courseid)
In enrol.php in the get_course_details function, there is an SQL statement that reads:
$query = "SELECT $columns FROM {$CFG->enrol_coursetable} " .
"WHERE {$CFG->enrol_courseid} = '$courseid'";
I think, because my enroloment table has multiple entries against it (a tutor & multiple students), more than 1 row is being returned & the enclosed IF statement is returning an error... I added a DISTINCT statement to the query & every started working properly.
$query = "SELECT DISTINCT $columns FROM {$CFG->enrol_coursetable} " .
"WHERE {$CFG->enrol_courseid} = '$courseid'";
I'm not sure if there are any other implications to this, but if you are reading this Iñaki, perhaps you can tell me if I did the right thing? Also, do you know if your code will be added to the main Moodle distribution? I find it a bit strange that this functionality is not already there?
PS.. Thanks for all the work you do... This enrolment plugin is great..