diff --git a/Changes.md b/Changes.md index c8a710d5..1a5e455f 100644 --- a/Changes.md +++ b/Changes.md @@ -3,6 +3,8 @@ History Version 403.1.5 - In development -------------------------------- +1. Fix 'Orphaned sections problem when adding sections', a regression caused by + 'Use section anchors in links when editing - pt 2' - #223. Version 403.1.4.5 - 28/09/2024 ------------------------------ diff --git a/lib.php b/lib.php index b0b1483d..d351bd19 100755 --- a/lib.php +++ b/lib.php @@ -980,10 +980,11 @@ public function section_deleted() { * @param bool $add Add a section or delete if false. */ protected function change_gnumsections($add) { + $currentsettings = $this->get_settings(); if ($add) { - $newgnumsetions = $this->settings['gnumsections'] + 1; + $newgnumsetions = $currentsettings['gnumsections'] + 1; } else { - $newgnumsetions = $this->settings['gnumsections'] - 1; + $newgnumsetions = $currentsettings['gnumsections'] - 1; } $data = ['gnumsections' => $newgnumsetions]; $this->update_format_options($data);