Skip to content

A free open source IT asset/license management system

fixed conflicts

Godfrey M21a27dcac11a
diff --cc app/Listeners/CheckoutableListener.php
index 58ee68ea00,b9b176f16f..f8c6c8baa9
--- a/app/Listeners/CheckoutableListener.php
+++ b/app/Listeners/CheckoutableListener.php
@@@ -73,21 -74,23 +74,27 @@@ class CheckoutableListene
* 2. The item has a EULA
* 3. The item should send an email at check-in/check-out
*/
- if ($notifiable instanceof User && $notifiable->email != '') {
+
if ($event->checkoutable->requireAcceptance() || $event->checkoutable->getEula() ||
(method_exists($event->checkoutable, 'checkin_email') && $event->checkoutable->checkin_email())) {
- Mail::to($notifiable)->cc($ccEmails)->send($mailable);
+ if (!empty($notifiable->email)) {
+ Mail::to($notifiable)->cc($ccEmails)->send($mailable);
+ } else {
+ Mail::cc($ccEmails)->send($mailable);
+ }
Log::info('Sending email, Locale: ' . ($event->checkedOutTo->locale ?? 'default'));
}
- }
+
// Send Webhook notification
if ($this->shouldSendWebhookNotification()) {
- Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
- ->notify($this->getCheckoutNotification($event, $acceptance));
+ if (Setting::getSettings()->webhook_selected === 'microsoft') {
+ $message = $this->getCheckoutNotification($event)->toMicrosoftTeams();
+ $notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint);
+ $notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams
+ } else {
+ Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint)
+ ->notify($this->getCheckoutNotification($event, $acceptance));
+ }
}
} catch (ClientException $e) {
Log::debug("Exception caught during checkout notification: " . $e->getMessage());