Merge pull request #15806 from Godmartinz/improved-checkoutable-logging

improved logging in checkoutable listener
This commit is contained in:
snipe 2024-11-13 20:39:21 +00:00 committed by GitHub
commit f2fc11035f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -78,12 +78,13 @@ class CheckoutableListener
if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() || if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() ||
(method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) { (method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) {
Log::info('Sending checkout email, Locale: ' . ($event->checkedOutTo->locale ?? 'default'));
if (!empty($notifiable)) { if (!empty($notifiable)) {
Mail::to($notifiable)->cc($ccEmails)->send($mailable); Mail::to($notifiable)->cc($ccEmails)->send($mailable);
} elseif (!empty($ccEmails)) { } elseif (!empty($ccEmails)) {
Mail::cc($ccEmails)->send($mailable); Mail::cc($ccEmails)->send($mailable);
} }
Log::info('Sending email, Locale: ' . ($event->checkedOutTo->locale ?? 'default')); Log::info('Checkout Mail sent.');
} }
} catch (ClientException $e) { } catch (ClientException $e) {
Log::debug("Exception caught during checkout email: " . $e->getMessage()); Log::debug("Exception caught during checkout email: " . $e->getMessage());
@ -159,12 +160,13 @@ class CheckoutableListener
*/ */
if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() || if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() ||
(method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) { (method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) {
Log::info('Sending checkin email, Locale: ' . ($event->checkedOutTo->locale ?? 'default'));
if (!empty($notifiable)) { if (!empty($notifiable)) {
Mail::to($notifiable)->cc($ccEmails)->send($mailable); Mail::to($notifiable)->cc($ccEmails)->send($mailable);
} elseif (!empty($ccEmails)){ } elseif (!empty($ccEmails)){
Mail::cc($ccEmails)->send($mailable); Mail::cc($ccEmails)->send($mailable);
} }
Log::info('Sending email, Locale: ' . $event->checkedOutTo->locale); Log::info('Checkin Mail sent.');
} }
} catch (ClientException $e) { } catch (ClientException $e) {
Log::debug("Exception caught during checkin email: " . $e->getMessage()); Log::debug("Exception caught during checkin email: " . $e->getMessage());