Merge remote-tracking branch 'origin/develop'

Signed-off-by: snipe <snipe@snipe.net>

# Conflicts:
#	public/css/dist/all.css
#	public/css/dist/bootstrap-table.css
#	public/js/dist/bootstrap-table.js
#	public/mix-manifest.json
This commit is contained in:
snipe 2025-01-20 16:59:55 +00:00
commit ca446ad7df
10 changed files with 22 additions and 11 deletions

View file

@ -40,10 +40,13 @@ class ActionlogController extends Controller
public function getStoredEula($filename) : Response | BinaryFileResponse | RedirectResponse public function getStoredEula($filename) : Response | BinaryFileResponse | RedirectResponse
{ {
$this->authorize('view', \App\Models\Asset::class); $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)) { 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')); return redirect()->back()->with('error', trans('general.file_does_not_exist'));

View file

@ -39,6 +39,7 @@ abstract class Importer
* @var array * @var array
*/ */
private $defaultFieldMap = [ private $defaultFieldMap = [
'id' => 'id',
'asset_tag' => 'asset tag', 'asset_tag' => 'asset tag',
'activated' => 'activated', 'activated' => 'activated',
'category' => 'category', 'category' => 'category',

View file

@ -456,14 +456,13 @@ class ItemImporter extends Importer
{ {
if (empty($asset_location)) { if (empty($asset_location)) {
$this->log('No location given, so none created.'); $this->log('No location given, so none created.');
return null; return null;
} }
$location = Location::where(['name' => $asset_location])->first(); $location = Location::where(['name' => $asset_location])->first();
if ($location) { if ($location) {
$this->log('Location '.$asset_location.' already exists'); $this->log('Location '.$asset_location.' already exists');
return $location->id; return $location->id;
} }
// No matching locations in the collection, create a new one. // No matching locations in the collection, create a new one.

View file

@ -38,8 +38,16 @@ class LocationImporter extends ItemImporter
{ {
$editingLocation = false; $editingLocation = false;
$location = Location::where('name', '=', $this->findCsvMatch($row, 'name'))->first(); $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 ($location) {
if (! $this->updating) { if (! $this->updating) {
$this->log('A matching Location '.$this->item['name'].' already exists'); $this->log('A matching Location '.$this->item['name'].' already exists');
@ -95,6 +103,7 @@ class LocationImporter extends ItemImporter
} else { } else {
Log::debug($location->getErrors()); Log::debug($location->getErrors());
$this->logError($location, 'Location "'.$this->item['name'].'"');
return $location->errors; return $location->errors;
} }

View file

@ -329,6 +329,7 @@ class Importer extends Component
]; ];
$this->locations_fields = [ $this->locations_fields = [
'id' => trans('general.id'),
'name' => trans('general.item_name_var', ['item' => trans('general.location')]), 'name' => trans('general.item_name_var', ['item' => trans('general.location')]),
'address' => trans('general.address'), 'address' => trans('general.address'),
'address2' => trans('general.importer.address2'), 'address2' => trans('general.importer.address2'),
@ -400,7 +401,6 @@ class Importer extends Component
'requestable', 'requestable',
'Requestable', 'Requestable',
], ],
'gravatar' => 'gravatar' =>
[ [
'gravatar', 'gravatar',

8
package-lock.json generated
View file

@ -15,7 +15,7 @@
"bootstrap-colorpicker": "^2.5.3", "bootstrap-colorpicker": "^2.5.3",
"bootstrap-datepicker": "^1.10.0", "bootstrap-datepicker": "^1.10.0",
"bootstrap-less": "^3.3.8", "bootstrap-less": "^3.3.8",
"bootstrap-table": "1.23.5", "bootstrap-table": "1.24.0",
"canvas-confetti": "^1.9.3", "canvas-confetti": "^1.9.3",
"chart.js": "^2.9.4", "chart.js": "^2.9.4",
"clipboard": "^2.0.11", "clipboard": "^2.0.11",
@ -3705,9 +3705,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/bootstrap-table": { "node_modules/bootstrap-table": {
"version": "1.23.5", "version": "1.24.0",
"resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.23.5.tgz", "resolved": "https://registry.npmjs.org/bootstrap-table/-/bootstrap-table-1.24.0.tgz",
"integrity": "sha512-9WByoSpJvA73gi2YYIlX6IWR74oZtBmSixul/Th8FTBtBd/kZRpbKESGTjhA3BA3AYTnfyY8Iy1KeRWPlV2GWQ==", "integrity": "sha512-dyRf5PQwTgFHj9yjuPXa+GIf4JpuQhsgD1CJrOqhw40qI2gTb3mJfRdoBc7iF2bqzOl+k0RnbAlhSPbGe4VS+w==",
"peerDependencies": { "peerDependencies": {
"jquery": "3" "jquery": "3"
} }

View file

@ -35,7 +35,7 @@
"bootstrap-colorpicker": "^2.5.3", "bootstrap-colorpicker": "^2.5.3",
"bootstrap-datepicker": "^1.10.0", "bootstrap-datepicker": "^1.10.0",
"bootstrap-less": "^3.3.8", "bootstrap-less": "^3.3.8",
"bootstrap-table": "1.23.5", "bootstrap-table": "1.24.0",
"canvas-confetti": "^1.9.3", "canvas-confetti": "^1.9.3",
"chart.js": "^2.9.4", "chart.js": "^2.9.4",
"clipboard": "^2.0.11", "clipboard": "^2.0.11",

Binary file not shown.

Binary file not shown.

View file

@ -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]); $this->assertEquals($evil_string, $results->json()['files'][0]['first_row'][0]);
} }
} }