From 196f9348fbc901f3aae24df8e6d4e163eea998b7 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 19 Mar 2025 10:22:52 +0800 Subject: [PATCH] * [bug#60364] Add parent in parent item when has no priv. --- module/doc/control.php | 1 + module/doc/model.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/module/doc/control.php b/module/doc/control.php index eca4636349..f4dae02b70 100755 --- a/module/doc/control.php +++ b/module/doc/control.php @@ -1955,6 +1955,7 @@ class doc extends control if($parentID || (isset($doc) && $doc->parent)) { $chapterAndDocs = $this->doc->getDocsOfLibs(array($libID), $objectType, $docID); + if(!isset($chapterAndDocs[$doc->parent])) $chapterAndDocs[$doc->parent] = $this->doc->fetchByID($doc->parent); $chapterAndDocs = $this->doc->buildNestedDocs($chapterAndDocs); $this->view->chapterAndDocs = $chapterAndDocs; } diff --git a/module/doc/model.php b/module/doc/model.php index 414bef586f..3ed5776bd8 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -744,7 +744,7 @@ class docModel extends model ->andWhere("(t1.status = 'normal' or (t1.status = 'draft' and t1.addedBy='{$this->app->user->account}'))") ->andWhere('t2.type')->eq('doc') ->andWhere('t2.deleted')->eq('0') - ->beginIF(!empty($excludeID))->andWhere('t1.parent')->ne($excludeID)->andWhere('t1.id')->ne($excludeID)->fi() + ->beginIF(!empty($excludeID))->andWhere("NOT FIND_IN_SET('{$excludeID}', t1.`path`)")->andWhere('t1.id')->ne($excludeID)->fi() ->orderBy('t1.`order` asc, t1.id asc') ->fetchAll('id', false); @@ -754,7 +754,7 @@ class docModel extends model ->andWhere('templateType')->eq('') ->andWhere("(status = 'normal' or (status = 'draft' and addedBy='{$this->app->user->account}'))") ->andWhere('module')->in(array('0', '')) - ->beginIF(!empty($excludeID))->andWhere('parent')->ne($excludeID)->andWhere('id')->ne($excludeID)->fi() + ->beginIF(!empty($excludeID))->andWhere("NOT FIND_IN_SET('{$excludeID}', `path`)")->andWhere('id')->ne($excludeID)->fi() ->orderBy('`order` asc, id_asc') ->fetchAll('id', false);