Commit 3a3121f36a991943d45274c30b017ce6e7e86a24

Authored by megan_w
1 parent e6870a87

KTS-2522

"Fatal Error when you perform a move and checkout"
Fixed. Refactored the prune users function into the getsubscribers function, where it is passed an array of id's instead of an array of objects.

Committed By: Megan Watson
Reviewed By: Conrad Vermeulen

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7445 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/subscriptions/subscriptions.inc.php
@@ -94,56 +94,54 @@ class SubscriptionEvent { @@ -94,56 +94,54 @@ class SubscriptionEvent {
94 94
95 // only useful for folder subscriptions. 95 // only useful for folder subscriptions.
96 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); 96 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
97 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
98 - foreach ($aUsers as $oSubscriber) {  
99 -  
100 - // notification object first.  
101 - $aNotificationOptions = array();  
102 - $aNotificationOptions['target_user'] = $oSubscriber->getID();  
103 - $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.  
104 - $aNotificationOptions['target_name'] = $oAddedFolder->getName();  
105 - $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());  
106 - $aNotificationOptions['object_id'] = $oAddedFolder->getId(); // parent folder_id, in this case.  
107 - $aNotificationOptions['event_type'] = "AddFolder";  
108 - $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);  
109 -  
110 - // now the email content.  
111 - // FIXME this needs to be handled entirely within notifications from now on.  
112 - if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {  
113 - $emailContent = $content->getEmailAlertContent($oNotification);  
114 - $emailSubject = $content->getEmailAlertSubject($oNotification);  
115 - $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);  
116 - $oEmail->send();  
117 - }  
118 - } 97 + foreach ($aUsers as $oSubscriber) {
  98 +
  99 + // notification object first.
  100 + $aNotificationOptions = array();
  101 + $aNotificationOptions['target_user'] = $oSubscriber->getID();
  102 + $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
  103 + $aNotificationOptions['target_name'] = $oAddedFolder->getName();
  104 + $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
  105 + $aNotificationOptions['object_id'] = $oAddedFolder->getId(); // parent folder_id, in this case.
  106 + $aNotificationOptions['event_type'] = "AddFolder";
  107 + $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
  108 +
  109 + // now the email content.
  110 + // FIXME this needs to be handled entirely within notifications from now on.
  111 + if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
  112 + $emailContent = $content->getEmailAlertContent($oNotification);
  113 + $emailSubject = $content->getEmailAlertSubject($oNotification);
  114 + $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
  115 + $oEmail->send();
  116 + }
  117 + }
119 } 118 }
120 function AddDocument ($oAddedDocument, $oParentFolder) { 119 function AddDocument ($oAddedDocument, $oParentFolder) {
121 $content = new SubscriptionContent(); // needed for i18n 120 $content = new SubscriptionContent(); // needed for i18n
122 // two parts to this: 121 // two parts to this:
123 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); 122 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
124 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
125 - foreach ($aUsers as $oSubscriber) {  
126 -  
127 - // notification object first.  
128 - $aNotificationOptions = array();  
129 - $aNotificationOptions['target_user'] = $oSubscriber->getID();  
130 - $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null - is this valid?  
131 - $aNotificationOptions['target_name'] = $oAddedDocument->getName();  
132 - $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());  
133 - $aNotificationOptions['object_id'] = $oAddedDocument->getId(); // parent folder_id, in this case.  
134 - $aNotificationOptions['event_type'] = "AddDocument";  
135 -  
136 - $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);  
137 -  
138 - // now the email content.  
139 - // FIXME this needs to be handled entirely within notifications from now on.  
140 - if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {  
141 - $emailContent = $content->getEmailAlertContent($oNotification);  
142 - $emailSubject = $content->getEmailAlertSubject($oNotification);  
143 - $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);  
144 - $oEmail->send();  
145 - }  
146 - } 123 + foreach ($aUsers as $oSubscriber) {
  124 +
  125 + // notification object first.
  126 + $aNotificationOptions = array();
  127 + $aNotificationOptions['target_user'] = $oSubscriber->getID();
  128 + $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null - is this valid?
  129 + $aNotificationOptions['target_name'] = $oAddedDocument->getName();
  130 + $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
  131 + $aNotificationOptions['object_id'] = $oAddedDocument->getId(); // parent folder_id, in this case.
  132 + $aNotificationOptions['event_type'] = "AddDocument";
  133 +
  134 + $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
  135 +
  136 + // now the email content.
  137 + // FIXME this needs to be handled entirely within notifications from now on.
  138 + if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
  139 + $emailContent = $content->getEmailAlertContent($oNotification);
  140 + $emailSubject = $content->getEmailAlertSubject($oNotification);
  141 + $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
  142 + $oEmail->send();
  143 + }
  144 + }
