Commit 83c73f0c2747bdd3dd5f039a18d3175fbb23feed
1 parent
6e4e74a4
PT-2294593: Bulk emails updated.
Committed by: Jarrett Jordaan Reviewed by: Megan Watson
Showing
2 changed files
with
25 additions
and
11 deletions
lib/foldermanagement/compressionArchiveUtil.inc.php
| ... | ... | @@ -602,11 +602,11 @@ class DownloadQueue |
| 602 | 602 | foreach ($download as $item){ |
| 603 | 603 | if($item['object_type'] == 'document'){ |
| 604 | 604 | $docId = $item['object_id']; |
| 605 | - $this->addDocument($zip, $docId); | |
| 605 | + $this->addDocument($zip, $docId, false); | |
| 606 | 606 | } |
| 607 | 607 | if($item['object_type'] == 'folder'){ |
| 608 | 608 | $folderId = $item['object_id']; |
| 609 | - $this->addFolder($zip, $folderId); | |
| 609 | + $this->addFolder($zip, $folderId, false); | |
| 610 | 610 | } |
| 611 | 611 | } |
| 612 | 612 | |
| ... | ... | @@ -700,9 +700,10 @@ class DownloadQueue |
| 700 | 700 | * |
| 701 | 701 | * @param unknown_type $zip |
| 702 | 702 | * @param unknown_type $folderId |
| 703 | + * @param boolean $alerts | |
| 703 | 704 | * @return unknown |
| 704 | 705 | */ |
| 705 | - public function addFolder(&$zip, $folderId) | |
| 706 | + public function addFolder(&$zip, $folderId, $alerts = true) | |
| 706 | 707 | { |
| 707 | 708 | $oFolder = Folder::get($folderId); |
| 708 | 709 | |
| ... | ... | @@ -782,7 +783,7 @@ class DownloadQueue |
| 782 | 783 | } |
| 783 | 784 | |
| 784 | 785 | // fire subscription alerts for the downloaded document |
| 785 | - if($this->bNotifications){ | |
| 786 | + if($this->bNotifications && $alerts) { | |
| 786 | 787 | $oSubscriptionEvent = new SubscriptionEvent(); |
| 787 | 788 | $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); |
| 788 | 789 | } | ... | ... |
plugins/ktstandard/KTBulkExportPlugin.php
| ... | ... | @@ -70,6 +70,16 @@ class KTBulkExportAction extends KTFolderAction { |
| 70 | 70 | return _kt('Bulk Download'); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | + /** | |
| 74 | + * Deal with bulk actions | |
| 75 | + */ | |
| 76 | + function do_notification($objects, $eventAction, $targetFolder) { | |
| 77 | + if ($targetFolder && count($objects) > 0 && $eventAction != '') { // Make sure there were documents/folders affected | |
| 78 | + $oSubscriptionEvent = new SubscriptionEvent(); | |
| 79 | + $oSubscriptionEvent->notifyBulkDocumentAction($objects, $eventAction, $targetFolder); | |
| 80 | + } | |
| 81 | + } | |
| 82 | + | |
| 73 | 83 | function do_main() { |
| 74 | 84 | $config = KTConfig::getSingleton(); |
| 75 | 85 | $useQueue = $config->get('export/useDownloadQueue', true); |
| ... | ... | @@ -91,13 +101,22 @@ class KTBulkExportAction extends KTFolderAction { |
| 91 | 101 | $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); |
| 92 | 102 | |
| 93 | 103 | if($useQueue){ |
| 104 | + $aDocList = array(); | |
| 105 | + $originalFolder =& Folder::get($sCurrentFolderId); | |
| 106 | + $docIds = $originalFolder->getDocumentIDs($sCurrentFolderId); | |
| 107 | + $docIds = split(",", $docIds); | |
| 108 | + foreach ($docIds as $dId) { | |
| 109 | + $aDocList[] = & Document::get($dId); | |
| 110 | + } | |
| 111 | + $this->do_notification($aDocList, "DownloadDocument", $originalFolder); // Send off notifications about bulk action | |
| 112 | + | |
| 94 | 113 | DownloadQueue::addItem($exportCode, $sCurrentFolderId, $sCurrentFolderId, 'folder'); |
| 95 | 114 | |
| 96 | 115 | $task_url = KTUtil::kt_url() . '/presentation/lookAndFeel/knowledgeTree/bulkdownload/downloadTask.php'; |
| 97 | - | |
| 98 | 116 | $oTemplating =& KTTemplating::getSingleton(); |
| 99 | 117 | $oTemplate = $oTemplating->loadTemplate('ktcore/action/bulk_download'); |
| 100 | 118 | |
| 119 | + | |
| 101 | 120 | $aParams = array( |
| 102 | 121 | 'folder_url' => $folderurl, |
| 103 | 122 | 'url' => $task_url, |
| ... | ... | @@ -176,12 +195,6 @@ class KTBulkExportAction extends KTFolderAction { |
| 176 | 195 | $oDocumentTransaction->create(); |
| 177 | 196 | } |
| 178 | 197 | |
| 179 | - // fire subscription alerts for the downloaded document | |
| 180 | - if($bNotifications){ | |
| 181 | - //$oSubscriptionEvent = new SubscriptionEvent(); | |
| 182 | - //$oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); | |
| 183 | - } | |
| 184 | - | |
| 185 | 198 | $this->oZip->addDocumentToZip($oDocument, $oFolder); |
| 186 | 199 | } |
| 187 | 200 | } | ... | ... |