Skip to content

A free open source IT asset/license management system

WIP

Marcus Moorea3871bd1f295
diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php
index 5411008d30..a5b60be683 100644
--- a/app/Listeners/CheckoutableListener.php
+++ b/app/Listeners/CheckoutableListener.php
@@ -67,17 +67,19 @@ class CheckoutableListener
$notifiableHasEmail = $notifiable instanceof User && $notifiable->email;
+ $shouldSendEmailToUser = $shouldSendEmailToUser && $notifiableHasEmail;
+
$to = [];
$cc = [];
// if user && cc: to user, cc admin
- if (($shouldSendEmailToUser && $notifiableHasEmail) && $shouldSendEmailToAlertAddress) {
+ if ($shouldSendEmailToUser && $shouldSendEmailToAlertAddress) {
$to[] = $notifiable;
$cc[] = $this->getFormattedAlertAddresses();
}
// if user && no cc: to user
- if (($shouldSendEmailToUser && $notifiableHasEmail) && !$shouldSendEmailToAlertAddress) {
+ if ($shouldSendEmailToUser && !$shouldSendEmailToAlertAddress) {
$to[] = $notifiable;
}
@@ -86,10 +88,6 @@ class CheckoutableListener
$to[] = $this->getFormattedAlertAddresses();
}
- if (empty($to) && $shouldSendEmailToAlertAddress) {
- $to[] = $this->getFormattedAlertAddresses();
- }
-
if (!empty($to)) {
try {
Mail::to(array_flatten($to))->cc(array_flatten($cc))->send($mailable);