147 } 145 }
148 function RemoveFolder($oRemovedFolder, $oParentFolder) { 146 function RemoveFolder($oRemovedFolder, $oParentFolder) {
149 $content = new SubscriptionContent(); // needed for i18n 147 $content = new SubscriptionContent(); // needed for i18n
@@ -153,7 +151,6 @@ class SubscriptionEvent { @@ -153,7 +151,6 @@ class SubscriptionEvent {
153 151
154 // we need to start with the latter, so we don't "lose" any. 152 // we need to start with the latter, so we don't "lose" any.
155 $aUsers = $this->_getSubscribers($oRemovedFolder->getId(), $this->subscriptionTypes["Folder"]); 153 $aUsers = $this->_getSubscribers($oRemovedFolder->getId(), $this->subscriptionTypes["Folder"]);
156 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
157 foreach ($aUsers as $oSubscriber) { 154 foreach ($aUsers as $oSubscriber) {
158 155
159 // notification object first. 156 // notification object first.
@@ -184,7 +181,6 @@ class SubscriptionEvent { @@ -184,7 +181,6 @@ class SubscriptionEvent {
184 181
185 // now handle (for those who haven't been alerted) users watching the folder. 182 // now handle (for those who haven't been alerted) users watching the folder.
186 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); 183 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
187 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
188 foreach ($aUsers as $oSubscriber) { 184 foreach ($aUsers as $oSubscriber) {
189 185
190 // notification object first. 186 // notification object first.
@@ -216,7 +212,6 @@ class SubscriptionEvent { @@ -216,7 +212,6 @@ class SubscriptionEvent {
216 212
217 // we need to start with the latter, so we don't "lose" any. 213 // we need to start with the latter, so we don't "lose" any.
218 $aUsers = $this->_getSubscribers($oRemovedDocument->getId(), $this->subscriptionTypes["Document"]); 214 $aUsers = $this->_getSubscribers($oRemovedDocument->getId(), $this->subscriptionTypes["Document"]);
219 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
220 foreach ($aUsers as $oSubscriber) { 215 foreach ($aUsers as $oSubscriber) {
221 216
222 // notification object first. 217 // notification object first.
@@ -247,7 +242,6 @@ class SubscriptionEvent { @@ -247,7 +242,6 @@ class SubscriptionEvent {
247 242
248 // now handle (for those who haven't been alerted) users watching the folder. 243 // now handle (for those who haven't been alerted) users watching the folder.
249 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); 244 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
250 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
251 foreach ($aUsers as $oSubscriber) { 245 foreach ($aUsers as $oSubscriber) {
252 246
253 // notification object first. 247 // notification object first.
@@ -275,7 +269,6 @@ class SubscriptionEvent { @@ -275,7 +269,6 @@ class SubscriptionEvent {
275 $content = new SubscriptionContent(); // needed for i18n 269 $content = new SubscriptionContent(); // needed for i18n
276 // OK: two actions: document registrants, folder registrants. 270 // OK: two actions: document registrants, folder registrants.
277 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); 271 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]);
278 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
279 foreach ($aUsers as $oSubscriber) { 272 foreach ($aUsers as $oSubscriber) {
280 273
281 // notification object first. 274 // notification object first.
@@ -300,7 +293,6 @@ class SubscriptionEvent { @@ -300,7 +293,6 @@ class SubscriptionEvent {
300 293
301 294
302 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); 295 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
303 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
304 foreach ($aUsers as $oSubscriber) { 296 foreach ($aUsers as $oSubscriber) {
305 297
306 // notification object first. 298 // notification object first.
@@ -328,7 +320,6 @@ class SubscriptionEvent { @@ -328,7 +320,6 @@ class SubscriptionEvent {
328 $content = new SubscriptionContent(); // needed for i18n 320 $content = new SubscriptionContent(); // needed for i18n
329 // OK: two actions: document registrants, folder registrants. 321 // OK: two actions: document registrants, folder registrants.
330 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); 322 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]);
331 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
332 foreach ($aUsers as $oSubscriber) { 323 foreach ($aUsers as $oSubscriber) {
333 324
334 // notification object first. 325 // notification object first.
@@ -352,7 +343,6 @@ class SubscriptionEvent { @@ -352,7 +343,6 @@ class SubscriptionEvent {
352 } 343 }
353 344
354 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); 345 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
355 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
356 foreach ($aUsers as $oSubscriber) { 346 foreach ($aUsers as $oSubscriber) {
357 347
358 // notification object first. 348 // notification object first.
@@ -380,7 +370,6 @@ class SubscriptionEvent { @@ -380,7 +370,6 @@ class SubscriptionEvent {
380 $content = new SubscriptionContent(); // needed for i18n 370 $content = new SubscriptionContent(); // needed for i18n
381 // OK: two actions: document registrants, folder registrants. 371 // OK: two actions: document registrants, folder registrants.
382 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); 372 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]);
383 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
384 foreach ($aUsers as $oSubscriber) { 373 foreach ($aUsers as $oSubscriber) {
385 374
386 // notification object first. 375 // notification object first.
@@ -405,7 +394,7 @@ class SubscriptionEvent { @@ -405,7 +394,7 @@ class SubscriptionEvent {
405 394
406 395
407 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); 396 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
408 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. 397 +
409 foreach ($aUsers as $oSubscriber) { 398 foreach ($aUsers as $oSubscriber) {
410 399
411 // notification object first. 400 // notification object first.
@@ -433,60 +422,58 @@ class SubscriptionEvent { @@ -433,60 +422,58 @@ class SubscriptionEvent {
433 $content = new SubscriptionContent(); // needed for i18n 422 $content = new SubscriptionContent(); // needed for i18n
434 // OK: two actions: document registrants, folder registrants. 423 // OK: two actions: document registrants, folder registrants.
435 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); 424 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]);
436 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
437 - foreach ($aUsers as $oSubscriber) {  
438 -  
439 - // notification object first.  
440 - $aNotificationOptions = array();  
441 - $aNotificationOptions['target_user'] = $oSubscriber->getID();  
442 - $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.  
443 - $aNotificationOptions['target_name'] = $oModifiedDocument->getName();  
444 - $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());  
445 - $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.  
446 - $aNotificationOptions['event_type'] = "CheckOutDocument";  
447 - $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);  
448 -  
449 - // now the email content.  
450 - // FIXME this needs to be handled entirely within notifications from now on.  
451 - if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {  
452 - $emailContent = $content->getEmailAlertContent($oNotification);  
453 - $emailSubject = $content->getEmailAlertSubject($oNotification);  
454 - $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);  
455 - $oEmail->send();  
456 - }  
457 - } 425 +
  426 + foreach ($aUsers as $oSubscriber) {
  427 +
  428 + // notification object first.
  429 + $aNotificationOptions = array();
  430 + $aNotificationOptions['target_user'] = $oSubscriber->getID();
  431 + $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
  432 + $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
  433 + $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
  434 + $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
  435 + $aNotificationOptions['event_type'] = "CheckOutDocument";
  436 + $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
  437 +
  438 + // now the email content.
  439 + // FIXME this needs to be handled entirely within notifications from now on.
  440 + if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
  441 + $emailContent = $content->getEmailAlertContent($oNotification);
  442 + $emailSubject = $content->getEmailAlertSubject($oNotification);
  443 + $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
  444 + $oEmail->send();
  445 + }
  446 + }
458 447
459 448
460 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); 449 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
461 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
462 - foreach ($aUsers as $oSubscriber) {  
463 -  
464 - // notification object first.  
465 - $aNotificationOptions = array();  
466 - $aNotificationOptions['target_user'] = $oSubscriber->getID();  
467 - $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.  
468 - $aNotificationOptions['target_name'] = $oModifiedDocument->getName();  
469 - $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());  
470 - $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.  
471 - $aNotificationOptions['event_type'] = "CheckOutDocument";  
472 - $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);  
473 -  
474 - // now the email content.  
475 - // FIXME this needs to be handled entirely within notifications from now on.  
476 - if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {  
477 - $emailContent = $content->getEmailAlertContent($oNotification);  
478 - $emailSubject = $content->getEmailAlertSubject($oNotification);  
479 - $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);  
480 - $oEmail->send();  
481 - }  
482 - } 450 + foreach ($aUsers as $oSubscriber) {
  451 +
  452 + // notification object first.
  453 + $aNotificationOptions = array();
  454 + $aNotificationOptions['target_user'] = $oSubscriber->getID();
  455 + $aNotificationOptions['actor_id'] = KTUtil::arrayGet($_SESSION,"userID", null); // _won't_ be null.
  456 + $aNotificationOptions['target_name'] = $oModifiedDocument->getName();
  457 + $aNotificationOptions['location_name'] = Folder::generateFullFolderPath($oParentFolder->getId());
  458 + $aNotificationOptions['object_id'] = $oModifiedDocument->getId(); // parent folder_id, in this case.
  459 + $aNotificationOptions['event_type'] = "CheckOutDocument";
  460 + $oNotification =& KTSubscriptionNotification::generateSubscriptionNotification($aNotificationOptions);
  461 +
  462 + // now the email content.
  463 + // FIXME this needs to be handled entirely within notifications from now on.
  464 + if ($oSubscriber->getEmailNotification() && (strlen($oSubscriber->getEmail()) > 0)) {
  465 + $emailContent = $content->getEmailAlertContent($oNotification);
  466 + $emailSubject = $content->getEmailAlertSubject($oNotification);
  467 + $oEmail = new EmailAlert($oSubscriber->getEmail(), $emailSubject, $emailContent);
  468 + $oEmail->send();
  469 + }
  470 + }
483 } 471 }
484 472
485 function MoveDocument($oMovedDocument, $oToFolder, $oFromFolder, $moveOrCopy = "MovedDocument") { 473 function MoveDocument($oMovedDocument, $oToFolder, $oFromFolder, $moveOrCopy = "MovedDocument") {
486 $content = new SubscriptionContent(); // needed for i18n 474 $content = new SubscriptionContent(); // needed for i18n
487 // OK: two actions: document registrants, folder registrants. 475 // OK: two actions: document registrants, folder registrants.
488 $aUsers = $this->_getSubscribers($oMovedDocument->getId(), $this->subscriptionTypes["Document"]); 476 $aUsers = $this->_getSubscribers($oMovedDocument->getId(), $this->subscriptionTypes["Document"]);
489 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
490 477
491 foreach ($aUsers as $oSubscriber) { 478 foreach ($aUsers as $oSubscriber) {
492 // notification object first. 479 // notification object first.
@@ -511,7 +498,7 @@ class SubscriptionEvent { @@ -511,7 +498,7 @@ class SubscriptionEvent {
511 498
512 499
513 $aUsers = $this->_getSubscribers($oFromFolder->getId(), $this->subscriptionTypes["Folder"]); 500 $aUsers = $this->_getSubscribers($oFromFolder->getId(), $this->subscriptionTypes["Folder"]);
514 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. 501 +
515 foreach ($aUsers as $oSubscriber) { 502 foreach ($aUsers as $oSubscriber) {
516 503
517 // notification object first. 504 // notification object first.
@@ -535,7 +522,6 @@ class SubscriptionEvent { @@ -535,7 +522,6 @@ class SubscriptionEvent {
535 } 522 }
536 523
537 $aUsers = $this->_getSubscribers($oToFolder->getId(), $this->subscriptionTypes["Folder"]); 524 $aUsers = $this->_getSubscribers($oToFolder->getId(), $this->subscriptionTypes["Folder"]);
538 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
539 foreach ($aUsers as $oSubscriber) { 525 foreach ($aUsers as $oSubscriber) {
540 526
541 // notification object first. 527 // notification object first.
@@ -563,7 +549,6 @@ class SubscriptionEvent { @@ -563,7 +549,6 @@ class SubscriptionEvent {
563 $content = new SubscriptionContent(); // needed for i18n 549 $content = new SubscriptionContent(); // needed for i18n
564 // OK: two actions: document registrants, folder registrants. 550 // OK: two actions: document registrants, folder registrants.
565 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); 551 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]);
566 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
567 foreach ($aUsers as $oSubscriber) { 552 foreach ($aUsers as $oSubscriber) {
568 553
569 // notification object first. 554 // notification object first.
@@ -588,7 +573,6 @@ class SubscriptionEvent { @@ -588,7 +573,6 @@ class SubscriptionEvent {
588 573
589 574
590 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); 575 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
591 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
592 foreach ($aUsers as $oSubscriber) { 576 foreach ($aUsers as $oSubscriber) {
593 577
594 // notification object first. 578 // notification object first.
@@ -616,7 +600,6 @@ class SubscriptionEvent { @@ -616,7 +600,6 @@ class SubscriptionEvent {
616 $content = new SubscriptionContent(); // needed for i18n 600 $content = new SubscriptionContent(); // needed for i18n
617 // OK: two actions: document registrants, folder registrants. 601 // OK: two actions: document registrants, folder registrants.
618 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); 602 $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]);
619 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
620 foreach ($aUsers as $oSubscriber) { 603 foreach ($aUsers as $oSubscriber) {
621 604
622 // notification object first. 605 // notification object first.
@@ -641,7 +624,6 @@ class SubscriptionEvent { @@ -641,7 +624,6 @@ class SubscriptionEvent {
641 624
642 625
643 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); 626 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
644 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
645 foreach ($aUsers as $oSubscriber) { 627 foreach ($aUsers as $oSubscriber) {
646 628
647 // notification object first. 629 // notification object first.
@@ -669,7 +651,6 @@ class SubscriptionEvent { @@ -669,7 +651,6 @@ class SubscriptionEvent {
669 $content = new SubscriptionContent(); // needed for i18n 651 $content = new SubscriptionContent(); // needed for i18n
670 // OK: two actions: document registrants, folder registrants. 652 // OK: two actions: document registrants, folder registrants.
671 $aUsers = $this->_getSubscribers($oDocument->getId(), $this->subscriptionTypes["Document"]); 653 $aUsers = $this->_getSubscribers($oDocument->getId(), $this->subscriptionTypes["Document"]);
672 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
673 foreach ($aUsers as $oSubscriber) { 654 foreach ($aUsers as $oSubscriber) {
674 655
675 // notification object first. 656 // notification object first.
@@ -694,7 +675,6 @@ class SubscriptionEvent { @@ -694,7 +675,6 @@ class SubscriptionEvent {
694 675
695 676
696 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); 677 $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]);
697 - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton.  
698 foreach ($aUsers as $oSubscriber) { 678 foreach ($aUsers as $oSubscriber) {
699 679
700 // notification object first. 680 // notification object first.
@@ -748,6 +728,9 @@ class SubscriptionEvent { @@ -748,6 +728,9 @@ class SubscriptionEvent {
748 728
749 $aNewUsers = DBUtil::getResultArrayKey(array($sQuery, $aParams), "user_id"); 729 $aNewUsers = DBUtil::getResultArrayKey(array($sQuery, $aParams), "user_id");
750 730
  731 + // Remove alerted users
  732 + $aNewUsers = $this->_pruneAlertedUsers($aNewUsers);
  733 +
751 // notionally less efficient than the old code. if its a big issue, can easily 734 // notionally less efficient than the old code. if its a big issue, can easily
752 // be refactored. 735 // be refactored.
753 foreach ($aNewUsers as $iUserId) { 736 foreach ($aNewUsers as $iUserId) {