A free open source IT asset/license management system
adds Asset Check Out Notification
Godfrey Mf049cf5b06e7
diff --git a/app/Notifications/CheckinAssetNotification.php b/app/Notifications/CheckinAssetNotification.phpindex 0b04af904b..e8dffd7ae8 100644--- a/app/Notifications/CheckinAssetNotification.php+++ b/app/Notifications/CheckinAssetNotification.php@@ -44,7 +44,8 @@ class CheckinAssetNotification extends Notification* @return array*/public function via()- { if (Setting::getSettings()->webhook_selected == 'microsoft'){+ {+ if (Setting::getSettings()->webhook_selected == 'microsoft'){return [MicrosoftTeamsChannel::class];}@@ -94,27 +95,18 @@ class CheckinAssetNotification extends Notification$admin = $this->admin;$item = $this->item;$note = $this->note;- $button = [- trans('general.administrator') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',- trans('general.status') => $item->assetstatus->name,- trans('general.location') => ($item->location) ? $item->location->name : '',- ];return MicrosoftTeamsMessage::create()->to($this->settings->webhook_endpoint)->type('success')- ->addStartGroupToSection('header')+ ->addStartGroupToSection('activityTitle')->title("Asset Checked in")+ ->addStartGroupToSection('activityText')->fact(htmlspecialchars_decode($item->present()->name), '', 'header')->fact('Checked into ', $item->location->name)->fact(trans('mail.Asset_Checkin_Notification')." by ", $admin->present()->fullName())->fact('Asset Status', $item->assetstatus->name)->fact('Notes', $note ?: 'No notes');-// ->image($item->getImageUrl(), $item->model()->name, 'header');----}/**diff --git a/app/Notifications/CheckoutAssetNotification.php b/app/Notifications/CheckoutAssetNotification.phpindex e57825f5c6..b6d31a8b61 100644--- a/app/Notifications/CheckoutAssetNotification.php+++ b/app/Notifications/CheckoutAssetNotification.php@@ -10,6 +10,8 @@ use Illuminate\Bus\Queueable;use Illuminate\Notifications\Messages\MailMessage;use Illuminate\Notifications\Messages\SlackMessage;use Illuminate\Notifications\Notification;+use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;+use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;class CheckoutAssetNotification extends Notification{@@ -51,6 +53,10 @@ class CheckoutAssetNotification extends Notification*/public function via(){+ if (Setting::getSettings()->webhook_selected == 'microsoft'){++ return [MicrosoftTeamsChannel::class];+ }$notifyBy = [];if ((Setting::getSettings()) && (Setting::getSettings()->webhook_endpoint != '')) {@@ -117,6 +123,24 @@ class CheckoutAssetNotification extends Notification->content($note);});}+ public function toMicrosoftTeams()+ {+ $admin = $this->admin;+ $item = $this->item;+ $note = $this->note;++ return MicrosoftTeamsMessage::create()+ ->to($this->settings->webhook_endpoint)+ ->type('success')+ ->addStartGroupToSection('activityTitle')+ ->title("Asset Checked Out")+ ->addStartGroupToSection('activityText')+ ->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')+ ->fact('Checked out from ', $item->location->name)+ ->fact(trans('mail.Asset_Checkout_Notification')." by ", $admin->present()->fullName())+ ->fact('Asset Status', $item->assetstatus->name)+ ->fact('Notes', $note ?: 'No notes');+ }/*** Get the mail representation of the notification.