Skip to content

Commit

Permalink
Fix 'Orphaned sections problem when adding sections', a regression ca…
Browse files Browse the repository at this point in the history
…used by 'Use section anchors in links when editing - pt 2' - #223.
  • Loading branch information
gjb2048 committed Sep 30, 2024
1 parent ce16d79 commit 7b160ab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
------------------------------
Expand Down
5 changes: 3 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7b160ab

Please sign in to comment.