Commit d4ad90b0c4bd203d8ab21caeab777f64ac74fad2
1 parent
f4b87234
(#2779) added check that the destination folder contains the document type of th…
…e document being moved git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2401 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
15 additions
and
8 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/moveDocumentBL.php
| ... | ... | @@ -109,15 +109,22 @@ if (checkSession()) { |
| 109 | 109 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 110 | 110 | $oPatternCustom = & new PatternCustom(); |
| 111 | 111 | |
| 112 | - $oDocument= Document::get($fDocumentID); | |
| 113 | - // check that there is no filename collision in the destination directory | |
| 114 | - $sNewDocumentFileSystemPath = Folder::getFolderPath($fFolderID) . $oDocument->getFileName(); | |
| 115 | - if (!file_exists($sNewDocumentFileSystemPath)) { | |
| 116 | - // display confirmation page | |
| 117 | - $oPatternCustom->setHtml(getConfirmationPage($fFolderID, $fDocumentID)); | |
| 112 | + $oDocument = Document::get($fDocumentID); | |
| 113 | + | |
| 114 | + // check if the selected folder has the same document type as the document we're moving | |
| 115 | + if (Folder::folderIsLinkedToDocType($fFolderID, $oDocument->getDocumentTypeID())) { | |
| 116 | + // check that there is no filename collision in the destination directory | |
| 117 | + $sNewDocumentFileSystemPath = Folder::getFolderPath($fFolderID) . $oDocument->getFileName(); | |
| 118 | + if (!file_exists($sNewDocumentFileSystemPath)) { | |
| 119 | + // display confirmation page | |
| 120 | + $oPatternCustom->setHtml(getConfirmationPage($fFolderID, $fDocumentID)); | |
| 121 | + } else { | |
| 122 | + // filename collision | |
| 123 | + $oPatternCustom->setHtml(getPage($fFolderID, $fDocumentID, "This folder already contains a document of the same name. Please choose another directory")); | |
| 124 | + } | |
| 118 | 125 | } else { |
| 119 | - // filename collision | |
| 120 | - $oPatternCustom->setHtml(getPage($fFolderID, $fDocumentID, "This folder already contains a document of the same name. Please choose another directory")); | |
| 126 | + // the right document type isn't mapped | |
| 127 | + $oPatternCustom->setHtml(getPage($fFolderID, $fDocumentID, "You can't move the document to this folder because it cannot store the document type of your document. Please choose another directory")); | |
| 121 | 128 | } |
| 122 | 129 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fForMove=1&fDocumentID=$fDocumentID&fFolderID=$fFolderID"); |
| 123 | 130 | $main->setCentralPayload($oPatternCustom); | ... | ... |