diff --git a/app/Http/Controllers/ActionlogController.php b/app/Http/Controllers/ActionlogController.php index f2580c96fc..057ca465bc 100644 --- a/app/Http/Controllers/ActionlogController.php +++ b/app/Http/Controllers/ActionlogController.php @@ -40,10 +40,13 @@ class ActionlogController extends Controller public function getStoredEula($filename) : Response | BinaryFileResponse | RedirectResponse { $this->authorize('view', \App\Models\Asset::class); - $file = config('app.private_uploads').'/eula-pdfs/'.$filename; + + if (config('filesystems.default') == 's3_private') { + return redirect()->away(Storage::disk('s3_private')->temporaryUrl('private_uploads/eula-pdfs/'.$filename, now()->addMinutes(5))); + } if (Storage::exists('private_uploads/eula-pdfs/'.$filename)) { - return response()->download($file); + return response()->download(config('app.private_uploads').'/eula-pdfs/'.$filename); } return redirect()->back()->with('error', trans('general.file_does_not_exist')); diff --git a/app/Importer/Importer.php b/app/Importer/Importer.php index 907c8b72c5..0d4b8d4932 100644 --- a/app/Importer/Importer.php +++ b/app/Importer/Importer.php @@ -39,6 +39,7 @@ abstract class Importer * @var array */ private $defaultFieldMap = [ + 'id' => 'id', 'asset_tag' => 'asset tag', 'activated' => 'activated', 'category' => 'category', diff --git a/app/Importer/ItemImporter.php b/app/Importer/ItemImporter.php index 6b1d647136..435f081aba 100644 --- a/app/Importer/ItemImporter.php +++ b/app/Importer/ItemImporter.php @@ -456,14 +456,13 @@ class ItemImporter extends Importer { if (empty($asset_location)) { $this->log('No location given, so none created.'); - return null; } + $location = Location::where(['name' => $asset_location])->first(); if ($location) { $this->log('Location '.$asset_location.' already exists'); - return $location->id; } // No matching locations in the collection, create a new one. diff --git a/app/Importer/LocationImporter.php b/app/Importer/LocationImporter.php index a9a5152234..5a87d069e5 100644 --- a/app/Importer/LocationImporter.php +++ b/app/Importer/LocationImporter.php @@ -38,8 +38,16 @@ class LocationImporter extends ItemImporter { $editingLocation = false; + $location = Location::where('name', '=', $this->findCsvMatch($row, 'name'))->first(); + if ($this->findCsvMatch($row, 'id')!='') { + // Override location if an ID was given + \Log::debug('Finding location by ID: '.$this->findCsvMatch($row, 'id')); + $location = Location::find($this->findCsvMatch($row, 'id')); + } + + if ($location) { if (! $this->updating) { $this->log('A matching Location '.$this->item['name'].' already exists'); @@ -95,6 +103,7 @@ class LocationImporter extends ItemImporter } else { Log::debug($location->getErrors()); + $this->logError($location, 'Location "'.$this->item['name'].'"'); return $location->errors; } diff --git a/app/Livewire/Importer.php b/app/Livewire/Importer.php index 75b707b8ad..aee6b852d4 100644 --- a/app/Livewire/Importer.php +++ b/app/Livewire/Importer.php @@ -329,6 +329,7 @@ class Importer extends Component ]; $this->locations_fields = [ + 'id' => trans('general.id'), 'name' => trans('general.item_name_var', ['item' => trans('general.location')]), 'address' => trans('general.address'), 'address2' => trans('general.importer.address2'), @@ -400,7 +401,6 @@ class Importer extends Component 'requestable', 'Requestable', ], - 'gravatar' => [ 'gravatar', diff --git a/package-lock.json b/package-lock.json index 4be77b4eaf..7de7aaea76 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "bootstrap-colorpicker": "^2.5.3", "bootstrap-datepicker": "^1.10.0", "bootstrap-less": "^3.3.8", - "bootstrap-table": "1.23.5", + "bootstrap-table": "1.24.0", "canvas-confetti": "^1.9.3", "chart.js": "^2.9.4", "clipboard": "^2.0.11", @@ -3705,9 +3705,9 @@ "license": "MIT" }, "node_modules/bootstrap-table": { - "version": "1.23.5", - "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.23.5.tgz", - "integrity": "sha512-9WByoSpJvA73gi2YYIlX6IWR74oZtBmSixul/Th8FTBtBd/kZRpbKESGTjhA3BA3AYTnfyY8Iy1KeRWPlV2GWQ==", + "version": "1.24.0", + "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.24.0.tgz", + "integrity": "sha512-dyRf5PQwTgFHj9yjuPXa+GIf4JpuQhsgD1CJrOqhw40qI2gTb3mJfRdoBc7iF2bqzOl+k0RnbAlhSPbGe4VS+w==", "peerDependencies": { "jquery": "3" } diff --git a/package.json b/package.json index 180c0655c2..e86bf90660 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "bootstrap-colorpicker": "^2.5.3", "bootstrap-datepicker": "^1.10.0", "bootstrap-less": "^3.3.8", - "bootstrap-table": "1.23.5", + "bootstrap-table": "1.24.0", "canvas-confetti": "^1.9.3", "chart.js": "^2.9.4", "clipboard": "^2.0.11", diff --git a/public/js/dist/bootstrap-table-en-US.min.js b/public/js/dist/bootstrap-table-en-US.min.js index 4361492573..a0e92322cf 100644 Binary files a/public/js/dist/bootstrap-table-en-US.min.js and b/public/js/dist/bootstrap-table-en-US.min.js differ diff --git a/public/js/dist/bootstrap-table-locale-all.min.js b/public/js/dist/bootstrap-table-locale-all.min.js index 760f77ba81..b555f75846 100644 Binary files a/public/js/dist/bootstrap-table-locale-all.min.js and b/public/js/dist/bootstrap-table-locale-all.min.js differ diff --git a/tests/Feature/Importing/Ui/ImportTest.php b/tests/Feature/Importing/Ui/ImportTest.php index 4b811c4872..2caaa4c097 100644 --- a/tests/Feature/Importing/Ui/ImportTest.php +++ b/tests/Feature/Importing/Ui/ImportTest.php @@ -43,7 +43,6 @@ class ImportTest extends TestCase ] ] ]); - \Log::error(print_r($results, true)); $this->assertEquals($evil_string, $results->json()['files'][0]['first_row'][0]); } }