diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php index 9f4281bd4648..8550340a21b3 100644 --- a/app/Console/Commands/LdapSync.php +++ b/app/Console/Commands/LdapSync.php @@ -2,6 +2,7 @@ namespace App\Console\Commands; +use App\Models\Asset; use App\Models\Department; use App\Models\Group; use Illuminate\Console\Command; @@ -418,6 +419,8 @@ public function handle() if ($item['createorupdate'] === 'created' && $ldap_default_group) { $user->groups()->attach($ldap_default_group); } + //updates assets location based on user's location + Asset::where('assigned_to', '=', $user->id)->update(['location_id' => $user->location_id]); } else { foreach ($user->getErrors()->getMessages() as $key => $err) { diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 8fa96acb6a32..aa857784b74b 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -175,8 +175,14 @@ public function onCheckedIn($event) // Send Webhook notification try { if ($this->shouldSendWebhookNotification()) { + if (Setting::getSettings()->webhook_selected === 'microsoft') { + $message = $this->getCheckinNotification($event)->toMicrosoftTeams(); + $notification = new TeamsNotification(Setting::getSettings()->webhook_endpoint); + $notification->success()->sendMessage($message[0], $message[1]); // Send the message to Microsoft Teams + } else { Notification::route(Setting::getSettings()->webhook_selected, Setting::getSettings()->webhook_endpoint) ->notify($this->getCheckinNotification($event)); + } } } catch (ClientException $e) { Log::warning("Exception caught during checkin notification: " . $e->getMessage()); diff --git a/app/Livewire/Importer.php b/app/Livewire/Importer.php index 65f0d10fc9ec..5ffd3b1f4d24 100644 --- a/app/Livewire/Importer.php +++ b/app/Livewire/Importer.php @@ -79,6 +79,9 @@ private function getColumns($type) case 'accessory': $results = $this->accessories_fields; break; + case 'consumable': + $results = $this->consumables_fields; + break; case 'component': $results = $this->components_fields; break; @@ -88,6 +91,9 @@ private function getColumns($type) case 'license': $results = $this->licenses_fields; break; + case 'user': + $results = $this->users_fields; + break; case 'location': $results = $this->locations_fields; break; @@ -527,9 +533,6 @@ public function mount() foreach ($this->importTypes as $type => $name) { $this->columnOptions[$type] = $this->getColumns($type); } - if ($this->activeFile) { - $this->field_map = $this->activeFile->field_map ? array_values($this->activeFile->field_map) : []; - } } public function selectFile($id) @@ -586,6 +589,7 @@ public function destroy($id) $this->message_type = 'success'; unset($this->files); + return; } diff --git a/app/Livewire/SlackSettingsForm.php b/app/Livewire/SlackSettingsForm.php index 64196b5dd9b9..767838789669 100644 --- a/app/Livewire/SlackSettingsForm.php +++ b/app/Livewire/SlackSettingsForm.php @@ -114,6 +114,9 @@ public function updatedWebhookSelected() { $this->webhook_channel = '#NA'; } } + public function updatedwebhookEndpoint() { + $this->teams_webhook_deprecated = !Str::contains($this->webhook_endpoint, 'workflows'); + } private function isButtonDisabled() { if (empty($this->webhook_endpoint)) { diff --git a/database/factories/ImportFactory.php b/database/factories/ImportFactory.php index 79435a640b7e..0b0f79aa44fb 100644 --- a/database/factories/ImportFactory.php +++ b/database/factories/ImportFactory.php @@ -143,23 +143,4 @@ public function users() return $attributes; }); } - - /** - * Create an asset model import type. - * - * @return static - */ - public function assetmodel() - { - return $this->state(function (array $attributes) { - $fileBuilder = Importing\AssetModelsImportFileBuilder::new(); - - $attributes['name'] = "{$attributes['name']} Asset Model"; - $attributes['import_type'] = 'assetmodel'; - $attributes['header_row'] = $fileBuilder->toCsv()[0]; - $attributes['first_row'] = $fileBuilder->firstRow(); - - return $attributes; - }); - } }