Skip to content

Commit

Permalink
Fix boolean not saving
Browse files Browse the repository at this point in the history
  • Loading branch information
emilevirus committed Jun 6, 2022
1 parent 937d796 commit 20323ee
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -758,14 +758,14 @@ protected function update_format_options($data, $sectionid = null) {
$changed = $needrebuild = false;
foreach ($defaultoptions as $key => $value) {
if (isset($records[$key])) {
if (in_array($key, array('ttsectionshowactivities','ttsectiontitle')) && !$data[$key]){
$data[$key] = 0;
}
if (array_key_exists($key, $data) && $records[$key]->value !== $data[$key]) {
$value = $data[$key];
if (is_array($data[$key])) {
$value = $data[$key]['text'];
}
if (in_array($key, array('ttsectionshowactivities','ttsectiontitle')) && !$value){
$value = 0;
}
$DB->set_field('course_format_options', 'value', $value, array('id' => $records[$key]->id));
$changed = true;
$needrebuild = $needrebuild || $cached[$key];
Expand Down

0 comments on commit 20323ee

Please sign in to comment.