mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
added a location check, to prevent notif blowing up
This commit is contained in:
parent
b797795d37
commit
f270672a3d
|
@ -225,9 +225,10 @@ class CheckoutableListener
|
|||
break;
|
||||
case LicenseSeat::class:
|
||||
$notificationClass = CheckoutLicenseSeatNotification::class;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return new $notificationClass($event->checkoutable, $event->checkedOutTo, $event->checkedOutBy, $acceptance, $event->note);
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ class CheckinAccessoryNotification extends Notification
|
|||
->title("Accessory Checked In")
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
||||
->fact('Checked into ', $item->location->name)
|
||||
->fact('Checked into ', $item->location->name ? $item->location->name : '')
|
||||
->fact(trans('mail.Accessory_Checkin_Notification')." by ", $admin->present()->fullName())
|
||||
->fact('Number Remaining', $item->numRemaining())
|
||||
->fact('Notes', $note ?: 'No notes');
|
||||
|
|
|
@ -99,11 +99,10 @@ class CheckinAssetNotification extends Notification
|
|||
return MicrosoftTeamsMessage::create()
|
||||
->to($this->settings->webhook_endpoint)
|
||||
->type('success')
|
||||
->addStartGroupToSection('activityTitle')
|
||||
->title("Asset Checked in")
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'header')
|
||||
->fact('Checked into ', $item->location->name)
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText')
|
||||
->fact('Checked into ', $item->location->name ? $item->location->name : '')
|
||||
->fact(trans('mail.Asset_Checkin_Notification')." by ", $admin->present()->fullName())
|
||||
->fact('Asset Status', $item->assetstatus->name)
|
||||
->fact('Notes', $note ?: 'No notes');
|
||||
|
|
|
@ -116,7 +116,7 @@ class CheckoutAccessoryNotification extends Notification
|
|||
->title("Accessory Checked Out")
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
||||
->fact('Checked out from ', $item->location->name)
|
||||
->fact('Checked out from ', $item->location->name ? $item->location->name : '')
|
||||
->fact(trans('mail.Accessory_Checkout_Notification')." by ", $admin->present()->fullName())
|
||||
->fact('Number Remaining', $item->numRemaining())
|
||||
->fact('Notes', $note ?: 'No notes');
|
||||
|
|
|
@ -6,6 +6,7 @@ use App\Helpers\Helper;
|
|||
use App\Models\Asset;
|
||||
use App\Models\Setting;
|
||||
use App\Models\User;
|
||||
use Exception;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Messages\SlackMessage;
|
||||
|
@ -129,17 +130,23 @@ class CheckoutAssetNotification extends Notification
|
|||
$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');
|
||||
try {
|
||||
|
||||
return MicrosoftTeamsMessage::create()
|
||||
->to($this->settings->webhook_endpoint)
|
||||
->type('success')
|
||||
->title("Asset Checked Out")
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityText')
|
||||
->fact('Checked out from ', $item->location ? $item->location->name : '')
|
||||
->fact(trans('mail.Asset_Checkout_Notification') . " by ", $admin->present()->fullName())
|
||||
->fact('Asset Status', $item->assetstatus->name)
|
||||
->fact('Notes', $note ?: 'No notes');
|
||||
}
|
||||
catch(Exception $e) {
|
||||
dd($e);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue