diff --git a/app/Http/Requests/SaveUserRequest.php b/app/Http/Requests/SaveUserRequest.php index f778d016df..5a47362cfc 100644 --- a/app/Http/Requests/SaveUserRequest.php +++ b/app/Http/Requests/SaveUserRequest.php @@ -6,6 +6,7 @@ use App\Models\Setting; use Illuminate\Contracts\Validation\Validator; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Http\Exceptions\HttpResponseException; +use App\Rules\UserCannotSwitchCompaniesIfItemsAssigned; class SaveUserRequest extends FormRequest { @@ -34,14 +35,7 @@ class SaveUserRequest extends FormRequest $rules = [ 'department_id' => 'nullable|exists:departments,id', 'manager_id' => 'nullable|exists:users,id', - 'company_id' => [ - // determines if the user is being moved between companies and checks to see if they have any items assigned - function ($attribute, $value, $fail) { - if (($this->has('company_id')) && ($this->user?->allAssignedCount() > 0) && (Setting::getSettings()->full_multiple_companies_support)) { - $fail(trans('admin/users/message.error.multi_company_items_assigned')); - } - } - ] + 'company_id' => ['nullable','exists:companies,id'] ]; switch ($this->method()) { @@ -60,11 +54,13 @@ class SaveUserRequest extends FormRequest $rules['first_name'] = 'required|string|min:1'; $rules['username'] = 'required_unless:ldap_import,1|string|min:1'; $rules['password'] = Setting::passwordComplexityRulesSaving('update').'|confirmed'; + $rules['company_id'] = [new UserCannotSwitchCompaniesIfItemsAssigned()]; break; // Save only what's passed case 'PATCH': $rules['password'] = Setting::passwordComplexityRulesSaving('update'); + $rules['company_id'] = [new UserCannotSwitchCompaniesIfItemsAssigned()]; break; default: diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 98d7275b15..f1150f9a2d 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -1561,7 +1561,7 @@ class Asset extends Depreciable $leftJoin->on('assets_dept_users.id', '=', 'assets.assigned_to') ->where('assets.assigned_type', '=', User::class); })->where(function ($query) use ($search) { - $query->where('assets_dept_users.department_id', '=', $search); + $query->whereIn('assets_dept_users.department_id', $search); })->withTrashed()->whereNull('assets.deleted_at'); //workaround for laravel bug } @@ -1811,7 +1811,7 @@ class Asset extends Depreciable public function scopeInCategory($query, $category_id) { return $query->join('models as category_models', 'assets.model_id', '=', 'category_models.id') - ->join('categories', 'category_models.category_id', '=', 'categories.id')->where('category_models.category_id', '=', $category_id); + ->join('categories', 'category_models.category_id', '=', 'categories.id')->whereIn('category_models.category_id', $category_id); } /** @@ -1825,7 +1825,7 @@ class Asset extends Depreciable public function scopeByManufacturer($query, $manufacturer_id) { return $query->join('models', 'assets.model_id', '=', 'models.id') - ->join('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id')->where('models.manufacturer_id', '=', $manufacturer_id); + ->join('manufacturers', 'models.manufacturer_id', '=', 'manufacturers.id')->whereIn('models.manufacturer_id', $manufacturer_id); } diff --git a/app/Rules/UserCannotSwitchCompaniesIfItemsAssigned.php b/app/Rules/UserCannotSwitchCompaniesIfItemsAssigned.php new file mode 100644 index 0000000000..c3dd58f424 --- /dev/null +++ b/app/Rules/UserCannotSwitchCompaniesIfItemsAssigned.php @@ -0,0 +1,23 @@ +route('user')->id); + if (($value) && ($user->allAssignedCount() > 0) && (Setting::getSettings()->full_multiple_companies_support)) { + $fail(trans('admin/users/message.error.multi_company_items_assigned')); + } + } +} diff --git a/public/css/build/app.css b/public/css/build/app.css index 4c38af4bcc..8b055d9f29 100644 Binary files a/public/css/build/app.css and b/public/css/build/app.css differ diff --git a/public/css/build/overrides.css b/public/css/build/overrides.css index fead85d6ca..e95a6bd470 100644 Binary files a/public/css/build/overrides.css and b/public/css/build/overrides.css differ diff --git a/public/css/dist/all.css b/public/css/dist/all.css index cb3069ae87..ba8526074a 100644 Binary files a/public/css/dist/all.css and b/public/css/dist/all.css differ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 28cda414c1..1e7c59ecc8 100644 --- a/public/mix-manifest.json +++ b/public/mix-manifest.json @@ -2,8 +2,8 @@ "/js/build/app.js": "/js/build/app.js?id=6d4d575774a1be993efe0598cc6b1c20", "/css/dist/skins/skin-black-dark.css": "/css/dist/skins/skin-black-dark.css?id=5f3abb12a286d6cb8aa523322d7f053b", "/css/dist/skins/_all-skins.css": "/css/dist/skins/_all-skins.css?id=89b7dcd91db033fb19ebbd7f7dcc0c35", - "/css/build/overrides.css": "/css/build/overrides.css?id=863d3083406a65c0fd94cf9ecda6a6ae", - "/css/build/app.css": "/css/build/app.css?id=5b0b07ff6c9a9582237f6be5e08d7287", + "/css/build/overrides.css": "/css/build/overrides.css?id=32e3d9dab3e648abee02ff33901aaa73", + "/css/build/app.css": "/css/build/app.css?id=2756ccc4c9c1ebc75ff107bbeb32ebb1", "/css/build/AdminLTE.css": "/css/build/AdminLTE.css?id=a67bd93bed52e6a29967fe472de66d6c", "/css/dist/skins/skin-yellow.css": "/css/dist/skins/skin-yellow.css?id=fc7adb943668ac69fe4b646625a7571f", "/css/dist/skins/skin-yellow-dark.css": "/css/dist/skins/skin-yellow-dark.css?id=dd5eb6c76770bacaa2e960849d275516", @@ -19,7 +19,7 @@ "/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=392cc93cfc0be0349bab9697669dd091", "/css/dist/skins/skin-blue-dark.css": "/css/dist/skins/skin-blue-dark.css?id=34023bf46b7c2486b7468de9b750dbff", "/css/dist/skins/skin-black.css": "/css/dist/skins/skin-black.css?id=1f33ca3d860461c1127ec465ab3ebb6b", - "/css/dist/all.css": "/css/dist/all.css?id=075a2ab4b670e56f0ff5dd20419221e2", + "/css/dist/all.css": "/css/dist/all.css?id=001f9687ccd46e4288258abffdf00081", "/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7", "/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7", "/js/select2/i18n/af.js": "/js/select2/i18n/af.js?id=4f6fcd73488ce79fae1b7a90aceaecde", diff --git a/resources/assets/less/overrides.less b/resources/assets/less/overrides.less index 096d67f75c..f3261a19b7 100644 --- a/resources/assets/less/overrides.less +++ b/resources/assets/less/overrides.less @@ -500,13 +500,27 @@ body { .select2-selection--multiple { border-color: #d2d6de !important; - height: 34px; + overflow-y: auto; } .select2-selection__choice { border-radius: 0px !important; } +.select2-search select2-search--inline { + height: 35px !important; + float: left; + margin: 0; +} + + + +.select2-results__option { + padding: 5px; + user-select: none; + -webkit-user-select: none; + margin: 0px; +} img.navbar-brand-img, .navbar-brand>img { float: left; @@ -514,8 +528,8 @@ img.navbar-brand-img, .navbar-brand>img { max-height: 50px; } -.input-daterange { - border-radius: 0px; +.input-daterange, .input-daterange input:first-child, .input-daterange input:last-child { + border-radius: 0px !important; } .btn.bg-maroon, .btn.bg-purple{ diff --git a/resources/lang/en-US/localizations.php b/resources/lang/en-US/localizations.php index e87af0718e..fdca1532bd 100644 --- a/resources/lang/en-US/localizations.php +++ b/resources/lang/en-US/localizations.php @@ -2,7 +2,7 @@ return [ - 'select_language' => 'Select a language', + 'select_language' => 'Select a Language', 'languages' => [ 'en-US'=> 'English, US', 'en-GB'=> 'English, UK', @@ -68,7 +68,7 @@ return [ 'zu-ZA'=> 'Zulu', ], - 'select_country' => 'Select a country', + 'select_country' => 'Select a Country', 'countries' => [ 'AC'=>'Ascension Island', diff --git a/resources/lang/en-US/mail.php b/resources/lang/en-US/mail.php index cb08ddc3d5..72fb70db80 100644 --- a/resources/lang/en-US/mail.php +++ b/resources/lang/en-US/mail.php @@ -31,7 +31,7 @@ return [ 'accessory_name' => 'Accessory Name', 'additional_notes' => 'Additional Notes', 'admin_has_created' => 'An administrator has created an account for you on the :web website.', - 'asset' => 'Asse:', + 'asset' => 'Asset', 'asset_name' => 'Asset Name', 'asset_requested' => 'Asset requested', 'asset_tag' => 'Asset Tag', diff --git a/resources/macros/macros.php b/resources/macros/macros.php index 5d0813115e..1b2c127a4f 100644 --- a/resources/macros/macros.php +++ b/resources/macros/macros.php @@ -11,7 +11,7 @@ Form::macro('locales', function ($name = 'locale', $selected = null, $class = nu $idclause = (!is_null($id)) ? $id : ''; - $select = ''; $select .= ''; // Pull the autoglossonym array from the localizations translation file diff --git a/resources/views/partials/forms/edit/category-select.blade.php b/resources/views/partials/forms/edit/category-select.blade.php index 66800deedf..bfa8e3b793 100644 --- a/resources/views/partials/forms/edit/category-select.blade.php +++ b/resources/views/partials/forms/edit/category-select.blade.php @@ -9,8 +9,6 @@ - @else - @endif diff --git a/resources/views/partials/forms/edit/company-select.blade.php b/resources/views/partials/forms/edit/company-select.blade.php index 9aaa5cafdf..012e032866 100644 --- a/resources/views/partials/forms/edit/company-select.blade.php +++ b/resources/views/partials/forms/edit/company-select.blade.php @@ -10,7 +10,7 @@ {{ (\App\Models\Company::find($company_id)) ? \App\Models\Company::find($company_id)->name : '' }} @else - + {!! (!isset($multiple) || ($multiple=='false')) ? '' : '' !!} @endif @@ -20,14 +20,14 @@
{{ Form::label($fieldname, $translated_name, array('class' => 'col-md-3 control-label')) }} -
+
diff --git a/resources/views/partials/forms/edit/department-select.blade.php b/resources/views/partials/forms/edit/department-select.blade.php index c695d04ef4..7d67416f5f 100644 --- a/resources/views/partials/forms/edit/department-select.blade.php +++ b/resources/views/partials/forms/edit/department-select.blade.php @@ -8,8 +8,6 @@ - @else - @endif
diff --git a/resources/views/partials/forms/edit/location-select.blade.php b/resources/views/partials/forms/edit/location-select.blade.php index 6752657cb5..aad8af15e6 100644 --- a/resources/views/partials/forms/edit/location-select.blade.php +++ b/resources/views/partials/forms/edit/location-select.blade.php @@ -8,8 +8,6 @@ - @else - @endif
diff --git a/resources/views/partials/forms/edit/manufacturer-select.blade.php b/resources/views/partials/forms/edit/manufacturer-select.blade.php index ba7d4e59d6..28a8382c18 100644 --- a/resources/views/partials/forms/edit/manufacturer-select.blade.php +++ b/resources/views/partials/forms/edit/manufacturer-select.blade.php @@ -10,7 +10,7 @@ {{ (\App\Models\Manufacturer::find($manufacturer_id)) ? \App\Models\Manufacturer::find($manufacturer_id)->name : '' }} @else - + {!! (!isset($multiple) || ($multiple=='false')) ? '' : '' !!} @endif diff --git a/resources/views/partials/forms/edit/model-select.blade.php b/resources/views/partials/forms/edit/model-select.blade.php index 78073c9a66..c18d85af3b 100644 --- a/resources/views/partials/forms/edit/model-select.blade.php +++ b/resources/views/partials/forms/edit/model-select.blade.php @@ -9,8 +9,6 @@ - @else - @endif diff --git a/resources/views/partials/forms/edit/status-select.blade.php b/resources/views/partials/forms/edit/status-select.blade.php index bd3c8dec2c..836b8145a0 100644 --- a/resources/views/partials/forms/edit/status-select.blade.php +++ b/resources/views/partials/forms/edit/status-select.blade.php @@ -9,8 +9,6 @@ - @else - @endif diff --git a/resources/views/partials/forms/edit/supplier-select.blade.php b/resources/views/partials/forms/edit/supplier-select.blade.php index 35c5165e59..55add41aa5 100644 --- a/resources/views/partials/forms/edit/supplier-select.blade.php +++ b/resources/views/partials/forms/edit/supplier-select.blade.php @@ -8,8 +8,6 @@ - @else - @endif diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php index 7a33b2c0a2..de673377f8 100644 --- a/resources/views/reports/custom.blade.php +++ b/resources/views/reports/custom.blade.php @@ -278,15 +278,60 @@
- @include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'),'multiple' => 'true', 'fieldname' => 'by_company_id[]', 'hide_new' => 'true']) - @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'multiple' => 'true', 'fieldname' => 'by_location_id[]', 'hide_new' => 'true']) - @include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/hardware/form.default_location'), 'multiple' => 'true', 'fieldname' => 'by_rtd_location_id[]', 'hide_new' => 'true']) - @include ('partials.forms.edit.department-select', ['translated_name' => trans('general.department'), 'fieldname' => 'by_dept_id', 'hide_new' => 'true']) - @include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'by_supplier_id[]', 'multiple' => 'true', 'hide_new' => 'true']) - @include ('partials.forms.edit.model-select', ['translated_name' => trans('general.asset_model'), 'fieldname' => 'by_model_id[]', 'multiple' => 'true', 'hide_new' => 'true']) - @include ('partials.forms.edit.manufacturer-select', ['translated_name' => trans('general.manufacturer'), 'fieldname' => 'by_manufacturer_id', 'hide_new' => 'true']) - @include ('partials.forms.edit.category-select', ['translated_name' => trans('general.category'), 'fieldname' => 'by_category_id', 'hide_new' => 'true', 'category_type' => 'asset']) - @include ('partials.forms.edit.status-select', ['translated_name' => trans('admin/hardware/form.status'), 'fieldname' => 'by_status_id[]', 'multiple' => 'true', 'hide_new' => 'true']) + @include ('partials.forms.edit.company-select', [ + 'translated_name' => trans('general.company'), + 'fieldname' => + 'by_company_id[]', + 'multiple' => 'true', + 'hide_new' => 'true' + ]) + @include ('partials.forms.edit.location-select', [ + 'translated_name' => trans('general.location'), + 'fieldname' => 'by_location_id[]', + 'multiple' => 'true', + 'hide_new' => 'true' + ]) + @include ('partials.forms.edit.location-select', [ + 'translated_name' => trans('admin/hardware/form.default_location'), + 'fieldname' => 'by_rtd_location_id[]', + 'multiple' => 'true', + 'hide_new' => 'true' + ]) + @include ('partials.forms.edit.department-select',[ + 'translated_name' => trans('general.department'), + 'fieldname' => 'by_dept_id[]', + 'multiple' => 'true', + 'hide_new' => 'true' + ]) + @include ('partials.forms.edit.supplier-select', [ + 'translated_name' => trans('general.supplier'), + 'fieldname' => 'by_supplier_id[]', + 'multiple' => 'true', + 'hide_new' => 'true' + ]) + @include ('partials.forms.edit.model-select', [ + 'translated_name' => trans('general.asset_model'), + 'fieldname' => 'by_model_id[]', + 'multiple' => 'true', + 'hide_new' => 'true' + ]) + @include ('partials.forms.edit.manufacturer-select', [ + 'translated_name' => trans('general.manufacturer'), + 'fieldname' => 'by_manufacturer_id[]', + 'multiple' => 'true', + 'hide_new' => 'true' + ]) + @include ('partials.forms.edit.category-select', [ + 'translated_name' => trans('general.category'), + 'fieldname' => 'by_category_id[]', + 'multiple' => 'true', + 'hide_new' => 'true', 'category_type' => 'asset' + ]) + @include ('partials.forms.edit.status-select', [ + 'translated_name' => trans('admin/hardware/form.status'), + 'fieldname' => 'by_status_id[]', + 'multiple' => 'true', + 'hide_new' => 'true'])
diff --git a/resources/views/users/edit.blade.php b/resources/views/users/edit.blade.php index 9b4080a339..fc342897a7 100755 --- a/resources/views/users/edit.blade.php +++ b/resources/views/users/edit.blade.php @@ -307,7 +307,7 @@
-
+
{!! Form::locales('locale', old('locale', $user->locale), 'select2') !!} {!! $errors->first('locale', '') !!}