check if logger is set before using it

This commit is contained in:
Uwe Steinmann 2022-05-30 09:15:08 +02:00
parent ece2eec128
commit a11bba23e4

View File

@ -93,13 +93,16 @@ class SeedDMS_NotificationService {
if(!$service->toIndividual($sender, $recipient, $subject, $message, $params)) {
$error = false;
$this->errors[$name] = false;
$this->logger->log('Notification service \''.$name.'\': Sending notification \''.$subject.'\' to user \''.$to.'\' ('.$recvtype.') failed.', PEAR_LOG_ERR);
if($this->logger)
$this->logger->log('Notification service \''.$name.'\': Sending notification \''.$subject.'\' to user \''.$to.'\' ('.$recvtype.') failed.', PEAR_LOG_ERR);
} else {
$this->logger->log('Notification service \''.$name.'\': Sending notification \''.$subject.'\' to user \''.$to.'\' ('.$recvtype.') successful (reason for notification: '.$recvtype.').', PEAR_LOG_INFO);
if($this->logger)
$this->logger->log('Notification service \''.$name.'\': Sending notification \''.$subject.'\' to user \''.$to.'\' ('.$recvtype.') successful (reason for notification: '.$recvtype.').', PEAR_LOG_INFO);
$this->errors[$name] = true;
}
} else {
$this->logger->log('Notification service \''.$name.'\': Notification \''.$subject.'\' to user \''.$to.'\' ('.$recvtype.') filtered out (reason for notification: '.$recvtype.').', PEAR_LOG_INFO);
if($this->logger)
$this->logger->log('Notification service \''.$name.'\': Notification \''.$subject.'\' to user \''.$to.'\' ('.$recvtype.') filtered out (reason for notification: '.$recvtype.').', PEAR_LOG_INFO);
}
}
return $error;