mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 12:45:04 +01:00
MDL-60115 mod_book: Book Resource Cancel Button Redirect Bug
When the user creates a book but adds no chapters, hitting cancel on the chapter creation page would redirect you right back to the same page with no explanation. This solution redirects to the course page when canceling chapter creation when no chapters are present.
This commit is contained in:
parent
39fab18e27
commit
37fdff573b
@ -61,6 +61,12 @@ $mform = new book_chapter_edit_form(null, array('chapter'=>$chapter, 'options'=>
|
||||
|
||||
// If data submitted, then process and store.
|
||||
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.
|
||||
}
|
||||
|
||||
if (empty($chapter->id)) {
|
||||
redirect("view.php?id=$cm->id");
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user