mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 14:27:33 -08:00
adds Accessory Check in out Notifcations,
This commit is contained in:
parent
f049cf5b06
commit
5a46ef5d5b
|
@ -58,8 +58,13 @@ class CheckoutableListener
|
|||
}
|
||||
|
||||
if ($this->shouldSendWebhookNotification()) {
|
||||
Notification::route('slack', Setting::getSettings()->webhook_endpoint)
|
||||
->notify($this->getCheckoutNotification($event));
|
||||
|
||||
//slack doesn't include the url in its messaging format so this is needed to hit the endpoint
|
||||
if(Setting::getSettings()->webhook_selected =='slack') {
|
||||
|
||||
Notification::route('slack', Setting::getSettings()->webhook_endpoint)
|
||||
->notify($this->getCheckoutNotification($event));
|
||||
}
|
||||
}
|
||||
} catch (ClientException $e) {
|
||||
Log::debug("Exception caught during checkout notification: " . $e->getMessage());
|
||||
|
|
|
@ -9,6 +9,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 CheckinAccessoryNotification extends Notification
|
||||
{
|
||||
|
@ -35,7 +37,10 @@ class CheckinAccessoryNotification extends Notification
|
|||
*/
|
||||
public function via()
|
||||
{
|
||||
\Log::debug('via called');
|
||||
if (Setting::getSettings()->webhook_selected == 'microsoft'){
|
||||
|
||||
return [MicrosoftTeamsChannel::class];
|
||||
}
|
||||
$notifyBy = [];
|
||||
|
||||
if (Setting::getSettings()->webhook_endpoint != '') {
|
||||
|
@ -108,6 +113,24 @@ class CheckinAccessoryNotification 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("Accessory Checked Out")
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
||||
->fact('Checked out from ', $item->location->name)
|
||||
->fact(trans('mail.Accessory_Checkin_Notification')." by ", $admin->present()->fullName())
|
||||
->fact('Number Remaining', $item->numRemaining())
|
||||
->fact('Notes', $note ?: 'No notes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
|
|
|
@ -9,6 +9,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 CheckoutAccessoryNotification extends Notification
|
||||
{
|
||||
|
@ -37,7 +39,13 @@ class CheckoutAccessoryNotification extends Notification
|
|||
{
|
||||
$notifyBy = [];
|
||||
|
||||
if (Setting::getSettings()->webhook_endpoint != '') {
|
||||
if (Setting::getSettings()->webhook_selected == 'microsoft'){
|
||||
|
||||
// return [MicrosoftTeamsChannel::class];
|
||||
$notifyBy[] = MicrosoftTeamsChannel::class;
|
||||
}
|
||||
|
||||
if (Setting::getSettings()->webhook_selected == 'slack') {
|
||||
$notifyBy[] = 'slack';
|
||||
}
|
||||
|
||||
|
@ -96,6 +104,24 @@ class CheckoutAccessoryNotification 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("Accessory Checked Out")
|
||||
->addStartGroupToSection('activityText')
|
||||
->fact(htmlspecialchars_decode($item->present()->name), '', 'activityTitle')
|
||||
->fact('Checked out from ', $item->location->name)
|
||||
->fact(trans('mail.Accessory_Checkout_Notification')." by ", $admin->present()->fullName())
|
||||
->fact('Number Remaining', $item->numRemaining())
|
||||
->fact('Notes', $note ?: 'No notes');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mail representation of the notification.
|
||||
|
|
|
@ -1,10 +1,31 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'acceptance_asset_accepted' => 'A user has accepted an item',
|
||||
'acceptance_asset_declined' => 'A user has declined an item',
|
||||
|
||||
'Accessory_Checkin_Notification' => 'Accessory checked in',
|
||||
'Accessory_Checkout_Notification' => 'Accessory checked out',
|
||||
'Asset_Checkin_Notification' => 'Asset checked in',
|
||||
'Asset_Checkout_Notification' => 'Asset checked out',
|
||||
'Confirm_Accessory_Checkin' => 'Accessory checkin confirmation',
|
||||
'Confirm_Asset_Checkin' => 'Asset checkin confirmation',
|
||||
'Confirm_accessory_delivery' => 'Accessory delivery confirmation',
|
||||
'Confirm_asset_delivery' => 'Asset delivery confirmation',
|
||||
'Confirm_consumable_delivery' => 'Consumable delivery confirmation',
|
||||
'Confirm_license_delivery' => 'License delivery confirmation',
|
||||
'Days' => 'Days',
|
||||
'Expected_Checkin_Date' => 'An asset checked out to you is due to be checked back in on :date',
|
||||
'Expected_Checkin_Notification' => 'Reminder: :name checkin deadline approaching',
|
||||
'Expected_Checkin_Report' => 'Expected asset checkin report',
|
||||
'Expiring_Assets_Report' => 'Expiring Assets Report.',
|
||||
'Expiring_Licenses_Report' => 'Expiring Licenses Report.',
|
||||
'Item_Request_Canceled' => 'Item Request Canceled',
|
||||
'Item_Requested' => 'Item Requested',
|
||||
'License_Checkin_Notification' => 'License checked in',
|
||||
'Low_Inventory_Report' => 'Low Inventory Report',
|
||||
'a_user_canceled' => 'A user has canceled an item request on the website',
|
||||
'a_user_requested' => 'A user has requested an item on the website',
|
||||
'acceptance_asset_accepted' => 'A user has accepted an item',
|
||||
'acceptance_asset_declined' => 'A user has declined an item',
|
||||
'accessory_name' => 'Accessory Name:',
|
||||
'additional_notes' => 'Additional Notes:',
|
||||
'admin_has_created' => 'An administrator has created an account for you on the :web website.',
|
||||
|
@ -12,59 +33,46 @@ return [
|
|||
'asset_name' => 'Asset Name:',
|
||||
'asset_requested' => 'Asset requested',
|
||||
'asset_tag' => 'Asset Tag',
|
||||
'assets_warrantee_alert' => 'There is :count asset with a warranty expiring in the next :threshold days.|There are :count assets with warranties expiring in the next :threshold days.',
|
||||
'assigned_to' => 'Assigned To',
|
||||
'best_regards' => 'Best regards,',
|
||||
'canceled' => 'Canceled:',
|
||||
'checkin_date' => 'Checkin Date:',
|
||||
'checkout_date' => 'Checkout Date:',
|
||||
'click_to_confirm' => 'Please click on the following link to confirm your :web account:',
|
||||
'click_on_the_link_accessory' => 'Please click on the link at the bottom to confirm that you have received the accessory.',
|
||||
'click_on_the_link_asset' => 'Please click on the link at the bottom to confirm that you have received the asset.',
|
||||
'Confirm_Asset_Checkin' => 'Asset checkin confirmation',
|
||||
'Confirm_Accessory_Checkin' => 'Accessory checkin confirmation',
|
||||
'Confirm_accessory_delivery' => 'Accessory delivery confirmation',
|
||||
'Confirm_license_delivery' => 'License delivery confirmation',
|
||||
'Confirm_asset_delivery' => 'Asset delivery confirmation',
|
||||
'Confirm_consumable_delivery' => 'Consumable delivery confirmation',
|
||||
'click_to_confirm' => 'Please click on the following link to confirm your :web account:',
|
||||
'current_QTY' => 'Current QTY',
|
||||
'Days' => 'Days',
|
||||
'days' => 'Days',
|
||||
'expecting_checkin_date' => 'Expected Checkin Date:',
|
||||
'expires' => 'Expires',
|
||||
'Expiring_Assets_Report' => 'Expiring Assets Report.',
|
||||
'Expiring_Licenses_Report' => 'Expiring Licenses Report.',
|
||||
'hello' => 'Hello',
|
||||
'hi' => 'Hi',
|
||||
'i_have_read' => 'I have read and agree to the terms of use, and have received this item.',
|
||||
'item' => 'Item:',
|
||||
'Item_Request_Canceled' => 'Item Request Canceled',
|
||||
'Item_Requested' => 'Item Requested',
|
||||
'link_to_update_password' => 'Please click on the following link to update your :web password:',
|
||||
'login_first_admin' => 'Login to your new Snipe-IT installation using the credentials below:',
|
||||
'login' => 'Login:',
|
||||
'Low_Inventory_Report' => 'Low Inventory Report',
|
||||
'inventory_report' => 'Inventory Report',
|
||||
'item' => 'Item:',
|
||||
'license_expiring_alert' => 'There is :count license expiring in the next :threshold days.|There are :count licenses expiring in the next :threshold days.',
|
||||
'link_to_update_password' => 'Please click on the following link to update your :web password:',
|
||||
'login' => 'Login:',
|
||||
'login_first_admin' => 'Login to your new Snipe-IT installation using the credentials below:',
|
||||
'low_inventory_alert' => 'There is :count item that is below minimum inventory or will soon be low.|There are :count items that are below minimum inventory or will soon be low.',
|
||||
'min_QTY' => 'Min QTY',
|
||||
'name' => 'Name',
|
||||
'new_item_checked' => 'A new item has been checked out under your name, details are below.',
|
||||
'password' => 'Password:',
|
||||
'password_reset' => 'Password Reset',
|
||||
|
||||
'read_the_terms' => 'Please read the terms of use below.',
|
||||
'read_the_terms_and_click' => 'Please read the terms of use below, and click on the link at the bottom to confirm that you read
|
||||
and agree to the terms of use, and have received the asset.',
|
||||
'read_the_terms_and_click' => 'Please read the terms of use below, and click on the link at the bottom to confirm that you read and agree to the terms of use, and have received the asset.',
|
||||
'requested' => 'Requested:',
|
||||
'reset_link' => 'Your Password Reset Link',
|
||||
'reset_password' => 'Click here to reset your password:',
|
||||
'rights_reserved' => 'All rights reserved.',
|
||||
'serial' => 'Serial',
|
||||
'supplier' => 'Supplier',
|
||||
'tag' => 'Tag',
|
||||
'test_email' => 'Test Email from Snipe-IT',
|
||||
'test_mail_text' => 'This is a test from the Snipe-IT Asset Management System. If you got this, mail is working :)',
|
||||
'the_following_item' => 'The following item has been checked in: ',
|
||||
'low_inventory_alert' => 'There is :count item that is below minimum inventory or will soon be low.|There are :count items that are below minimum inventory or will soon be low.',
|
||||
'assets_warrantee_alert' => 'There is :count asset with a warranty expiring in the next :threshold days.|There are :count assets with warranties expiring in the next :threshold days.',
|
||||
'license_expiring_alert' => 'There is :count license expiring in the next :threshold days.|There are :count licenses expiring in the next :threshold days.',
|
||||
'to_reset' => 'To reset your :web password, complete this form:',
|
||||
'type' => 'Type',
|
||||
'upcoming-audits' => 'There is :count asset that is coming up for audit within :threshold days.|There are :count assets that are coming up for audit within :threshold days.',
|
||||
|
@ -72,14 +80,6 @@ return [
|
|||
'username' => 'Username',
|
||||
'welcome' => 'Welcome :name',
|
||||
'welcome_to' => 'Welcome to :web!',
|
||||
'your_credentials' => 'Your Snipe-IT credentials',
|
||||
'Accessory_Checkin_Notification' => 'Accessory checked in',
|
||||
'Asset_Checkin_Notification' => 'Asset checked in',
|
||||
'Asset_Checkout_Notification' => 'Asset checked out',
|
||||
'License_Checkin_Notification' => 'License checked in',
|
||||
'Expected_Checkin_Report' => 'Expected asset checkin report',
|
||||
'Expected_Checkin_Notification' => 'Reminder: :name checkin deadline approaching',
|
||||
'Expected_Checkin_Date' => 'An asset checked out to you is due to be checked back in on :date',
|
||||
'your_assets' => 'View Your Assets',
|
||||
'rights_reserved' => 'All rights reserved.',
|
||||
'your_credentials' => 'Your Snipe-IT credentials',
|
||||
];
|
||||
|
|
Loading…
Reference in a new issue