From c919b26d7eda222fc1ac5c0012e6b04b3ca6c04f Mon Sep 17 00:00:00 2001 From: Aaron Barnes Date: Wed, 4 Aug 2010 02:21:19 +0000 Subject: [PATCH] course completion: MDL-2631 Prevent error when no roles are available --- course/completion.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/course/completion.php b/course/completion.php index 137f084ebb5..861a576048b 100644 --- a/course/completion.php +++ b/course/completion.php @@ -132,6 +132,10 @@ if ($form->is_cancelled()){ $aggregation->insert(); // Role aggregation + if (empty($data->role_aggregation)) { + $data->role_aggregation = 0; + } + $aggregation = new completion_aggregation(); $aggregation->course = $data->id; $aggregation->criteriatype = COMPLETION_CRITERIA_TYPE_ROLE; -- 2.43.0