MDL-16506 Fixed error when deleting the only page in the Lesson. Credit goes to Chris Bertagne for the patch. Merged from 1.9

This commit is contained in:
mudrd8mz 2008-10-09 11:07:34 +00:00
parent 38dc85bf1f
commit a51a5ee009

View File

@ -21,7 +21,9 @@
$DB->delete_records("lesson_pages", array("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 = $DB->get_record("lesson_pages", array("id" => $thispage->nextpageid))) {
print_error("Delete: next page not found");