A free open source IT asset/license management system
Merge branch 'master' into integrations/2020-08-31-v5-rc
snipee321aeabaed5
diff --cc README.mdindex d9b7db5a1c,20a6e35946..2e85a4ed60--- a/README.md+++ b/README.md@@@ -1,5 -1,5 +1,6 @@@[](https://travis-ci.org/snipe/snipe-it) [](https://crowdin.com/project/snipe-it) [](https://gitter.im/snipe/snipe-it?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [](https://hub.docker.com/r/snipe/snipe-it/) [](https://twitter.com/snipeitapp) [](https://www.codacy.com/app/snipe/snipe-it?utm_source=github.com&utm_medium=referral&utm_content=snipe/snipe-it&utm_campaign=Badge_Grade)+ [](#contributors) [](https://www.codetriage.com/snipe/snipe-it)+[](#contributors) [](https://www.codetriage.com/snipe/snipe-it)## Snipe-IT - Open Source Asset Management System@@@ -114,12 -105,8 +115,14 @@@ Thanks goes to all of these wonderful p| [<img src="https://avatars2.githubusercontent.com/u/982885?v=4" width="110px;"/><br /><sub>Martin Stub</sub>](http://martinstub.dk)<br />[π](#translation-stubben "Translation") | [<img src="https://avatars2.githubusercontent.com/u/28959963?v=4" width="110px;"/><br /><sub>Meyer Flavio</sub>](https://github.com/meyerf99)<br />[π](#translation-meyerf99 "Translation") | [<img src="https://avatars3.githubusercontent.com/u/796443?v=4" width="110px;"/><br /><sub>Micael Rodrigues</sub>](https://github.com/MicaelRodrigues)<br />[π](#translation-MicaelRodrigues "Translation") | [<img src="https://avatars0.githubusercontent.com/u/10481331?v=4" width="110px;"/><br /><sub>Mikael Rasmussen</sub>](http://rubixy.com/)<br />[π](#translation-mikaelssen "Translation") | [<img src="https://avatars1.githubusercontent.com/u/1544552?v=4" width="110px;"/><br /><sub>IxFail</sub>](https://github.com/IxFail)<br />[π](#translation-IxFail "Translation") | [<img src="https://avatars3.githubusercontent.com/u/18483118?v=4" width="110px;"/><br /><sub>Mohammed Fota</sub>](http://www.mohammedfota.com)<br />[π](#translation-MohammedFota "Translation") | [<img src="https://avatars0.githubusercontent.com/u/227080?v=4" width="110px;"/><br /><sub>Moayad Alserihi</sub>](https://github.com/omego)<br />[π](#translation-omego "Translation") || [<img src="https://avatars0.githubusercontent.com/u/1680266?v=4" width="110px;"/><br /><sub>saymd</sub>](https://github.com/saymd)<br />[π](#translation-saymd "Translation") | [<img src="https://avatars0.githubusercontent.com/u/1826808?v=4" width="110px;"/><br /><sub>Patrik Larsson</sub>](https://nordsken.se)<br />[π](#translation-pooot "Translation") | [<img src="https://avatars1.githubusercontent.com/u/20584746?v=4" width="110px;"/><br /><sub>drcryo</sub>](https://github.com/drcryo)<br />[π](#translation-drcryo "Translation") | [<img src="https://avatars1.githubusercontent.com/u/19408004?v=4" width="110px;"/><br /><sub>pawel1615</sub>](https://github.com/pawel1615)<br />[π](#translation-pawel1615 "Translation") | [<img src="https://avatars2.githubusercontent.com/u/23340468?v=4" width="110px;"/><br /><sub>bodrovics</sub>](https://github.com/bodrovics)<br />[π](#translation-bodrovics "Translation") | [<img src="https://avatars0.githubusercontent.com/u/3257654?v=4" width="110px;"/><br /><sub>priatna</sub>](https://github.com/priatna)<br />[π](#translation-priatna "Translation") | [<img src="https://avatars1.githubusercontent.com/u/5358374?v=4" width="110px;"/><br /><sub>Fan Jiang</sub>](https://amayume.net)<br />[π](#translation-ProfFan "Translation") || [<img src="https://avatars1.githubusercontent.com/u/22555451?v=4" width="110px;"/><br /><sub>ragnarcx</sub>](https://github.com/ragnarcx)<br />[π](#translation-ragnarcx "Translation") | [<img src="https://avatars2.githubusercontent.com/u/18654582?v=4" width="110px;"/><br /><sub>Rein van Haaren</sub>](http://www.reinvanhaaren.nl/)<br />[π](#translation-reinvanhaaren "Translation") | [<img src="https://avatars1.githubusercontent.com/u/386672?v=4" width="110px;"/><br /><sub>Teguh Dwicaksana</sub>](http://dheche.songolimo.net)<br />[π](#translation-dheche "Translation") | [<img src="https://avatars2.githubusercontent.com/u/2572552?v=4" width="110px;"/><br /><sub>fraccie</sub>](https://github.com/FRaccie)<br />[π](#translation-FRaccie "Translation") | [<img src="https://avatars0.githubusercontent.com/u/35182720?v=4" width="110px;"/><br /><sub>vinzruzell</sub>](https://github.com/vinzruzell)<br />[π](#translation-vinzruzell "Translation") | [<img src="https://avatars1.githubusercontent.com/u/7883603?v=4" width="110px;"/><br /><sub>Kevin Austin</sub>](http://kevinaustin.com)<br />[π](#translation-vipsystem "Translation") | [<img src="https://avatars3.githubusercontent.com/u/3861828?v=4" width="110px;"/><br /><sub>Wira Sandy</sub>](http://azuraweb.xyz)<br />[π](#translation-wira-sandy "Translation") |+ | [<img src="https://avatars2.githubusercontent.com/u/8663789?v=4" width="110px;"/><br /><sub>ΠΠ»ΡΡ</sub>](https://github.com/GrayHoax)<br />[π](#translation-GrayHoax "Translation") | [<img src="https://avatars3.githubusercontent.com/u/30119111?v=4" width="110px;"/><br /><sub>GodUseVPN</sub>](https://github.com/godusevpn)<br />[π](#translation-godusevpn "Translation") | [<img src="https://avatars1.githubusercontent.com/u/745576?v=4" width="110px;"/><br /><sub>ε¨ε¨</sub>](https://github.com/EngrZhou)<br />[π](#translation-EngrZhou "Translation") | [<img src="https://avatars3.githubusercontent.com/u/1631095?v=4" width="110px;"/><br /><sub>Sam</sub>](https://github.com/takuy)<br />[π»](https://github.com/snipe/snipe-it/commits?author=takuy "Code") | [<img src="https://avatars1.githubusercontent.com/u/264022?v=4" width="110px;"/><br /><sub>Azerothian</sub>](https://www.illisian.com.au)<br />[π»](https://github.com/snipe/snipe-it/commits?author=Azerothian "Code") | [<img src="https://avatars1.githubusercontent.com/u/7632599?v=4" width="110px;"/><br /><sub>Tim Farmer</sub>](https://github.com/timothyfarmer)<br />[π»](https://github.com/snipe/snipe-it/commits?author=timothyfarmer "Code") | [<img src="https://avatars0.githubusercontent.com/u/17459600?v=4" width="110px;"/><br /><sub>MariΓ‘n Skrip</sub>](https://github.com/mskrip)<br />[π»](https://github.com/snipe/snipe-it/commits?author=mskrip "Code") |+ | [<img src="https://avatars2.githubusercontent.com/u/47435081?v=4" width="110px;"/><br /><sub>Godfrey Martinez</sub>](https://github.com/Godmartinz)<br />[π»](https://github.com/snipe/snipe-it/commits?author=Godmartinz "Code") | [<img src="https://avatars1.githubusercontent.com/u/2075128?v=4" width="110px;"/><br /><sub>bigtreeEdo</sub>](https://github.com/bigtreeEdo)<br />[π»](https://github.com/snipe/snipe-it/commits?author=bigtreeEdo "Code") | [<img src="https://avatars0.githubusercontent.com/u/5000430?v=4" width="110px;"/><br /><sub>Colin McNeil</sub>](https://colinmcneil.me/)<br />[π»](https://github.com/snipe/snipe-it/commits?author=ColinMcNeil "Code") | [<img src="https://avatars0.githubusercontent.com/u/421625?v=4" width="110px;"/><br /><sub>JoKneeMo</sub>](https://github.com/JoKneeMo)<br />[π»](https://github.com/snipe/snipe-it/commits?author=JoKneeMo "Code") | [<img src="https://avatars0.githubusercontent.com/u/54849013?v=4" width="110px;"/><br /><sub>Joshi</sub>](http://www.redbridge.se)<br />[π»](https://github.com/snipe/snipe-it/commits?author=joshi-redbridge "Code") | [<img src="https://avatars2.githubusercontent.com/u/15731458?v=4" width="110px;"/><br /><sub>Anthony Burns</sub>](https://github.com/anthonypburns)<br />[π»](https://github.com/snipe/snipe-it/commits?author=anthonypburns "Code") | [<img src="https://avatars2.githubusercontent.com/u/1972329?v=4" width="110px;"/><br /><sub>Alexander Chibrikin</sub>](http://phpprofi.ru/)<br />[π»](https://github.com/snipe/snipe-it/commits?author=alek13 "Code") |+| [<img src="https://avatars2.githubusercontent.com/u/8663789?v=4" width="110px;"/><br /><sub>ΠΠ»ΡΡ</sub>](https://github.com/GrayHoax)<br />[π](#translation-GrayHoax "Translation") | [<img src="https://avatars3.githubusercontent.com/u/30119111?v=4" width="110px;"/><br /><sub>GodUseVPN</sub>](https://github.com/godusevpn)<br />[π](#translation-godusevpn "Translation") | [<img src="https://avatars1.githubusercontent.com/u/745576?v=4" width="110px;"/><br /><sub>ε¨ε¨</sub>](https://github.com/EngrZhou)<br />[π](#translation-EngrZhou "Translation") | [<img src="https://avatars3.githubusercontent.com/u/1631095?v=4" width="110px;"/><br /><sub>Sam</sub>](https://github.com/takuy)<br />[π»](https://github.com/snipe/snipe-it/commits?author=takuy "Code") | [<img src="https://avatars1.githubusercontent.com/u/264022?v=4" width="110px;"/><br /><sub>Azerothian</sub>](https://www.illisian.com.au)<br />[π»](https://github.com/snipe/snipe-it/commits?author=Azerothian "Code") | [<img src="https://avatars1.githubusercontent.com/u/4930051?v=4" width="110px;"/><br /><sub>Wes Hulette</sub>](http://macfoo.wordpress.com/)<br />[π»](https://github.com/snipe/snipe-it/commits?author=jwhulette "Code") | [<img src="https://avatars0.githubusercontent.com/u/8134591?v=4" width="110px;"/><br /><sub>patrict</sub>](https://github.com/patrict)<br />[π»](https://github.com/snipe/snipe-it/commits?author=patrict "Code") |+| [<img src="https://avatars3.githubusercontent.com/u/2611616?v=4" width="110px;"/><br /><sub>Dmitriy Minaev</sub>](https://github.com/VELIKII-DIVAN)<br />[π»](https://github.com/snipe/snipe-it/commits?author=VELIKII-DIVAN "Code") | [<img src="https://avatars0.githubusercontent.com/u/5132245?v=4" width="110px;"/><br /><sub>liquidhorse</sub>](https://github.com/liquidhorse)<br />[π»](https://github.com/snipe/snipe-it/commits?author=liquidhorse "Code") | [<img src="https://avatars1.githubusercontent.com/u/183678?v=4" width="110px;"/><br /><sub>Jordi Boggiano</sub>](https://seld.be/)<br />[π»](https://github.com/snipe/snipe-it/commits?author=Seldaek "Code") | [<img src="https://avatars0.githubusercontent.com/u/653557?v=4" width="110px;"/><br /><sub>Ivan Nieto</sub>](https://github.com/inietov)<br />[π»](https://github.com/snipe/snipe-it/commits?author=inietov "Code") | [<img src="https://avatars2.githubusercontent.com/u/6764151?v=4" width="110px;"/><br /><sub>Ben RUBSON</sub>](https://github.com/benrubson)<br />[π»](https://github.com/snipe/snipe-it/commits?author=benrubson "Code") | [<img src="https://avatars2.githubusercontent.com/u/8554558?v=4" width="110px;"/><br /><sub>NMathar</sub>](https://github.com/NMathar)<br />[π»](https://github.com/snipe/snipe-it/commits?author=NMathar "Code") | [<img src="https://avatars1.githubusercontent.com/u/139566?v=4" width="110px;"/><br /><sub>Steffen</sub>](https://github.com/smb)<br />[π»](https://github.com/snipe/snipe-it/commits?author=smb "Code") |+| [<img src="https://avatars0.githubusercontent.com/u/6609453?v=4" width="110px;"/><br /><sub>Sxderp</sub>](https://github.com/Sxderp)<br />[π»](https://github.com/snipe/snipe-it/commits?author=Sxderp "Code") | [<img src="https://avatars1.githubusercontent.com/u/4807843?v=4" width="110px;"/><br /><sub>fanta8897</sub>](https://github.com/fanta8897)<br />[π»](https://github.com/snipe/snipe-it/commits?author=fanta8897 "Code") | [<img src="https://avatars2.githubusercontent.com/u/2576509?v=4" width="110px;"/><br /><sub>Andrey Bolonin</sub>](https://andreybolonin.com/phpconsulting/)<br />[π»](https://github.com/snipe/snipe-it/commits?author=andreybolonin "Code") | [<img src="https://avatars3.githubusercontent.com/u/2173307?v=4" width="110px;"/><br /><sub>shinayoshi</sub>](http://www.shinayoshi.net/)<br />[π»](https://github.com/snipe/snipe-it/commits?author=shinayoshi "Code") | [<img src="https://avatars3.githubusercontent.com/u/2130159?v=4" width="110px;"/><br /><sub>Hubert</sub>](https://github.com/reuser)<br />[π»](https://github.com/snipe/snipe-it/commits?author=reuser "Code") | [<img src="https://avatars0.githubusercontent.com/u/6865789?v=4" width="110px;"/><br /><sub>KeenRivals</sub>](https://brashear.me)<br />[π»](https://github.com/snipe/snipe-it/commits?author=KeenRivals "Code") | [<img src="https://avatars3.githubusercontent.com/u/2902513?v=4" width="110px;"/><br /><sub>omyno</sub>](https://github.com/omyno)<br />[π»](https://github.com/snipe/snipe-it/commits?author=omyno "Code") |+| [<img src="https://avatars1.githubusercontent.com/u/6271335?v=4" width="110px;"/><br /><sub>Evgeny</sub>](https://github.com/jackka)<br />[π»](https://github.com/snipe/snipe-it/commits?author=jackka "Code") | [<img src="https://avatars2.githubusercontent.com/u/1169963?v=4" width="110px;"/><br /><sub>Colin Campbell</sub>](https://digitalist.se)<br />[π»](https://github.com/snipe/snipe-it/commits?author=colin-campbell "Code") | [<img src="https://avatars3.githubusercontent.com/u/2872098?v=4" width="110px;"/><br /><sub>Δ½ubomΓr KuΔera</sub>](https://github.com/lubo)<br />[π»](https://github.com/snipe/snipe-it/commits?author=lubo "Code") | [<img src="https://avatars3.githubusercontent.com/u/570639?v=4" width="110px;"/><br /><sub>Martin Meredith</sub>](https://www.sourceguru.net)<br />[π»](https://github.com/snipe/snipe-it/commits?author=Mezzle "Code") | [<img src="https://avatars1.githubusercontent.com/u/7632599?v=4" width="110px;"/><br /><sub>Tim Farmer</sub>](https://github.com/timothyfarmer)<br />[π»](https://github.com/snipe/snipe-it/commits?author=timothyfarmer "Code") | [<img src="https://avatars0.githubusercontent.com/u/17459600?v=4" width="110px;"/><br /><sub>MariΓ‘n Skrip</sub>](https://github.com/mskrip)<br />[π»](https://github.com/snipe/snipe-it/commits?author=mskrip "Code") | [<img src="https://avatars2.githubusercontent.com/u/47435081?v=4" width="110px;"/><br /><sub>Godfrey Martinez</sub>](https://github.com/Godmartinz)<br />[π»](https://github.com/snipe/snipe-it/commits?author=Godmartinz "Code") |+| [<img src="https://avatars1.githubusercontent.com/u/2075128?v=4" width="110px;"/><br /><sub>bigtreeEdo</sub>](https://github.com/bigtreeEdo)<br />[π»](https://github.com/snipe/snipe-it/commits?author=bigtreeEdo "Code") | [<img src="https://avatars0.githubusercontent.com/u/5000430?v=4" width="110px;"/><br /><sub>Colin McNeil</sub>](https://colinmcneil.me/)<br />[π»](https://github.com/snipe/snipe-it/commits?author=ColinMcNeil "Code") | [<img src="https://avatars0.githubusercontent.com/u/421625?v=4" width="110px;"/><br /><sub>JoKneeMo</sub>](https://github.com/JoKneeMo)<br />[π»](https://github.com/snipe/snipe-it/commits?author=JoKneeMo "Code") | [<img src="https://avatars0.githubusercontent.com/u/54849013?v=4" width="110px;"/><br /><sub>Joshi</sub>](http://www.redbridge.se)<br />[π»](https://github.com/snipe/snipe-it/commits?author=joshi-redbridge "Code") | [<img src="https://avatars2.githubusercontent.com/u/15731458?v=4" width="110px;"/><br /><sub>Anthony Burns</sub>](https://github.com/anthonypburns)<br />[π»](https://github.com/snipe/snipe-it/commits?author=anthonypburns "Code") | [<img src="https://avatars1.githubusercontent.com/u/63399474?v=4" width="110px;"/><br /><sub>johnson-yi</sub>](https://github.com/johnson-yi)<br />[π»](https://github.com/snipe/snipe-it/commits?author=johnson-yi "Code") | [<img src="https://avatars1.githubusercontent.com/u/1862720?v=4" width="110px;"/><br /><sub>Sanjay Govind</sub>](https://tangentmc.net)<br />[π»](https://github.com/snipe/snipe-it/commits?author=sanjay900 "Code") |+| [<img src="https://avatars0.githubusercontent.com/u/1255375?v=4" width="110px;"/><br /><sub>Peter Upfold</sub>](https://peter.upfold.org.uk/)<br />[π»](https://github.com/snipe/snipe-it/commits?author=PeterUpfold "Code") | [<img src="https://avatars2.githubusercontent.com/u/961717?v=4" width="110px;"/><br /><sub>Jared Biel</sub>](https://github.com/jbiel)<br />[π»](https://github.com/snipe/snipe-it/commits?author=jbiel "Code") |<!-- ALL-CONTRIBUTORS-LIST:END -->This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!diff --cc app/Http/Controllers/Api/AssetsController.phpindex 5585f3a695,91e22e780f..4c4e2a8a92--- a/app/Http/Controllers/Api/AssetsController.php+++ b/app/Http/Controllers/Api/AssetsController.php@@@ -457,23 -453,8 +457,24 @@@ class AssetsController extends Controll$asset->supplier_id = $request->get('supplier_id', 0);$asset->requestable = $request->get('requestable', 0);$asset->rtd_location_id = $request->get('rtd_location_id', null);+ $asset->location_id = $request->get('rtd_location_id', null);+ if ($request->has('image_source') && $request->input('image_source') != "") {+ $saved_image_path = Helper::processUploadedImage(+ $request->input('image_source'), 'uploads/assets/'+ );++ if (!$saved_image_path) {+ return response()->json(Helper::formatStandardApiResponse(+ 'error',+ null,+ trans('admin/hardware/message.create.error')+ ), 200);+ }++ $asset->image = $saved_image_path;+ }+// Update custom fields in the database.// Validation for these fields is handled through the AssetRequest form request$model = AssetModel::find($request->get('model_id'));diff --cc app/Http/Controllers/Api/ConsumablesController.phpindex a3b785333f,e7b15c4f24..b1d953b975--- a/app/Http/Controllers/Api/ConsumablesController.php+++ b/app/Http/Controllers/Api/ConsumablesController.php@@@ -2,13 -2,13 +2,15 @@@namespace App\Http\Controllers\Api;-use Illuminate\Http\Request;+use App\Helpers\Helper;use App\Http\Controllers\Controller;+use App\Http\Transformers\ConsumablesTransformer;+use App\Http\Transformers\SelectlistTransformer;use App\Models\Company;use App\Models\Consumable;- use Illuminate\Http\Request;+ use App\Models\User;+ use App\Http\Transformers\ConsumablesTransformer;+ use App\Helpers\Helper;class ConsumablesController extends Controller{@@@ -198,27 -198,54 +200,78 @@@return $data;}+ /**+ * Checkout a consumable+ *+ * @author [A. Gutierrez] [<[email protected]>]+ * @param int $id+ * @since [v4.9.5]+ * @return JsonResponse+ */+ public function checkout(Request $request, $id)+ {+ // Check if the consumable exists+ if (is_null($consumable = Consumable::find($id))) {+ return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/consumables/message.does_not_exist')));+ }++ $this->authorize('checkout', $consumable);++ if ($consumable->qty > 0) {++ // Check if the user exists+ $assigned_to = $request->input('assigned_to');+ if (is_null($user = User::find($assigned_to))) {+ // Return error message+ return response()->json(Helper::formatStandardApiResponse('error', null, 'No user found'));+ }++ // Update the consumable data+ $consumable->assigned_to = e($assigned_to);++ $consumable->users()->attach($consumable->id, [+ 'consumable_id' => $consumable->id,+ 'user_id' => $user->id,+ 'assigned_to' => $assigned_to+ ]);++ // Log checkout event+ $logaction = $consumable->logCheckout(e($request->input('note')), $user);+ $data['log_id'] = $logaction->id;+ $data['eula'] = $consumable->getEula();+ $data['first_name'] = $user->first_name;+ $data['item_name'] = $consumable->name;+ $data['checkout_date'] = $logaction->created_at;+ $data['note'] = $logaction->note;+ $data['require_acceptance'] = $consumable->requireAcceptance();++ return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/consumables/message.checkout.success')));+ }++ return response()->json(Helper::formatStandardApiResponse('error', null, 'No consumables remaining'));+ }+++ /**+ * Gets a paginated collection for the select2 menus+ *+ * @see \App\Http\Transformers\SelectlistTransformer+ *+ */+ public function selectlist(Request $request)+ {++ $consumables = Consumable::select([+ 'consumables.id',+ 'consumables.name'+ ]);++ if ($request->filled('search')) {+ $consumables = $consumables->where('consumables.name', 'LIKE', '%'.$request->get('search').'%');+ }++ $consumables = $consumables->orderBy('name', 'ASC')->paginate(50);+++ return (new SelectlistTransformer)->transformSelectlist($consumables);+ }}diff --cc app/Http/Controllers/Auth/LoginController.phpindex 2f25deab92,b9b238167f..3ed9940118--- a/app/Http/Controllers/Auth/LoginController.php+++ b/app/Http/Controllers/Auth/LoginController.php@@@ -363,34 -303,11 +363,35 @@@ class LoginController extends Controlle*/public function logout(Request $request){+ $settings = Setting::getSettings();+ $saml = $this->saml;+ $sloRedirectUrl = null;+ $sloRequestUrl = null;++ if ($saml->isEnabled()) {+ $auth = $saml->getAuth();+ $sloRedirectUrl = $request->session()->get('saml_slo_redirect_url');++ if (!empty($auth->getSLOurl()) && $settings->saml_slo == '1' && $saml->isAuthenticated() && empty($sloRedirectUrl)) {+ $sloRequestUrl = $auth->logout(null, array(), $saml->getNameId(), $saml->getSessionIndex(), true, $saml->getNameIdFormat(), $saml->getNameIdNameQualifier(), $saml->getNameIdSPNameQualifier());+ }++ $saml->clearData();+ }++ if (!empty($sloRequestUrl)) {+ return redirect()->away($sloRequestUrl);+ }++ $request->session()->regenerate(true);+ $request->session()->regenerate(true);Auth::logout();- $settings = Setting::getSettings();+ if (!empty($sloRedirectUrl)) {+ return redirect()->away($sloRedirectUrl);+ }+$customLogoutUrl = $settings->login_remote_user_custom_logout_url ;if ($settings->login_remote_user_enabled == '1' && $customLogoutUrl != '') {return redirect()->away($customLogoutUrl);diff --cc app/Importer/UserImporter.phpindex acbfab54f7,761efe69bb..4fcf221cba--- a/app/Importer/UserImporter.php+++ b/app/Importer/UserImporter.php@@@ -48,15 -46,21 +48,19 @@@ class UserImporter extends ItemImporte$this->item['email'] = $this->findCsvMatch($row, 'email');$this->item['phone'] = $this->findCsvMatch($row, 'phone_number');$this->item['jobtitle'] = $this->findCsvMatch($row, 'jobtitle');+ $this->item['address'] = $this->findCsvMatch($row, 'address');+ $this->item['city'] = $this->findCsvMatch($row, 'city');+ $this->item['state'] = $this->findCsvMatch($row, 'state');+ $this->item['country'] = $this->findCsvMatch($row, 'country');$this->item['activated'] = ($this->fetchHumanBoolean($this->findCsvMatch($row, 'activated')) == 1) ? '1' : 0;-- \Log::debug('UserImporter.php Activated: '.$this->findCsvMatch($row, 'activated'));- \Log::debug('UserImporter.php Activated fetchHumanBoolean: '. $this->fetchHumanBoolean($this->findCsvMatch($row, 'activated')));-$this->item['employee_num'] = $this->findCsvMatch($row, 'employee_num');- $this->item['department_id'] = $this->createOrFetchDepartment($this->findCsvMatch($row, 'department')) ? $this->createOrFetchDepartment($this->findCsvMatch($row, 'department')) : null;- $this->item['manager_id'] = $this->fetchManager($this->findCsvMatch($row, 'manager_first_name'), $this->findCsvMatch($row, 'manager_last_name')) ? $this->fetchManager($this->findCsvMatch($row, 'manager_first_name'), $this->findCsvMatch($row, 'manager_last_name')) : null;-+ $this->item['department_id'] = $this->createOrFetchDepartment($this->findCsvMatch($row, 'department'));+ $this->item['manager_id'] = $this->fetchManager($this->findCsvMatch($row, 'manager_first_name'), $this->findCsvMatch($row, 'manager_last_name'));+ $user_department = $this->findCsvMatch($row, 'department');+ if ($this->shouldUpdateField($user_department)) {+ $this->item["department_id"] = $this->createOrFetchDepartment($user_department);+ }$user = User::where('username', $this->item['username'])->first();if ($user) {if (!$this->updating) {diff --cc app/Importer/import_mappings.mdindex 0642241525,c6ea3e2376..7899cf679a--- a/app/Importer/import_mappings.md+++ b/app/Importer/import_mappings.md@@@ -32,6 -33,9 +33,10 @@@| warranty months | warranty_months | Asset || User Related Fields | assigned_to | Asset || name | | |+| email | | || username | | |+ | address | address | User |+ | city | city | User |+ | state | state | User |+ | country | country | User |diff --cc app/Models/Loggable.phpindex 1bb05b9298,ccf5fdfc8a..bff1ac2e10--- a/app/Models/Loggable.php+++ b/app/Models/Loggable.php@@@ -24,12 -36,14 +24,13 @@@ trait Loggabl* @since [v3.4]* @return \App\Models\Actionlog*/- public function logCheckout($note, $target /* What are we checking out to? */)+ public function logCheckout($note, $target, $action_date = null){- $settings = Setting::getSettings();$log = new Actionlog;$log = $this->determineLogItemType($log);- if(Auth::user())+ if (Auth::user()) {$log->user_id = Auth::user()->id;+ }if (!isset($target)) {throw new \Exception('All checkout logs require a target.');diff --cc app/Models/User.phpindex 109ad4f92d,f163ba217c..ff886905fc--- a/app/Models/User.php+++ b/app/Models/User.php@@@ -331,22 -237,14 +331,22 @@@ class User extends SnipeModel implement*/public function userlog(){- return $this->hasMany('\App\Models\Actionlog', 'target_id')->orderBy('created_at', 'DESC')->withTrashed();+ return $this->hasMany('\App\Models\Actionlog', 'target_id')->where('target_type', '=', 'App\Models\User')->orderBy('created_at', 'DESC')->withTrashed();}+/**+ * Establishes the user -> location relationship+ ** Get the asset's location based on the assigned user- * @todo - this should be removed once we're sure we've switched it- * to location()- **/+ *+ * @todo - this should be removed once we're sure we've switched it to location()+ *+ * @author A. Gianotto <[email protected]>+ * @since [v4.0]+ * @return \Illuminate\Database\Eloquent\Relations\Relation+ */+public function userloc(){return $this->belongsTo('\App\Models\Location', 'location_id')->withTrashed();diff --cc resources/assets/js/components/importer/importer-file.vueindex 4bcad9cce0,cabc1d3095..8dba9fe5d9--- a/resources/assets/js/components/importer/importer-file.vue+++ b/resources/assets/js/components/importer/importer-file.vue@@@ -1,15 -1,11 +1,9 @@@- <style>- tr {- padding-left:30px;- }- </style>-<template>- <div v-show="processDetail">+ <div v-show="processDetail" class="col-md-6 col-md-offset-3"><div class="row">- <div class="col-md-2"></div>- <div class="col-md-8" style="padding-top: 30px; margin: 0 auto;"><div class="dynamic-form-row">- <div class="col-md-5 col-xs-12">+ <div class="col-md-5 col-xs-12"><label for="import-type">Import Type:</label></div><div class="col-md-7 col-xs-12">@@@ -179,8 -168,11 +167,12 @@@{id: 'phone_number', text: 'Phone Number' },{id: 'manager_first_name', text: 'Manager First Name' },{id: 'manager_last_name', text: 'Manager Last Name' },+ {id: 'department', text: 'Department' },{id: 'activated', text: 'Activated' },+ {id: 'address', text: 'Address' },+ {id: 'city', text: 'City' },+ {id: 'state', text: 'State' },+ {id: 'country', text: 'Country' },],customFields: this.customFields,diff --cc resources/assets/js/components/passport/Clients.vueindex 936786a87a,de164c6f29..ee5db67742--- a/resources/assets/js/components/passport/Clients.vue+++ b/resources/assets/js/components/passport/Clients.vue@@@ -83,9 -83,9 +83,9 @@@<div class="modal-header"><button type="button " class="close" data-dismiss="modal" aria-hidden="true">×</button>- <h2 class="modal-title">+ <h4 class="modal-title">Create Client- </h4>+ </h2></div><div class="modal-body">@@@ -151,9 -151,9 +151,9 @@@<div class="modal-header"><button type="button " class="close" data-dismiss="modal" aria-hidden="true">×</button>- <h2 class="modal-title">+ <h4 class="modal-title">Edit Client- </h4>+ </h2></div><div class="modal-body">diff --cc resources/assets/less/overrides.lessindex 21f8fc5012,e6130e2360..d189a90796--- a/resources/assets/less/overrides.less+++ b/resources/assets/less/overrides.less@@@ -466,21 -466,71 +466,89 @@@ h4display: table-cell;}++++ /**++ COLUMN SELECTOR ICONS+ -----------------------------+ This is kind of weird, but it is necessary to prevent the column-selector code from barfing, since+ any HTML used in the UserPresenter "title" attribute breaks the column selector HTML.++ Instead, we use CSS to add the icon into the table header, which leaves the column selector+ "title" text as-is.++ See https://github.com/snipe/snipe-it/issues/7989++ */++ th.css-barcode > .th-inner,+ th.css-license > .th-inner,+ th.css-consumable > .th-inner,+ th.css-accessory > .th-inner+ {+ font-size: 0px;+ line-height: 4!important;+ text-align: left;+ text-rendering: auto;+ -webkit-font-smoothing: antialiased;+ -moz-osx-font-smoothing: grayscale;+ }+++ th.css-padlock > .th-inner::before,+ th.css-barcode > .th-inner::before,+ th.css-license > .th-inner::before,+ th.css-consumable > .th-inner::before,+ th.css-accessory > .th-inner::before++ {+ display: inline-block;+ font: normal normal normal 14px/1 FontAwesome;+ font-size: 20px;+ }++ th.css-padlock > .th-inner::before+ {+ content: "\f023";+ padding-right: 2px;+ }++ th.css-barcode > .th-inner::before+ {+ content: "\f02a";+ }++ th.css-license > .th-inner::before+ {+ content: "\f0c7";+ }++ th.css-consumable > .th-inner::before+ {+ content: "\f043";+ }++ th.css-accessory > .th-inner::before+ {+ content: "\f11c";-}++}+.small-box .inner {+ padding-left: 15px;+ padding-right: 15px;+ padding-top: 15px;+ color: #fff;+}+++.small-box > a:link, .small-box > a:visited, .small-box > a:hover {+ color: #fff;+}++.select2-container--default .select2-selection--single, .select2-selection .select2-selection--single {+ border: 1px solid #d2d6de;+ border-radius: 0;+ padding: 6px 12px;+ height: 34px;+}diff --cc resources/lang/en/general.phpindex 962bfb8341,765b8d5451..27e456042a--- a/resources/lang/en/general.php+++ b/resources/lang/en/general.php@@@ -89,8 -87,12 +89,13 @@@'firstname_lastname_format' => 'First Name Last Name ([email protected])','firstname_lastname_underscore_format' => 'First Name Last Name ([email protected])','lastnamefirstinitial_format' => 'Last Name First Initial ([email protected])',+ 'firstintial_dot_lastname_format' => 'First Initial Last Name ([email protected])','first' => 'First',+ 'firstnamelastname' => 'First Name Last Name ([email protected])',+ 'lastname_firstinitial' => 'Last Name First Initial ([email protected])',+ 'firstinitial.lastname' => 'First Initial Last Name ([email protected])',+ 'firstnamelastinitial' => 'First Name Last Initial ([email protected])',+ 'first' => 'First','first_name' => 'First Name','first_name_format' => 'First Name ([email protected])','files' => 'Files',diff --cc resources/views/modals/user.blade.phpindex 0969d9a754,56a6099fa0..f290b528c1--- a/resources/views/modals/user.blade.php+++ b/resources/views/modals/user.blade.php@@@ -1,12 -1,13 +1,12 @@@{{-- See snipeit_modals.js for what powers this --}}-<script nonce="{{ csrf_token() }}">- $(document).ready(function () {- $('#genPassword').pGenerator({+ window.setTimeout(function () {+ $('#modal-genPassword').pGenerator({'bind': 'click','passwordElement': '#modal-password',- 'displayElement': '#generated-password',+ 'displayElement': '#modal-generated-password','passwordLength': 16,'uppercase': true,'lowercase': true,diff --cc resources/views/users/bulk-edit.blade.phpindex b62a73b2a2,fbcc9fdb23..6f401c8767--- a/resources/views/users/bulk-edit.blade.php+++ b/resources/views/users/bulk-edit.blade.php@@@ -50,9 -50,18 +50,18 @@@<div class="form-group {{ $errors->has('locale') ? 'has-error' : '' }}"><label class="col-md-3 control-label" for="locale">{{ trans('general.language') }}</label><div class="col-md-8">- {!! Form::locales('locale', Input::old('locale', $user->locale), 'select2') !!}+ {!! Form::locales('locale', old('locale', $user->locale), 'select2') !!}{!! $errors->first('locale', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}</div>+ </div>++ <!-- City -->+ <div class="form-group{{ $errors->has('city') ? ' has-error' : '' }}">+ <label class="col-md-3 control-label" for="city">{{ trans('general.city') }}</label>+ <div class="col-md-4">+ <input class="form-control" type="text" name="city" id="city" aria-label="city" />+ {!! $errors->first('city', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}+ </div></div><!-- activated -->diff --cc resources/views/users/index.blade.phpindex 4ca154a596,30b791378f..b28a3fdc9b--- a/resources/views/users/index.blade.php+++ b/resources/views/users/index.blade.php@@@ -15,77 -15,17 +15,17 @@@@section('header_right')- <style>- /**- This is kind of weird, but it is necessary to prevent the column-selector code from barfing, since- any HTML used in the UserPresenter "title" attribute breaks the column selector HTML.-- Instead, we use CSS to add the icon into the table header, which leaves the column selector- "title" text as-is.-- See https://github.com/snipe/snipe-it/issues/7989-- */- th.css-barcode > .th-inner,- th.css-license > .th-inner,- th.css-consumable > .th-inner,- th.css-accessory > .th-inner- {- font-size: 0px;- line-height: 4!important;- text-align: left;- text-rendering: auto;- -webkit-font-smoothing: antialiased;- -moz-osx-font-smoothing: grayscale;- }--- th.css-barcode > .th-inner::before,- th.css-license > .th-inner::before,- th.css-consumable > .th-inner::before,- th.css-accessory > .th-inner::before-- {- display: inline-block;- font: normal normal normal 14px/1 FontAwesome;- font-size: 20px;- }--- th.css-barcode > .th-inner::before- {- content: "\f02a";- }-- th.css-license > .th-inner::before- {- content: "\f0c7";- }-- th.css-consumable > .th-inner::before- {- content: "\f043";- }-- th.css-accessory > .th-inner::before- {- content: "\f11c";- }--- </style>-@can('create', \App\Models\User::class)- @if ($snipeSettings->ldap_enabled == 1)- <a href="{{ route('ldap/user') }}" class="btn btn-default pull-right"><span class="fa fa-sitemap"></span> LDAP Sync</a>- @endif- <a href="{{ route('users.create') }}" class="btn btn-primary pull-right" style="margin-right: 5px;"> {{ trans('general.create') }}</a>+ @if ($snipeSettings->ldap_enabled == 1)+ <a href="{{ route('ldap/user') }}" class="btn btn-default pull-right"><span class="fa fa-sitemap"></span> LDAP Sync</a>+ @endif+ <a href="{{ route('users.create') }}" class="btn btn-primary pull-right" style="margin-right: 5px;"> {{ trans('general.create') }}</a>@endcan- @if (Input::get('status')=='deleted')- <a class="btn btn-default pull-right" href="{{ route('users.index') }}" style="margin-right: 5px;">{{ trans('admin/users/table.show_current') }}</a>+ @if (request('status')=='deleted')+ <a class="btn btn-default pull-right" href="{{ route('users.index') }}" style="margin-right: 5px;">{{ trans('admin/users/table.show_current') }}</a>@else- <a class="btn btn-default pull-right" href="{{ route('users.index', ['status' => 'deleted']) }}" style="margin-right: 5px;">{{ trans('admin/users/table.show_deleted') }}</a>+ <a class="btn btn-default pull-right" href="{{ route('users.index', ['status' => 'deleted']) }}" style="margin-right: 5px;">{{ trans('admin/users/table.show_deleted') }}</a>@endif@can('view', \App\Models\User::class)<a class="btn btn-default pull-right" href="{{ route('users.export') }}" style="margin-right: 5px;">Export</a>diff --cc tests/unit/UserTest.phpindex 6624363b6d,fc60926fa6..85ae9054d0--- a/tests/unit/UserTest.php+++ b/tests/unit/UserTest.php@@@ -74,8 -74,8 +74,8 @@@ class UserTest extends BaseTespublic function testFirstInitialUnderscoreLastName(){$fullname = "Natalia Allanovna Romanova-O'Shostakova";- $expected_username = 'natalia_allanovna-romanova-oshostakova';+ $expected_username = 'n_allanovna-romanova-oshostakova';- $user = User::generateFormattedNameFromFullName('firstname_lastname', $fullname);+ $user = User::generateFormattedNameFromFullName($fullname, 'firstname_lastname');$this->assertEquals($expected_username, $user['username']);}@@@ -83,9 -83,36 +83,36 @@@{$fullname = "Natalia";$expected_username = 'natalia';- $user = User::generateFormattedNameFromFullName($fullname, 'firstname_lastname');+ $user = User::generateFormattedNameFromFullName('firstname_lastname', $fullname);+ $this->assertEquals($expected_username, $user['username']);+ }+ public function firstInitialDotLastname()+ {+ $fullname = "Natalia Allanovna Romanova-O'Shostakova";+ $expected_username = 'n.allanovnaromanovaoshostakova';- $user = User::generateFormattedNameFromFullName('firstinitial.lastname', $fullname);++ $user = User::generateFormattedNameFromFullName($fullname, 'firstinitial.lastname');+ $this->assertEquals($expected_username, $user['username']);+ }+ public function lastNameUnderscoreFirstInitial()+ {+ $fullname = "Natalia Allanovna Romanova-O'Shostakova";+ $expected_username = 'allanovnaromanovaoshostakova_n';- $user = User::generateFormattedNameFromFullName('lastname_firstinitial', $fullname);++ $user = User::generateFormattedNameFromFullName($fullname, 'lastname_firstinitial');+ $this->assertEquals($expected_username, $user['username']);+ }+ public function firstNameLastName()+ {+ $fullname = "Natalia Allanovna Romanova-O'Shostakova";+ $expected_username = 'nataliaallanovnaromanovaoshostakova';- $user = User::generateFormattedNameFromFullName('firstnamelastname', $fullname);++ $user = User::generateFormattedNameFromFullName($fullname, 'firstnamelastname)';+ $this->assertEquals($expected_username, $user['username']);+ }+ public function firstNameLastInitial()+ {+ $fullname = "Natalia Allanovna Romanova-O'Shostakova";+ $expected_username = 'nataliaa';- $user = User::generateFormattedNameFromFullName('firstnamelastinitial', $fullname);++ $user = User::generateFormattedNameFromFullName($fullname, 'firstnamelastinitial');$this->assertEquals($expected_username, $user['username']);}-}