Skip to content

Commit 1a11202

Browse files
authored
Merge pull request #16765 from grokability/#15035-add-company_name_to_slack
Fixed #15035 - adds company to slack message
2 parents 4170397 + ad6352a commit 1a11202

8 files changed

+73
-13
lines changed

app/Notifications/CheckinAccessoryNotification.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,18 @@ public function toSlack()
7373
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
7474

7575
$fields = [
76-
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
77-
'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
76+
trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
77+
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
7878
];
7979

80+
if ($item->location) {
81+
$fields[trans('general.location')] = $item->location->name;
82+
}
83+
84+
if ($item->company) {
85+
$fields[trans('general.company')] = $item->company->name;
86+
}
87+
8088
return (new SlackMessage)
8189
->content(':arrow_down: :keyboard: '.trans('mail.Accessory_Checkin_Notification'))
8290
->from($botname)

app/Notifications/CheckinAssetNotification.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,15 @@ public function toSlack()
8383
trans('general.location') => ($item->location) ? $item->location->name : '',
8484
];
8585

86+
if ($item->location) {
87+
$fields[trans('general.location')] = $item->location->name;
88+
}
89+
90+
if ($item->company) {
91+
$fields[trans('general.company')] = $item->company->name;
92+
}
93+
94+
8695
return (new SlackMessage)
8796
->content(':arrow_down: :computer: '.trans('mail.Asset_Checkin_Notification'))
8897
->from($botname)

app/Notifications/CheckinLicenseSeatNotification.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,18 @@ public function toSlack()
7777

7878
if ($admin) {
7979
$fields = [
80-
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
81-
'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
80+
trans('general.from') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
81+
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
8282
];
83+
84+
if ($item->location) {
85+
$fields[trans('general.location')] = $item->location->name;
86+
}
87+
88+
if ($item->company) {
89+
$fields[trans('general.company')] = $item->company->name;
90+
}
91+
8392
} else {
8493
$fields = [
8594
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',

app/Notifications/CheckoutAccessoryNotification.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,18 @@ public function toSlack()
100100
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
101101

102102
$fields = [
103-
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
104-
'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
103+
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
104+
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
105105
];
106106

107+
if ($item->location) {
108+
$fields[trans('general.location')] = $item->location->name;
109+
}
110+
111+
if ($item->company) {
112+
$fields[trans('general.company')] = $item->company->name;
113+
}
114+
107115
return (new SlackMessage)
108116
->content(':arrow_up: :keyboard: Accessory Checked Out')
109117
->from($botname)

app/Notifications/CheckoutAssetNotification.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,20 @@ public function toSlack() :SlackMessage
9393
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
9494

9595
$fields = [
96-
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
97-
'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
96+
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
97+
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
9898
];
9999

100+
if ($item->location) {
101+
$fields[trans('general.location')] = $item->location->name;
102+
}
103+
104+
if ($item->company) {
105+
$fields[trans('general.company')] = $item->company->name;
106+
}
107+
100108
if (($this->expected_checkin) && ($this->expected_checkin !== '')) {
101-
$fields['Expected Checkin'] = $this->expected_checkin;
109+
$fields[trans('general.expected_checkin')] = $this->expected_checkin;
102110
}
103111

104112
return (new SlackMessage)

app/Notifications/CheckoutConsumableNotification.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,18 @@ public function toSlack()
8080
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
8181

8282
$fields = [
83-
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
84-
'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
83+
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
84+
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
8585
];
8686

87+
if ($item->location) {
88+
$fields[trans('general.location')] = $item->location->name;
89+
}
90+
91+
if ($item->company) {
92+
$fields[trans('general.company')] = $item->company->name;
93+
}
94+
8795
return (new SlackMessage)
8896
->content(':arrow_up: :paperclip: Consumable Checked Out')
8997
->from($botname)

app/Notifications/CheckoutLicenseSeatNotification.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,18 @@ public function toSlack()
7878
$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';
7979

8080
$fields = [
81-
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
82-
'By' => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
81+
trans('general.to') => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',
82+
trans('general.by') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',
8383
];
8484

85+
if ($item->location) {
86+
$fields[trans('general.location')] = $item->location->name;
87+
}
88+
89+
if ($item->company) {
90+
$fields[trans('general.company')] = $item->company->name;
91+
}
92+
8593
return (new SlackMessage)
8694
->content(':arrow_up: :floppy_disk: License Checked Out')
8795
->from($botname)

resources/lang/en-US/general.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,8 @@
574574
'user_managed_passwords' => 'Password Management',
575575
'user_managed_passwords_disallow' => 'Disallow users from managing their own passwords',
576576
'user_managed_passwords_allow' => 'Allow users to manage their own passwords',
577+
'from' => 'From',
578+
'by' => 'By',
577579

578580
// Add form placeholders here
579581
'placeholders' => [

0 commit comments

Comments
 (0)