Commit c739a35f7cb0bea25d8f29bf5955ff2c582cb877
1 parent
eedb9ef1
(#2986) check the document types of the destination folder before allow restorat…
…ion of a deleted document. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2702 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
13 additions
and
7 deletions
presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/restoreDeletedDocumentBL.php
| ... | ... | @@ -70,13 +70,19 @@ if (checkSession()) { |
| 70 | 70 | $oContent->setHtml(renderErrorPage("The document could not be restored. Please try again later")); |
| 71 | 71 | } |
| 72 | 72 | } else { |
| 73 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 74 | - if (!Document::documentExists($oDocument->getFileName(), $fFolderID)) { | |
| 75 | - $oContent->setHtml(renderConfirmationPage($fDocumentID, $fFolderID)); | |
| 76 | - } else { | |
| 77 | - // there is already a document with that filename here | |
| 78 | - $oContent->setHtml(statusPage("Restore Deleted Document", "", "A document with this file name (" . $oDocument->getFileName() . ") already exists in that folder.", "restoreDeletedDocument", "fDocumentID=$fDocumentID&fFolderID=$fFolderID")); | |
| 79 | - } | |
| 73 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 74 | + // check if the selected folder has the same document type as the document we're moving | |
| 75 | + if (Folder::folderIsLinkedToDocType($fFolderID, $oDocument->getDocumentTypeID())) { | |
| 76 | + if (!Document::documentExists($oDocument->getFileName(), $fFolderID)) { | |
| 77 | + $oContent->setHtml(renderConfirmationPage($fDocumentID, $fFolderID)); | |
| 78 | + } else { | |
| 79 | + // there is already a document with that filename here | |
| 80 | + $oContent->setHtml(statusPage("Restore Deleted Document", "", "A document with this file name (" . $oDocument->getFileName() . ") already exists in that folder.", "restoreDeletedDocument", "fDocumentID=$fDocumentID&fFolderID=$fFolderID")); | |
| 81 | + } | |
| 82 | + } else { | |
| 83 | + // the right document type isn't mapped | |
| 84 | + $oContent->setHtml(statusPage("Restored Deleted Document", "", "You can't restore the document to this folder because it cannot store the document type of your document. Please choose another directory.", "restoreDeletedDocument", "fDocumentID=$fDocumentID&fFolderID=$fFolderID")); | |
| 85 | + } | |
| 80 | 86 | } |
| 81 | 87 | } else { |
| 82 | 88 | // no document | ... | ... |