mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-22787 MNet Fix: enrol/mnet/enrol.php/available_courses is not indexed by courseid
This commit is contained in:
parent
e3c6db931b
commit
af827747a3
1 changed files with 16 additions and 4 deletions
|
@ -156,8 +156,14 @@ class enrol_mnet_mnetservice_enrol {
|
|||
}
|
||||
|
||||
$courses = $this->available_courses();
|
||||
|
||||
if (empty($courses[$course->id])) {
|
||||
$isavailable = false;
|
||||
foreach ($courses as $available) {
|
||||
if ($available->remoteid == $course->id) {
|
||||
$isavailable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$isavailable) {
|
||||
throw new mnet_server_exception(5013, 'courseunavailable', 'enrol_mnet');
|
||||
}
|
||||
|
||||
|
@ -219,8 +225,14 @@ class enrol_mnet_mnetservice_enrol {
|
|||
}
|
||||
|
||||
$courses = $this->available_courses();
|
||||
|
||||
if (empty($courses[$course->id])) {
|
||||
$isavailable = false;
|
||||
foreach ($courses as $available) {
|
||||
if ($available->remoteid == $course->id) {
|
||||
$isavailable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$isavailable) {
|
||||
// if they can not enrol, they can not unenrol
|
||||
throw new mnet_server_exception(5013, 'courseunavailable', 'enrol_mnet');
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue