A free open source IT asset/license management system
add a check for audit notification variables in MS Teams and a translation
Godfrey Mdd742a2e4ae3
diff --git a/app/Notifications/AuditNotification.php b/app/Notifications/AuditNotification.phpindex a7056e8cbd..47dfde30ee 100644--- a/app/Notifications/AuditNotification.php+++ b/app/Notifications/AuditNotification.php@@ -57,7 +57,7 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;$channel = ($this->settings->webhook_channel) ? $this->settings->webhook_channel : '';return (new SlackMessage)->success()- ->content(class_basename(get_class($this->params['item'])).' Audited')+ ->content(class_basename(get_class($this->params['item'])).' '.trans('general.audited'))->from(($this->settings->webhook_botname) ? $this->settings->webhook_botname : 'Snipe-Bot')->to($channel)->attachment(function ($attachment) {@@ -76,17 +76,17 @@ use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;public static function toMicrosoftTeams($params){- $item = $params['item'];- $admin_user = $params['admin'];- $note = $params['note'];- $location = $params['location'];+ $item = $params['item'] ?? null;+ $admin_user = $params['admin'] ?? null;+ $note = $params['note'] ?? '';+ $location = $params['location'] ?? '';$setting = Setting::getSettings();if(!Str::contains($setting->webhook_endpoint, 'workflows')) {return MicrosoftTeamsMessage::create()->to($setting->webhook_endpoint)->type('success')- ->title(class_basename(get_class($params['item'])) . ' Audited')+ ->title(class_basename(get_class($params['item'])) .' '.trans('general.audited'))->addStartGroupToSection('activityText')->fact(trans('mail.asset'), $item)->fact(trans('general.administrator'), $admin_user->present()->viewUrl() . '|' . $admin_user->present()->fullName());diff --git a/resources/lang/en-US/general.php b/resources/lang/en-US/general.phpindex e4bc2ad232..1d501ee616 100644--- a/resources/lang/en-US/general.php+++ b/resources/lang/en-US/general.php@@ -36,6 +36,7 @@ return ['accept_assets_menu' => 'Accept Assets','accept_item' => 'Accept Item','audit' => 'Audit',+ 'audited' => 'Audited','audits' => 'Audits','audit_report' => 'Audit Log','assets' => 'Assets',