Commit dd4ece67e9b26c89bbd2f55a3b6530dbb8caa1aa

Authored by Michael Joseph
1 parent 40129601

remove document subscriptions on deletion


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1277 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php
@@ -15,6 +15,7 @@ require_once("$default->fileSystemRoot/lib/users/User.inc"); @@ -15,6 +15,7 @@ require_once("$default->fileSystemRoot/lib/users/User.inc");
15 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); 15 require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc");
16 require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc"); 16 require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc");
17 require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionEngine.inc"); 17 require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionEngine.inc");
  18 +require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc");
18 19
19 require_once("$default->fileSystemRoot/presentation/Html.inc"); 20 require_once("$default->fileSystemRoot/presentation/Html.inc");
20 21
@@ -37,13 +38,20 @@ if (checkSession()) { @@ -37,13 +38,20 @@ if (checkSession()) {
37 // successfully deleted the document from the file system 38 // successfully deleted the document from the file system
38 39
39 // fire subscription alerts for the deleted document 40 // fire subscription alerts for the deleted document
40 - $count = SubscriptionEngine::fireSubscription($oDocument->getFolderID(), SubscriptionConstants::subscriptionAlertType("RemoveDocument"),  
41 - SubscriptionConstants::subscriptionType("FolderSubscription"),  
42 - array( "removedDocumentName" => $oDocument->getName(),  
43 - "folderName" => Folder::getFolderName($oDocument->getFolderID()))); 41 + $count = SubscriptionEngine::fireSubscription($fDocumentID, SubscriptionConstants::subscriptionAlertType("RemoveSubscribedDocument"),
  42 + SubscriptionConstants::subscriptionType("DocumentSubscription"),
  43 + array( "folderID" => $oDocument->getFolderID(),
  44 + "removedDocumentName" => $oDocument->getName(),
  45 + "folderName" => Folder::getFolderDisplayPath($oDocument->getFolderID())));
44 $default->log->info("deleteDocumentBL.php fired $count subscription alerts for removed document " . $oDocument->getName()); 46 $default->log->info("deleteDocumentBL.php fired $count subscription alerts for removed document " . $oDocument->getName());
45 47
46 - 48 + // TODO: remove all document subscriptions for this document
  49 + if (SubscriptionManager::removeSubscriptions($fDocumentID, SubscriptionConstants::subscriptionType("DocumentSubscription"))) {
  50 + $default->log->info("deleteDocumentBL.php removed all subscriptions for this document");
  51 + } else {
  52 + $default->log->error("deleteDocumentBL.php couldn't remove document subscriptions");
  53 + }
  54 +
47 // redirect to the browse folder page 55 // redirect to the browse folder page
48 redirect("$default->rootUrl/control.php?action=browse&fFolderID=" . $oDocument->getFolderID()); 56 redirect("$default->rootUrl/control.php?action=browse&fFolderID=" . $oDocument->getFolderID());
49 } else { 57 } else {