Commit a13276c7be4c642568fa879c5ff5b6da984d5e69
1 parent
6fac9f0f
don't allow the last document type to be deleted from a folder
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1692 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
8 additions
and
0 deletions
presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderDocTypeBL.php
| ... | ... | @@ -24,6 +24,7 @@ if (checkSession()) { |
| 24 | 24 | //user has permission to delete |
| 25 | 25 | if (isset($fFolderDocTypeID)) { |
| 26 | 26 | //the required variables exist |
| 27 | + | |
| 27 | 28 | if (Document::documentIsAssignedDocTypeInFolder($fFolderID, $fFolderDocTypeID)) { |
| 28 | 29 | //there is a document in the folder assigned this type, so |
| 29 | 30 | //it may not be deleted |
| ... | ... | @@ -32,6 +33,13 @@ if (checkSession()) { |
| 32 | 33 | $main->setCentralPayload($oPatternCustom); |
| 33 | 34 | $main->setErrorMessage("A document in this folder is currently assigned this type. You may not delete it."); |
| 34 | 35 | $main->render(); |
| 36 | + } else if (count(FolderDocTypeLink::getList("folder_id=$fFolderID")) == 1) { | |
| 37 | + // there is only one document type mapped to this folder- not allowed to delete the last one | |
| 38 | + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 39 | + $oPatternCustom->setHtml(getPage($fFolderID)); | |
| 40 | + $main->setCentralPayload($oPatternCustom); | |
| 41 | + $main->setErrorMessage("You may not delete the last document type for this folder."); | |
| 42 | + $main->render(); | |
| 35 | 43 | } else { |
| 36 | 44 | //go ahead and delete |
| 37 | 45 | $oFolderDocTypeLink = FolderDocTypeLink::get($fFolderDocTypeID); | ... | ... |