Skip to content

A free open source IT asset/license management system

Fixed #15035 - adds company to slack message

snipead6352adc47f
diff --git a/app/Notifications/CheckinAccessoryNotification.php b/app/Notifications/CheckinAccessoryNotification.php
index 28e6c054f7..5354775d7e 100644
--- a/app/Notifications/CheckinAccessoryNotification.php
+++ b/app/Notifications/CheckinAccessoryNotification.php
@@ -73,10 +73,18 @@ class CheckinAccessoryNotification extends Notification
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
$fields = [
- 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
- 'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
+ trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
+ trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
];
+ if ($item->location) {
+ $fields[trans('general.location')] = $item->location->name;
+ }
+
+ if ($item->company) {
+ $fields[trans('general.company')] = $item->company->name;
+ }
+
return (new SlackMessage)
->content(':arrow_down: :keyboard: '.trans('mail.Accessory_Checkin_Notification'))
->from($botname)
diff --git a/app/Notifications/CheckinAssetNotification.php b/app/Notifications/CheckinAssetNotification.php
index c6828ef8e9..5de3ff1be8 100644
--- a/app/Notifications/CheckinAssetNotification.php
+++ b/app/Notifications/CheckinAssetNotification.php
@@ -83,6 +83,15 @@ class CheckinAssetNotification extends Notification
trans('general.location') => ($item->location) ? $item->location->name : '',
];
+ if ($item->location) {
+ $fields[trans('general.location')] = $item->location->name;
+ }
+
+ if ($item->company) {
+ $fields[trans('general.company')] = $item->company->name;
+ }
+
+
return (new SlackMessage)
->content(':arrow_down: :computer: '.trans('mail.Asset_Checkin_Notification'))
->from($botname)
diff --git a/app/Notifications/CheckinLicenseSeatNotification.php b/app/Notifications/CheckinLicenseSeatNotification.php
index 1cb8706e67..07c3308dbc 100644
--- a/app/Notifications/CheckinLicenseSeatNotification.php
+++ b/app/Notifications/CheckinLicenseSeatNotification.php
@@ -77,9 +77,18 @@ class CheckinLicenseSeatNotification extends Notification
if ($admin) {
$fields = [
- 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
- 'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
+ trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
+ trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
];
+
+ if ($item->location) {
+ $fields[trans('general.location')] = $item->location->name;
+ }
+
+ if ($item->company) {
+ $fields[trans('general.company')] = $item->company->name;
+ }
+
} else {
$fields = [
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
diff --git a/app/Notifications/CheckoutAccessoryNotification.php b/app/Notifications/CheckoutAccessoryNotification.php
index 116a5ac29f..016bfc526c 100644
--- a/app/Notifications/CheckoutAccessoryNotification.php
+++ b/app/Notifications/CheckoutAccessoryNotification.php
@@ -100,10 +100,18 @@ class CheckoutAccessoryNotification extends Notification
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
$fields = [
- 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
- 'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
+ trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
+ trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
];
+ if ($item->location) {
+ $fields[trans('general.location')] = $item->location->name;
+ }
+
+ if ($item->company) {
+ $fields[trans('general.company')] = $item->company->name;
+ }
+
return (new SlackMessage)
->content(':arrow_up: :keyboard: Accessory Checked Out')
->from($botname)
diff --git a/app/Notifications/CheckoutAssetNotification.php b/app/Notifications/CheckoutAssetNotification.php
index 61499e62f2..8cdfbdd046 100644
--- a/app/Notifications/CheckoutAssetNotification.php
+++ b/app/Notifications/CheckoutAssetNotification.php
@@ -93,12 +93,20 @@ class CheckoutAssetNotification extends Notification
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
$fields = [
- 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
- 'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
+ trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
+ trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
];
+ if ($item->location) {
+ $fields[trans('general.location')] = $item->location->name;
+ }
+
+ if ($item->company) {
+ $fields[trans('general.company')] = $item->company->name;
+ }
+
if (($this->expected_checkin) && ($this->expected_checkin !== '')) {
- $fields['Expected Checkin'] = $this->expected_checkin;
+ $fields[trans('general.expected_checkin')] = $this->expected_checkin;
}
return (new SlackMessage)
diff --git a/app/Notifications/CheckoutConsumableNotification.php b/app/Notifications/CheckoutConsumableNotification.php
index ba7c5646ab..e8db8b8bd1 100644
--- a/app/Notifications/CheckoutConsumableNotification.php
+++ b/app/Notifications/CheckoutConsumableNotification.php
@@ -80,10 +80,18 @@ class CheckoutConsumableNotification extends Notification
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
$fields = [
- 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
- 'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
+ trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
+ trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
];
+ if ($item->location) {
+ $fields[trans('general.location')] = $item->location->name;
+ }
+
+ if ($item->company) {
+ $fields[trans('general.company')] = $item->company->name;
+ }
+
return (new SlackMessage)
->content(':arrow_up: :paperclip: Consumable Checked Out')
->from($botname)
diff --git a/app/Notifications/CheckoutLicenseSeatNotification.php b/app/Notifications/CheckoutLicenseSeatNotification.php
index 1aed0d2004..fa00421885 100644
--- a/app/Notifications/CheckoutLicenseSeatNotification.php
+++ b/app/Notifications/CheckoutLicenseSeatNotification.php
@@ -78,10 +78,18 @@ class CheckoutLicenseSeatNotification extends Notification
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
$fields = [
- 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
- 'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
+ trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
+ trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
];
+ if ($item->location) {
+ $fields[trans('general.location')] = $item->location->name;
+ }
+
+ if ($item->company) {
+ $fields[trans('general.company')] = $item->company->name;
+ }
+
return (new SlackMessage)
->content(':arrow_up: :floppy_disk: License Checked Out')
->from($botname)
diff --git a/resources/lang/en-US/general.php b/resources/lang/en-US/general.php
index c785fa2606..3a84d2412f 100644
--- a/resources/lang/en-US/general.php
+++ b/resources/lang/en-US/general.php
@@ -574,6 +574,8 @@ return [
'user_managed_passwords' => 'Password Management',
'user_managed_passwords_disallow' => 'Disallow users from managing their own passwords',
'user_managed_passwords_allow' => 'Allow users to manage their own passwords',
+ 'from' => 'From',
+ 'by' => 'By',
// Add form placeholders here
'placeholders' => [