diff --git a/group/import.php b/group/import.php index ae0923bcdb5c1..41f8b2a2bf04b 100644 --- a/group/import.php +++ b/group/import.php @@ -134,7 +134,7 @@ } } - if (!empty($newgroup->idnumber)) { + if (isset($newgroup->idnumber) && strlen($newgroup->idnumber)) { //if idnumber is set, we use that. //unset invalid courseid if (!$mycourse = $DB->get_record('course', array('idnumber'=>$newgroup->idnumber))) { @@ -144,7 +144,7 @@ $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 //unset invalid coursename (if no id) if (!$mycourse = $DB->get_record('course', array('shortname' => $newgroup->coursename))) {