Commit 463545881382839c5ea77f43207621a08fad55ef

Authored by michael
1 parent 433ccb80

changes status_id and moves to Deleted/ instead of removing the file


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2103 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php
... ... @@ -15,6 +15,7 @@ require_once("$default->fileSystemRoot/lib/foldermanagement/FolderUserRole.inc")
15 15 require_once("$default->fileSystemRoot/lib/users/User.inc");
16 16 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
17 17 require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc");
  18 +require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc");
18 19 require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionEngine.inc");
19 20 require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc");
20 21 require_once("$default->fileSystemRoot/lib/web/WebDocument.inc");
... ... @@ -45,9 +46,13 @@ if (checkSession()) {
45 46 $sDocumentPath = Folder::getFolderPath($oDocument->getFolderID()) . $oDocument->getFileName();
46 47 $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document deleted", DELETE);
47 48 $oDocumentTransaction->create();
48   - if ($oDocument->delete()) {
49   - if (unlink($sDocumentPath)) {
50   - // successfully deleted the document from the file system
  49 + // flip the status id
  50 + $oDocument->setStatusID(lookupStatusID("Deleted"));
  51 + // store
  52 + if ($oDocument->update()) {
  53 + // now move the document to the delete folder
  54 + if (PhysicalDocumentManager::delete($oDocument)) {
  55 + // successfully deleted the document
51 56 $default->log->info("deleteDocumentBL.php successfully deleted document " . $oDocument->getFileName() . " from folder " . Folder::getFolderPath($oDocument->getFolderID()) . " id=" . $oDocument->getFolderID());
52 57  
53 58 // delete all collaboration roles
... ... @@ -70,14 +75,15 @@ if (checkSession()) {
70 75 } else {
71 76 $default->log->error("deleteDocumentBL.php couldn't remove document subscriptions");
72 77 }
73   -
  78 +
  79 + // TODO: move to expunge
74 80 //remove any document word links that this document may have
75   - Document::deleteFromDocumentText($fDocumentID);
  81 + //Document::deleteFromDocumentText($fDocumentID);
76 82  
77   -
  83 + // TODO: move to expunge
78 84 // delete the corresponding web document entry
79   - $oWebDocument = WebDocument::get(lookupID($default->owl_web_documents_table, "document_id", $fDocumentID));
80   - $oWebDocument->delete();
  85 +// $oWebDocument = WebDocument::get(lookupID($default->owl_web_documents_table, "document_id", $fDocumentID));
  86 +// $oWebDocument->delete();
81 87  
82 88 // redirect to the browse folder page
83 89 redirect("$default->rootUrl/control.php?action=browse&fFolderID=" . $oDocument->getFolderID());
... ...