Files
snipe-it/app/Console/Commands/TestLocationsFMCS.php
T
Tobias Regnery 6921df9334 Check for inconsistencies before activating scoped locations
Before activating scoped location all locations and their related objects will be checked.
If there are locations with different companies than the related objects error out.

Because this operation is quite slow, bail out on the first inconsistent entry.
There is a new artisan command introduced that checks every location.

Depending on the size of the database, this will take very long.

Signed-off-by: Tobias Regnery <tobias.regnery@gmail.com>
2025-01-23 15:26:04 +01:00

38 lines
974 B
PHP

<?php
namespace App\Console\Commands;
use App\Helpers\Helper;
use Illuminate\Console\Command;
class TestLocationsFMCS extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'snipeit:test-locations-fmcs';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Test for inconsistencies if FullMultipleCompanySupport with scoped locations will be used';
/**
* Execute the console command.
*/
public function handle()
{
$this->info('Test for inconsistencies if FullMultipleCompanySupport with scoped locations will be used');
$this->info('Depending on the database size this will take a while, output will be displayed after the complete test is over');
$ret = Helper::test_locations_fmcs(true);
foreach($ret as $output) {
$this->info($output);
}
}
}