check for duplicate names if this is turn on in the settings

This commit is contained in:
Uwe Steinmann 2019-07-01 20:40:21 +02:00
parent d18a3389bc
commit 7fc98be1be
2 changed files with 14 additions and 0 deletions

View File

@ -62,6 +62,13 @@ if($document->isLocked()) {
}
}
/* Check if name already exists in the folder */
if(!$settings->_enableDuplicateDocNames) {
if($targetFolder->hasDocumentByName($document->getName())) {
UI::exitError(getMLText("folder_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("document_duplicate_name"));
}
}
if ($targetid != $oldFolder->getID()) {
if ($document->setFolder($targetFolder)) {
// Send notification to subscribers.

View File

@ -60,6 +60,13 @@ if ($folder->getAccessMode($user, 'moveFolder') < M_READWRITE || $targetFolder->
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("access_denied"));
}
/* Check if name already exists in the folder */
if(!$settings->_enableDuplicateSubFolderNames) {
if($targetFolder->hasSubFolderByName($folder->getName())) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("subfolder_duplicate_name"));
}
}
$oldFolder = $folder->getParent();
if ($folder->setParent($targetFolder)) {
// Send notification to subscribers.