Commit 952e758e505e119cbb070464f928bebdb77324d8
1 parent
011e9656
KTS-4239 Displays a single message after email failure
Committed By : Jarrett Jordaan Reviewed by : Paul Barrett
Showing
1 changed file
with
5 additions
and
7 deletions
plugins/ktstandard/KTEmail.php
| ... | ... | @@ -66,6 +66,7 @@ function sendGroupEmails($aGroupIDs, &$aUserEmails, &$aEmailErrors) { |
| 66 | 66 | $default->log->info('sendingEmail to group ' . $oDestGroup->getName()); |
| 67 | 67 | // for each group, retrieve all the users |
| 68 | 68 | foreach($aDestinationGroups as $oGroup){ |
| 69 | + // Need to only retrieve users that are not diabled. | |
| 69 | 70 | $aUsers = kt_array_merge($aUsers, $oGroup->getUsers()); |
| 70 | 71 | } |
| 71 | 72 | |
| ... | ... | @@ -441,7 +442,6 @@ class KTDocumentEmailAction extends KTDocumentAction { |
| 441 | 442 | function json_getGroups() { |
| 442 | 443 | $oConfig = KTConfig::getSingleton(); |
| 443 | 444 | $bOnlyOwnGroup = $oConfig->get('email/onlyOwnGroups', false); |
| 444 | - | |
| 445 | 445 | $sFilter = KTUtil::arrayGet($_REQUEST, 'filter', false); |
| 446 | 446 | $aGroupList = array('off'=> _kt('-- Please filter --')); |
| 447 | 447 | |
| ... | ... | @@ -452,7 +452,6 @@ class KTDocumentEmailAction extends KTDocumentAction { |
| 452 | 452 | } else { |
| 453 | 453 | $aGroups = GroupUtil::listGroupsForUser($this->oUser, array('where' => $sWhere)); |
| 454 | 454 | } |
| 455 | - | |
| 456 | 455 | $aGroupList = array(); |
| 457 | 456 | foreach($aGroups as $g) { |
| 458 | 457 | $aGroupList[$g->getId()] = $g->getName(); |
| ... | ... | @@ -545,13 +544,12 @@ class KTDocumentEmailAction extends KTDocumentAction { |
| 545 | 544 | $this->errorRedirectToMain(_kt('No recipients set'), sprintf('fDocumentId=%d', $this->oDocument->getId())); |
| 546 | 545 | exit(0); |
| 547 | 546 | } |
| 548 | - | |
| 547 | + | |
| 549 | 548 | $iDocumentID = $this->oDocument->getID(); |
| 550 | 549 | $sDocumentName = $this->oDocument->getName(); |
| 551 | 550 | |
| 552 | 551 | $aEmailErrors = array(); |
| 553 | 552 | $aUserEmails = array(); |
| 554 | - | |
| 555 | 553 | // send group emails |
| 556 | 554 | sendGroupEmails($aGroupIDs, $aUserEmails, $aEmailErrors); |
| 557 | 555 | // send user emails |
| ... | ... | @@ -569,12 +567,12 @@ class KTDocumentEmailAction extends KTDocumentAction { |
| 569 | 567 | $aListEmails = array_keys($aUserEmails); |
| 570 | 568 | sendEmail($aListEmails, $iDocumentID, $sDocumentName, $fComment, (boolean)$fAttachDocument, $aEmailErrors); |
| 571 | 569 | } |
| 572 | - | |
| 570 | + // Display success or error | |
| 573 | 571 | if (count($aEmailErrors)) { |
| 574 | 572 | $_SESSION['KTErrorMessage'][] = join('<br />\n', $aEmailErrors); |
| 573 | + } else { | |
| 574 | + $_SESSION['KTInfoMessage'][] = _kt('Email sent'); | |
| 575 | 575 | } |
| 576 | - | |
| 577 | - $_SESSION['KTInfoMessage'][] = _kt('Email sent'); | |
| 578 | 576 | //go back to the document view page |
| 579 | 577 | controllerRedirect('viewDocument', sprintf("fDocumentId=%d", $this->oDocument->getId())); |
| 580 | 578 | } | ... | ... |