diff --git a/app/Http/Controllers/Api/LocationsController.php b/app/Http/Controllers/Api/LocationsController.php index 8353e00aec39..d2b888567512 100644 --- a/app/Http/Controllers/Api/LocationsController.php +++ b/app/Http/Controllers/Api/LocationsController.php @@ -484,6 +484,10 @@ public function selectlist(Request $request): array $locations->where('locations.id', '!=', (int) $request->input('excludeId')); } + if ((Setting::getSettings()->full_multiple_companies_support == '1') && $request->filled('companyId')) { + $locations->where('locations.company_id', '=', (int) $request->input('companyId')); + } + $locations = $locations->orderBy('name', 'ASC')->get(); $locations_with_children = []; diff --git a/resources/views/locations/edit.blade.php b/resources/views/locations/edit.blade.php index 6fb1609fd8be..049189b3a2ac 100755 --- a/resources/views/locations/edit.blade.php +++ b/resources/views/locations/edit.blade.php @@ -1,3 +1,16 @@ +@push('js') + +@endpush + @extends('layouts/edit-form', [ 'createText' => trans('admin/locations/table.create') , 'updateText' => trans('admin/locations/table.update'), @@ -10,7 +23,7 @@ @include ('partials.forms.edit.name', ['translated_name' => trans('admin/locations/table.name')]) -@include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/locations/table.parent'), 'fieldname' => 'parent_id', 'exclude_id' => isset($item) ? $item->id : null]) +@include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/locations/table.parent'), 'fieldname' => 'parent_id', 'exclude_id' => isset($item) ? $item->id : null, 'company_id' => isset($item) ? $item->company_id : null]) @include ('partials.forms.edit.user-select', ['translated_name' => trans('admin/users/table.manager'), 'fieldname' => 'manager_id'])