From ca6248108334e597f60225ecf9a5b07a6df814d3 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 9 Feb 2024 20:23:13 +0000 Subject: [PATCH 1/4] Added button and route Signed-off-by: snipe --- resources/views/users/view.blade.php | 6 ++++++ routes/web/users.php | 18 +++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index c28a9079cfa8..8bee71384de3 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -218,6 +218,12 @@ @endif @endcan + @can('update', $user) + + @endcan + @can('delete', $user) @if ($user->deleted_at=='')
diff --git a/routes/web/users.php b/routes/web/users.php index 95de200638db..370fbc8b884d 100644 --- a/routes/web/users.php +++ b/routes/web/users.php @@ -43,11 +43,27 @@ Route::post( '{userId}/clone', [ - Users\UsersController::class, + Users\UsersController::class, 'postCreate' ] )->name('users.clone.store'); + Route::get( + '{userId}/transfer', + [ + Users\UsersController::class, + 'getTransfer' + ] + )->name('users.transfer.show'); + + Route::post( + '{userId}/transfer', + [ + Users\UsersController::class, + 'postTransfer' + ] + )->name('users.transfer.store'); + Route::post( '{userId}/restore', [ From fa47707974dc3ec5d0abc6e6659eb663881ee88b Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 9 Feb 2024 20:26:49 +0000 Subject: [PATCH 2/4] Use withTrashed() to get the barcode on deleted assets Signed-off-by: snipe --- app/Http/Controllers/Assets/AssetsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index e4a6e792aff9..111f0df6cff4 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -521,7 +521,7 @@ public function getQrCode($assetId = null) public function getBarCode($assetId = null) { $settings = Setting::getSettings(); - $asset = Asset::find($assetId); + $asset = Asset::withTrashed()->find($assetId); $barcode_file = public_path().'/uploads/barcodes/'.str_slug($settings->alt_barcode).'-'.str_slug($asset->asset_tag).'.png'; if (isset($asset->id, $asset->asset_tag)) { From 84f8eee86950804e48bafd8638d754eb0a3f2210 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 9 Feb 2024 20:35:45 +0000 Subject: [PATCH 3/4] Revert "Fixed barcodes crashing if asset was deleted" --- .../Controllers/Assets/AssetsController.php | 2 +- resources/views/users/view.blade.php | 6 ------ routes/web/users.php | 18 +----------------- 3 files changed, 2 insertions(+), 24 deletions(-) diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index 111f0df6cff4..e4a6e792aff9 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -521,7 +521,7 @@ public function getQrCode($assetId = null) public function getBarCode($assetId = null) { $settings = Setting::getSettings(); - $asset = Asset::withTrashed()->find($assetId); + $asset = Asset::find($assetId); $barcode_file = public_path().'/uploads/barcodes/'.str_slug($settings->alt_barcode).'-'.str_slug($asset->asset_tag).'.png'; if (isset($asset->id, $asset->asset_tag)) { diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index 8bee71384de3..c28a9079cfa8 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -218,12 +218,6 @@ @endif @endcan - @can('update', $user) - - @endcan - @can('delete', $user) @if ($user->deleted_at=='')
diff --git a/routes/web/users.php b/routes/web/users.php index 370fbc8b884d..95de200638db 100644 --- a/routes/web/users.php +++ b/routes/web/users.php @@ -43,27 +43,11 @@ Route::post( '{userId}/clone', [ - Users\UsersController::class, + Users\UsersController::class, 'postCreate' ] )->name('users.clone.store'); - Route::get( - '{userId}/transfer', - [ - Users\UsersController::class, - 'getTransfer' - ] - )->name('users.transfer.show'); - - Route::post( - '{userId}/transfer', - [ - Users\UsersController::class, - 'postTransfer' - ] - )->name('users.transfer.store'); - Route::post( '{userId}/restore', [ From 55b3050ca867eef7c728a4618479accfe917737e Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 9 Feb 2024 20:37:18 +0000 Subject: [PATCH 4/4] Re-applied previous withTrashed PR Signed-off-by: snipe --- app/Http/Controllers/Assets/AssetsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index e4a6e792aff9..111f0df6cff4 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -521,7 +521,7 @@ public function getQrCode($assetId = null) public function getBarCode($assetId = null) { $settings = Setting::getSettings(); - $asset = Asset::find($assetId); + $asset = Asset::withTrashed()->find($assetId); $barcode_file = public_path().'/uploads/barcodes/'.str_slug($settings->alt_barcode).'-'.str_slug($asset->asset_tag).'.png'; if (isset($asset->id, $asset->asset_tag)) {