From 9f944ad497193fa94299661b7ff42518e5c35335 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Thu, 27 May 2021 15:48:13 -0500 Subject: [PATCH 1/3] Added the 'required' attribute to the input file n the upload file form modal. Added a validation for the UserFilesController if the user doesn't select any file to upload [ch16471]. --- app/Http/Controllers/Users/UserFilesController.php | 4 ++++ resources/views/modals/upload-file.blade.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Users/UserFilesController.php b/app/Http/Controllers/Users/UserFilesController.php index f5a3ea1180..61a195012a 100644 --- a/app/Http/Controllers/Users/UserFilesController.php +++ b/app/Http/Controllers/Users/UserFilesController.php @@ -33,6 +33,10 @@ class UserFilesController extends Controller $logActions = []; $files = $request->file('file'); + + if (is_null($files)){ + return redirect()->back()->with('error', trans('admin/users/message.upload.nofiles')); + } foreach($files as $file) { $extension = $file->getClientOriginalExtension(); $filename = 'user-' . $user->id . '-' . str_random(8); diff --git a/resources/views/modals/upload-file.blade.php b/resources/views/modals/upload-file.blade.php index a5ee373cbb..f2910967b9 100644 --- a/resources/views/modals/upload-file.blade.php +++ b/resources/views/modals/upload-file.blade.php @@ -19,7 +19,7 @@ From ebe7c2da879defeb1921bb9636cf8542e8938611 Mon Sep 17 00:00:00 2001 From: Travis Miller Date: Mon, 7 Jun 2021 11:10:30 -0500 Subject: [PATCH 2/3] Fixed #8486: Add index for asset serial number --- ...06_07_155421_add_serial_number_indexes.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 database/migrations/2021_06_07_155421_add_serial_number_indexes.php diff --git a/database/migrations/2021_06_07_155421_add_serial_number_indexes.php b/database/migrations/2021_06_07_155421_add_serial_number_indexes.php new file mode 100644 index 0000000000..3673489c7e --- /dev/null +++ b/database/migrations/2021_06_07_155421_add_serial_number_indexes.php @@ -0,0 +1,32 @@ +index(['serial']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('assets', function (Blueprint $table) { + $table->dropIndex(['serial']); + }); + } +} From 103c4325ce0341e1fcc54812489f72235dfb510c Mon Sep 17 00:00:00 2001 From: Travis Miller Date: Mon, 7 Jun 2021 11:12:48 -0500 Subject: [PATCH 3/3] Fixed #9682: Add indexes for company_id --- ...21_06_07_155436_add_company_id_indexes.php | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 database/migrations/2021_06_07_155436_add_company_id_indexes.php diff --git a/database/migrations/2021_06_07_155436_add_company_id_indexes.php b/database/migrations/2021_06_07_155436_add_company_id_indexes.php new file mode 100644 index 0000000000..f4a83800cd --- /dev/null +++ b/database/migrations/2021_06_07_155436_add_company_id_indexes.php @@ -0,0 +1,88 @@ +index(['company_id']); + }); + + Schema::table('action_logs', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('assets', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('components', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('consumables', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('departments', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('licenses', function (Blueprint $table) { + $table->index(['company_id']); + }); + + Schema::table('users', function (Blueprint $table) { + $table->index(['company_id']); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('licenses', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('departments', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('consumables', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('components', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('assets', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('action_logs', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + + Schema::table('accessories', function (Blueprint $table) { + $table->dropIndex(['company_id']); + }); + } +}