From 09c2eb69e2976ec2fc46c87e82d77fc770dc6c71 Mon Sep 17 00:00:00 2001 From: mudrd8mz Date: Thu, 9 Oct 2008 11:04:12 +0000 Subject: [PATCH] MDL-16506 Fixed error when deleting the only page in the Lesson. Credit goes to Chris Bertagne for the patch. --- mod/lesson/action/delete.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mod/lesson/action/delete.php b/mod/lesson/action/delete.php index 48aa1a84371..9be1272a12b 100644 --- a/mod/lesson/action/delete.php +++ b/mod/lesson/action/delete.php @@ -21,7 +21,9 @@ delete_records("lesson_pages", "id", $pageid); // repair the hole in the linkage - if (!$thispage->prevpageid) { + if (!$thispage->prevpageid AND !$thispage->nextpageid) { + //This is the only page, no repair needed + } elseif (!$thispage->prevpageid) { // this is the first page... if (!$page = get_record("lesson_pages", "id", $thispage->nextpageid)) { error("Delete: next page not found");