Time end not being recorded in external database enrollmentst

Time end not being recorded in external database enrollmentst

by Nikki Macfarlane -
Number of replies: 2
I have ju switched to external enrollment and it is all working grat except for one thing. I have noticed that since I switched over from manual only to manual and external enrollment, those students on external enrollment have a time end set as unlimited. The course is set to a specific number of days and it all worked just fine for manual enrollment.

I have looked at the enrol/database/enrol.php file and cannot find any code that specifies the time end to be set. In the enrol/manual/enrol.php there is code at about line 140 and line 224 that says:

        } elseif (!empty($_GET['confirm'])) {
            if ($course->enrolperiod) {
                $timestart = time();
                $timeend = time() + $course->enrolperiod;
            } else {
                $timestart = $timeend = 0;
            }

There is also a function cron at about line 330 that deletes studnets whose enrolment has expired but nothing in enrol/database/enrol.php and line 368 has the code for notifying teachers of students about to expire but nothing in enrol/database/enrol.php.

Is there a reason that the enrollment information has been left out of the database enrollment option? Any ideas on how I include it - loathe to just copy the code across from enrol/manual/enrol.php as my programming skills are pretty basic to say the least!

Nikki Macfarlane
Average of ratings: -
In reply to Nikki Macfarlane

Re: Time end not being recorded in external database enrollmentst

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I have looked at the enrol/database/enrol.php file and cannot find any code that specifies the time end to be set.

It seems the current code is just missing that part. You can file a bug (at http://moodle.org/bugs) or use my 'improved' version of the database enrolment plugin that you can get here:

http://orodruin.escomposlinux.org/~iarenaza/moodle/enrol_db_files_for_16/

(you can see the changes to the stock 1.6.x version in the patch series I have at http://orodruin.escomposlinux.org/~iarenaza/moodle/enrol_db_patch_series_for_16/).

There is also a function cron at about line 330 that deletes studnets whose enrolment has expired but nothing in enrol/database/enrol.php and line 368 has the code for notifying teachers of students about to expire but nothing in enrol/database/enrol.php.

In Moodle 1.6.x, manual enrolment is always enabled, even if you don't use it at all. This means the cron function in the manual enrolment code is always run and thus performs the actions you want. The problem is just that the stock database enrolment is not filling the enrolment period data, so no student (or teacher) enrolment ever expires.

If you use the files mentionned above, everything should work as expected.

Saludos. Iñaki.

In reply to Iñaki Arenaza

Re: Time end not being recorded in external database enrollmentst

by Nikki Macfarlane -
Thank you so much Iñaki - that worked perfectly!!

Nikki