From 705b0c69e8b67e6d562acad68e0636731dc922f3 Mon Sep 17 00:00:00 2001 From: liyuchun Date: Tue, 31 Aug 2021 16:26:03 +0800 Subject: [PATCH] * Fix bug #14439. --- module/doc/model.php | 2 +- module/doc/view/tablecontents.html.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/doc/model.php b/module/doc/model.php index dc7f054707..34b2071b52 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -2310,7 +2310,7 @@ EOT; { $libs = $this->getLibsByObject('book', 0, '', $appendLib); $this->app->rawMethod = 'book'; - if($libID == 0 and !empty($libs)) $libID = reset($libs)->id; + if(!empty($libs) and ($libID == 0 or !isset($libs[$libID]))) $libID = reset($libs)->id; $this->lang->modulePageNav = $this->select($type, $objects, $objectID, $libs, $libID); $object = new stdclass(); diff --git a/module/doc/view/tablecontents.html.php b/module/doc/view/tablecontents.html.php index e54b1de5a8..fa0adfb0db 100644 --- a/module/doc/view/tablecontents.html.php +++ b/module/doc/view/tablecontents.html.php @@ -52,7 +52,7 @@ if(empty($type)) $type = 'product'; echo ''; } - if($type == 'book' and ($canEditLib or $canManageBook)) + if($type == 'book' and ($canEditLib or $canManageBook) and !empty($libs)) { echo "