Instead of using a constructor, add a special check in the boot-method for locations.
This seems to fit better in the system and does hopefully not break the existing tests.
Signed-off-by: Tobias Regnery <tobias.regnery@gmail.com>
Now that locations have a company_id they get restricted to the users company with FullMultipleCompanySupport.
This breaks backward compatibility, because before everyone can handle locations without restrictions.
Add a setting right below FullMultipleCompanySupport so that everyone can switch to the desired behaviour.
The default is off and the existing behaviour is preserved.
Locations are the last big part of the application that can't be tied to companies.
This can be a problem with FullMultipleCompanySupport, because you can't restrict the visibility of locations to the company of the users.
In order to change this, add a company_id to the locations table and wire everything up in the views and controllers.
Aditionally add a new formatter to filter the locations to a specific company, like it is done for assets.
Locations are properly scoped to the users company if FullMultipleCompanySupport is enabled.
If a parent location of a location has a different company than the user, the location does not show up.
When upgrading to php8.3 i started getting deprecation warning about
using ${var} instead of {$var} in 2 places in License.php
PHP Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /var/www/snipe-it/app/Models/License.php on line 187
PHP Deprecated: Using ${var} in strings is deprecated, use {$var} instead in /var/www/snipe-it/app/Models/License.php on line 219
This simple fix switches the offending statements to {$var} syntax.