From b908e942a8deeb7ec112e8debd192e6ea48d89ac Mon Sep 17 00:00:00 2001 From: zenggang Date: Tue, 29 Nov 2022 06:35:11 +0000 Subject: [PATCH] * Fix bug#29140 --- module/doc/lang/de.php | 1 + module/doc/lang/en.php | 1 + module/doc/lang/fr.php | 1 + module/doc/lang/zh-cn.php | 1 + module/doc/model.php | 10 ++++++++++ 5 files changed, 14 insertions(+) diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index 1bdbf6a030..00bc38149e 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -249,6 +249,7 @@ $lang->doc->errorEmptyLib = 'No data in document library.'; $lang->doc->confirmUpdateContent = 'You have a document that is not saved from last time. Do you want to continue editing it?'; $lang->doc->selectLibType = 'Please select a type of doc library.'; $lang->doc->noLibreOffice = 'You does not have access to office conversion settings!'; +$lang->doc->errorParentChapter = 'The parent chapter cannot be its own chapter or sub chapter!'; $lang->doc->noticeAcl['lib']['product']['default'] = 'Users who can access the selected product can access it.'; $lang->doc->noticeAcl['lib']['product']['custom'] = 'Users who can access the selected product or users in the whiltelist can access it.'; diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 0fe692fd76..905f4b0b4d 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -249,6 +249,7 @@ $lang->doc->errorEmptyLib = 'No data in document library.'; $lang->doc->confirmUpdateContent = 'You have a document that is not saved from last time. Do you want to continue editing it?'; $lang->doc->selectLibType = 'Please select a type of doc library.'; $lang->doc->noLibreOffice = 'You does not have access to office conversion settings!'; +$lang->doc->errorParentChapter = 'The parent chapter cannot be its own chapter or sub chapter!'; $lang->doc->noticeAcl['lib']['product']['default'] = 'Users who can access the selected product can access it.'; $lang->doc->noticeAcl['lib']['product']['custom'] = 'Users who can access the selected product or users in the whiltelist can access it.'; diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index 7fb46c8e44..53de6d24f9 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -249,6 +249,7 @@ $lang->doc->errorEmptyLib = 'No data in document library.'; $lang->doc->confirmUpdateContent = 'You have a document that is not saved from last time. Do you want to continue editing it?'; $lang->doc->selectLibType = 'Please select a type of doc library.'; $lang->doc->noLibreOffice = 'You does not have access to office conversion settings!'; +$lang->doc->errorParentChapter = 'The parent chapter cannot be its own chapter or sub chapter!'; $lang->doc->noticeAcl['lib']['product']['default'] = 'Les utilisateurs qui ont accès au Product peuvent y accéder.'; $lang->doc->noticeAcl['lib']['product']['custom'] = 'Les utilisateurs qui ont accès au Product ou les utilisateurs de la Liste Blanche peuvent y accéder.'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 28c4093d1a..df60f7cd10 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -249,6 +249,7 @@ $lang->doc->errorEmptyLib = '文档库暂无数据。'; $lang->doc->confirmUpdateContent = '检查到您有未保存的文档内容,是否继续编辑?'; $lang->doc->selectLibType = '请选择文档库类型'; $lang->doc->noLibreOffice = '您还没有office转换设置访问权限!'; +$lang->doc->errorParentChapter = '父章节不能是自身章节及子章节!'; $lang->doc->noticeAcl['lib']['product']['default'] = '有所选产品访问权限的用户可以访问。'; $lang->doc->noticeAcl['lib']['product']['custom'] = '有所选产品访问权限或白名单里的用户可以访问。'; diff --git a/module/doc/model.php b/module/doc/model.php index 61370b13f5..9c08b6d366 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -821,6 +821,16 @@ class docModel extends model ->remove('comment,files,labels,uid,contactListMenu') ->get(); + if($doc->type == 'chapter' and $doc->parent) + { + $parentDoc = $this->dao->select('*')->from(TABLE_DOC)->where('id')->eq((int)$doc->parent)->fetch(); + if(strpos($parentDoc->path, ",$docID,") !== false) + { + dao::$errors['parent'] = $this->lang->doc->errorParentChapter; + return false; + } + } + if(!empty($doc->acl) and $doc->acl == 'private') $doc->users = $oldDoc->addedBy; $oldDocContent = $this->dao->select('*')->from(TABLE_DOCCONTENT)->where('doc')->eq($docID)->andWhere('version')->eq($oldDoc->version)->fetch();