From 1b9c56180ec42ba6d3aac998577a879d3d23230e Mon Sep 17 00:00:00 2001 From: Michael Joseph Date: Wed, 30 Jul 2003 13:40:27 +0000 Subject: [PATCH] (#2794) added check- does a file with the same name exist in the restore to folder? --- presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/restoreDeletedDocumentBL.php | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/restoreDeletedDocumentBL.php b/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/restoreDeletedDocumentBL.php index 2f121d3..42e9771 100644 --- a/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/restoreDeletedDocumentBL.php +++ b/presentation/lookAndFeel/knowledgeTree/administration/documentmanagement/restoreDeletedDocumentBL.php @@ -31,10 +31,10 @@ if (checkSession()) { if ($fDocumentID && $fFolderID) { if (isset($fForMove)) { - if ($fConfirmed) { - $oDocument = Document::get($fDocumentID); - $oFolder = Folder::get($fFolderID); - if ($oDocument && $oFolder) { + $oDocument = Document::get($fDocumentID); + $oFolder = Folder::get($fFolderID); + if ($oDocument && $oFolder) { + if ($fConfirmed) { require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); // restore the document $oDocument->setStatusID(LIVE); @@ -57,14 +57,19 @@ if (checkSession()) { $oContent->setHtml(renderErrorPage("The document could not be restored. Please try again later")); } } else { - // no document - $default->log->error("restoreDeletedDocumentBL.php documentID=$fDocumentID folderID=$fFolderID instantiation failed"); - // TODO: redirect to list page with error - controllerRedirect("deletedDocuments", ""); + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); + if (!Document::documentExists($oDocument->getFileName(), $fFolderID)) { + $oContent->setHtml(renderConfirmationPage($fDocumentID, $fFolderID)); + } else { + // there is already a document with that filename here + $oContent->setHtml(statusPage("Restore Deleted Document", "", "A document with this file name (" . $oDocument->getFileName() . ") already exists in that folder.", "restoreDeletedDocument", "fDocumentID=$fDocumentID&fFolderID=$fFolderID")); + } } } else { - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - $oContent->setHtml(renderConfirmationPage($fDocumentID, $fFolderID)); + // no document + $default->log->error("restoreDeletedDocumentBL.php documentID=$fDocumentID folderID=$fFolderID instantiation failed"); + // TODO: redirect to list page with error + controllerRedirect("deletedDocuments", ""); } } else { require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); -- libgit2 0.21.4