Commit 1eb489fd39a1e0753604640f2db65cd083a6eb1d

Authored by michael
1 parent 4dbf601b

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
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);
... ...