mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
MDL-40095 SCORM: Fixed DML error when saving with completion options locked
Regression caused by MDL-38315.
This commit is contained in:
parent
b3be471f52
commit
82bd0c6643
1 changed files with 13 additions and 9 deletions
|
@ -504,18 +504,22 @@ class mod_scorm_mod_form extends moodleform_mod {
|
|||
return false;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
$data->completionstatusrequired = $total;
|
||||
}
|
||||
|
||||
if (!empty($data->completionunlocked)) {
|
||||
// Turn off completion settings if the checkboxes aren't ticked
|
||||
// Turn off completion settings if the checkboxes aren't ticked.
|
||||
$autocompletion = isset($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
|
||||
|
||||
if (isset($data->completionstatusrequired) &&
|
||||
is_array($data->completionstatusrequired) && $autocompletion) {
|
||||
$total = 0;
|
||||
foreach (array_keys($data->completionstatusrequired) as $state) {
|
||||
$total |= $state;
|
||||
}
|
||||
|
||||
$data->completionstatusrequired = $total;
|
||||
if (isset($data->completionstatusrequired) && $autocompletion) {
|
||||
// Do nothing: completionstatusrequired has been already converted
|
||||
// into a correct integer representation.
|
||||
} else {
|
||||
$data->completionstatusrequired = null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue