Commit b955ad6a authored by Marina Glancy's avatar Marina Glancy
Browse files

MDL-45068 groups: corrected check for idnumber '0'

parent a0de91e9
...@@ -134,7 +134,7 @@ if ($mform_post->is_cancelled()) { ...@@ -134,7 +134,7 @@ if ($mform_post->is_cancelled()) {
} }
} }
if (!empty($newgroup->idnumber)) { if (isset($newgroup->idnumber) && strlen($newgroup->idnumber)) {
//if idnumber is set, we use that. //if idnumber is set, we use that.
//unset invalid courseid //unset invalid courseid
if (!$mycourse = $DB->get_record('course', array('idnumber'=>$newgroup->idnumber))) { if (!$mycourse = $DB->get_record('course', array('idnumber'=>$newgroup->idnumber))) {
...@@ -144,7 +144,7 @@ if ($mform_post->is_cancelled()) { ...@@ -144,7 +144,7 @@ if ($mform_post->is_cancelled()) {
$newgroup->courseid = $mycourse->id; $newgroup->courseid = $mycourse->id;
} }
} else if (!empty($newgroup->coursename)) { } else if (isset($newgroup->coursename) && strlen($newgroup->coursename)) {
//else use course short name to look up //else use course short name to look up
//unset invalid coursename (if no id) //unset invalid coursename (if no id)
if (!$mycourse = $DB->get_record('course', array('shortname' => $newgroup->coursename))) { if (!$mycourse = $DB->get_record('course', array('shortname' => $newgroup->coursename))) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment