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,11 +602,11 @@ class DownloadQueue | ||
| 602 | foreach ($download as $item){ | 602 | foreach ($download as $item){ |
| 603 | if($item['object_type'] == 'document'){ | 603 | if($item['object_type'] == 'document'){ |
| 604 | $docId = $item['object_id']; | 604 | $docId = $item['object_id']; |
| 605 | - $this->addDocument($zip, $docId); | 605 | + $this->addDocument($zip, $docId, false); |
| 606 | } | 606 | } |
| 607 | if($item['object_type'] == 'folder'){ | 607 | if($item['object_type'] == 'folder'){ |
| 608 | $folderId = $item['object_id']; | 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,9 +700,10 @@ class DownloadQueue | ||
| 700 | * | 700 | * |
| 701 | * @param unknown_type $zip | 701 | * @param unknown_type $zip |
| 702 | * @param unknown_type $folderId | 702 | * @param unknown_type $folderId |
| 703 | + * @param boolean $alerts | ||
| 703 | * @return unknown | 704 | * @return unknown |
| 704 | */ | 705 | */ |
| 705 | - public function addFolder(&$zip, $folderId) | 706 | + public function addFolder(&$zip, $folderId, $alerts = true) |
| 706 | { | 707 | { |
| 707 | $oFolder = Folder::get($folderId); | 708 | $oFolder = Folder::get($folderId); |
| 708 | 709 | ||
| @@ -782,7 +783,7 @@ class DownloadQueue | @@ -782,7 +783,7 @@ class DownloadQueue | ||
| 782 | } | 783 | } |
| 783 | 784 | ||
| 784 | // fire subscription alerts for the downloaded document | 785 | // fire subscription alerts for the downloaded document |
| 785 | - if($this->bNotifications){ | 786 | + if($this->bNotifications && $alerts) { |
| 786 | $oSubscriptionEvent = new SubscriptionEvent(); | 787 | $oSubscriptionEvent = new SubscriptionEvent(); |
| 787 | $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); | 788 | $oSubscriptionEvent->DownloadDocument($oDocument, $oFolder); |
| 788 | } | 789 | } |
plugins/ktstandard/KTBulkExportPlugin.php
| @@ -70,6 +70,16 @@ class KTBulkExportAction extends KTFolderAction { | @@ -70,6 +70,16 @@ class KTBulkExportAction extends KTFolderAction { | ||
| 70 | return _kt('Bulk Download'); | 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 | function do_main() { | 83 | function do_main() { |
| 74 | $config = KTConfig::getSingleton(); | 84 | $config = KTConfig::getSingleton(); |
| 75 | $useQueue = $config->get('export/useDownloadQueue', true); | 85 | $useQueue = $config->get('export/useDownloadQueue', true); |
| @@ -91,13 +101,22 @@ class KTBulkExportAction extends KTFolderAction { | @@ -91,13 +101,22 @@ class KTBulkExportAction extends KTFolderAction { | ||
| 91 | $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); | 101 | $folderurl = KTBrowseUtil::getUrlForFolder($this->oFolder); |
| 92 | 102 | ||
| 93 | if($useQueue){ | 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 | DownloadQueue::addItem($exportCode, $sCurrentFolderId, $sCurrentFolderId, 'folder'); | 113 | DownloadQueue::addItem($exportCode, $sCurrentFolderId, $sCurrentFolderId, 'folder'); |
| 95 | 114 | ||
| 96 | $task_url = KTUtil::kt_url() . '/presentation/lookAndFeel/knowledgeTree/bulkdownload/downloadTask.php'; | 115 | $task_url = KTUtil::kt_url() . '/presentation/lookAndFeel/knowledgeTree/bulkdownload/downloadTask.php'; |
| 97 | - | ||
| 98 | $oTemplating =& KTTemplating::getSingleton(); | 116 | $oTemplating =& KTTemplating::getSingleton(); |
| 99 | $oTemplate = $oTemplating->loadTemplate('ktcore/action/bulk_download'); | 117 | $oTemplate = $oTemplating->loadTemplate('ktcore/action/bulk_download'); |
| 100 | 118 | ||
| 119 | + | ||
| 101 | $aParams = array( | 120 | $aParams = array( |
| 102 | 'folder_url' => $folderurl, | 121 | 'folder_url' => $folderurl, |
| 103 | 'url' => $task_url, | 122 | 'url' => $task_url, |
| @@ -176,12 +195,6 @@ class KTBulkExportAction extends KTFolderAction { | @@ -176,12 +195,6 @@ class KTBulkExportAction extends KTFolderAction { | ||
| 176 | $oDocumentTransaction->create(); | 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 | $this->oZip->addDocumentToZip($oDocument, $oFolder); | 198 | $this->oZip->addDocumentToZip($oDocument, $oFolder); |
| 186 | } | 199 | } |
| 187 | } | 200 | } |