Skip to content

A free open source IT asset/license management system

Squashed commit of the following:

snipe3d3e3a955786
diff --git a/app/Console/Commands/LdapSync.php b/app/Console/Commands/LdapSync.php
index 9f4281bd46..8550340a21 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 @@ class LdapSync extends Command
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 8fa96acb6a..aa857784b7 100644
--- a/app/Listeners/CheckoutableListener.php
+++ b/app/Listeners/CheckoutableListener.php
@@ -175,8 +175,14 @@ class CheckoutableListener
// 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 65f0d10fc9..5ffd3b1f4d 100644
--- a/app/Livewire/Importer.php
+++ b/app/Livewire/Importer.php
@@ -79,6 +79,9 @@ class Importer extends Component
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 @@ class Importer extends Component
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 @@ class Importer extends Component
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 @@ class Importer extends Component
$this->message_type = 'success';
unset($this->files);
+
return;
}
diff --git a/app/Livewire/SlackSettingsForm.php b/app/Livewire/SlackSettingsForm.php
index 64196b5dd9..7678387896 100644
--- a/app/Livewire/SlackSettingsForm.php
+++ b/app/Livewire/SlackSettingsForm.php
@@ -114,6 +114,9 @@ class SlackSettingsForm extends Component
$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 79435a640b..0b0f79aa44 100644
--- a/database/factories/ImportFactory.php
+++ b/database/factories/ImportFactory.php
@@ -143,23 +143,4 @@ class ImportFactory extends Factory
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;
- });
- }
}