From c9101f4d9789030936440d8f5c3b0ce2f6c4d339 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Thu, 25 Jan 2024 18:18:24 -0600 Subject: [PATCH 01/12] initial work, not working yet --- app/Http/Controllers/Api/AssetsController.php | 7 ++++++- app/Importer/AssetImporter.php | 3 ++- app/Models/Loggable.php | 12 ++++++++++++ app/Observers/AssetObserver.php | 4 ++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index f5168a5914..3347f6dabc 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -599,7 +599,12 @@ class AssetsController extends Controller $target = Location::find(request('assigned_location')); } if (isset($target)) { - $asset->checkOut($target, Auth::user(), date('Y-m-d H:i:s'), '', 'Checked out on asset creation', e($request->get('name'))); + $asset->checkOut($target, + Auth::user(), + date('Y-m-d H:i:s'), + '', + 'Checked out on asset creation', + e($request->get('name'))); } if ($asset->image) { diff --git a/app/Importer/AssetImporter.php b/app/Importer/AssetImporter.php index cf762a8fd4..870bf6d162 100644 --- a/app/Importer/AssetImporter.php +++ b/app/Importer/AssetImporter.php @@ -138,7 +138,8 @@ class AssetImporter extends ItemImporter if ($asset->save()) { - $asset->logCreate(trans('general.importer.import_note')); + //$asset->logCreate(trans('general.importer.import_note')); + $asset->setImported(true); $this->log('Asset '.$this->item['name'].' with serial number '.$this->item['serial'].' was created'); // If we have a target to checkout to, lets do so. diff --git a/app/Models/Loggable.php b/app/Models/Loggable.php index ce3a07f159..8d63d19882 100644 --- a/app/Models/Loggable.php +++ b/app/Models/Loggable.php @@ -8,6 +8,8 @@ use Illuminate\Support\Facades\Auth; trait Loggable { + public ?bool $imported = false; // Import note attribute + /** * @author Daniel Meltzer * @since [v3.4] @@ -18,6 +20,16 @@ trait Loggable return $this->morphMany(Actionlog::class, 'item'); } + public function setImported(bool $bool): void + { + $this->imported = $bool; + } + + public function getImported(): bool + { + return $this->imported; + } + /** * @author Daniel Meltzer * @since [v3.4] diff --git a/app/Observers/AssetObserver.php b/app/Observers/AssetObserver.php index 2b0955fde6..55cd05471d 100644 --- a/app/Observers/AssetObserver.php +++ b/app/Observers/AssetObserver.php @@ -109,6 +109,10 @@ class AssetObserver $logAction->item_id = $asset->id; $logAction->created_at = date('Y-m-d H:i:s'); $logAction->user_id = Auth::id(); + $logAction->note = 'poop'; + if($asset->getImported()) { + $logAction->note = "this asset was imported"; + } $logAction->logaction('create'); } From 4a7df470f04ae667a87ba3d0d4e65fa894690744 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Thu, 25 Jan 2024 19:34:41 -0600 Subject: [PATCH 02/12] this works --- app/Importer/AssetImporter.php | 5 ++--- app/Models/Loggable.php | 8 ++------ app/Observers/AssetObserver.php | 5 ++--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/app/Importer/AssetImporter.php b/app/Importer/AssetImporter.php index 870bf6d162..312c9b44b2 100644 --- a/app/Importer/AssetImporter.php +++ b/app/Importer/AssetImporter.php @@ -135,11 +135,10 @@ class AssetImporter extends ItemImporter $asset->{$custom_field} = $val; } } - + //this sets an attribute on the Loggable trait for the action log + $asset->setImported(true); if ($asset->save()) { - //$asset->logCreate(trans('general.importer.import_note')); - $asset->setImported(true); $this->log('Asset '.$this->item['name'].' with serial number '.$this->item['serial'].' was created'); // If we have a target to checkout to, lets do so. diff --git a/app/Models/Loggable.php b/app/Models/Loggable.php index 8d63d19882..9e9355ea74 100644 --- a/app/Models/Loggable.php +++ b/app/Models/Loggable.php @@ -8,7 +8,8 @@ use Illuminate\Support\Facades\Auth; trait Loggable { - public ?bool $imported = false; // Import note attribute + // an attribute for setting whether or not the item was imported + public ?bool $imported = false; /** * @author Daniel Meltzer @@ -25,11 +26,6 @@ trait Loggable $this->imported = $bool; } - public function getImported(): bool - { - return $this->imported; - } - /** * @author Daniel Meltzer * @since [v3.4] diff --git a/app/Observers/AssetObserver.php b/app/Observers/AssetObserver.php index 55cd05471d..c94a7046e0 100644 --- a/app/Observers/AssetObserver.php +++ b/app/Observers/AssetObserver.php @@ -109,9 +109,8 @@ class AssetObserver $logAction->item_id = $asset->id; $logAction->created_at = date('Y-m-d H:i:s'); $logAction->user_id = Auth::id(); - $logAction->note = 'poop'; - if($asset->getImported()) { - $logAction->note = "this asset was imported"; + if($asset->imported) { + $logAction->note = trans('general.importer.import_note'); } $logAction->logaction('create'); } From abf13f1619e1ac292b7f1f82996225ee43443125 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Thu, 25 Jan 2024 19:37:59 -0600 Subject: [PATCH 03/12] revert spacing --- app/Http/Controllers/Api/AssetsController.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index 3347f6dabc..f5168a5914 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -599,12 +599,7 @@ class AssetsController extends Controller $target = Location::find(request('assigned_location')); } if (isset($target)) { - $asset->checkOut($target, - Auth::user(), - date('Y-m-d H:i:s'), - '', - 'Checked out on asset creation', - e($request->get('name'))); + $asset->checkOut($target, Auth::user(), date('Y-m-d H:i:s'), '', 'Checked out on asset creation', e($request->get('name'))); } if ($asset->image) { From 3574ef5bb9a4a929d709b65b78f6579935475c02 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Thu, 25 Jan 2024 19:54:53 -0600 Subject: [PATCH 04/12] a few more imports, component sample --- app/Importer/AccessoryImporter.php | 5 ++--- app/Importer/AssetImporter.php | 2 +- app/Importer/ComponentImporter.php | 6 +++--- app/Observers/AccessoryObserver.php | 3 +++ app/Observers/ComponentObserver.php | 3 +++ sample_csvs/components-sample.csv | 2 ++ 6 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 sample_csvs/components-sample.csv diff --git a/app/Importer/AccessoryImporter.php b/app/Importer/AccessoryImporter.php index 9901fb70d7..eb17c5acad 100644 --- a/app/Importer/AccessoryImporter.php +++ b/app/Importer/AccessoryImporter.php @@ -46,10 +46,9 @@ class AccessoryImporter extends ItemImporter $this->item['min_amt'] = $this->findCsvMatch($row, "min_amt"); $accessory->fill($this->sanitizeItemForStoring($accessory)); - //FIXME: this disables model validation. Need to find a way to avoid double-logs without breaking everything. - // $accessory->unsetEventDispatcher(); + // This sets an attribute on the Loggable trait for the action log + $accessory->setImported(true); if ($accessory->save()) { - $accessory->logCreate('Imported using CSV Importer'); $this->log('Accessory '.$this->item['name'].' was created'); return; diff --git a/app/Importer/AssetImporter.php b/app/Importer/AssetImporter.php index 312c9b44b2..e001a383ad 100644 --- a/app/Importer/AssetImporter.php +++ b/app/Importer/AssetImporter.php @@ -135,7 +135,7 @@ class AssetImporter extends ItemImporter $asset->{$custom_field} = $val; } } - //this sets an attribute on the Loggable trait for the action log + // This sets an attribute on the Loggable trait for the action log $asset->setImported(true); if ($asset->save()) { diff --git a/app/Importer/ComponentImporter.php b/app/Importer/ComponentImporter.php index 71ded1b0e5..f72d4cbfd7 100644 --- a/app/Importer/ComponentImporter.php +++ b/app/Importer/ComponentImporter.php @@ -48,10 +48,10 @@ class ComponentImporter extends ItemImporter $this->log('No matching component, creating one'); $component = new Component; $component->fill($this->sanitizeItemForStoring($component)); - //FIXME: this disables model validation. Need to find a way to avoid double-logs without breaking everything. - $component->unsetEventDispatcher(); + + // This sets an attribute on the Loggable trait for the action log + $component->setImported(true); if ($component->save()) { - $component->logCreate('Imported using CSV Importer'); $this->log('Component '.$this->item['name'].' was created'); // If we have an asset tag, checkout to that asset. diff --git a/app/Observers/AccessoryObserver.php b/app/Observers/AccessoryObserver.php index f97d166b17..99a594c5bc 100644 --- a/app/Observers/AccessoryObserver.php +++ b/app/Observers/AccessoryObserver.php @@ -38,6 +38,9 @@ class AccessoryObserver $logAction->item_id = $accessory->id; $logAction->created_at = date('Y-m-d H:i:s'); $logAction->user_id = Auth::id(); + if($accessory->imported) { + $logAction->note = trans('general.importer.import_note'); + } $logAction->logaction('create'); } diff --git a/app/Observers/ComponentObserver.php b/app/Observers/ComponentObserver.php index 57792022bb..e89006ad85 100644 --- a/app/Observers/ComponentObserver.php +++ b/app/Observers/ComponentObserver.php @@ -38,6 +38,9 @@ class ComponentObserver $logAction->item_id = $component->id; $logAction->created_at = date('Y-m-d H:i:s'); $logAction->user_id = Auth::id(); + if($component->imported) { + $logAction->note = trans('general.importer.import_note'); + } $logAction->logaction('create'); } diff --git a/sample_csvs/components-sample.csv b/sample_csvs/components-sample.csv new file mode 100644 index 0000000000..0861abc8dd --- /dev/null +++ b/sample_csvs/components-sample.csv @@ -0,0 +1,2 @@ +Item Name,Purchase Date,Purchase Cost,Location,Company,Order Number,Serial number,Category,Quantity +RTX 4080,2024-01-01,5000.00,Austin,Grokability,2790,123456789,GPU,10 \ No newline at end of file From 2deba17d9105fa584da743020d36f126cf1394f2 Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Thu, 25 Jan 2024 20:04:02 -0600 Subject: [PATCH 05/12] that's all of 'em --- app/Importer/ConsumableImporter.php | 6 +++--- app/Importer/LicenseImporter.php | 6 +++--- app/Observers/ConsumableObserver.php | 3 +++ app/Observers/LicenseObserver.php | 3 +++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/Importer/ConsumableImporter.php b/app/Importer/ConsumableImporter.php index 5a65514deb..9e7019b086 100644 --- a/app/Importer/ConsumableImporter.php +++ b/app/Importer/ConsumableImporter.php @@ -45,10 +45,10 @@ class ConsumableImporter extends ItemImporter $this->item['item_no'] = trim($this->findCsvMatch($row, 'item_number')); $this->item['min_amt'] = trim($this->findCsvMatch($row, "min_amt")); $consumable->fill($this->sanitizeItemForStoring($consumable)); - //FIXME: this disables model validation. Need to find a way to avoid double-logs without breaking everything. - $consumable->unsetEventDispatcher(); + + // This sets an attribute on the Loggable trait for the action log + $consumable->setImported(true); if ($consumable->save()) { - $consumable->logCreate('Imported using CSV Importer'); $this->log('Consumable '.$this->item['name'].' was created'); return; diff --git a/app/Importer/LicenseImporter.php b/app/Importer/LicenseImporter.php index 393d00367d..b7c55cdba6 100644 --- a/app/Importer/LicenseImporter.php +++ b/app/Importer/LicenseImporter.php @@ -85,10 +85,10 @@ class LicenseImporter extends ItemImporter } else { $license->fill($this->sanitizeItemForStoring($license)); } - //FIXME: this disables model validation. Need to find a way to avoid double-logs without breaking everything. - // $license->unsetEventDispatcher(); + + // This sets an attribute on the Loggable trait for the action log + $license->setImported(true); if ($license->save()) { - $license->logCreate('Imported using csv importer'); $this->log('License '.$this->item['name'].' with serial number '.$this->item['serial'].' was created'); // Lets try to checkout seats if the fields exist and we have seats. diff --git a/app/Observers/ConsumableObserver.php b/app/Observers/ConsumableObserver.php index b945196e20..265e64d73e 100644 --- a/app/Observers/ConsumableObserver.php +++ b/app/Observers/ConsumableObserver.php @@ -38,6 +38,9 @@ class ConsumableObserver $logAction->item_id = $consumable->id; $logAction->created_at = date('Y-m-d H:i:s'); $logAction->user_id = Auth::id(); + if($consumable->imported) { + $logAction->note = trans('general.importer.import_note'); + } $logAction->logaction('create'); } diff --git a/app/Observers/LicenseObserver.php b/app/Observers/LicenseObserver.php index 1478aba113..2d0f60a625 100644 --- a/app/Observers/LicenseObserver.php +++ b/app/Observers/LicenseObserver.php @@ -38,6 +38,9 @@ class LicenseObserver $logAction->item_id = $license->id; $logAction->created_at = date('Y-m-d H:i:s'); $logAction->user_id = Auth::id(); + if($license->imported) { + $logAction->note = trans('general.importer.import_note'); + } $logAction->logaction('create'); } From 63e733f0d6b553d2776f0ff6ca6cdd256f646a0c Mon Sep 17 00:00:00 2001 From: spencerrlongg Date: Tue, 30 Jan 2024 15:14:59 -0600 Subject: [PATCH 06/12] changes from a note to a source --- app/Models/Actionlog.php | 16 +++++++++++++++- app/Observers/AccessoryObserver.php | 2 +- app/Observers/AssetObserver.php | 2 +- app/Observers/ComponentObserver.php | 2 +- app/Observers/ConsumableObserver.php | 2 +- app/Observers/LicenseObserver.php | 2 +- 6 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/Models/Actionlog.php b/app/Models/Actionlog.php index bc08aa800a..90e0e884f8 100755 --- a/app/Models/Actionlog.php +++ b/app/Models/Actionlog.php @@ -19,6 +19,9 @@ class Actionlog extends SnipeModel { use HasFactory; + // This is to manually set the source (via setActionSource()) for determineActionSource() + protected ?string $source = null; + protected $presenter = \App\Presenters\ActionlogPresenter::class; use SoftDeletes; use Presentable; @@ -341,7 +344,12 @@ class Actionlog extends SnipeModel * @since v6.3.0 * @return string */ - public function determineActionSource() { + public function determineActionSource(): string + { + // This is a manually set source + if($this->source) { + return $this->source; + } // This is an API call if (((request()->header('content-type') && (request()->header('accept'))=='application/json')) @@ -358,4 +366,10 @@ class Actionlog extends SnipeModel return 'cli/unknown'; } + + // Manually sets $this->source for determineActionSource() + public function setActionSource($source = null): void + { + $this->source = $source; + } } diff --git a/app/Observers/AccessoryObserver.php b/app/Observers/AccessoryObserver.php index 99a594c5bc..ddf29681be 100644 --- a/app/Observers/AccessoryObserver.php +++ b/app/Observers/AccessoryObserver.php @@ -39,7 +39,7 @@ class AccessoryObserver $logAction->created_at = date('Y-m-d H:i:s'); $logAction->user_id = Auth::id(); if($accessory->imported) { - $logAction->note = trans('general.importer.import_note'); + $logAction->setActionSource('importer'); } $logAction->logaction('create'); } diff --git a/app/Observers/AssetObserver.php b/app/Observers/AssetObserver.php index c94a7046e0..8fcf2485a3 100644 --- a/app/Observers/AssetObserver.php +++ b/app/Observers/AssetObserver.php @@ -110,7 +110,7 @@ class AssetObserver $logAction->created_at = date('Y-m-d H:i:s'); $logAction->user_id = Auth::id(); if($asset->imported) { - $logAction->note = trans('general.importer.import_note'); + $logAction->setActionSource('importer'); } $logAction->logaction('create'); } diff --git a/app/Observers/ComponentObserver.php b/app/Observers/ComponentObserver.php index e89006ad85..a8bb386e8e 100644 --- a/app/Observers/ComponentObserver.php +++ b/app/Observers/ComponentObserver.php @@ -39,7 +39,7 @@ class ComponentObserver $logAction->created_at = date('Y-m-d H:i:s'); $logAction->user_id = Auth::id(); if($component->imported) { - $logAction->note = trans('general.importer.import_note'); + $logAction->setActionSource('importer'); } $logAction->logaction('create'); } diff --git a/app/Observers/ConsumableObserver.php b/app/Observers/ConsumableObserver.php index 265e64d73e..1f0c777dcc 100644 --- a/app/Observers/ConsumableObserver.php +++ b/app/Observers/ConsumableObserver.php @@ -39,7 +39,7 @@ class ConsumableObserver $logAction->created_at = date('Y-m-d H:i:s'); $logAction->user_id = Auth::id(); if($consumable->imported) { - $logAction->note = trans('general.importer.import_note'); + $logAction->setActionSource('importer'); } $logAction->logaction('create'); } diff --git a/app/Observers/LicenseObserver.php b/app/Observers/LicenseObserver.php index 2d0f60a625..0628020965 100644 --- a/app/Observers/LicenseObserver.php +++ b/app/Observers/LicenseObserver.php @@ -39,7 +39,7 @@ class LicenseObserver $logAction->created_at = date('Y-m-d H:i:s'); $logAction->user_id = Auth::id(); if($license->imported) { - $logAction->note = trans('general.importer.import_note'); + $logAction->setActionSource('importer'); } $logAction->logaction('create'); } From b136e9e29df08df5ac0e0beda28a97af38c3e6cf Mon Sep 17 00:00:00 2001 From: Godfrey M Date: Wed, 14 Feb 2024 09:16:20 -0800 Subject: [PATCH 07/12] fix the listener to fire when checking in --- app/Listeners/CheckoutableListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Listeners/CheckoutableListener.php b/app/Listeners/CheckoutableListener.php index 6aa0a0d376..c8f937f8be 100644 --- a/app/Listeners/CheckoutableListener.php +++ b/app/Listeners/CheckoutableListener.php @@ -115,7 +115,7 @@ class CheckoutableListener ); } //slack doesn't include the url in its messaging format so this is needed to hit the endpoint - if(Setting::getSettings()->webhook_selected =='slack') { + if(Setting::getSettings()->webhook_selected =='slack' || Setting::getSettings()->webhook_selected =='general') { if ($this->shouldSendWebhookNotification()) { Notification::route('slack', Setting::getSettings()->webhook_endpoint) From bc0a7542ac9624923f81162130720d41919498d7 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 14 Feb 2024 18:17:34 -0800 Subject: [PATCH 08/12] Change enableWebhook to enableSlackWebhook --- tests/Feature/Notifications/AccessoryWebhookTest.php | 4 ++-- tests/Feature/Notifications/AssetWebhookTest.php | 4 ++-- tests/Feature/Notifications/ComponentWebhookTest.php | 4 ++-- tests/Feature/Notifications/ConsumableWebhookTest.php | 2 +- tests/Feature/Notifications/LicenseWebhookTest.php | 4 ++-- tests/Support/Settings.php | 4 +++- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/tests/Feature/Notifications/AccessoryWebhookTest.php b/tests/Feature/Notifications/AccessoryWebhookTest.php index a1db59b985..2e3ef999ba 100644 --- a/tests/Feature/Notifications/AccessoryWebhookTest.php +++ b/tests/Feature/Notifications/AccessoryWebhookTest.php @@ -22,7 +22,7 @@ class AccessoryWebhookTest extends TestCase { Notification::fake(); - $this->settings->enableWebhook(); + $this->settings->enableSlackWebhook(); event(new CheckoutableCheckedOut( Accessory::factory()->appleBtKeyboard()->create(), @@ -60,7 +60,7 @@ class AccessoryWebhookTest extends TestCase { Notification::fake(); - $this->settings->enableWebhook(); + $this->settings->enableSlackWebhook(); event(new CheckoutableCheckedIn( Accessory::factory()->appleBtKeyboard()->create(), diff --git a/tests/Feature/Notifications/AssetWebhookTest.php b/tests/Feature/Notifications/AssetWebhookTest.php index ae45a4caa4..158bced664 100644 --- a/tests/Feature/Notifications/AssetWebhookTest.php +++ b/tests/Feature/Notifications/AssetWebhookTest.php @@ -33,7 +33,7 @@ class AssetWebhookTest extends TestCase { Notification::fake(); - $this->settings->enableWebhook(); + $this->settings->enableSlackWebhook(); event(new CheckoutableCheckedOut( $this->createAsset(), @@ -73,7 +73,7 @@ class AssetWebhookTest extends TestCase { Notification::fake(); - $this->settings->enableWebhook(); + $this->settings->enableSlackWebhook(); event(new CheckoutableCheckedIn( $this->createAsset(), diff --git a/tests/Feature/Notifications/ComponentWebhookTest.php b/tests/Feature/Notifications/ComponentWebhookTest.php index 8f3a51b15d..2e2a535219 100644 --- a/tests/Feature/Notifications/ComponentWebhookTest.php +++ b/tests/Feature/Notifications/ComponentWebhookTest.php @@ -20,7 +20,7 @@ class ComponentWebhookTest extends TestCase { Notification::fake(); - $this->settings->enableWebhook(); + $this->settings->enableSlackWebhook(); event(new CheckoutableCheckedOut( Component::factory()->ramCrucial8()->create(), @@ -36,7 +36,7 @@ class ComponentWebhookTest extends TestCase { Notification::fake(); - $this->settings->enableWebhook(); + $this->settings->enableSlackWebhook(); event(new CheckoutableCheckedIn( Component::factory()->ramCrucial8()->create(), diff --git a/tests/Feature/Notifications/ConsumableWebhookTest.php b/tests/Feature/Notifications/ConsumableWebhookTest.php index 854fdf5341..2815731bd2 100644 --- a/tests/Feature/Notifications/ConsumableWebhookTest.php +++ b/tests/Feature/Notifications/ConsumableWebhookTest.php @@ -20,7 +20,7 @@ class ConsumableWebhookTest extends TestCase { Notification::fake(); - $this->settings->enableWebhook(); + $this->settings->enableSlackWebhook(); event(new CheckoutableCheckedOut( Consumable::factory()->cardstock()->create(), diff --git a/tests/Feature/Notifications/LicenseWebhookTest.php b/tests/Feature/Notifications/LicenseWebhookTest.php index 4313ff69d4..24ec53a75e 100644 --- a/tests/Feature/Notifications/LicenseWebhookTest.php +++ b/tests/Feature/Notifications/LicenseWebhookTest.php @@ -32,7 +32,7 @@ class LicenseWebhookTest extends TestCase { Notification::fake(); - $this->settings->enableWebhook(); + $this->settings->enableSlackWebhook(); event(new CheckoutableCheckedOut( LicenseSeat::factory()->create(), @@ -72,7 +72,7 @@ class LicenseWebhookTest extends TestCase { Notification::fake(); - $this->settings->enableWebhook(); + $this->settings->enableSlackWebhook(); event(new CheckoutableCheckedIn( LicenseSeat::factory()->create(), diff --git a/tests/Support/Settings.php b/tests/Support/Settings.php index d5aad59ada..3104851152 100644 --- a/tests/Support/Settings.php +++ b/tests/Support/Settings.php @@ -39,9 +39,10 @@ class Settings return $this->update(['full_multiple_companies_support' => 0]); } - public function enableWebhook(): Settings + public function enableSlackWebhook(): Settings { return $this->update([ + 'webhook_selected' => 'slack', 'webhook_botname' => 'SnipeBot5000', 'webhook_endpoint' => 'https://hooks.slack.com/services/NZ59/Q446/672N', 'webhook_channel' => '#it', @@ -51,6 +52,7 @@ class Settings public function disableWebhook(): Settings { return $this->update([ + 'webhook_selected' => '', 'webhook_botname' => '', 'webhook_endpoint' => '', 'webhook_channel' => '', From 9a4cda0bf668a328745575c8f37f0e2b8968f196 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 15 Feb 2024 08:21:19 +0000 Subject: [PATCH 09/12] Upgrade alpinejs from 3.13.3 to 3.13.5 Signed-off-by: snipe --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6db30f8651..b1232694d6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2350,9 +2350,9 @@ } }, "alpinejs": { - "version": "3.13.3", - "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.13.3.tgz", - "integrity": "sha512-WZ6WQjkAOl+WdW/jukzNHq9zHFDNKmkk/x6WF7WdyNDD6woinrfXCVsZXm0galjbco+pEpYmJLtwlZwcOfIVdg==", + "version": "3.13.5", + "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.13.5.tgz", + "integrity": "sha512-1d2XeNGN+Zn7j4mUAKXtAgdc4/rLeadyTMWeJGXF5DzwawPBxwTiBhFFm6w/Ei8eJxUZeyNWWSD9zknfdz1kEw==", "requires": { "@vue/reactivity": "~3.1.1" } diff --git a/package.json b/package.json index e54390ee90..a54108899d 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "acorn-import-assertions": "^1.9.0", "admin-lte": "^2.4.18", "ajv": "^6.12.6", - "alpinejs": "^3.13.3", + "alpinejs": "^3.13.5", "blueimp-file-upload": "^9.34.0", "bootstrap": "^3.4.1", "bootstrap-colorpicker": "^2.5.3", From 42cf17d3bf291ae6fa58e3872703b694ce3fb2e2 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 15 Feb 2024 08:27:52 +0000 Subject: [PATCH 10/12] Upgrade webpack from 5.89.0 to 5.90.0 Signed-off-by: snipe --- package-lock.json | 87 ++++++++++++++++++++++++++++++++++------------- package.json | 2 +- 2 files changed, 64 insertions(+), 25 deletions(-) diff --git a/package-lock.json b/package-lock.json index b1232694d6..ab896b09fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1565,9 +1565,9 @@ } }, "@types/eslint": { - "version": "8.56.1", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.1.tgz", - "integrity": "sha512-18PLWRzhy9glDQp3+wOgfLYRWlhgX0azxgJ63rdpoUHyrC9z0f5CkFburjQx4uD7ZCruw85ZtMt6K+L+R8fLJQ==", + "version": "8.56.2", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.2.tgz", + "integrity": "sha512-uQDwm1wFHmbBbCZCqAlq6Do9LYwByNZHWzXppSnay9SuwJ+VRbjkbLABer54kcPnMSlG6Fdiy2yaFXm/z9Z5gw==", "requires": { "@types/estree": "*", "@types/json-schema": "*" @@ -3611,6 +3611,7 @@ "version": "4.19.1", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", + "dev": true, "requires": { "caniuse-lite": "^1.0.30001286", "electron-to-chromium": "^1.4.17", @@ -3731,7 +3732,8 @@ "caniuse-lite": { "version": "1.0.30001292", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001292.tgz", - "integrity": "sha512-jnT4Tq0Q4ma+6nncYQVe7d73kmDmE9C3OGTx3MvW7lBM/eY1S1DZTMBON7dqV481RhNiS5OxD7k9JQvmDOTirw==" + "integrity": "sha512-jnT4Tq0Q4ma+6nncYQVe7d73kmDmE9C3OGTx3MvW7lBM/eY1S1DZTMBON7dqV481RhNiS5OxD7k9JQvmDOTirw==", + "dev": true }, "canvg": { "version": "3.0.10", @@ -4931,7 +4933,8 @@ "electron-to-chromium": { "version": "1.4.28", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.28.tgz", - "integrity": "sha512-Gzbf0wUtKfyPaqf0Plz+Ctinf9eQIzxEqBHwSvbGfeOm9GMNdLxyu1dNiCUfM+x6r4BE0xUJNh3Nmg9gfAtTmg==" + "integrity": "sha512-Gzbf0wUtKfyPaqf0Plz+Ctinf9eQIzxEqBHwSvbGfeOm9GMNdLxyu1dNiCUfM+x6r4BE0xUJNh3Nmg9gfAtTmg==", + "dev": true }, "elliptic": { "version": "6.5.4", @@ -17418,7 +17421,8 @@ "node-releases": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", - "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==" + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", + "dev": true }, "normalize-path": { "version": "3.0.0", @@ -20097,18 +20101,18 @@ "dev": true }, "webpack": { - "version": "5.89.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.89.0.tgz", - "integrity": "sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==", + "version": "5.90.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.90.1.tgz", + "integrity": "sha512-SstPdlAC5IvgFnhiRok8hqJo/+ArAbNv7rhU4fnWGHNVfN59HSQFaxZDSAL3IFG2YmqxuRs+IU33milSxbPlog==", "requires": { "@types/eslint-scope": "^3.7.3", - "@types/estree": "^1.0.0", + "@types/estree": "^1.0.5", "@webassemblyjs/ast": "^1.11.5", "@webassemblyjs/wasm-edit": "^1.11.5", "@webassemblyjs/wasm-parser": "^1.11.5", "acorn": "^8.7.1", "acorn-import-assertions": "^1.9.0", - "browserslist": "^4.14.5", + "browserslist": "^4.21.10", "chrome-trace-event": "^1.0.2", "enhanced-resolve": "^5.15.0", "es-module-lexer": "^1.2.1", @@ -20122,15 +20126,15 @@ "neo-async": "^2.6.2", "schema-utils": "^3.2.0", "tapable": "^2.1.1", - "terser-webpack-plugin": "^5.3.7", + "terser-webpack-plugin": "^5.3.10", "watchpack": "^2.4.0", "webpack-sources": "^3.2.3" }, "dependencies": { "@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==" + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==" }, "@jridgewell/sourcemap-codec": { "version": "1.4.15", @@ -20138,9 +20142,9 @@ "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" }, "@jridgewell/trace-mapping": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", - "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.22.tgz", + "integrity": "sha512-Wf963MzWtA2sjrNt+g18IAln9lKnlRp+K2eH4jjIoF1wYeq3aMREpG09xhlhdzS0EjwU7qmUJYangWa+151vZw==", "requires": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" @@ -20151,16 +20155,42 @@ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" }, + "browserslist": { + "version": "4.23.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.0.tgz", + "integrity": "sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==", + "requires": { + "caniuse-lite": "^1.0.30001587", + "electron-to-chromium": "^1.4.668", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" + } + }, + "caniuse-lite": { + "version": "1.0.30001587", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001587.tgz", + "integrity": "sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==" + }, "commander": { "version": "2.20.3", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" }, + "electron-to-chromium": { + "version": "1.4.670", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.670.tgz", + "integrity": "sha512-hcijYOWjOtjKrKPtNA6tuLlA/bTLO3heFG8pQA6mLpq7dRydSWicXova5lyxDzp1iVJaYhK7J2OQlGE52KYn7A==" + }, "graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, + "node-releases": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==" + }, "schema-utils": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.3.0.tgz", @@ -20172,17 +20202,17 @@ } }, "serialize-javascript": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz", - "integrity": "sha512-owoXEFjWRllis8/M1Q+Cw5k8ZH40e3zhp/ovX+Xr/vi1qj6QesbyXXViFbpNvWvPNAD62SutwEXavefrLJWj7w==", + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", + "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", "requires": { "randombytes": "^2.1.0" } }, "terser": { - "version": "5.26.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.26.0.tgz", - "integrity": "sha512-dytTGoE2oHgbNV9nTzgBEPaqAWvcJNl66VZ0BkJqlvp71IjO8CxdBx/ykCNb47cLnCmCvRZ6ZR0tLkqvZCdVBQ==", + "version": "5.27.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.27.0.tgz", + "integrity": "sha512-bi1HRwVRskAjheeYl291n3JC4GgO/Ty4z1nVs5AAsmonJulGxpSektecnNedrwK9C7vpvVtcX3cw00VSLt7U2A==", "requires": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.8.2", @@ -20202,6 +20232,15 @@ "terser": "^5.26.0" } }, + "update-browserslist-db": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", + "requires": { + "escalade": "^3.1.1", + "picocolors": "^1.0.0" + } + }, "webpack-sources": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.3.tgz", diff --git a/package.json b/package.json index a54108899d..7a7b20e906 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,6 @@ "tableexport.jquery.plugin": "1.28.0", "tether": "^1.4.0", "vue-resource": "^1.5.2", - "webpack": "^5.89.0" + "webpack": "^5.90.0" } } From bf3794822c410967a42847cb57509244d885fc27 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 15 Feb 2024 09:47:45 +0000 Subject: [PATCH 11/12] Updated assets Signed-off-by: snipe --- public/js/dist/all-defer.js | Bin 105939 -> 106924 bytes public/mix-manifest.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/public/js/dist/all-defer.js b/public/js/dist/all-defer.js index 53e56a8a672127d09f8b74c43d4e6d94d04083ee..50470c93f94476a9e18c2393958ae02a43c41f5a 100644 GIT binary patch delta 1582 zcmb7EO>7%Q6xPIUa2tgrN}IMKDbFT}cd@%_Tonn79R#IN2n}kHQbdrw*?nFwS?{|0 zlQgm{R}~UMoT`zSLr=Y-il%_EeL$RYfJ+Mk350}%5E7hvfK#~uvp-H~Ll5j_cHX@A zz3=^g``O@!TZ11J6Vm_{&s1F9GGSeIm8zhj>!O_nMK+8TSy>gK!R~tGQMLs{qE|a3 z?5ia*GRSoVG0#Slc$gTls zWC1VMZEocET{C!Sj}}+PhR(URZfcS(ub1hi#fhoq@^nMhdBI!`lWQ)QCGbV2T*Kxv z-CPu7Wid~G&pqE4|Y_Lf`9+ z(oT1Yo}L++wmja?FUn4JL3Yt`A<0X}_5Ljr>65(^^ymu%nZ{WL^Qv~O*V#bbP~+TVTAIL}ItlS51caw^8hjLu!&?+?@7R@l%0xF#DO zXOI&FJs2bZj=TW+wwq|mf``zo86JLUo*B$AH+aA-hpGynP1CFAgh-!=?C&(m_Fhks zU*qhCL?+qEG=Y{PD^+|MH#lBD=hKZa!bXc$pT> z=MAi(=?Z??`;h!EB9VOtE>xZU}bKHmu8r!IiD9d^UcpRbljean1(vLR} zyrio;f-oI^D7>@k9uH=FpZ3?+ZWOK*YO~f8WQu*TL59=2L7P!4M7a(v_*zXdNRvb_ zBamB}#G1u(aV!hHyXVM_=UCSwa~WNAb|=hVvO5`bLf*~y1@ahs<^mb+-DYIZ;6Iw_ B4|ManwPzz=L;68+inA4j5fNQP7v6;Z33XAIK^L7fm(1GT`{R3`=Xsy^d;G3(`*q{9 z5g$J`Kss^sh1crv54R2KG_C2Glu1nr!*KcPNk2eN(qU0nlnc6+ri@+O_hd#=7{&QW z*UJ9Usw|P#)U;#>+BBnjj_L_Rx<+?Vm>`NS1%NyQLiLP7)mdW>dV3*On_Gl@c@Qev zg8z!cNL>V>DLAz7pKhT->JryRca|@2#^Drc!z-ID$yz8C37UG&G$eyoFHm8qvC=Rc zwthylb>Uri0TgP0PP1B$W+t=@Wo6^7&3Kl07ECsW9obj;M>4!W}r61_hg6^D9)>J51&7;$yp^AsD z69DmXNmVriW@I%38QBqU$Te zr&cJg*)fmv0T@2FJ9mT6wt@FbalBq^!kyJnliM{wGY!05jNo!Hh;NFMVQ?!{KO?a@ z$B?}^>G;eHOdSeisw6l#VSHK)^5ilJ5WwwH48Qn7__7qjrICXe)q+;*tF315(RjbB z6GviE>(~45_12G%>=Gv?Y3KPkIn5WBNju)~CHRMR(t|s`Z}rXr@uqjcrd=e^z*hy* x!=raefDbwz^9hlR@jD_p&YiYkulJEpeYQGDo{V$3i*)h_CrFF^@IGm1`~yk1E^`0? diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 8c20f3cc48..468a577690 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -33,7 +33,7 @@ "/js/build/vendor.js": "/js/build/vendor.js?id=a2b971da417306a63385c8098acfe4af", "/js/dist/bootstrap-table.js": "/js/dist/bootstrap-table.js?id=29340c70d13855fa0165cd4d799c6f5b", "/js/dist/all.js": "/js/dist/all.js?id=13bdb521e0c745d7f81dae3fb110b650", - "/js/dist/all-defer.js": "/js/dist/all-defer.js?id=7f9a130eda6916eaa32a0a57e81918f3", + "/js/dist/all-defer.js": "/js/dist/all-defer.js?id=19ccc62a8f1ea103dede4808837384d4", "/css/dist/skins/skin-green.min.css": "/css/dist/skins/skin-green.min.css?id=0a82a6ae6bb4e58fe62d162c4fb50397", "/css/dist/skins/skin-green-dark.min.css": "/css/dist/skins/skin-green-dark.min.css?id=d419cb63a12dc175d71645c876bfc2ab", "/css/dist/skins/skin-black.min.css": "/css/dist/skins/skin-black.min.css?id=76482123f6c70e866d6b971ba91de7bb", From 13d2af2155889e6f39d9f6fdf8902d011f27f31a Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 15 Feb 2024 09:51:14 +0000 Subject: [PATCH 12/12] Fixed ambiguous query on supplier_id in maintenances Signed-off-by: snipe --- app/Http/Controllers/Api/AssetMaintenancesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/AssetMaintenancesController.php b/app/Http/Controllers/Api/AssetMaintenancesController.php index a26935cc59..4b47c323c2 100644 --- a/app/Http/Controllers/Api/AssetMaintenancesController.php +++ b/app/Http/Controllers/Api/AssetMaintenancesController.php @@ -48,7 +48,7 @@ class AssetMaintenancesController extends Controller } if ($request->filled('supplier_id')) { - $maintenances->where('supplier_id', '=', $request->input('supplier_id')); + $maintenances->where('asset_maintenances.supplier_id', '=', $request->input('supplier_id')); } if ($request->filled('asset_maintenance_type')) {