From d4ad90b0c4bd203d8ab21caeab777f64ac74fad2 Mon Sep 17 00:00:00 2001 From: Michael Joseph Date: Mon, 21 Jul 2003 14:27:10 +0000 Subject: [PATCH] (#2779) added check that the destination folder contains the document type of the document being moved --- presentation/lookAndFeel/knowledgeTree/documentmanagement/moveDocumentBL.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/moveDocumentBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/moveDocumentBL.php index 5c6e5c9..6e9bf74 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/moveDocumentBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/moveDocumentBL.php @@ -109,15 +109,22 @@ if (checkSession()) { require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oPatternCustom = & new PatternCustom(); - $oDocument= Document::get($fDocumentID); - // check that there is no filename collision in the destination directory - $sNewDocumentFileSystemPath = Folder::getFolderPath($fFolderID) . $oDocument->getFileName(); - if (!file_exists($sNewDocumentFileSystemPath)) { - // display confirmation page - $oPatternCustom->setHtml(getConfirmationPage($fFolderID, $fDocumentID)); + $oDocument = Document::get($fDocumentID); + + // check if the selected folder has the same document type as the document we're moving + if (Folder::folderIsLinkedToDocType($fFolderID, $oDocument->getDocumentTypeID())) { + // check that there is no filename collision in the destination directory + $sNewDocumentFileSystemPath = Folder::getFolderPath($fFolderID) . $oDocument->getFileName(); + if (!file_exists($sNewDocumentFileSystemPath)) { + // display confirmation page + $oPatternCustom->setHtml(getConfirmationPage($fFolderID, $fDocumentID)); + } else { + // filename collision + $oPatternCustom->setHtml(getPage($fFolderID, $fDocumentID, "This folder already contains a document of the same name. Please choose another directory")); + } } else { - // filename collision - $oPatternCustom->setHtml(getPage($fFolderID, $fDocumentID, "This folder already contains a document of the same name. Please choose another directory")); + // the right document type isn't mapped + $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")); } $main->setFormAction($_SERVER["PHP_SELF"] . "?fForMove=1&fDocumentID=$fDocumentID&fFolderID=$fFolderID"); $main->setCentralPayload($oPatternCustom); -- libgit2 0.21.4