Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-40095 SCORM: Fixed DML error when saving with completion options …

…locked

Regression caused by MDL-38315.
  • Loading branch information...
commit 7480e9930609c8a5bcf5d79cc0b822820880039b 1 parent 1430866
@scara scara authored
Showing with 13 additions and 9 deletions.
  1. +13 −9 mod/scorm/mod_form.php
View
22 mod/scorm/mod_form.php
@@ -504,18 +504,22 @@ function get_data($slashed = true) {
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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.