From 52136af7808833f373bb485be9fe4d04310835fc Mon Sep 17 00:00:00 2001 From: fdallet Date: Tue, 25 Jun 2019 11:16:41 +0200 Subject: [PATCH] MDL-65952 mod_scorm: Fix unwanted changes to require status --- mod/scorm/mod_form.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mod/scorm/mod_form.php b/mod/scorm/mod_form.php index b772c935fc7..ad2cdf27877 100644 --- a/mod/scorm/mod_form.php +++ b/mod/scorm/mod_form.php @@ -551,8 +551,13 @@ class mod_scorm_mod_form extends moodleform_mod { // Convert completionstatusrequired to a proper integer, if any. $total = 0; if (isset($data->completionstatusrequired) && is_array($data->completionstatusrequired)) { - foreach (array_keys($data->completionstatusrequired) as $state) { - $total |= $state; + foreach ($data->completionstatusrequired as $state => $value) { + if ($value) { + $total |= $state; + } + } + if (!$total) { + $total = null; } $data->completionstatusrequired = $total; }