Commit 3a3121f36a991943d45274c30b017ce6e7e86a24
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
Showing
1 changed file
with
91 additions
and
108 deletions
lib/subscriptions/subscriptions.inc.php
| ... | ... | @@ -94,56 +94,54 @@ class SubscriptionEvent { |
| 94 | 94 | |
| 95 | 95 | // only useful for folder subscriptions. |
| 96 | 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 | 119 | function AddDocument ($oAddedDocument, $oParentFolder) { |
| 121 | 120 | $content = new SubscriptionContent(); // needed for i18n |
| 122 | 121 | // two parts to this: |
| 123 | 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 | 146 | function RemoveFolder($oRemovedFolder, $oParentFolder) { |
| 149 | 147 | $content = new SubscriptionContent(); // needed for i18n |
| ... | ... | @@ -153,7 +151,6 @@ class SubscriptionEvent { |
| 153 | 151 | |
| 154 | 152 | // we need to start with the latter, so we don't "lose" any. |
| 155 | 153 | $aUsers = $this->_getSubscribers($oRemovedFolder->getId(), $this->subscriptionTypes["Folder"]); |
| 156 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 157 | 154 | foreach ($aUsers as $oSubscriber) { |
| 158 | 155 | |
| 159 | 156 | // notification object first. |
| ... | ... | @@ -184,7 +181,6 @@ class SubscriptionEvent { |
| 184 | 181 | |
| 185 | 182 | // now handle (for those who haven't been alerted) users watching the folder. |
| 186 | 183 | $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); |
| 187 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 188 | 184 | foreach ($aUsers as $oSubscriber) { |
| 189 | 185 | |
| 190 | 186 | // notification object first. |
| ... | ... | @@ -216,7 +212,6 @@ class SubscriptionEvent { |
| 216 | 212 | |
| 217 | 213 | // we need to start with the latter, so we don't "lose" any. |
| 218 | 214 | $aUsers = $this->_getSubscribers($oRemovedDocument->getId(), $this->subscriptionTypes["Document"]); |
| 219 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 220 | 215 | foreach ($aUsers as $oSubscriber) { |
| 221 | 216 | |
| 222 | 217 | // notification object first. |
| ... | ... | @@ -247,7 +242,6 @@ class SubscriptionEvent { |
| 247 | 242 | |
| 248 | 243 | // now handle (for those who haven't been alerted) users watching the folder. |
| 249 | 244 | $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); |
| 250 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 251 | 245 | foreach ($aUsers as $oSubscriber) { |
| 252 | 246 | |
| 253 | 247 | // notification object first. |
| ... | ... | @@ -275,7 +269,6 @@ class SubscriptionEvent { |
| 275 | 269 | $content = new SubscriptionContent(); // needed for i18n |
| 276 | 270 | // OK: two actions: document registrants, folder registrants. |
| 277 | 271 | $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); |
| 278 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 279 | 272 | foreach ($aUsers as $oSubscriber) { |
| 280 | 273 | |
| 281 | 274 | // notification object first. |
| ... | ... | @@ -300,7 +293,6 @@ class SubscriptionEvent { |
| 300 | 293 | |
| 301 | 294 | |
| 302 | 295 | $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); |
| 303 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 304 | 296 | foreach ($aUsers as $oSubscriber) { |
| 305 | 297 | |
| 306 | 298 | // notification object first. |
| ... | ... | @@ -328,7 +320,6 @@ class SubscriptionEvent { |
| 328 | 320 | $content = new SubscriptionContent(); // needed for i18n |
| 329 | 321 | // OK: two actions: document registrants, folder registrants. |
| 330 | 322 | $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); |
| 331 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 332 | 323 | foreach ($aUsers as $oSubscriber) { |
| 333 | 324 | |
| 334 | 325 | // notification object first. |
| ... | ... | @@ -352,7 +343,6 @@ class SubscriptionEvent { |
| 352 | 343 | } |
| 353 | 344 | |
| 354 | 345 | $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); |
| 355 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 356 | 346 | foreach ($aUsers as $oSubscriber) { |
| 357 | 347 | |
| 358 | 348 | // notification object first. |
| ... | ... | @@ -380,7 +370,6 @@ class SubscriptionEvent { |
| 380 | 370 | $content = new SubscriptionContent(); // needed for i18n |
| 381 | 371 | // OK: two actions: document registrants, folder registrants. |
| 382 | 372 | $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); |
| 383 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 384 | 373 | foreach ($aUsers as $oSubscriber) { |
| 385 | 374 | |
| 386 | 375 | // notification object first. |
| ... | ... | @@ -405,7 +394,7 @@ class SubscriptionEvent { |
| 405 | 394 | |
| 406 | 395 | |
| 407 | 396 | $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); |
| 408 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 397 | + | |
| 409 | 398 | foreach ($aUsers as $oSubscriber) { |
| 410 | 399 | |
| 411 | 400 | // notification object first. |
| ... | ... | @@ -433,60 +422,58 @@ class SubscriptionEvent { |
| 433 | 422 | $content = new SubscriptionContent(); // needed for i18n |
| 434 | 423 | // OK: two actions: document registrants, folder registrants. |
| 435 | 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 | 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 | 473 | function MoveDocument($oMovedDocument, $oToFolder, $oFromFolder, $moveOrCopy = "MovedDocument") { |
| 486 | 474 | $content = new SubscriptionContent(); // needed for i18n |
| 487 | 475 | // OK: two actions: document registrants, folder registrants. |
| 488 | 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 | 478 | foreach ($aUsers as $oSubscriber) { |
| 492 | 479 | // notification object first. |
| ... | ... | @@ -511,7 +498,7 @@ class SubscriptionEvent { |
| 511 | 498 | |
| 512 | 499 | |
| 513 | 500 | $aUsers = $this->_getSubscribers($oFromFolder->getId(), $this->subscriptionTypes["Folder"]); |
| 514 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 501 | + | |
| 515 | 502 | foreach ($aUsers as $oSubscriber) { |
| 516 | 503 | |
| 517 | 504 | // notification object first. |
| ... | ... | @@ -535,7 +522,6 @@ class SubscriptionEvent { |
| 535 | 522 | } |
| 536 | 523 | |
| 537 | 524 | $aUsers = $this->_getSubscribers($oToFolder->getId(), $this->subscriptionTypes["Folder"]); |
| 538 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 539 | 525 | foreach ($aUsers as $oSubscriber) { |
| 540 | 526 | |
| 541 | 527 | // notification object first. |
| ... | ... | @@ -563,7 +549,6 @@ class SubscriptionEvent { |
| 563 | 549 | $content = new SubscriptionContent(); // needed for i18n |
| 564 | 550 | // OK: two actions: document registrants, folder registrants. |
| 565 | 551 | $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); |
| 566 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 567 | 552 | foreach ($aUsers as $oSubscriber) { |
| 568 | 553 | |
| 569 | 554 | // notification object first. |
| ... | ... | @@ -588,7 +573,6 @@ class SubscriptionEvent { |
| 588 | 573 | |
| 589 | 574 | |
| 590 | 575 | $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); |
| 591 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 592 | 576 | foreach ($aUsers as $oSubscriber) { |
| 593 | 577 | |
| 594 | 578 | // notification object first. |
| ... | ... | @@ -616,7 +600,6 @@ class SubscriptionEvent { |
| 616 | 600 | $content = new SubscriptionContent(); // needed for i18n |
| 617 | 601 | // OK: two actions: document registrants, folder registrants. |
| 618 | 602 | $aUsers = $this->_getSubscribers($oModifiedDocument->getId(), $this->subscriptionTypes["Document"]); |
| 619 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 620 | 603 | foreach ($aUsers as $oSubscriber) { |
| 621 | 604 | |
| 622 | 605 | // notification object first. |
| ... | ... | @@ -641,7 +624,6 @@ class SubscriptionEvent { |
| 641 | 624 | |
| 642 | 625 | |
| 643 | 626 | $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); |
| 644 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 645 | 627 | foreach ($aUsers as $oSubscriber) { |
| 646 | 628 | |
| 647 | 629 | // notification object first. |
| ... | ... | @@ -669,7 +651,6 @@ class SubscriptionEvent { |
| 669 | 651 | $content = new SubscriptionContent(); // needed for i18n |
| 670 | 652 | // OK: two actions: document registrants, folder registrants. |
| 671 | 653 | $aUsers = $this->_getSubscribers($oDocument->getId(), $this->subscriptionTypes["Document"]); |
| 672 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 673 | 654 | foreach ($aUsers as $oSubscriber) { |
| 674 | 655 | |
| 675 | 656 | // notification object first. |
| ... | ... | @@ -694,7 +675,6 @@ class SubscriptionEvent { |
| 694 | 675 | |
| 695 | 676 | |
| 696 | 677 | $aUsers = $this->_getSubscribers($oParentFolder->getId(), $this->subscriptionTypes["Folder"]); |
| 697 | - $aUsers = $this->_pruneAlertedUsers($aUsers); // setup the alerted users. _might_ be a singleton. | |
| 698 | 678 | foreach ($aUsers as $oSubscriber) { |
| 699 | 679 | |
| 700 | 680 | // notification object first. |
| ... | ... | @@ -748,6 +728,9 @@ class SubscriptionEvent { |
| 748 | 728 | |
| 749 | 729 | $aNewUsers = DBUtil::getResultArrayKey(array($sQuery, $aParams), "user_id"); |
| 750 | 730 | |
| 731 | + // Remove alerted users | |
| 732 | + $aNewUsers = $this->_pruneAlertedUsers($aNewUsers); | |
| 733 | + | |
| 751 | 734 | // notionally less efficient than the old code. if its a big issue, can easily |
| 752 | 735 | // be refactored. |
| 753 | 736 | foreach ($aNewUsers as $iUserId) { | ... | ... |