From a937bd34f69870411a97f605333e2736250ebd86 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 29 Mar 2022 16:28:43 +0100 Subject: [PATCH] Merge master back down into develop Signed-off-by: snipe --- .all-contributorsrc | 9 ++ README.md | 4 + app/Console/Commands/MoveUploadsToNewDisk.php | 150 +++++++++--------- app/Console/Commands/RestoreFromBackup.php | 4 +- .../Api/StatuslabelsController.php | 13 +- app/Importer/LicenseImporter.php | 2 +- app/Models/Asset.php | 9 ++ app/Models/User.php | 1 - config/version.php | 12 +- ...8_10_18_191228_add_kits_licenses_table.php | 4 +- .../2018_10_19_153910_add_kits_table.php | 3 +- ...018_10_19_154013_add_kits_models_table.php | 5 +- ...2_07_185953_add_kits_consumables_table.php | 4 +- ...2_07_190030_add_kits_accessories_table.php | 4 +- .../views/partials/bootstrap-table.blade.php | 11 +- 15 files changed, 134 insertions(+), 101 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 412e929e4a..e07a3f24f7 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2585,6 +2585,15 @@ "contributions": [ "code" ] + }, + { + "login": "QveenSi", + "name": "Yevhenii Huzii", + "avatar_url": "https://avatars.githubusercontent.com/u/19945501?v=4", + "profile": "https://github.com/QveenSi", + "contributions": [ + "code" + ] } ] } diff --git a/README.md b/README.md index a15e19f13c..9e6c3c981d 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,10 @@ Thanks goes to all of these wonderful people ([emoji key](https://github.com/ken | [
Mark Stenglein](https://markstenglein.com)
[💻](https://github.com/snipe/snipe-it/commits?author=ocelotsloth "Code") | [
ajsy](https://github.com/ajsy)
[💻](https://github.com/snipe/snipe-it/commits?author=ajsy "Code") | [
Jan Kiesewetter](https://github.com/t3easy)
[💻](https://github.com/snipe/snipe-it/commits?author=t3easy "Code") | [
Tetrachloromethane250](https://github.com/Tetrachloromethane250)
[💻](https://github.com/snipe/snipe-it/commits?author=Tetrachloromethane250 "Code") | [
Lars Kajes](https://www.kajes.se/)
[💻](https://github.com/snipe/snipe-it/commits?author=kajes "Code") | [
Joly0](https://github.com/Joly0)
[💻](https://github.com/snipe/snipe-it/commits?author=Joly0 "Code") | [
theburger](https://github.com/limeless)
[💻](https://github.com/snipe/snipe-it/commits?author=limeless "Code") | | [
David Valin Alonso](https://github.com/deivishome)
[💻](https://github.com/snipe/snipe-it/commits?author=deivishome "Code") | [
andreaci](https://github.com/andreaci)
[💻](https://github.com/snipe/snipe-it/commits?author=andreaci "Code") | [
Jelle Sebreghts](http://www.jellesebreghts.be)
[💻](https://github.com/snipe/snipe-it/commits?author=Jelle-S "Code") | [
Michael Pietsch](https://github.com/Skywalker-11)
| [
Masudul Haque Shihab](https://github.com/sh1hab)
[💻](https://github.com/snipe/snipe-it/commits?author=sh1hab "Code") | [
Supapong Areeprasertkul](http://www.freedomdive.com/)
[💻](https://github.com/snipe/snipe-it/commits?author=zybersup "Code") | [
Peter Sarossy](https://github.com/psarossy)
[💻](https://github.com/snipe/snipe-it/commits?author=psarossy "Code") | | [
Renee Margaret McConahy](https://github.com/nepella)
[💻](https://github.com/snipe/snipe-it/commits?author=nepella "Code") | [
JohnnyPicnic](https://github.com/JohnnyPicnic)
[💻](https://github.com/snipe/snipe-it/commits?author=JohnnyPicnic "Code") | [
markbrule](https://github.com/markbrule)
[💻](https://github.com/snipe/snipe-it/commits?author=markbrule "Code") | [
Mike Campbell](https://github.com/mikecmpbll)
[💻](https://github.com/snipe/snipe-it/commits?author=mikecmpbll "Code") | [
tbrconnect](https://github.com/tbrconnect)
[💻](https://github.com/snipe/snipe-it/commits?author=tbrconnect "Code") | [
kcoyo](https://github.com/kcoyo)
[💻](https://github.com/snipe/snipe-it/commits?author=kcoyo "Code") | [
Travis Miller](https://travismiller.com/)
[💻](https://github.com/snipe/snipe-it/commits?author=travismiller "Code") | +| [
Petri Asikainen](https://github.com/PetriAsi)
[💻](https://github.com/snipe/snipe-it/commits?author=PetriAsi "Code") | [
derdeagle](https://github.com/derdeagle)
[💻](https://github.com/snipe/snipe-it/commits?author=derdeagle "Code") | [
Mike Frysinger](https://wh0rd.org/)
[💻](https://github.com/snipe/snipe-it/commits?author=vapier "Code") | [
ALPHA](https://github.com/AL4AL)
[💻](https://github.com/snipe/snipe-it/commits?author=AL4AL "Code") | [
FliegenKLATSCH](https://www.ifern.de)
[💻](https://github.com/snipe/snipe-it/commits?author=FliegenKLATSCH "Code") | [
Jeremy Price](https://github.com/jerm)
[💻](https://github.com/snipe/snipe-it/commits?author=jerm "Code") | [
Toreg87](https://github.com/Toreg87)
[💻](https://github.com/snipe/snipe-it/commits?author=Toreg87 "Code") | +| [
Matthew Nickson](https://github.com/Computroniks)
[💻](https://github.com/snipe/snipe-it/commits?author=Computroniks "Code") | [
Jethro Nederhof](https://jethron.id.au)
[💻](https://github.com/snipe/snipe-it/commits?author=jethron "Code") | [
Oskar Stenberg](https://github.com/01ste02)
[💻](https://github.com/snipe/snipe-it/commits?author=01ste02 "Code") | [
Robert-Azelis](https://github.com/Robert-Azelis)
[💻](https://github.com/snipe/snipe-it/commits?author=Robert-Azelis "Code") | [
Alexander William Smith](https://github.com/alwism)
[💻](https://github.com/snipe/snipe-it/commits?author=alwism "Code") | [
LEITWERK AG](https://www.leitwerk.de/)
[💻](https://github.com/snipe/snipe-it/commits?author=leitwerk-ag "Code") | [
Adam](http://www.aboutcher.co.uk)
[💻](https://github.com/snipe/snipe-it/commits?author=adamboutcher "Code") | +| [
Ian](https://snksrv.com)
[💻](https://github.com/snipe/snipe-it/commits?author=sneak-it "Code") | [
Shao Yu-Lung (Allen)](http://blog.bestlong.idv.tw/)
[💻](https://github.com/snipe/snipe-it/commits?author=bestlong "Code") | [
Haxatron](https://github.com/Haxatron)
[💻](https://github.com/snipe/snipe-it/commits?author=Haxatron "Code") | [
Bradley Coudriet](http://bjcpgd.cias.rit.edu)
[💻](https://github.com/snipe/snipe-it/commits?author=exula "Code") | [
Dalton Durst](https://daltondur.st)
[💻](https://github.com/snipe/snipe-it/commits?author=UniversalSuperBox "Code") | [
TenOfTens](https://github.com/TenOfTens)
[💻](https://github.com/snipe/snipe-it/commits?author=TenOfTens "Code") | [
Simona Avornicesei](http://www.avornicesei.com)
[⚠️](https://github.com/snipe/snipe-it/commits?author=savornicesei "Tests") | +| [
Yevhenii Huzii](https://github.com/QveenSi)
[💻](https://github.com/snipe/snipe-it/commits?author=QveenSi "Code") | | [
Evan Taylor](https://github.com/Delta5)
[💻](https://github.com/snipe/snipe-it/commits?author=Delta5 "Code") | [
Petri Asikainen](https://github.com/PetriAsi)
[💻](https://github.com/snipe/snipe-it/commits?author=PetriAsi "Code") | [
derdeagle](https://github.com/derdeagle)
[💻](https://github.com/snipe/snipe-it/commits?author=derdeagle "Code") | [
Mike Frysinger](https://wh0rd.org/)
[💻](https://github.com/snipe/snipe-it/commits?author=vapier "Code") | [
ALPHA](https://github.com/AL4AL)
[💻](https://github.com/snipe/snipe-it/commits?author=AL4AL "Code") | [
FliegenKLATSCH](https://www.ifern.de)
[💻](https://github.com/snipe/snipe-it/commits?author=FliegenKLATSCH "Code") | [
Jeremy Price](https://github.com/jerm)
[💻](https://github.com/snipe/snipe-it/commits?author=jerm "Code") | | [
Toreg87](https://github.com/Toreg87)
[💻](https://github.com/snipe/snipe-it/commits?author=Toreg87 "Code") | [
Matthew Nickson](https://github.com/Computroniks)
[💻](https://github.com/snipe/snipe-it/commits?author=Computroniks "Code") | [
Jethro Nederhof](https://jethron.id.au)
[💻](https://github.com/snipe/snipe-it/commits?author=jethron "Code") | [
Oskar Stenberg](https://github.com/01ste02)
[💻](https://github.com/snipe/snipe-it/commits?author=01ste02 "Code") | [
Robert-Azelis](https://github.com/Robert-Azelis)
[💻](https://github.com/snipe/snipe-it/commits?author=Robert-Azelis "Code") | [
Alexander William Smith](https://github.com/alwism)
[💻](https://github.com/snipe/snipe-it/commits?author=alwism "Code") | [
LEITWERK AG](https://www.leitwerk.de/)
[💻](https://github.com/snipe/snipe-it/commits?author=leitwerk-ag "Code") | | [
Adam](http://www.aboutcher.co.uk)
[💻](https://github.com/snipe/snipe-it/commits?author=adamboutcher "Code") | [
Ian](https://snksrv.com)
[💻](https://github.com/snipe/snipe-it/commits?author=sneak-it "Code") | [
Shao Yu-Lung (Allen)](http://blog.bestlong.idv.tw/)
[💻](https://github.com/snipe/snipe-it/commits?author=bestlong "Code") | [
Haxatron](https://github.com/Haxatron)
[💻](https://github.com/snipe/snipe-it/commits?author=Haxatron "Code") | [
PlaneNuts](https://github.com/PlaneNuts)
[💻](https://github.com/snipe/snipe-it/commits?author=PlaneNuts "Code") | [
Bradley Coudriet](http://bjcpgd.cias.rit.edu)
[💻](https://github.com/snipe/snipe-it/commits?author=exula "Code") | [
Dalton Durst](https://daltondur.st)
[💻](https://github.com/snipe/snipe-it/commits?author=UniversalSuperBox "Code") | diff --git a/app/Console/Commands/MoveUploadsToNewDisk.php b/app/Console/Commands/MoveUploadsToNewDisk.php index 8fa5ddafd7..9de6781fb6 100644 --- a/app/Console/Commands/MoveUploadsToNewDisk.php +++ b/app/Console/Commands/MoveUploadsToNewDisk.php @@ -46,32 +46,33 @@ public function handle() } $delete_local = $this->argument('delete_local'); - $public_uploads['accessories'] = glob('public/accessories'.'/*.*'); - $public_uploads['assets'] = glob('public/assets'.'/*.*'); - $public_uploads['avatars'] = glob('public/avatars'.'/*.*'); - $public_uploads['categories'] = glob('public/categories'.'/*.*'); - $public_uploads['companies'] = glob('public/companies'.'/*.*'); - $public_uploads['components'] = glob('public/components'.'/*.*'); - $public_uploads['consumables'] = glob('public/consumables'.'/*.*'); - $public_uploads['departments'] = glob('public/departments'.'/*.*'); - $public_uploads['locations'] = glob('public/locations'.'/*.*'); - $public_uploads['manufacturers'] = glob('public/manufacturers'.'/*.*'); - $public_uploads['suppliers'] = glob('public/suppliers'.'/*.*'); - $public_uploads['assetmodels'] = glob('public/models'.'/*.*'); + $public_uploads['accessories'] = glob('public/uploads/accessories' . "/*.*"); + $public_uploads['assets'] = glob('public/uploads/assets' . "/*.*"); + $public_uploads['avatars'] = glob('public/uploads/avatars' . "/*.*"); + $public_uploads['categories'] = glob('public/uploads/categories' . "/*.*"); + $public_uploads['companies'] = glob('public/uploads/companies' . "/*.*"); + $public_uploads['components'] = glob('public/uploads/components' . "/*.*"); + $public_uploads['consumables'] = glob('public/uploads/consumables' . "/*.*"); + $public_uploads['departments'] = glob('public/uploads/departments' . "/*.*"); + $public_uploads['locations'] = glob('public/uploads/locations' . "/*.*"); + $public_uploads['manufacturers'] = glob('public/uploads/manufacturers' . "/*.*"); + $public_uploads['suppliers'] = glob('public/uploads/suppliers' . "/*.*"); + $public_uploads['assetmodels'] = glob('public/uploads/models' . "/*.*"); + // iterate files foreach ($public_uploads as $public_type => $public_upload) { $type_count = 0; - $this->info('- There are '.count($public_upload).' PUBLIC '.$public_type.' files.'); + $this->info('- There are ' . count($public_upload) . ' PUBLIC ' . $public_type . ' files.'); for ($i = 0; $i < count($public_upload); $i++) { $type_count++; $filename = basename($public_upload[$i]); try { - Storage::disk('public')->put('uploads/'.public_type.'/'.$filename, file_get_contents($public_upload[$i])); - $new_url = Storage::disk('public')->url('uploads/'.$public_type.'/'.$filename, $filename); - $this->info($type_count.'. PUBLIC: '.$filename.' was copied to '.$new_url); + Storage::disk('public')->put('uploads/' . $public_type . '/' . $filename, file_get_contents($public_upload[$i])); + $new_url = Storage::disk('public')->url('uploads/' . $public_type . '/' . $filename, $filename); + $this->info($type_count . '. PUBLIC: ' . $filename . ' was copied to ' . $new_url); } catch (\Exception $e) { \Log::debug($e); $this->error($e); @@ -80,82 +81,85 @@ public function handle() } $logos = glob('public/uploads/setting*.*'); - $this->info('- There are '.count($logos).' files that might be logos.'); + $this->info('- There are ' . count($logos) . ' files that might be logos.'); $type_count = 0; foreach ($logos as $logo) { $this->info($logo); $type_count++; $filename = basename($logo); - Storage::disk('public')->put('uploads/'.$filename, file_get_contents($logo)); - $this->info($type_count.'. LOGO: '.$filename.' was copied to '.env('PUBLIC_AWS_URL').'/uploads/'.$filename); + Storage::disk('public')->put('uploads/' . $filename, file_get_contents($logo)); + $this->info($type_count . '. LOGO: ' . $filename . ' was copied to ' . env('PUBLIC_AWS_URL') . '/uploads/' . $filename); } - $private_uploads['assets'] = glob('storage/private_uploads/assets'.'/*.*'); - $private_uploads['signatures'] = glob('storage/private_uploads/signatures'.'/*.*'); - $private_uploads['audits'] = glob('storage/private_uploads/audits'.'/*.*'); - $private_uploads['assetmodels'] = glob('storage/private_uploads/assetmodels'.'/*.*'); - $private_uploads['imports'] = glob('storage/private_uploads/imports'.'/*.*'); - $private_uploads['licenses'] = glob('storage/private_uploads/licenses'.'/*.*'); - $private_uploads['users'] = glob('storage/private_uploads/users'.'/*.*'); - $private_uploads['backups'] = glob('storage/private_uploads/users'.'/*.*'); + $private_uploads['assets'] = glob('storage/private_uploads/assets' . '/*.*'); + $private_uploads['signatures'] = glob('storage/private_uploads/signatures' . '/*.*'); + $private_uploads['audits'] = glob('storage/private_uploads/audits' . '/*.*'); + $private_uploads['assetmodels'] = glob('storage/private_uploads/assetmodels' . '/*.*'); + $private_uploads['imports'] = glob('storage/private_uploads/imports' . '/*.*'); + $private_uploads['licenses'] = glob('storage/private_uploads/licenses' . '/*.*'); + $private_uploads['users'] = glob('storage/private_uploads/users' . '/*.*'); + $private_uploads['backups'] = glob('storage/private_uploads/users' . '/*.*'); foreach ($private_uploads as $private_type => $private_upload) { - $this->info('- There are '.count($private_upload).' PRIVATE '.$private_type.' files.'); - - $type_count = 0; - for ($x = 0; $x < count($private_upload); $x++) { - $type_count++; - $filename = basename($private_upload[$x]); - - try { - Storage::put($private_type.'/'.$filename, file_get_contents($private_upload[$i])); - $new_url = Storage::url($private_type.'/'.$filename, $filename); - $this->info($type_count.'. PRIVATE: '.$filename.' was copied to '.$new_url); - } catch (\Exception $e) { - \Log::debug($e); - $this->error($e); + { + $this->info('- There are ' . count($private_upload) . ' PRIVATE ' . $private_type . ' files.'); + + $type_count = 0; + for ($x = 0; $x < count($private_upload); $x++) { + $type_count++; + $filename = basename($private_upload[$x]); + + try { + Storage::put($private_type . '/' . $filename, file_get_contents($private_upload[$i])); + $new_url = Storage::url($private_type . '/' . $filename, $filename); + $this->info($type_count . '. PRIVATE: ' . $filename . ' was copied to ' . $new_url); + } catch (\Exception $e) { + \Log::debug($e); + $this->error($e); + } } } - } - if ($delete_local == 'true') { - $public_delete_count = 0; - $private_delete_count = 0; - - $this->info("\n\n"); - $this->error('!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); - $this->warn("\nTHIS WILL DELETE ALL OF YOUR LOCAL UPLOADED FILES. \n\nThis cannot be undone, so you should take a backup of your system before you proceed.\n"); - $this->error('!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); - - if ($this->confirm('Do you wish to continue?')) { - foreach ($public_uploads as $public_type => $public_upload) { - for ($i = 0; $i < count($public_upload); $i++) { - $filename = $public_upload[$i]; - try { - unlink($filename); - $public_delete_count++; - } catch (\Exception $e) { - \Log::debug($e); - $this->error($e); + + if ($delete_local == 'true') { + $public_delete_count = 0; + $private_delete_count = 0; + + $this->info("\n\n"); + $this->error('!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); + $this->warn("\nTHIS WILL DELETE ALL OF YOUR LOCAL UPLOADED FILES. \n\nThis cannot be undone, so you should take a backup of your system before you proceed.\n"); + $this->error('!!!!!!!!!!!!!!!!!!!!!!!!!!!!! WARNING!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); + + if ($this->confirm('Do you wish to continue?')) { + foreach ($public_uploads as $public_type => $public_upload) { + for ($i = 0; $i < count($public_upload); $i++) { + $filename = $public_upload[$i]; + try { + unlink($filename); + $public_delete_count++; + } catch (\Exception $e) { + \Log::debug($e); + $this->error($e); + } } } - } - foreach ($private_uploads as $private_type => $private_upload) { - for ($i = 0; $i < count($private_upload); $i++) { - $filename = $private_upload[$i]; - try { - unlink($filename); - $private_delete_count++; - } catch (\Exception $e) { - \Log::debug($e); - $this->error($e); + foreach ($private_uploads as $private_type => $private_upload) { + for ($i = 0; $i < count($private_upload); $i++) { + $filename = $private_upload[$i]; + try { + unlink($filename); + $private_delete_count++; + } catch (\Exception $e) { + \Log::debug($e); + $this->error($e); + } } } - } - $this->info($public_delete_count.' PUBLIC local files and '.$private_delete_count.' PRIVATE local files were deleted from your filesystem.'); + $this->info($public_delete_count . ' PUBLIC local files and ' . $private_delete_count . ' PRIVATE local files were deleted from your filesystem.'); + } } } } diff --git a/app/Console/Commands/RestoreFromBackup.php b/app/Console/Commands/RestoreFromBackup.php index fe778172c8..e0f4eeab16 100644 --- a/app/Console/Commands/RestoreFromBackup.php +++ b/app/Console/Commands/RestoreFromBackup.php @@ -13,8 +13,8 @@ class RestoreFromBackup extends Command * @var string */ protected $signature = 'snipeit:restore - {--force : Skip the danger prompt; assuming you hit "y"} - {filename : The full path of the .zip file to be migrated} + {--force : Skip the danger prompt; assuming you enter "y"} + {filename : The zip file to be migrated} {--no-progress : Don\'t show a progress bar}'; /** diff --git a/app/Http/Controllers/Api/StatuslabelsController.php b/app/Http/Controllers/Api/StatuslabelsController.php index a3734a042f..48cb20018c 100644 --- a/app/Http/Controllers/Api/StatuslabelsController.php +++ b/app/Http/Controllers/Api/StatuslabelsController.php @@ -33,13 +33,13 @@ public function index(Request $request) // if a status_type is passed, filter by that if ($request->filled('status_type')) { - if (strtolower($request->input('status_type'))== 'pending') { + if (strtolower($request->input('status_type')) == 'pending') { $statuslabels = $statuslabels->Pending(); - } elseif (strtolower($request->input('status_type'))== 'archived') { + } elseif (strtolower($request->input('status_type')) == 'archived') { $statuslabels = $statuslabels->Archived(); - } elseif (strtolower($request->input('status_type'))== 'deployable') { + } elseif (strtolower($request->input('status_type')) == 'deployable') { $statuslabels = $statuslabels->Deployable(); - } elseif (strtolower($request->input('status_type'))== 'undeployable') { + } elseif (strtolower($request->input('status_type')) == 'undeployable') { $statuslabels = $statuslabels->Undeployable(); } } @@ -94,8 +94,8 @@ public function store(Request $request) if ($statuslabel->save()) { return response()->json(Helper::formatStandardApiResponse('success', $statuslabel, trans('admin/statuslabels/message.create.success'))); } - return response()->json(Helper::formatStandardApiResponse('error', null, $statuslabel->getErrors())); + } /** @@ -114,6 +114,7 @@ public function show($id) return (new StatuslabelsTransformer)->transformStatuslabel($statuslabel); } + /** * Update the specified resource in storage. * @@ -130,6 +131,7 @@ public function update(Request $request, $id) $request->except('deployable', 'pending', 'archived'); + if (! $request->filled('type')) { return response()->json(Helper::formatStandardApiResponse('error', null, 'Status label type is required.')); } @@ -175,6 +177,7 @@ public function destroy($id) return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/statuslabels/message.assoc_assets'))); } + /** * Show a count of assets by status label for pie chart * diff --git a/app/Importer/LicenseImporter.php b/app/Importer/LicenseImporter.php index 358164313f..894c50bbfa 100644 --- a/app/Importer/LicenseImporter.php +++ b/app/Importer/LicenseImporter.php @@ -35,7 +35,7 @@ public function createLicenseIfNotExists(array $row) ->first(); if ($license) { if (! $this->updating) { - $this->log('A matching License '.$this->item['name'].'with serial '.$this->item['serial'].' already exists'); + $this->log('A matching License '.$this->item['name'].' with serial '.$this->item['serial'].' already exists'); return; } diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 4da71d3669..ac373b2ad4 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -195,6 +195,13 @@ public function save(array $params = []) $model = AssetModel::find($this->model_id); if (($model) && ($model->fieldset)) { + + foreach ($model->fieldset->fields as $field){ + if($field->format == 'BOOLEAN'){ + $this->{$field->db_column} = filter_var($this->{$field->db_column}, FILTER_VALIDATE_BOOLEAN); + } + } + $this->rules += $model->fieldset->validation_rules(); foreach ($this->model->fieldset->fields as $field){ @@ -205,6 +212,8 @@ public function save(array $params = []) } } + + return parent::save($params); } diff --git a/app/Models/User.php b/app/Models/User.php index 8f06eae6a8..f211a3c134 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -74,7 +74,6 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo * @var array */ - // 'username' => 'required|string|min:1|unique:users,username,NULL,id,deleted_at,NULL', protected $rules = [ 'first_name' => 'required|string|min:1', 'username' => 'required|string|min:1|unique_undeleted', diff --git a/config/version.php b/config/version.php index c9ff26503d..29e2589345 100644 --- a/config/version.php +++ b/config/version.php @@ -1,10 +1,10 @@ 'v6.0.0-RC-5', - 'full_app_version' => 'v6.0.0-RC-5 - build 6772-g7cbcd2d95', - 'build_version' => '6772', + 'app_version' => 'v6.0.0-RC-6', + 'full_app_version' => 'v6.0.0-RC-6 - build 6785-gab18ceb2f', + 'build_version' => '6785', 'prerelease_version' => '', - 'hash_version' => 'g7cbcd2d95', - 'full_hash' => 'v6.0.0-RC-5-19-g7cbcd2d95', - 'branch' => 'merges/master_down_to_develop_march_16', + 'hash_version' => 'gab18ceb2f', + 'full_hash' => 'v6.0.0-RC-6-gab18ceb2f', + 'branch' => 'develop', ); \ No newline at end of file diff --git a/database/migrations/2018_10_18_191228_add_kits_licenses_table.php b/database/migrations/2018_10_18_191228_add_kits_licenses_table.php index 470f67803c..5461742022 100644 --- a/database/migrations/2018_10_18_191228_add_kits_licenses_table.php +++ b/database/migrations/2018_10_18_191228_add_kits_licenses_table.php @@ -17,8 +17,8 @@ public function up() if (!Schema::hasTable('kits_licenses')) { Schema::create('kits_licenses', function ($table) { $table->increments('id'); - $table->integer('kit_id')->nullable()->default(null); - $table->integer('license_id')->nullable()->default(null); + $table->integer('kit_id')->nullable()->default(NULL); + $table->integer('license_id')->nullable()->default(NULL); $table->integer('quantity')->default(1); $table->timestamps(); }); diff --git a/database/migrations/2018_10_19_153910_add_kits_table.php b/database/migrations/2018_10_19_153910_add_kits_table.php index fbc683f180..08d04d29e8 100644 --- a/database/migrations/2018_10_19_153910_add_kits_table.php +++ b/database/migrations/2018_10_19_153910_add_kits_table.php @@ -16,7 +16,7 @@ public function up() if (!Schema::hasTable('kits')) { Schema::create('kits', function ($table) { $table->increments('id'); - $table->string('name')->nullable()->default(null); + $table->string('name')->nullable()->default(NULL); $table->timestamps(); $table->engine = 'InnoDB'; }); @@ -34,6 +34,7 @@ public function down() if (Schema::hasTable('kits')) { Schema::drop('kits'); } + } } diff --git a/database/migrations/2018_10_19_154013_add_kits_models_table.php b/database/migrations/2018_10_19_154013_add_kits_models_table.php index 3b5224c6bc..ea651085b5 100644 --- a/database/migrations/2018_10_19_154013_add_kits_models_table.php +++ b/database/migrations/2018_10_19_154013_add_kits_models_table.php @@ -17,8 +17,8 @@ public function up() if (!Schema::hasTable('kits_models')) { Schema::create('kits_models', function ($table) { $table->increments('id'); - $table->integer('kit_id')->nullable()->default(null); - $table->integer('model_id')->nullable()->default(null); + $table->integer('kit_id')->nullable()->default(NULL); + $table->integer('model_id')->nullable()->default(NULL); $table->integer('quantity')->default(1); $table->timestamps(); }); @@ -36,4 +36,5 @@ public function down() Schema::drop('kits_models'); } } + } diff --git a/database/migrations/2019_02_07_185953_add_kits_consumables_table.php b/database/migrations/2019_02_07_185953_add_kits_consumables_table.php index 34fbb3539b..6f7595484a 100644 --- a/database/migrations/2019_02_07_185953_add_kits_consumables_table.php +++ b/database/migrations/2019_02_07_185953_add_kits_consumables_table.php @@ -16,8 +16,8 @@ public function up() if (!Schema::hasTable('kits_consumables')) { Schema::create('kits_consumables', function ($table) { $table->increments('id'); - $table->integer('kit_id')->nullable()->default(null); - $table->integer('consumable_id')->nullable()->default(null); + $table->integer('kit_id')->nullable()->default(NULL); + $table->integer('consumable_id')->nullable()->default(NULL); $table->integer('quantity')->default(1); $table->timestamps(); }); diff --git a/database/migrations/2019_02_07_190030_add_kits_accessories_table.php b/database/migrations/2019_02_07_190030_add_kits_accessories_table.php index 1a4e14af94..242b283e52 100644 --- a/database/migrations/2019_02_07_190030_add_kits_accessories_table.php +++ b/database/migrations/2019_02_07_190030_add_kits_accessories_table.php @@ -16,8 +16,8 @@ public function up() if (!Schema::hasTable('kits_accessories')) { Schema::create('kits_accessories', function ($table) { $table->increments('id'); - $table->integer('kit_id')->nullable()->default(null); - $table->integer('accessory_id')->nullable()->default(null); + $table->integer('kit_id')->nullable()->default(NULL); + $table->integer('accessory_id')->nullable()->default(NULL); $table->integer('quantity')->default(1); $table->timestamps(); }); diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 257718361a..98fb784a33 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -31,6 +31,11 @@ } $('.snipe-table').bootstrapTable({ + data_export_options = $(this).attr('data-export-options'); + export_options = data_export_options? JSON.parse(data_export_options): {}; + export_options['htmlContent'] = true; //always enforce this on the given data-export-options (to prevent XSS) + + $(this).bootstrapTable({ classes: 'table table-responsive table-no-bordered', ajaxOptions: { headers: { @@ -76,17 +81,15 @@ classes: 'table table-responsive table-no-bordered', export: 'fa-download', clearSearch: 'fa-times' }, - exportOptions: { - htmlContent: true, - }, + exportOptions: export_options, exportTypes: ['csv', 'excel', 'doc', 'txt','json', 'xml', 'pdf'], onLoadSuccess: function () { $('[data-toggle="tooltip"]').tooltip(); // Needed to attach tooltips after ajax call } + }); }); - });