From 4ce6e6878623243aba8db9b513a5a84bb8fa3bf4 Mon Sep 17 00:00:00 2001 From: Patryk Mroczko Date: Tue, 26 Nov 2024 12:24:41 +0100 Subject: [PATCH] Fix get_in_or_equal does not accept empty arrays in the Resync users in Microsoft 365 groups for courses feature --- local/o365/classes/page/acp.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/local/o365/classes/page/acp.php b/local/o365/classes/page/acp.php index 7d41d1f20..894163351 100644 --- a/local/o365/classes/page/acp.php +++ b/local/o365/classes/page/acp.php @@ -1432,10 +1432,12 @@ public function mode_maintenance_resyncgroupusers() { $sql .= ' AND crs.id = ?'; $params[] = $courseid; } - if (is_array($coursesenabled)) { + if (is_array($coursesenabled) && !empty($coursesenabled)) { [$coursesinsql, $coursesparams] = $DB->get_in_or_equal($coursesenabled); $sql .= ' AND crs.id ' . $coursesinsql; $params = array_merge($params, $coursesparams); + } else { + $sql .= ' AND 1 = 0'; } $courses = $DB->get_recordset_sql($sql, $params); $outputsbycourse = [];