Merge remote-tracking branch 'origin/develop'

This commit is contained in:
snipe 2023-03-23 10:55:58 -07:00
commit b91e914a61
21 changed files with 51 additions and 47 deletions

View file

@ -83,9 +83,9 @@ class Setting extends Model
'email_domain', 'email_domain',
'email_format', 'email_format',
'username_format', 'username_format',
'slack_endpoint', 'webhook_endpoint',
'slack_channel', 'webhook_channel',
'slack_botname', 'webhook_botname',
]; ];
/** /**
@ -265,7 +265,7 @@ class Setting extends Model
{ {
// At this point the endpoint is the same for everything. // At this point the endpoint is the same for everything.
// In the future this may want to be adapted for individual notifications. // In the future this may want to be adapted for individual notifications.
return self::getSettings()->slack_endpoint; return self::getSettings()->webhook_endpoint;
} }
/** /**

View file

@ -272,7 +272,7 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo
{ {
// At this point the endpoint is the same for everything. // At this point the endpoint is the same for everything.
// In the future this may want to be adapted for individual notifications. // In the future this may want to be adapted for individual notifications.
$this->endpoint = \App\Models\Setting::getSettings()->slack_endpoint; $this->endpoint = \App\Models\Setting::getSettings()->webhook_endpoint;
return $this->endpoint; return $this->endpoint;
} }

View file

@ -34,7 +34,7 @@ class AuditNotification extends Notification
public function via() public function via()
{ {
$notifyBy = []; $notifyBy = [];
if (Setting::getSettings()->slack_endpoint) { if (Setting::getSettings()->webhook_endpoint) {
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }

View file

@ -39,11 +39,7 @@ class CheckinAccessoryNotification extends Notification
\Log::debug('via called'); \Log::debug('via called');
$notifyBy = []; $notifyBy = [];
if (Setting::getSettings()->slack_endpoint) { if (Setting::getSettings()->webhook_endpoint != '') {
$notifyBy[] = 'slack';
}
if (Setting::getSettings()->slack_endpoint != '') {
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }
@ -95,7 +91,7 @@ class CheckinAccessoryNotification extends Notification
$admin = $this->admin; $admin = $this->admin;
$item = $this->item; $item = $this->item;
$note = $this->note; $note = $this->note;
$botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot'; $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [ $fields = [
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>', 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',

View file

@ -43,9 +43,8 @@ class CheckinAssetNotification extends Notification
public function via() public function via()
{ {
$notifyBy = []; $notifyBy = [];
if (Setting::getSettings()->webhook_endpoint != '') {
if (Setting::getSettings()->slack_endpoint != '') { \Log::debug('use webhook');
\Log::debug('use slack');
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }
@ -65,7 +64,7 @@ class CheckinAssetNotification extends Notification
$admin = $this->admin; $admin = $this->admin;
$item = $this->item; $item = $this->item;
$note = $this->note; $note = $this->note;
$botname = ($this->settings->slack_botname != '') ? $this->settings->slack_botname : 'Snipe-Bot'; $botname = ($this->settings->webhook_botname != '') ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [ $fields = [
trans('general.administrator') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>', trans('general.administrator') => '<'.$admin->present()->viewUrl().'|'.$admin->present()->fullName().'>',

View file

@ -41,7 +41,7 @@ class CheckinLicenseSeatNotification extends Notification
{ {
$notifyBy = []; $notifyBy = [];
if (Setting::getSettings()->slack_endpoint != '') { if (Setting::getSettings()->webhook_endpoint != '') {
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }
@ -62,7 +62,7 @@ class CheckinLicenseSeatNotification extends Notification
$admin = $this->admin; $admin = $this->admin;
$item = $this->item; $item = $this->item;
$note = $this->note; $note = $this->note;
$botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot'; $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
if ($admin) { if ($admin) {
$fields = [ $fields = [

View file

@ -37,7 +37,7 @@ class CheckoutAccessoryNotification extends Notification
{ {
$notifyBy = []; $notifyBy = [];
if (Setting::getSettings()->slack_endpoint != '') { if (Setting::getSettings()->webhook_endpoint != '') {
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }
@ -78,7 +78,7 @@ class CheckoutAccessoryNotification extends Notification
$admin = $this->admin; $admin = $this->admin;
$item = $this->item; $item = $this->item;
$note = $this->note; $note = $this->note;
$botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot'; $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [ $fields = [
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>', 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',

View file

@ -53,8 +53,8 @@ class CheckoutAssetNotification extends Notification
{ {
$notifyBy = []; $notifyBy = [];
if ((Setting::getSettings()) && (Setting::getSettings()->slack_endpoint != '')) { if ((Setting::getSettings()) && (Setting::getSettings()->webhook_endpoint != '')) {
\Log::debug('use slack'); \Log::debug('use webhook');
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }
@ -95,7 +95,7 @@ class CheckoutAssetNotification extends Notification
$admin = $this->admin; $admin = $this->admin;
$item = $this->item; $item = $this->item;
$note = $this->note; $note = $this->note;
$botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot'; $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [ $fields = [
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>', 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',

View file

@ -43,7 +43,7 @@ class CheckoutConsumableNotification extends Notification
{ {
$notifyBy = []; $notifyBy = [];
if (Setting::getSettings()->slack_endpoint != '') { if (Setting::getSettings()->webhook_endpoint != '') {
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }
@ -84,7 +84,7 @@ class CheckoutConsumableNotification extends Notification
$admin = $this->admin; $admin = $this->admin;
$item = $this->item; $item = $this->item;
$note = $this->note; $note = $this->note;
$botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot'; $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [ $fields = [
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>', 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',

View file

@ -43,7 +43,7 @@ class CheckoutLicenseSeatNotification extends Notification
{ {
$notifyBy = []; $notifyBy = [];
if (Setting::getSettings()->slack_endpoint != '') { if (Setting::getSettings()->webhook_endpoint != '') {
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }
@ -84,7 +84,7 @@ class CheckoutLicenseSeatNotification extends Notification
$admin = $this->admin; $admin = $this->admin;
$item = $this->item; $item = $this->item;
$note = $this->note; $note = $this->note;
$botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot'; $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [ $fields = [
'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>', 'To' => '<'.$target->present()->viewUrl().'|'.$target->present()->fullName().'>',

View file

@ -57,8 +57,8 @@ class RequestAssetCancelation extends Notification
{ {
$notifyBy = []; $notifyBy = [];
if (Setting::getSettings()->slack_endpoint != '') { if (Setting::getSettings()->webhook_endpoint != '') {
\Log::debug('use slack'); \Log::debug('use webhook');
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }
@ -73,7 +73,7 @@ class RequestAssetCancelation extends Notification
$item = $this->item; $item = $this->item;
$note = $this->note; $note = $this->note;
$qty = $this->item_quantity; $qty = $this->item_quantity;
$botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot'; $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [ $fields = [
'QTY' => $qty, 'QTY' => $qty,

View file

@ -58,7 +58,7 @@ class RequestAssetNotification extends Notification
{ {
$notifyBy = []; $notifyBy = [];
if (Setting::getSettings()->slack_endpoint != '') { if (Setting::getSettings()->webhook_endpoint != '') {
$notifyBy[] = 'slack'; $notifyBy[] = 'slack';
} }
@ -73,7 +73,7 @@ class RequestAssetNotification extends Notification
$qty = $this->item_quantity; $qty = $this->item_quantity;
$item = $this->item; $item = $this->item;
$note = $this->note; $note = $this->note;
$botname = ($this->settings->slack_botname) ? $this->settings->slack_botname : 'Snipe-Bot'; $botname = ($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot';
$fields = [ $fields = [
'QTY' => $qty, 'QTY' => $qty,

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 766 B

View file

@ -42,5 +42,6 @@ return [
'error_messages' => 'Error messages:', 'error_messages' => 'Error messages:',
'success_messages' => 'Success messages:', 'success_messages' => 'Success messages:',
'alert_details' => 'Please see below for details.', 'alert_details' => 'Please see below for details.',
'custom_export' => 'Custom Export' 'custom_export' => 'Custom Export',
'mfg_warranty_lookup' => ':manufacturer Warranty Status Lookup',
]; ];

View file

@ -253,7 +253,7 @@ return [
'signature' => 'Signature', 'signature' => 'Signature',
'signed_off_by' => 'Signed Off By', 'signed_off_by' => 'Signed Off By',
'skin' => 'Skin', 'skin' => 'Skin',
'webhook_msg_note' => 'A :app message will be sent', 'webhook_msg_note' => 'A notification will be sent via webhook',
'webhook_test_msg' => 'Oh hai! Looks like your :app integration with Snipe-IT is working!', 'webhook_test_msg' => 'Oh hai! Looks like your :app integration with Snipe-IT is working!',
'some_features_disabled' => 'DEMO MODE: Some features are disabled for this installation.', 'some_features_disabled' => 'DEMO MODE: Some features are disabled for this installation.',
'site_name' => 'Site Name', 'site_name' => 'Site Name',

View file

@ -54,7 +54,7 @@
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'assigned_to']) @include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'assigned_to'])
@if ($accessory->requireAcceptance() || $accessory->getEula() || ($snipeSettings->slack_endpoint!='')) @if ($accessory->requireAcceptance() || $accessory->getEula() || ($snipeSettings->webhook_endpoint!=''))
<div class="form-group notification-callout"> <div class="form-group notification-callout">
<div class="col-md-8 col-md-offset-3"> <div class="col-md-8 col-md-offset-3">
<div class="callout callout-info"> <div class="callout callout-info">
@ -71,9 +71,9 @@
<br> <br>
@endif @endif
@if ($snipeSettings->slack_endpoint!='') @if ($snipeSettings->webhook_endpoint!='')
<i class="fab fa-slack"></i> <i class="fab fa-slack"></i>
A slack message will be sent {{ trans('general.webhook_msg_note') }}
@endif @endif
</div> </div>
</div> </div>

View file

@ -41,7 +41,7 @@
@include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'assigned_to', 'required'=> 'true']) @include ('partials.forms.edit.user-select', ['translated_name' => trans('general.select_user'), 'fieldname' => 'assigned_to', 'required'=> 'true'])
@if ($consumable->requireAcceptance() || $consumable->getEula() || ($snipeSettings->slack_endpoint!='')) @if ($consumable->requireAcceptance() || $consumable->getEula() || ($snipeSettings->webhook_endpoint!=''))
<div class="form-group notification-callout"> <div class="form-group notification-callout">
<div class="col-md-8 col-md-offset-3"> <div class="col-md-8 col-md-offset-3">
<div class="callout callout-info"> <div class="callout callout-info">
@ -58,9 +58,9 @@
<br> <br>
@endif @endif
@if ($snipeSettings->slack_endpoint!='') @if ($snipeSettings->webhook_endpoint!='')
<i class="fab fa-slack"></i> <i class="fab fa-slack"></i>
{{ trans('general.slack_msg_note') }} {{ trans('general.webhook_msg_note') }}
@endif @endif
</div> </div>
</div> </div>

View file

@ -114,7 +114,7 @@
</div> </div>
</div> </div>
@if ($asset->requireAcceptance() || $asset->getEula() || ($snipeSettings->slack_endpoint!='')) @if ($asset->requireAcceptance() || $asset->getEula() || ($snipeSettings->webhook_endpoint!=''))
<div class="form-group notification-callout"> <div class="form-group notification-callout">
<div class="col-md-8 col-md-offset-3"> <div class="col-md-8 col-md-offset-3">
<div class="callout callout-info"> <div class="callout callout-info">
@ -131,9 +131,9 @@
<br> <br>
@endif @endif
@if ($snipeSettings->slack_endpoint!='') @if ($snipeSettings->webhook_endpoint!='')
<i class="fab fa-slack" aria-hidden="true"></i> <i class="fab fa-slack" aria-hidden="true"></i>
{{ trans('general.slack_msg_note')}} {{ trans('general.webhook_msg_note') }}
@endif @endif
</div> </div>
</div> </div>

View file

@ -598,7 +598,15 @@
@if ($asset->serial && $asset->model->manufacturer) @if ($asset->serial && $asset->model->manufacturer)
@if ((strtolower($asset->model->manufacturer->name) == "apple") || (str_starts_with(str_replace(' ','',strtolower($asset->model->manufacturer->name)),"appleinc"))) @if ((strtolower($asset->model->manufacturer->name) == "apple") || (str_starts_with(str_replace(' ','',strtolower($asset->model->manufacturer->name)),"appleinc")))
<a href="https://checkcoverage.apple.com/us/{{ \App\Models\Setting::getSettings()->locale }}/?sn={{ $asset->serial }}" target="_blank"> <a href="https://checkcoverage.apple.com/us/{{ \App\Models\Setting::getSettings()->locale }}/?sn={{ $asset->serial }}" target="_blank">
<i class="fa-brands fa-apple" aria-hidden="true"><span class="sr-only">Applecare Status Lookup</span></i> <i class="fa-brands fa-apple" aria-hidden="true"><span class="sr-only">{{ trans('hardware/general.mfg_warranty_lookup') }}</span></i>
</a>
@elseif ((strtolower($asset->model->manufacturer->name) == "dell") || (str_starts_with(str_replace(' ','',strtolower($asset->model->manufacturer->name)),"dellinc")))
<a href="https://www.dell.com/support/home/en-us?app=warranty" target="_blank">
<img src="/img/demo/manufacturers/dellicon.png" style="width:25px;height:25px;"><span class="sr-only">{{ trans('hardware/general.mfg_warranty_lookup') }}</span></i>
</a>
@elseif ((strtolower($asset->model->manufacturer->name) == "lenovo") || (str_starts_with(str_replace(' ','',strtolower($asset->model->manufacturer->name)),"lenovoinc")))
<a href="https://pcsupport.lenovo.com/us/en/warrantylookup#/" target="_blank">
<img src="/img/demo/manufacturers/lenovoicon.png" style="width:25px;height:25px;"><span class="sr-only">{{ trans('hardware/general.mfg_warranty_lookup') }}</span></i>
</a> </a>
@endif @endif
@endif @endif

View file

@ -65,7 +65,7 @@
</div> </div>
@if ($license->requireAcceptance() || $license->getEula() || ($snipeSettings->slack_endpoint!='')) @if ($license->requireAcceptance() || $license->getEula() || ($snipeSettings->webhook_endpoint!=''))
<div class="form-group notification-callout"> <div class="form-group notification-callout">
<div class="col-md-8 col-md-offset-3"> <div class="col-md-8 col-md-offset-3">
<div class="callout callout-info"> <div class="callout callout-info">
@ -88,9 +88,9 @@
<br> <br>
@endif @endif
@if ($snipeSettings->slack_endpoint!='') @if ($snipeSettings->webhook_endpoint!='')
<i class="fab fa-slack"></i> <i class="fab fa-slack"></i>
{{ trans('general.slack_msg_note') }} {{ trans('general.webhook_msg_note') }}
@endif @endif
</div> </div>
</div> </div>