From ee87a1bcace5cb9456be5d1f95d18cc1fab39e06 Mon Sep 17 00:00:00 2001 From: James C <5689414+james-cnz@users.noreply.github.com> Date: Mon, 30 Sep 2024 13:33:00 +1300 Subject: [PATCH] MDL-83306 book: Book section return fix --- mod/book/edit.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mod/book/edit.php b/mod/book/edit.php index 5ae1b2ae2d1..f4704af9f0b 100644 --- a/mod/book/edit.php +++ b/mod/book/edit.php @@ -74,7 +74,8 @@ if ($mform->is_cancelled()) { // Make sure at least one chapter exists. $chapters = book_preload_chapters($book); if (!$chapters) { - redirect(new moodle_url('/course/view.php', array('id' => $course->id))); // Back to course view. + $section = $DB->get_record('course_sections', ['id' => $cm->section]); + redirect(course_get_url($course, $section)); // Back to course view. } if (empty($chapter->id)) {