mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
log filtered out notifications
This commit is contained in:
parent
ae2eebd562
commit
3a9bec69af
|
@ -70,20 +70,29 @@ class SeedDMS_NotificationService {
|
|||
public function toIndividual($sender, $recipient, $subject, $message, $params=array(), $recvtype=0) {
|
||||
$error = true;
|
||||
foreach($this->services as $name => $service) {
|
||||
/* Set $to to email address of user or the string passed in $recipient
|
||||
* This is only used for logging
|
||||
*/
|
||||
if(is_object($recipient) && $recipient->isType('user') && !$recipient->isDisabled() && $recipient->getEmail()!="") {
|
||||
$to = $recipient->getEmail();
|
||||
} elseif(is_string($recipient) && trim($recipient) != "") {
|
||||
$to = $recipient;
|
||||
} else {
|
||||
$to = '';
|
||||
}
|
||||
|
||||
/* Call filter of notification service if set */
|
||||
if(!is_callable([$service, 'filter']) || $service->filter($sender, $recipient, $subject, $message, $params, $recvtype)) {
|
||||
if(is_object($recipient) && ($dms = $recipient->getDMS()) && !strcasecmp(get_class($recipient), $dms->getClassname('user')) && !$recipient->isDisabled() && $recipient->getEmail()!="") {
|
||||
$to = $recipient->getEmail();
|
||||
} elseif(is_string($recipient) && trim($recipient) != "") {
|
||||
$to = $recipient;
|
||||
}
|
||||
if(!$service->toIndividual($sender, $recipient, $subject, $message, $params)) {
|
||||
$error = false;
|
||||
$this->errors[$name] = false;
|
||||
$this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to user \''.$to.'\' failed.', PEAR_LOG_ERR);
|
||||
$this->logger->log('Notification service \''.$name.'\': Sending mail \''.$subject.'\' to user \''.$to.'\' failed.', PEAR_LOG_ERR);
|
||||
} else {
|
||||
$this->logger->log('Notification service: '.$name.'. Sending mail \''.$subject.'\' to user \''.$to.'\' successful.', PEAR_LOG_INFO);
|
||||
$this->logger->log('Notification service \''.$name.'\': Sending mail \''.$subject.'\' to user \''.$to.'\' successful.', PEAR_LOG_INFO);
|
||||
$this->errors[$name] = true;
|
||||
}
|
||||
} else {
|
||||
$this->logger->log('Notification service \''.$name.'\': Sending mail \''.$subject.'\' to user \''.$to.'\' filtered out.', PEAR_LOG_INFO);
|
||||
}
|
||||
}
|
||||
return $error;
|
||||
|
|
Loading…
Reference in New Issue
Block a user