Skip to content

A free open source IT asset/license management system

adds check in and checkout messag for accessories

Godfrey Mcce75a81859d
diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php
index 5363da0a9f..ba19d68f20 100644
--- a/app/Listeners/CheckoutableListener.php
+++ b/app/Listeners/CheckoutableListener.php
@@ -49,16 +49,16 @@ class CheckoutableListener
// Send email notifications
try {
- foreach ($notifiables as $notifiable) {
- if ($notifiable instanceof User && $notifiable->email != '') {
- if (! $event->checkedOutTo->locale){
- Notification::locale(Setting::getSettings()->locale)->send($notifiable, $this->getCheckoutNotification($event, $acceptance));
- }
- else {
- Notification::send($notifiable, $this->getCheckoutNotification($event, $acceptance));
- }
- }
- }
+// foreach ($notifiables as $notifiable) {
+// if ($notifiable instanceof User && $notifiable->email != '') {
+// if (! $event->checkedOutTo->locale){
+// Notification::locale(Setting::getSettings()->locale)->send($notifiable, $this->getCheckoutNotification($event, $acceptance));
+// }
+// else {
+// Notification::send($notifiable, $this->getCheckoutNotification($event, $acceptance));
+// }
+// }
+// }
// Send Webhook notification
if ($this->shouldSendWebhookNotification()) {
diff --git a/app/Notifications/CheckinAccessoryNotification.php b/app/Notifications/CheckinAccessoryNotification.php
index 7e033f1870..300e460902 100644
--- a/app/Notifications/CheckinAccessoryNotification.php
+++ b/app/Notifications/CheckinAccessoryNotification.php
@@ -104,17 +104,15 @@ class CheckinAccessoryNotification extends Notification
$item = $this->item;
$note = $this->note;
- return MicrosoftTeamsMessage::create()
- ->to($this->settings->webhook_endpoint)
- ->type('success')
- ->addStartGroupToSection('activityTitle')
- ->title(trans('Accessory_Checkin_Notification'))
- ->addStartGroupToSection('activityText')
- ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
- ->fact(trans('mail.checked_into'), $item->location->name ? $item->location->name : '')
- ->fact(trans('mail.Accessory_Checkin_Notification')." by ", $admin->present()->fullName())
- ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
- ->fact(trans('mail.notes'), $note ?: '');
+ $message = trans('mail.Accessory_Checkin_Notification');
+ $details = [
+ trans('mail.accessory_name') => htmlspecialchars_decode($item->present()->name),
+ trans('mail.checked_into') => $item->location->name ? $item->location->name : '',
+ trans('mail.Accessory_Checkin_Notification'). ' by' => $admin->present()->fullName(),
+ trans('admin/consumables/general.remaining')=> $item->numRemaining(),
+ trans('mail.notes') => $note ?: '',
+ ];
+ return array($message, $details);
}
public function toGoogleChat()
{
diff --git a/app/Notifications/CheckoutAccessoryNotification.php b/app/Notifications/CheckoutAccessoryNotification.php
index 721ba7f6a4..c862e94d0c 100644
--- a/app/Notifications/CheckoutAccessoryNotification.php
+++ b/app/Notifications/CheckoutAccessoryNotification.php
@@ -120,20 +120,17 @@ class CheckoutAccessoryNotification extends Notification
$item = $this->item;
$note = $this->note;
- return MicrosoftTeamsMessage::create()
- ->to($this->settings->webhook_endpoint)
- ->type('success')
- ->addStartGroupToSection('activityTitle')
- ->title(trans('mail.Accessory_Checkout_Notification'))
- ->addStartGroupToSection('activityText')
- ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
- ->fact(trans('mail.assigned_to'), $target->present()->name)
- ->fact(trans('general.qty'), $this->checkout_qty)
- ->fact(trans('mail.checkedout_from'), $item->location->name ? $item->location->name : '')
- ->fact(trans('mail.Accessory_Checkout_Notification') . " by ", $admin->present()->fullName())
- ->fact(trans('admin/consumables/general.remaining'), $item->numRemaining())
- ->fact(trans('mail.notes'), $note ?: '');
-
+ $message = trans('mail.Accessory_Checkout_Notification');
+ $details = [
+ trans('mail.assigned_to') => $target->present()->name,
+ trans('mail.accessory_name') => htmlspecialchars_decode($item->present()->name),
+ trans('general.qty') => $this->checkout_qty,
+ trans('mail.checkedout_from') => $item->location->name ? $item->location->name : '',
+ trans('mail.Accessory_Checkout_Notification'). ' by' => $admin->present()->fullName(),
+ trans('admin/consumables/general.remaining')=> $item->numRemaining(),
+ trans('mail.notes') => $note ?: '',
+ ];
+ return array($message, $details);
}
public function toGoogleChat()
{