Commit 4e969de6b87912c61fdd9bd22cf8e65e4169c7e8
1 parent
a0434159
integrated subscription firing
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1624 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
22 additions
and
1 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/moveDocumentBL.php
| ... | ... | @@ -12,6 +12,8 @@ require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); |
| 12 | 12 | require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc"); |
| 13 | 13 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); |
| 14 | 14 | |
| 15 | +require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionEngine.inc"); | |
| 16 | + | |
| 15 | 17 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); |
| 16 | 18 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); |
| 17 | 19 | |
| ... | ... | @@ -32,11 +34,30 @@ if (checkSession()) { |
| 32 | 34 | $sOldDocumentFileSystemPath = Folder::getFolderPath($iOldFolderID) . $oDocument->getFileName(); |
| 33 | 35 | //put the document in the new folder |
| 34 | 36 | $oDocument->setFolderID($fFolderID); |
| 35 | - if ($oDocument->update(true)) { | |
| 37 | + if ($oDocument->update(true)) { | |
| 36 | 38 | //get the new document path |
| 37 | 39 | $sNewDocumentFileSystemPath = Folder::getFolderPath($oDocument->getFolderID()) . $oDocument->getFileName(); |
| 38 | 40 | //move the document on the file system |
| 39 | 41 | if (PhysicalDocumentManager::move($sOldDocumentFileSystemPath, $sNewDocumentFileSystemPath)) { |
| 42 | + | |
| 43 | + // fire subscription alerts for the moved document (and the folder its in) | |
| 44 | + $count = SubscriptionEngine::fireSubscription($fDocumentID, SubscriptionConstants::subscriptionAlertType("MovedDocument"), | |
| 45 | + SubscriptionConstants::subscriptionType("DocumentSubscription"), | |
| 46 | + array( "folderID" => $iOldFolderID, | |
| 47 | + "modifiedDocumentName" => $oDocument->getName(), | |
| 48 | + "oldFolderName" => Folder::getFolderName($iOldFolderID), | |
| 49 | + "newFolderName" => Folder::getFolderName($fFolderID) )); | |
| 50 | + $default->log->info("moveDocumentBL.php fired $count subscription alerts for moved document " . $oDocument->getName()); | |
| 51 | + | |
| 52 | + // fire folder subscriptions for the destination folder | |
| 53 | + $count = SubscriptionEngine::fireSubscription($oDocument->getFolderID(), SubscriptionConstants::subscriptionAlertType("MovedDocument"), | |
| 54 | + SubscriptionConstants::subscriptionType("FolderSubscription"), | |
| 55 | + array( "modifiedDocumentName" => $oDocument->getName(), | |
| 56 | + "oldFolderName" => Folder::getFolderName($iOldFolderID), | |
| 57 | + "newFolderName" => Folder::getFolderName($fFolderID) )); | |
| 58 | + $default->log->info("moveDocumentBL.php fired $count (folderID=$fFolderID) folder subscription alerts for moved document " . $oDocument->getName()); | |
| 59 | + | |
| 60 | + | |
| 40 | 61 | //redirect to the view path |
| 41 | 62 | redirect("$default->rootUrl/control.php?action=viewDocument&fDocumentID=$fDocumentID"); |
| 42 | 63 | } else { | ... | ... |